Skip to content

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 the component/core Related to console core functionality label Jan 30, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2026
@coderabbitai
Copy link

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

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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

Copy link

@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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 30, 2026

@logonoff: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-images 762a071 link true /test okd-scos-images

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.

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. px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants