Skip to content

move Set TechPreviewNoUpgrade on the target cluster#2911

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
ElayAharoni:move--Set-TechPreviewNoUpgrade-on-the-target-cluster-to-host-discovery-step
Apr 14, 2025
Merged

move Set TechPreviewNoUpgrade on the target cluster#2911
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
ElayAharoni:move--Set-TechPreviewNoUpgrade-on-the-target-cluster-to-host-discovery-step

Conversation

@ElayAharoni
Copy link
Copy Markdown
Contributor

@ElayAharoni ElayAharoni commented Apr 14, 2025

move Set TechPreviewNoUpgrade on the target cluster to host discovery

Summary by CodeRabbit

  • New Features

    • The host discovery process now conditionally updates the cluster configuration based on enabled features, providing more responsive error notifications during setup.
  • Refactor

    • The cluster creation workflow has been streamlined by removing legacy conditional checks, resulting in a more efficient and straightforward experience.

 to host discovery step

Signed-off-by: Elay Aharoni <elayaha@gmail.com>
@openshift-ci openshift-ci bot requested review from ammont82 and rawagner April 14, 2025 10:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2025

Walkthrough

This pull request simplifies and extends the cluster creation flow. In the ClusterDetails component, the logic for the single cluster feature and its associated API interactions has been removed. In contrast, the HostDiscovery component now introduces a feature toggle to conditionally enable API calls for updating the installation configuration. The new asynchronous onNext function performs the API call and error handling when the single cluster feature is enabled, streamlining the control flow for cluster configuration updates.

Changes

File(s) Change Summary
.../clusterWizard/ClusterDetails.tsx Removed ClustersAPI import and associated logic for the single cluster feature. Deleted the try-catch block and error handling related to updating the install configuration and removed the corresponding dependency from the callback.
.../clusterWizard/HostDiscovery.tsx Added ClustersAPI and useFeature imports. Introduced a feature toggle (isSingleClusterFeatureEnabled) in the asynchronous onNext function that conditionally calls ClustersAPI.updateInstallConfig and handles errors through handleApiError and a server update error dispatch.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HostDiscoveryForm
  participant FeatureToggle
  participant ClustersAPI
  participant ErrorHandler

  User->>HostDiscoveryForm: Click "Next"
  HostDiscoveryForm->>FeatureToggle: Check single cluster feature enabled
  FeatureToggle-->>HostDiscoveryForm: Return (true/false)
  alt Feature enabled
    HostDiscoveryForm->>ClustersAPI: updateInstallConfig(config)
    alt API call successful
      ClustersAPI-->>HostDiscoveryForm: Success
      HostDiscoveryForm->>User: Proceed to next step
    else API call fails
      ClustersAPI-->>HostDiscoveryForm: Error
      HostDiscoveryForm->>ErrorHandler: Invoke handleApiError
      ErrorHandler-->>HostDiscoveryForm: Alert error & dispatch server error action
    end
  else Feature not enabled
    HostDiscoveryForm->>User: Proceed to next step without API call
  end
Loading

Poem

I'm a rabbit hopping with glee,
Celebrating changes that set us free.
Code simplified and toggles in sight,
API calls on when they're right.
With each clean branch, we bound ahead,
Happy ears and code well-spread!
🐰✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38987a6 and d6c4fd6.

📒 Files selected for processing (2)
  • libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx (2 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx (3)
libs/ui-lib/lib/common/features/featureGate.tsx (1)
  • useFeature (56-59)
libs/ui-lib/lib/ocm/services/apis/index.ts (1)
  • ClustersAPI (5-5)
libs/ui-lib/lib/common/api/utils.ts (3)
  • handleApiError (19-51)
  • getApiErrorMessage (53-58)
  • isUnknownServerError (60-62)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: unit-tests
  • GitHub Check: translation-files
  • GitHub Check: circular-deps
  • GitHub Check: tests
  • GitHub Check: format
  • GitHub Check: lint
🔇 Additional comments (7)
libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx (2)

6-6: Import cleanup after refactoring

The ClustersAPI import has been removed from this file as part of moving the TechPreviewNoUpgrade setting functionality to the host discovery phase.


94-94: Dependency array updated correctly

The dependency array has been updated to remove isSingleClusterFeatureEnabled which is no longer used in this function after the functionality was moved to the HostDiscovery component.

libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx (5)

11-11: Added ClustersAPI import for install config updates

The ClustersAPI import has been added to support updating the install configuration with the TechPreviewNoUpgrade feature.


26-26: Added useFeature hook for feature flag checking

This import enables checking if the single cluster feature is enabled, which determines whether to update the install configuration.


34-36: Added necessary variables for install config update functionality

These variables are required to:

  1. Check if the single cluster feature is enabled
  2. Display alerts if there's an error
  3. Dispatch Redux actions if needed

Good preparation for implementing the moved functionality.


74-74: Updated onNext handler with correct async handling

The void onNext() pattern is used to properly handle the async function in the onClick event handler, which prevents potential React warnings about async event handlers.


45-66:

Details

❓ Verification inconclusive

Verify double JSON.stringify usage in install config update

The implementation correctly moves the TechPreviewNoUpgrade setting to the host discovery phase. However, there's a double JSON.stringify that should be verified:

JSON.stringify(JSON.stringify({ featureSet: 'TechPreviewNoUpgrade' }))

This results in a double-encoded string which might be intentional if the API expects this format, but it's worth confirming.


🏁 Script executed:

#!/bin/bash
# Search for other examples of updateInstallConfig to verify the expected format
rg -A 2 "updateInstallConfig" --type=ts --type=tsx

Length of output: 78


Below is a revised review comment that reflects our current findings. Since the initial search using a TSX file type produced an error—and no further examples of a double-encoded payload were identified—we need manual confirmation that the API indeed expects data encoded as a double JSON string.

Action: Verify Double JSON Encoding in API Call

In libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx (lines 45–66), the call

await ClustersAPI.updateInstallConfig(
  cluster.id,
  JSON.stringify(JSON.stringify({ featureSet: 'TechPreviewNoUpgrade' })),
);

produces a double-encoded string, which would be correct only if the API expects these nested encodings. However, our repository search for additional instances of updateInstallConfig (or similar double-stringify patterns) returned no conclusive output. Please verify manually that:

  • The API requires the payload to be double-encoded.
  • If this behavior is intentional, a short comment should be added to clarify the rationale.
  • Otherwise, consider removing one layer of JSON.stringify.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 14, 2025
@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 14, 2025
@rawagner
Copy link
Copy Markdown
Member

/lgtm
/approve

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ElayAharoni, rawagner

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-merge-bot openshift-merge-bot bot merged commit 7167786 into openshift-assisted:master Apr 14, 2025
11 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 14, 2025
ammont82 pushed a commit to ammont82/assisted-installer-ui that referenced this pull request Sep 12, 2025
…ed#2911)

to host discovery step

Signed-off-by: Elay Aharoni <elayaha@gmail.com>
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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants