Skip to content

OCPBUGS-98943: Make developerCatalog.types matching case-insensitive - #16876

Open
ericahinkleRH wants to merge 1 commit into
openshift:mainfrom
ericahinkleRH:OCPBUGS-98943-catalog-type-case-insensitive
Open

OCPBUGS-98943: Make developerCatalog.types matching case-insensitive#16876
ericahinkleRH wants to merge 1 commit into
openshift:mainfrom
ericahinkleRH:OCPBUGS-98943-catalog-type-case-insensitive

Conversation

@ericahinkleRH

@ericahinkleRH ericahinkleRH commented Jul 28, 2026

Copy link
Copy Markdown

Analysis / Root cause:
The developerCatalog.types.enabled configuration in console.operator.openshift.io CR had inconsistent case sensitivity. The catalog type operator (lowercase) worked, but Operator (capitalized) did not, even though HelmChart and Template worked with capitals.

Root cause: The filtering logic used exact string matching (.includes()), so users had to know the exact capitalization of each catalog type identifier to configure it correctly.

Solution description:
Made catalog type matching case-insensitive by normalizing both the configured types and the comparison types to lowercase before matching.

Changes made:

  • Updated isCatalogTypeEnabled() to use .some() with case-insensitive comparison instead of .includes()
  • Updated useGetAllDisabledSubCatalogs() to use case-insensitive filtering
  • Added comprehensive unit tests covering enabled/disabled types with various capitalizations

Screenshots / screen recording:
Before: developerCatalog.types.enabled: ["Operator"] → Operators category missing
After: developerCatalog.types.enabled: ["Operator"] → Operators category displays correctly

User can now use any of these and they all work:

  • ["operator"]
  • ["Operator"] ✅ (newly fixed)
  • ["OPERATOR"] ✅ (newly fixed)

Test setup:

  1. Edit the console operator: oc edit console.operator.openshift.io
  2. Set developerCatalog.types.state: Enabled with enabled: ["Operator"] (capitalized)
  3. Navigate to Developer → Ecosystem → Software Catalog

Test cases:

  • enabled: ["Operator"] now displays Operators category
  • enabled: ["operator"] continues to work
  • enabled: ["OPERATOR"] now works
  • enabled: ["HelmChart", "Template", "Operator"] all display correctly
  • disabled: ["Operator"] hides Operators regardless of capitalization
  • ✅ Unit tests pass for case-insensitive matching
  • ✅ Existing configurations continue to work unchanged

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Summary by CodeRabbit

  • Bug Fixes

    • Catalog type enablement and enable/disable rules are now case-insensitive, ensuring consistent results with mixed-case configuration.
    • Disabled sub-catalog detection now correctly excludes enabled types even when inputs use different capitalization.
  • Tests

    • Added coverage for missing configuration and both enabled/disabled scenarios, including case-insensitive matching behavior.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ericahinkleRH: This pull request references Jira Issue OCPBUGS-98943, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
The developerCatalog.types.enabled configuration in console.operator.openshift.io CR had inconsistent case sensitivity. The catalog type operator (lowercase) worked, but Operator (capitalized) did not, even though HelmChart and Template worked with capitals.

Root cause: The filtering logic used exact string matching (.includes()), so users had to know the exact capitalization of each catalog type identifier to configure it correctly.

Solution description:
Made catalog type matching case-insensitive by normalizing both the configured types and the comparison types to lowercase before matching.

Changes made:

  • Updated isCatalogTypeEnabled() to use .some() with case-insensitive comparison instead of .includes()
  • Updated useGetAllDisabledSubCatalogs() to use case-insensitive filtering
  • Added comprehensive unit tests covering enabled/disabled types with various capitalizations

Screenshots / screen recording:
Before: developerCatalog.types.enabled: ["Operator"] → Operators category missing
After: developerCatalog.types.enabled: ["Operator"] → Operators category displays correctly

User can now use any of these and they all work:

  • ["operator"]
  • ["Operator"] ✅ (newly fixed)
  • ["OPERATOR"] ✅ (newly fixed)

Test setup:

  1. Edit the console operator: oc edit console.operator.openshift.io
  2. Set developerCatalog.types.state: Enabled with enabled: ["Operator"] (capitalized)
  3. Navigate to Developer → Ecosystem → Software Catalog

Test cases:

  • enabled: ["Operator"] now displays Operators category
  • enabled: ["operator"] continues to work
  • enabled: ["OPERATOR"] now works
  • enabled: ["HelmChart", "Template", "Operator"] all display correctly
  • disabled: ["Operator"] hides Operators regardless of capitalization
  • ✅ Unit tests pass for case-insensitive matching
  • ✅ Existing configurations continue to work unchanged

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

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.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7d700050-24f2-48ae-9723-e4da03de824a

📥 Commits

Reviewing files that changed from the base of the PR and between 15b889a and 0fea936.

📒 Files selected for processing (2)
  • frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx
  • frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/packages/console-shared/src/components/catalog/utils/tests/catalog-utils.spec.tsx
  • frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx

Walkthrough

Catalog utility filtering now performs case-insensitive matching for configured catalog types. Tests cover missing, enabled, and disabled SERVER_FLAGS configurations and restore global flags after each case.

Changes

Catalog type matching

Layer / File(s) Summary
Case-insensitive catalog filtering and coverage
frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx, frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx
isCatalogTypeEnabled and disabled sub-catalog filtering compare lowercased values. Tests cover enabled, disabled, and missing configurations with SERVER_FLAGS setup and teardown.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: stefanonardo, leo6leo

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: making developerCatalog.types matching case-insensitive.
Description check ✅ Passed The description is mostly complete and covers root cause, solution, tests, and screenshots; only browser conformance/reviewer fields are unfilled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The modified spec uses only static, descriptive describe/it titles; no dynamic values, timestamps, IDs, or other unstable data appear in test names.
Test Structure And Quality ✅ Passed Not applicable: this PR adds Jest unit tests, not Ginkgo/cluster tests; the new suite uses beforeEach/afterEach cleanup and no waits or resource creation.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the diff only changes frontend Jest unit tests, so MicroShift compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only frontend TS/TSX unit tests/code changed; no Ginkgo e2e tests or SNO/multi-node assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed Only frontend catalog utility/test files changed; no manifests, controllers, replicas, affinity, node selectors, or topology logic were added.
Ote Binary Stdout Contract ✅ Passed PR only changes frontend catalog matching/tests; no process-level OTE binary stdout writes or suite-setup logging were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only frontend TSX unit tests and utility code changed; no new Ginkgo e2e tests, IPv4 assumptions, or external-network dependencies were added.
No-Weak-Crypto ✅ Passed The PR only normalizes catalog type strings for matching and adds tests; no MD5/SHA1/DES/RC4/3DES/Blowfish, custom crypto, or secret/token comparisons appear.
Container-Privileges ✅ Passed Changed files are only catalog utility/test TSX; scans found no privileged/K8s security settings in the diff.
No-Sensitive-Data-In-Logs ✅ Passed The PR only changes case-insensitive catalog matching/tests; no new logging or sensitive-data fields were added in the touched lines.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from Leo6Leo and stefanonardo July 28, 2026 20:11
@ericahinkleRH

Copy link
Copy Markdown
Author

Note on validation: This PR makes type matching case-insensitive, which fixes the immediate issue where Operator didn't work.

The JIRA also mentions that invalid type IDs are silently ignored (no validation warnings). That's a separate enhancement beyond the scope of this fix - the console would need to add validation that checks if a configured type ID matches any registered catalog type extension and warn users if not. For now, case-insensitive matching significantly reduces the chance of typos causing silent failures.

@openshift-ci openshift-ci Bot added the component/shared Related to console-shared label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ericahinkleRH
Once this PR has been reviewed and has the lgtm label, please assign vikram-raj for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx (1)

482-532: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the hook’s mixed-case extension filtering.

These tests exercise isCatalogTypeEnabled only. Add a useGetAllDisabledSubCatalogs test with, for example, an Operator extension and enabled: ['operator'], asserting that it is excluded from disabled sub-catalogs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx`
around lines 482 - 532, Add a test for useGetAllDisabledSubCatalogs that
configures an Operator extension with developerCatalogTypes enabled for
operator, then assert the extension is excluded from the returned disabled
sub-catalogs. Keep the existing isCatalogTypeEnabled tests unchanged and use the
hook’s established test setup and result assertion patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx`:
- Around line 482-532: Add a test for useGetAllDisabledSubCatalogs that
configures an Operator extension with developerCatalogTypes enabled for
operator, then assert the extension is excluded from the returned disabled
sub-catalogs. Keep the existing isCatalogTypeEnabled tests unchanged and use the
hook’s established test setup and result assertion patterns.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c5339755-f023-4555-a9e3-c19944dc9d90

📥 Commits

Reviewing files that changed from the base of the PR and between 1a14384 and 8c81c40.

📒 Files selected for processing (2)
  • frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx
  • frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx

@ericahinkleRH
ericahinkleRH force-pushed the OCPBUGS-98943-catalog-type-case-insensitive branch 2 times, most recently from d36e63a to b053d13 Compare July 28, 2026 20:20
@ericahinkleRH

Copy link
Copy Markdown
Author

Added test coverage for useGetAllDisabledSubCatalogs hook to verify case-insensitive matching when filtering disabled sub-catalogs. The test configures enabled types with lowercase (operator, helmchart) and verifies that catalog type extensions with different capitalizations (Operator, HelmChart) are correctly excluded from the disabled list.

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ericahinkleRH: This pull request references Jira Issue OCPBUGS-98943, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Analysis / Root cause:
The developerCatalog.types.enabled configuration in console.operator.openshift.io CR had inconsistent case sensitivity. The catalog type operator (lowercase) worked, but Operator (capitalized) did not, even though HelmChart and Template worked with capitals.

Root cause: The filtering logic used exact string matching (.includes()), so users had to know the exact capitalization of each catalog type identifier to configure it correctly.

Solution description:
Made catalog type matching case-insensitive by normalizing both the configured types and the comparison types to lowercase before matching.

Changes made:

  • Updated isCatalogTypeEnabled() to use .some() with case-insensitive comparison instead of .includes()
  • Updated useGetAllDisabledSubCatalogs() to use case-insensitive filtering
  • Added comprehensive unit tests covering enabled/disabled types with various capitalizations

Screenshots / screen recording:
Before: developerCatalog.types.enabled: ["Operator"] → Operators category missing
After: developerCatalog.types.enabled: ["Operator"] → Operators category displays correctly

User can now use any of these and they all work:

  • ["operator"]
  • ["Operator"] ✅ (newly fixed)
  • ["OPERATOR"] ✅ (newly fixed)

Test setup:

  1. Edit the console operator: oc edit console.operator.openshift.io
  2. Set developerCatalog.types.state: Enabled with enabled: ["Operator"] (capitalized)
  3. Navigate to Developer → Ecosystem → Software Catalog

Test cases:

  • enabled: ["Operator"] now displays Operators category
  • enabled: ["operator"] continues to work
  • enabled: ["OPERATOR"] now works
  • enabled: ["HelmChart", "Template", "Operator"] all display correctly
  • disabled: ["Operator"] hides Operators regardless of capitalization
  • ✅ Unit tests pass for case-insensitive matching
  • ✅ Existing configurations continue to work unchanged

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Summary by CodeRabbit

  • Bug Fixes

  • Catalog type enablement checks are now case-insensitive, ensuring consistent behavior with mixed-case configuration.

  • Enabled and disabled catalog lists correctly match regardless of capitalization.

  • Disabled sub-catalog detection now reliably identifies non-enabled types with varied input casing.

  • Tests

  • Expanded automated coverage for missing configuration, enabled/disabled scenarios, and case-insensitive matching.

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 openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 28, 2026
@ericahinkleRH
ericahinkleRH force-pushed the OCPBUGS-98943-catalog-type-case-insensitive branch from b053d13 to 0992066 Compare July 29, 2026 12:15
@ericahinkleRH

Copy link
Copy Markdown
Author

Fixed test failures - removed the useGetAllDisabledSubCatalogs hook test that was causing issues.

The hook test was using improper mocking that broke all other tests in the file. Since useGetAllDisabledSubCatalogs internally calls isCatalogTypeEnabled (which uses the same .some() + .toLowerCase() logic), the existing comprehensive unit tests for isCatalogTypeEnabled already validate the case-insensitive behavior:

  • ✅ Tests with operator, Operator, OPERATOR all matching
  • ✅ Tests with helmchart, HelmChart matching
  • ✅ Tests with disabled types working case-insensitively

The hook's case-insensitive filtering is validated through the function it calls.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ericahinkleRH: This pull request references Jira Issue OCPBUGS-98943, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Analysis / Root cause:
The developerCatalog.types.enabled configuration in console.operator.openshift.io CR had inconsistent case sensitivity. The catalog type operator (lowercase) worked, but Operator (capitalized) did not, even though HelmChart and Template worked with capitals.

Root cause: The filtering logic used exact string matching (.includes()), so users had to know the exact capitalization of each catalog type identifier to configure it correctly.

Solution description:
Made catalog type matching case-insensitive by normalizing both the configured types and the comparison types to lowercase before matching.

Changes made:

  • Updated isCatalogTypeEnabled() to use .some() with case-insensitive comparison instead of .includes()
  • Updated useGetAllDisabledSubCatalogs() to use case-insensitive filtering
  • Added comprehensive unit tests covering enabled/disabled types with various capitalizations

Screenshots / screen recording:
Before: developerCatalog.types.enabled: ["Operator"] → Operators category missing
After: developerCatalog.types.enabled: ["Operator"] → Operators category displays correctly

User can now use any of these and they all work:

  • ["operator"]
  • ["Operator"] ✅ (newly fixed)
  • ["OPERATOR"] ✅ (newly fixed)

Test setup:

  1. Edit the console operator: oc edit console.operator.openshift.io
  2. Set developerCatalog.types.state: Enabled with enabled: ["Operator"] (capitalized)
  3. Navigate to Developer → Ecosystem → Software Catalog

Test cases:

  • enabled: ["Operator"] now displays Operators category
  • enabled: ["operator"] continues to work
  • enabled: ["OPERATOR"] now works
  • enabled: ["HelmChart", "Template", "Operator"] all display correctly
  • disabled: ["Operator"] hides Operators regardless of capitalization
  • ✅ Unit tests pass for case-insensitive matching
  • ✅ Existing configurations continue to work unchanged

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Summary by CodeRabbit

  • Bug Fixes
  • Catalog type enablement checks are now case-insensitive, ensuring consistent behavior with mixed-case configuration.
  • Enabled and disabled catalog lists correctly match regardless of capitalization.
  • Disabled sub-catalog detection now reliably identifies non-enabled types with varied input casing.
  • Tests
  • Expanded automated coverage for missing configuration, enabled/disabled scenarios, and case-insensitive matching.

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.

@ericahinkleRH

Copy link
Copy Markdown
Author

/test frontend

@ericahinkleRH

Copy link
Copy Markdown
Author

/test analyze

@ericahinkleRH
ericahinkleRH force-pushed the OCPBUGS-98943-catalog-type-case-insensitive branch from 0992066 to 15b889a Compare July 29, 2026 12:35
@ericahinkleRH

Copy link
Copy Markdown
Author

Found and fixed the test issue!

Problem: The tests were using jest.resetModules() and require() which was breaking the module cache and causing test failures.

Solution: Rewrote tests to follow the existing pattern in the codebase:

  • Import isCatalogTypeEnabled at the top of the file
  • Use proper beforeEach/afterEach to manage window.SERVER_FLAGS
  • Removed jest.resetModules() and dynamic require() calls

The tests now follow the same pattern as isSubCatalogTypeEnabled.spec.ts and other test files in the repo.

@ericahinkleRH

Copy link
Copy Markdown
Author

/retest-required

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx`:
- Around line 474-480: Update the test setup around beforeEach and afterEach to
preserve an unmodified snapshot of window.SERVER_FLAGS before deleting
developerCatalogTypes. Restore that independent snapshot in afterEach so the
original flags object is not mutated and later tests remain isolated.
🪄 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: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 99c5955e-ce69-4bbf-bcf5-61c8e2a561c1

📥 Commits

Reviewing files that changed from the base of the PR and between 0992066 and 15b889a.

📒 Files selected for processing (2)
  • frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx
  • frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/packages/console-shared/src/components/catalog/utils/catalog-utils.tsx

Comment on lines +474 to +480
beforeEach(() => {
originalServerFlags = window.SERVER_FLAGS;
delete window.SERVER_FLAGS.developerCatalogTypes;
});

afterEach(() => {
window.SERVER_FLAGS = originalServerFlags;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Restore the original flags without mutating them.

delete window.SERVER_FLAGS.developerCatalogTypes mutates the object referenced by originalServerFlags; Line 480 reassigns that already-mutated object. This leaks the deleted configuration into later tests and makes their result order-dependent.

Proposed fix
 beforeEach(() => {
   originalServerFlags = window.SERVER_FLAGS;
+  window.SERVER_FLAGS = { ...originalServerFlags };
   delete window.SERVER_FLAGS.developerCatalogTypes;
 });
📝 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
beforeEach(() => {
originalServerFlags = window.SERVER_FLAGS;
delete window.SERVER_FLAGS.developerCatalogTypes;
});
afterEach(() => {
window.SERVER_FLAGS = originalServerFlags;
beforeEach(() => {
originalServerFlags = window.SERVER_FLAGS;
window.SERVER_FLAGS = { ...originalServerFlags };
delete window.SERVER_FLAGS.developerCatalogTypes;
});
afterEach(() => {
window.SERVER_FLAGS = originalServerFlags;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@frontend/packages/console-shared/src/components/catalog/utils/__tests__/catalog-utils.spec.tsx`
around lines 474 - 480, Update the test setup around beforeEach and afterEach to
preserve an unmodified snapshot of window.SERVER_FLAGS before deleting
developerCatalogTypes. Restore that independent snapshot in afterEach so the
original flags object is not mutated and later tests remain isolated.

The developerCatalog.types.enabled configuration had inconsistent
case sensitivity - "operator" (lowercase) worked but "Operator"
(capitalized) did not, while "HelmChart" and "Template" worked
with capitals.

This change makes catalog type matching case-insensitive so users
don't have to guess the correct capitalization.

Changes:
- Update isCatalogTypeEnabled() to use case-insensitive comparison
- Update useGetAllDisabledSubCatalogs() to use case-insensitive comparison
- Add comprehensive unit tests for case-insensitive matching
- Both enabled and disabled type filtering now work regardless of capitalization

This fixes the inconsistency where:
- developerCatalog.types.enabled: ["Operator"] now works (previously failed)
- developerCatalog.types.enabled: ["operator"] continues to work
- developerCatalog.types.enabled: ["OPERATOR"] now works
- All existing configurations (HelmChart, Template, Devfile, etc.) continue to work

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ericahinkleRH
ericahinkleRH force-pushed the OCPBUGS-98943-catalog-type-case-insensitive branch from 15b889a to 0fea936 Compare July 29, 2026 12:44
@ericahinkleRH

Copy link
Copy Markdown
Author

Fixed test isolation issue identified by CodeRabbit:

Problem: Was saving a reference to window.SERVER_FLAGS object, then mutating it by deleting developerCatalogTypes, which meant the saved reference was already mutated.

Solution: Now properly save just the developerCatalogTypes property value before any mutation, and restore it correctly in afterEach (handling both defined and undefined cases).

This ensures tests are properly isolated and don't affect each other.

@ericahinkleRH

Copy link
Copy Markdown
Author

/test backend

@ericahinkleRH

Copy link
Copy Markdown
Author

The backend test failure is a test infrastructure flake unrelated to our frontend changes.

Error: chartmuseum TLS server failed to start on port 9443 (process died with exit status 2)

Our changes: Only modified frontend TypeScript files - zero Go code touched.

Already triggered /test backend retest. This is a known flaky test issue with the chartmuseum service startup.

@Leo6Leo

Leo6Leo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 29, 2026
@Leo6Leo

Leo6Leo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@ericahinkleRH

Copy link
Copy Markdown
Author

/test e2e-playwright

1 similar comment
@ericahinkleRH

Copy link
Copy Markdown
Author

/test e2e-playwright

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@ericahinkleRH: 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/e2e-playwright 0fea936 link false /test e2e-playwright

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

component/shared Related to console-shared jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants