Skip to content

feat: Add support for opt-in and opt-out in Workflow History V2 feature flag#1132

Merged
adhityamamallan merged 8 commits intocadence-workflow:masterfrom
adhityamamallan:history-v2-new-flag
Jan 14, 2026
Merged

feat: Add support for opt-in and opt-out in Workflow History V2 feature flag#1132
adhityamamallan merged 8 commits intocadence-workflow:masterfrom
adhityamamallan:history-v2-new-flag

Conversation

@adhityamamallan
Copy link
Member

@adhityamamallan adhityamamallan commented Jan 7, 2026

Summary

  • Update return type of HISTORY_PAGE_V2_ENABLED feature flag from simple boolean to enum, to support special behaviour for opting in to and opting out from Workflow History V2
  • Create new hook useIsWorkflowHistoryV2Selected that uses the feature flag value and combines it with local storage to decide if History V2 is selected
  • Load isWorkflowHistoryV2Selected into Workflow History Context
  • Move history v2 selected flag check to separate WorkflowHistoryComponent

Test plan

Updated unit tests + tested in follow-up #1133

Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Workflow History V2 feature flag from a simple boolean to an enum with four states (DISABLED, OPT_IN, OPT_OUT, ENABLED), enabling a gradual rollout strategy with user opt-in/opt-out capabilities. The implementation introduces a new custom hook that combines the config value with localStorage to track user preferences, and refactors the component structure to separate concerns.

Key changes:

  • Feature flag now supports DISABLED, OPT_IN, OPT_OUT, and ENABLED modes
  • New useIsWorkflowHistoryV2Enabled hook manages state based on config and localStorage
  • Component architecture refactored to move version-switching logic to a dedicated WorkflowHistoryComponent

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/config/dynamic/resolvers/history-page-v2-enabled-values.config.ts Defines the four valid enum values for the feature flag
src/config/dynamic/resolvers/history-page-v2-enabled.types.ts Exports TypeScript type for the enum values
src/config/dynamic/resolvers/history-page-v2-enabled.ts Updates resolver to return enum instead of boolean, with env var validation
src/config/dynamic/resolvers/schemas/resolver-schemas.ts Updates Zod schema to validate enum instead of boolean
src/config/dynamic/dynamic.config.ts Updates type definition for the config value
src/utils/config/__fixtures__/resolved-config-values.ts Updates mock fixture from false to 'DISABLED'
src/views/workflow-history-v2/hooks/use-is-workflow-history-v2-enabled.ts New hook that determines enabled state based on config and localStorage
src/views/workflow-history-v2/hooks/__tests__/use-is-workflow-history-v2-enabled.test.tsx Comprehensive test coverage for the new hook
src/views/workflow-history/workflow-history-context-provider/workflow-history-context-provider.types.ts Adds v2 enabled state fields to context type
src/views/workflow-history/workflow-history-context-provider/workflow-history-context-provider.tsx Integrates the new hook into the context provider
src/views/workflow-history/workflow-history-context-provider/__tests__/workflow-history-context-provider.test.tsx Mocks the new hook in existing tests
src/views/workflow-history/workflow-history-wrapper/workflow-history-wrapper.tsx Simplified to delegate version-switching logic to child component
src/views/workflow-history/workflow-history-wrapper/__tests__/workflow-history-wrapper.test.tsx Deleted - tests moved to new component
src/views/workflow-history/workflow-history-component/workflow-history-component.tsx New component that handles version switching based on context
src/views/workflow-history/workflow-history-component/__tests__/workflow-history-component.test.tsx Tests for the new component's conditional rendering
src/views/workflow-history/config/workflow-history-user-preferences.config.ts Adds localStorage config for v2 enabled preference
src/views/workflow-history/__tests__/workflow-history.test.tsx Updates test mocks to include new context fields
src/views/workflow-history-v2/__tests__/workflow-history-v2.test.tsx Updates test mocks to include new context fields

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
@adhityamamallan adhityamamallan merged commit 76ef2c1 into cadence-workflow:master Jan 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants