Skip to content

Revert "SANDBOX-1755: OpenShift AI temporarily disabled"#58

Merged
MikelAlejoBR merged 1 commit intomasterfrom
revert-52-disable_openshift_ai
Apr 17, 2026
Merged

Revert "SANDBOX-1755: OpenShift AI temporarily disabled"#58
MikelAlejoBR merged 1 commit intomasterfrom
revert-52-disable_openshift_ai

Conversation

@alexeykazakov
Copy link
Copy Markdown
Contributor

@alexeykazakov alexeykazakov commented Apr 17, 2026

Reverts #52

Summary by CodeRabbit

Release Notes

  • New Features

    • OpenShift AI product is now available in the Sandbox Catalog with product information, branding, and link routing.
  • Tests

    • Updated test coverage to validate OpenShift AI product data and analytics tracking.

@openshift-ci openshift-ci bot requested review from fbm3307 and xcoulon April 17, 2026 18:12
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

Walkthrough

Re-enabled OpenShift AI product support previously commented out in test cases and runtime code. Changes include activating test assertions for analytics tracking, product data validation, and URL mapping configuration across test and implementation files.

Changes

Cohort / File(s) Summary
Test Cases
plugins/sandbox/src/components/SandboxCatalog/__tests__/SandboxCatalogCardButton.test.tsx, plugins/sandbox/src/components/SandboxCatalog/__tests__/productData.test.tsx
Re-enabled test cases and assertions for Product.OPENSHIFT_AI, including analytics tracking validation and product data structure verification; updated icon indexing to reflect new product ordering.
Product Data & URLs
plugins/sandbox/src/components/SandboxCatalog/productData.tsx, plugins/sandbox/src/hooks/useProductURLs.ts
Re-enabled OpenShift AI product entry with icon import and description data; activated corresponding URL mapping to use userData?.rhodsMemberURL when provisioned.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: reverting a previous commit that disabled OpenShift AI, thus re-enabling it throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-52-disable_openshift_ai

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

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
plugins/sandbox/src/components/SandboxCatalog/__tests__/productData.test.tsx (1)

71-71: Prefer ID-based lookup over fixed index in test setup.

At Line 71, using productData[3] couples this test to array order; a future reorder will cause unrelated failures. Resolve the AAP row by Product.AAP instead.

Suggested refactor
-    const warningIcon = productData[3].description[4].icon; // AAP's warning icon
+    const aapProduct = productData.find(p => p.id === Product.AAP);
+    expect(aapProduct).toBeDefined();
+    const warningIcon = aapProduct!.description[4].icon; // AAP's warning icon
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/sandbox/src/components/SandboxCatalog/__tests__/productData.test.tsx`
at line 71, The test currently picks AAP by array index (productData[3]) which
is brittle; change the setup to locate the AAP product by ID using
productData.find(p => p.id === Product.AAP) (or equivalent) and then read its
description[4].icon into warningIcon, guarding against undefined (throw or
assert) so the test fails clearly if AAP is absent. This replaces the
fixed-index lookup with an ID-based lookup while keeping the same description
index access.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/sandbox/src/hooks/useProductURLs.ts`:
- Around line 65-68: The current mapping for Product.OPENSHIFT_AI uses a
template literal which turns undefined into the string "undefined"; change the
url assignment in useProductURLs.ts so it does not stringify optional values —
use a direct conditional or nullish coalescing to set url to
userData.rhodsMemberURL only when isProvisioned and the property is defined,
otherwise set it to an empty string (update the object for Product.OPENSHIFT_AI
to reference userData?.rhodsMemberURL directly instead of using a template
literal).

---

Nitpick comments:
In
`@plugins/sandbox/src/components/SandboxCatalog/__tests__/productData.test.tsx`:
- Line 71: The test currently picks AAP by array index (productData[3]) which is
brittle; change the setup to locate the AAP product by ID using
productData.find(p => p.id === Product.AAP) (or equivalent) and then read its
description[4].icon into warningIcon, guarding against undefined (throw or
assert) so the test fails clearly if AAP is absent. This replaces the
fixed-index lookup with an ID-based lookup while keeping the same description
index access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 240405c8-4cbc-4fa1-8f56-aac00beef206

📥 Commits

Reviewing files that changed from the base of the PR and between 2fd41de and 0be17f8.

📒 Files selected for processing (4)
  • plugins/sandbox/src/components/SandboxCatalog/__tests__/SandboxCatalogCardButton.test.tsx
  • plugins/sandbox/src/components/SandboxCatalog/__tests__/productData.test.tsx
  • plugins/sandbox/src/components/SandboxCatalog/productData.tsx
  • plugins/sandbox/src/hooks/useProductURLs.ts

Comment on lines +65 to +68
{
id: Product.OPENSHIFT_AI,
url: isProvisioned ? `${userData?.rhodsMemberURL}` : '',
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify optional URL fields are not wrapped in template literals.
# Expected: avoid `${userData?.<optionalUrl>}` for URL values.
rg -nP --type=ts '\$\{userData\?\.(rhodsMemberURL|cheDashboardURL|consoleURL)\}' plugins/sandbox/src/hooks/useProductURLs.ts

Repository: codeready-toolchain/devsandbox-dashboard

Length of output: 396


🏁 Script executed:

cat -n plugins/sandbox/src/types/registration.ts | sed -n '30,50p'

Repository: codeready-toolchain/devsandbox-dashboard

Length of output: 679


🏁 Script executed:

cat -n plugins/sandbox/src/hooks/useProductURLs.ts | sed -n '55,85p'

Repository: codeready-toolchain/devsandbox-dashboard

Length of output: 1193


Avoid stringifying an optional URL into "undefined".

At line 67, the template literal converts undefined to a literal string when provisioned users lack rhodsMemberURL, producing an invalid URL.

Suggested fix
     {
       id: Product.OPENSHIFT_AI,
-      url: isProvisioned ? `${userData?.rhodsMemberURL}` : '',
+      url: isProvisioned ? userData?.rhodsMemberURL ?? '' : '',
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
id: Product.OPENSHIFT_AI,
url: isProvisioned ? `${userData?.rhodsMemberURL}` : '',
},
{
id: Product.OPENSHIFT_AI,
url: isProvisioned ? userData?.rhodsMemberURL ?? '' : '',
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/sandbox/src/hooks/useProductURLs.ts` around lines 65 - 68, The
current mapping for Product.OPENSHIFT_AI uses a template literal which turns
undefined into the string "undefined"; change the url assignment in
useProductURLs.ts so it does not stringify optional values — use a direct
conditional or nullish coalescing to set url to userData.rhodsMemberURL only
when isProvisioned and the property is defined, otherwise set it to an empty
string (update the object for Product.OPENSHIFT_AI to reference
userData?.rhodsMemberURL directly instead of using a template literal).

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 17, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, MikelAlejoBR

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:
  • OWNERS [MikelAlejoBR,alexeykazakov]

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

@MikelAlejoBR
Copy link
Copy Markdown
Contributor

/retest

@MikelAlejoBR MikelAlejoBR merged commit 4a95807 into master Apr 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants