Skip to content

NO-JIRA: Convert useTechPreviewFlagProvider to static function#15960

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
logonoff:FLAG_TECH_PREVIEW
Feb 5, 2026
Merged

NO-JIRA: Convert useTechPreviewFlagProvider to static function#15960
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
logonoff:FLAG_TECH_PREVIEW

Conversation

@logonoff
Copy link
Member

@logonoff logonoff commented Jan 30, 2026

(s3e5 "Initiation")

window.SERVER_FLAGS is generated by the backend server and is known to not change. Thus, we do not need a hook and ReactNode for this flag, and we can simplify this to a simple console.flag for performance

Summary by CodeRabbit

  • Refactor
    • Restructured tech preview feature flag initialization and registration for improved code maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 30, 2026
@openshift-ci-robot
Copy link
Contributor

@logonoff: This pull request explicitly references no jira issue.

Details

In response to this:

window.SERVER_FLAGS is generated by the backend server and is known to not change. Thus, we do not need a hook and ReactNode for this flag, and we can simplify this to a simple console.flag for performance

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@logonoff
Copy link
Member Author

/label px-approved
/label docs-approved
/assign @TheRealJon @vojtechszocs

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Jan 30, 2026
@openshift-ci openshift-ci bot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 30, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the tech preview feature flag initialization in OpenShift Console. The change migrates from a hook-based provider pattern (useTechPreviewFlagProvider) to a handler-based pattern. A new tech-preview.ts module exports a FeatureFlagHandler that sets the FLAG_TECH_PREVIEW flag based on window.SERVER_FLAGS.techPreview. The console extensions configuration is updated to reference the new handler, the package.json exports are adjusted to point to the new module, and the legacy hook module is removed. The underlying flag-setting logic remains functionally equivalent.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main refactoring: converting a React hook (useTechPreviewFlagProvider) into a static function for the tech preview flag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/packages/console-app/src/features/tech-preview.ts`:
- Around line 4-5: The current handler sets FLAG_TECH_PREVIEW from
window.SERVER_FLAGS.techPreview which can throw if SERVER_FLAGS is undefined;
update the handler (function name: handler) to defensively read the flag using
optional chaining and a default false (e.g., base the value on
window.SERVER_FLAGS?.techPreview || false or
Boolean(window.SERVER_FLAGS?.techPreview)) before calling
setFeatureFlag(FLAG_TECH_PREVIEW, ...), ensuring no runtime TypeError when
SERVER_FLAGS is missing.

@vojtechszocs
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 3, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@logonoff
Copy link
Member Author

logonoff commented Feb 3, 2026

in a dev instance, turned off -tech-preview bridge flag. refreshed console and observed that window.store.getState().FLAGS.toObject()['TECH_PREVIEW'] was false. turned it on and noticed that the flag is true

/verified by @logonoff

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 3, 2026
@openshift-ci-robot
Copy link
Contributor

@logonoff: This PR has been marked as verified by @logonoff.

Details

In response to this:

in a dev instance, turned off -tech-preview bridge flag. refreshed console and observed that window.store.getState().FLAGS.toObject()['TECH_PREVIEW'] was false. turned it on and noticed that the flag is true

/verified by @logonoff

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD c99c674 and 2 for PR HEAD 762a071 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 98409e8 and 1 for PR HEAD 762a071 in total

@logonoff
Copy link
Member Author

logonoff commented Feb 4, 2026

/retest

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 1a68f54 and 0 for PR HEAD 762a071 in total

@openshift-ci-robot
Copy link
Contributor

/hold

Revision 762a071 was retested 3 times: holding

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2026
@logonoff
Copy link
Member Author

logonoff commented Feb 4, 2026

/unhold
/retest

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2026
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 1a68f54 and 2 for PR HEAD 762a071 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD d101674 and 1 for PR HEAD 762a071 in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 5, 2026

@logonoff: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 61387af into openshift:main Feb 5, 2026
8 checks passed
@logonoff logonoff deleted the FLAG_TECH_PREVIEW branch February 5, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants