Skip to content

OCPBUGS-83799: Fix Workloads sidebar ordering when DeploymentConfig capability is disabled#16351

Open
jhadvig wants to merge 1 commit intoopenshift:mainfrom
jhadvig:OCPBUGS-83799
Open

OCPBUGS-83799: Fix Workloads sidebar ordering when DeploymentConfig capability is disabled#16351
jhadvig wants to merge 1 commit intoopenshift:mainfrom
jhadvig:OCPBUGS-83799

Conversation

@jhadvig
Copy link
Copy Markdown
Member

@jhadvig jhadvig commented Apr 27, 2026

Analysis / Root cause:
The StatefulSets nav item in console-extensions.json uses insertAfter: "deploymentconfigs". When the DeploymentConfig cluster capability is disabled, the deploymentconfigs nav item is filtered out entirely (via its flags.required: ["OPENSHIFT_DEPLOYMENTCONFIG"]), so the insertAfter target doesn't exist. The sorting algorithm in nav/utils.ts falls back to appending items with unresolved targets to the end of the list, which breaks the ordering chain for StatefulSets and everything after it (Secrets, ConfigMaps, etc.).

Solution description:
Change insertAfter from "deploymentconfigs" to ["deploymentconfigs", "deployments"]. The insertAfter property already supports array fallbacks — the sorting logic takes the first matching ID found. When deploymentconfigs is absent, it falls back to inserting after deployments, maintaining the correct menu order.

Screenshots / screen recording:

Test setup:
Create or use a cluster with the DeploymentConfig capability disabled: docs

Test cases:

  • On a cluster with DeploymentConfig capability enabled, verify the Workloads sidebar order is unchanged: Topology, Pods, Deployments, DeploymentConfigs, StatefulSets, Secrets, ConfigMaps, ...
  • On a cluster with DeploymentConfig capability disabled, verify the Workloads sidebar order is: Topology, Pods, Deployments, StatefulSets, Secrets, ConfigMaps, ... (same order, just missing DeploymentConfigs)
  • Unit test added for getSortedNavExtensions covering both normal chain and missing-target fallback

Browser conformance:

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

Additional info:
Jira: https://redhat.atlassian.net/browse/OCPBUGS-83799

🤖 Generated with Claude Code

Reviewers and assignees:

Summary by CodeRabbit

  • Chores

    • Updated navigation configuration to improve positioning of console navigation items with multiple reference points.
  • Tests

    • Added test coverage for navigation extension sorting logic, including fallback positioning behavior.

…apability is disabled

The StatefulSets nav item had insertAfter: "deploymentconfigs", which
breaks the ordering chain when the DeploymentConfig capability is
disabled since the target ID no longer exists. This caused StatefulSets
and all subsequent items to be appended to the end of the menu instead
of maintaining their expected position after Deployments.

Add "deployments" as a fallback target so the chain stays intact
regardless of whether DeploymentConfig is enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. 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 Apr 27, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jhadvig: This pull request references Jira Issue OCPBUGS-83799, 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 StatefulSets nav item in console-extensions.json uses insertAfter: "deploymentconfigs". When the DeploymentConfig cluster capability is disabled, the deploymentconfigs nav item is filtered out entirely (via its flags.required: ["OPENSHIFT_DEPLOYMENTCONFIG"]), so the insertAfter target doesn't exist. The sorting algorithm in nav/utils.ts falls back to appending items with unresolved targets to the end of the list, which breaks the ordering chain for StatefulSets and everything after it (Secrets, ConfigMaps, etc.).

Solution description:
Change insertAfter from "deploymentconfigs" to ["deploymentconfigs", "deployments"]. The insertAfter property already supports array fallbacks — the sorting logic takes the first matching ID found. When deploymentconfigs is absent, it falls back to inserting after deployments, maintaining the correct menu order.

Screenshots / screen recording:

Test setup:
Create or use a cluster with the DeploymentConfig capability disabled: docs

Test cases:

  • On a cluster with DeploymentConfig capability enabled, verify the Workloads sidebar order is unchanged: Topology, Pods, Deployments, DeploymentConfigs, StatefulSets, Secrets, ConfigMaps, ...
  • On a cluster with DeploymentConfig capability disabled, verify the Workloads sidebar order is: Topology, Pods, Deployments, StatefulSets, Secrets, ConfigMaps, ... (same order, just missing DeploymentConfigs)
  • Unit test added for getSortedNavExtensions covering both normal chain and missing-target fallback

Browser conformance:

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

Additional info:
Jira: https://redhat.atlassian.net/browse/OCPBUGS-83799

🤖 Generated with Claude Code

Reviewers and assignees:

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 openshift-ci Bot requested review from rhamilto and spadgett April 27, 2026 12:15
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 27, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig

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 component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 27, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

This change updates navigation extension configuration for the statefulsets item by modifying its insertAfter directive to support multiple reference points—deploymentconfigs and deployments—instead of a single anchor. Concurrently, a comprehensive unit test suite is introduced for the getSortedNavExtensions utility function, validating three core scenarios: stable ordering with all dependencies present, fallback behavior when primary insertion targets are unavailable, and graceful handling of orphaned items with missing insertion references. This establishes test coverage for the multi-target positioning fallback logic.

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Test Structure And Quality ❓ Inconclusive Test file referenced in PR summary could not be located in repository, and Ginkgo test framework requirements do not match indicated TypeScript test changes. Provide access to actual test file or clarify whether check should apply to TypeScript/Jest tests rather than Ginkgo Go tests.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the specific issue (OCPBUGS-83799) and describes the exact problem being solved: fixing Workloads sidebar ordering when DeploymentConfig capability is disabled.
Description check ✅ Passed The description comprehensively covers all required template sections: root cause analysis, solution description, test setup, test cases, and references the Jira issue. All critical information for review and verification is present.
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 Test file contains three deterministic test cases with stable, descriptive names fully compliant with Ginkgo naming requirements, containing no dynamic information.
Microshift Test Compatibility ✅ Passed This PR adds a TypeScript Jest unit test and configuration change, not Ginkgo e2e tests; the check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR contains only Jest unit tests for frontend navigation utility; no Ginkgo e2e tests present, so SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Pull request contains only frontend OpenShift Console UI changes: console-extensions.json navigation configuration and navigation sorting unit test. No Kubernetes scheduling, deployment manifests, operators, controllers, or pod topology constraints affected.
Ote Binary Stdout Contract ✅ Passed PR contains only frontend console application changes (JSON configuration and TypeScript Jest test) with no modifications to OTE binaries, Go infrastructure, or process-level code violating the OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds TypeScript unit test, not Ginkgo e2e tests. Check applies only to Ginkgo e2e tests.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
frontend/packages/console-app/src/components/nav/__tests__/utils.spec.ts (1)

61-78: Strengthen orphan-case assertions to catch ordering regressions.

Current assertions only check presence of statefulsets and secrets; they can pass even if relative ordering regresses. Please assert their relative positions explicitly.

Suggested test tightening
   const sorted = getIds(getSortedNavExtensions(items));
   expect(sorted[0]).toBe('topology');
   expect(sorted[1]).toBe('pods');
   expect(sorted[2]).toBe('deployments');
-  // statefulsets and secrets end up after deployments but order may vary
-  expect(sorted).toContain('statefulsets');
-  expect(sorted).toContain('secrets');
+  expect(sorted.indexOf('statefulsets')).toBeGreaterThan(sorted.indexOf('deployments'));
+  expect(sorted.indexOf('secrets')).toBeGreaterThan(sorted.indexOf('statefulsets'));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/console-app/src/components/nav/__tests__/utils.spec.ts`
around lines 61 - 78, The test currently only asserts presence of 'statefulsets'
and 'secrets' allowing ordering regressions; update the spec that uses
getSortedNavExtensions/getIds to explicitly assert relative indexes: compute
indexes via getIds(sorted).indexOf('deployments'), .indexOf('statefulsets'), and
.indexOf('secrets') and add expectations that deploymentsIndex <
statefulsetsIndex and deploymentsIndex < secretsIndex, and also assert
statefulsetsIndex < secretsIndex (or the intended relative order) to lock in the
correct ordering behavior; keep the rest of the test unchanged and reference
createNavItem/getSortedNavExtensions/getIds when locating where to add these
assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/packages/console-app/src/components/nav/__tests__/utils.spec.ts`:
- Around line 61-78: The test currently only asserts presence of 'statefulsets'
and 'secrets' allowing ordering regressions; update the spec that uses
getSortedNavExtensions/getIds to explicitly assert relative indexes: compute
indexes via getIds(sorted).indexOf('deployments'), .indexOf('statefulsets'), and
.indexOf('secrets') and add expectations that deploymentsIndex <
statefulsetsIndex and deploymentsIndex < secretsIndex, and also assert
statefulsetsIndex < secretsIndex (or the intended relative order) to lock in the
correct ordering behavior; keep the rest of the test unchanged and reference
createNavItem/getSortedNavExtensions/getIds when locating where to add these
assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 3a9eb561-7954-43ff-8e82-91d69a3fadcc

📥 Commits

Reviewing files that changed from the base of the PR and between b9813ea and acc1056.

📒 Files selected for processing (2)
  • frontend/packages/console-app/console-extensions.json
  • frontend/packages/console-app/src/components/nav/__tests__/utils.spec.ts
📜 Review details
🔇 Additional comments (3)
frontend/packages/console-app/console-extensions.json (1)

1156-1156: Good fallback anchor update for StatefulSets ordering.

This change correctly preserves the intended Workloads order when deploymentconfigs is filtered out, while still preferring it when available.

frontend/packages/console-app/src/components/nav/__tests__/utils.spec.ts (2)

22-59: Nice coverage for primary and fallback insertAfter behavior.

These two tests directly validate the ordering chain with and without deploymentconfigs, and they align well with the bug scenario.


2-2: Remove this suggestion—LoadedExtension is not exported from the public API.

The SDK intentionally keeps LoadedExtension as an internal type (in /src/types). It's not re-exported from the public entrypoint, so this import pattern is the standard and necessary way to access it. This is evident from 49+ usages across the codebase following the same approach. No change needed.

			> Likely an incorrect or invalid review comment.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 27, 2026

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

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 jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants