Skip to content

ACM-30888 Remove placement feature gate#6066

Open
fxiang1 wants to merge 5 commits intostolostron:mainfrom
fxiang1:feng-remove-placement-feature-gate
Open

ACM-30888 Remove placement feature gate#6066
fxiang1 wants to merge 5 commits intostolostron:mainfrom
fxiang1:feng-remove-placement-feature-gate

Conversation

@fxiang1
Copy link
Copy Markdown
Contributor

@fxiang1 fxiang1 commented Apr 28, 2026

📝 Summary

Ticket Summary (Title):
Remove enhancedPlacement feature flag

Ticket Link:
https://redhat.atlassian.net/browse/ACM-30888

Type of Change:

  • 🐞 Bug Fix
  • ✨ Feature
  • 🔧 Refactor
  • 💸 Tech Debt
  • 🧪 Test-related
  • 📄 Docs

✅ Checklist

General

  • PR title follows the convention (e.g. ACM-12340 Fix bug with...)
  • Code builds and runs locally without errors
  • No console logs, commented-out code, or unnecessary files
  • All commits are meaningful and well-labeled
  • All new display strings are externalized for localization (English only)
  • (Nice to have) JSDoc comments added for new functions and interfaces

If Feature

  • UI/UX reviewed (if applicable)
  • All acceptance criteria met
  • Unit test coverage added or updated
  • Relevant documentation or comments included

If Bugfix

  • Root cause and fix summary are documented in the ticket (for future reference / errata)
  • Fix tested thoroughly and resolves the issue
  • Test(s) added to prevent regression

🗒️ Notes for Reviewers

Summary by CodeRabbit

  • Enhancements

    • Placements are always shown across application, policy, and cluster views.
    • Placement preview is permanently enabled in placement wizards and Argo flows.
    • Placements tab always visible in cluster management.
  • Bug Fixes

    • Advanced Configuration deprecation alert and placement details now render consistently; placements toggle and conditional exports removed.
  • Chores

    • Tests updated to ignore placement-debug network calls.

Signed-off-by: fxiang1 <fxiang@redhat.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 28, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fxiang1

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

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
📝 Walkthrough

Walkthrough

Removes the backend enhancedPlacement config and front-end feature gating for enhancedPlacement, makes placement-related UI/logic unconditional, simplifies the usePlacementDebug hook API, and adds a test nock helper to ignore placement-debug requests; tests updated accordingly.

Changes

Configuration & Types

Layer / File(s) Summary
Config
backend/config/enhancedPlacement
Removed file contents (no enabled directive).
Types
frontend/src/atoms.ts
Removed `enhancedPlacement?: 'enabled'

Feature-flag removal & UI behavior

Layer / File(s) Summary
Shared atoms usage removal
frontend/src/routes/Applications/.../AdvancedConfiguration.tsx, frontend/src/routes/Applications/components/ToggleSelector.tsx, frontend/src/routes/Applications/AdvancedConfiguration.test.tsx
Deleted settingsState/placementsState reads; removed placement gating, placement table, and placements toggle; tests drop placements toggle/CSV cases and settings initialization.
Application details & overview
frontend/src/routes/Applications/.../ApplicationDetails.tsx, .../ApplicationDetails.test.tsx
Stopped reading settingsState; Placement detail (PlacementLinkList) now always rendered.
Governance pages
frontend/src/routes/Governance/policies/.../PolicyDetailsOverview.tsx, .../PolicyDetailsOverview.test.tsx, frontend/src/routes/Governance/policy-sets/.../PolicySetCard.tsx, .../PolicySetCard.test.tsx
Removed enhancedPlacement branching and alternate placement-table/risk-score paths; placement section and violations always render; tests no longer set settingsState.
Infrastructure — clusters & tabs
frontend/src/routes/Infrastructure/Clusters/ClustersPage.tsx, .../ClusterOverview.tsx
Always include Placements tab/overview entry; removed Recoil reads for enhancedPlacement.
Placement creation/wizard UI changes
frontend/src/routes/Infrastructure/Clusters/Placements/.../EditPlacement.tsx, .../PlacementWizard.tsx
Forwarded highlightEditorPath to SyncEditor; placement preview now always enabled; removed Recoil gating.
Placement UI components
frontend/src/wizards/Placement/Placement.tsx, frontend/src/wizards/Placement/PlacementSection.tsx, frontend/src/wizards/Placement/PlacementSection.test.tsx
Placement conditionally supplies placement to debug hook only when ownsDebugUI; PlacementSection removed Recoil gating so preview/footer/review-step are unconditional and fixed label-expression rendering; tests updated.
Argo & other wizards
frontend/src/wizards/Argo/ArgoWizard.tsx
Placement preview always enabled; removed Recoil settings reads.

Hook API change

Layer / File(s) Summary
Hook signature & logic
frontend/src/wizards/Placement/usePlacementDebug.ts
Removed enabled parameter from usePlacementDebug; initialization and effect early-exit no longer consider enabled; effect deps reduced to specKey.
Hook tests
frontend/src/wizards/Placement/usePlacementDebug.test.ts
Removed tests for disabled mode and updated invocations to the new single-argument hook API.

Testing & network mocks

Layer / File(s) Summary
Nock util addition
frontend/src/lib/nock-util.ts
Added export function nockIgnorePlacementDebug() that stubs persistent POST /placement-debug with an empty/placeholder payload.
Test wiring
multiple frontend/.../*.test.tsx (e.g., CreatePullApplicationSet.test.tsx, CreatePushApplicationSet.test.tsx, CreatePolicy.test.tsx, CreatePolicySet.test.tsx, EditPolicySet.test.tsx, ArgoWizard.test.tsx, PolicySetWizard.test.tsx)
Many test suites import and call nockIgnorePlacementDebug() (typically in beforeEach) to ignore placement-debug API calls; several tests removed settingsState initialization or adjusted minor test helper args.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the primary change: removing the enhancedPlacement feature flag, which aligns with the substantial refactoring across the codebase.
Description check ✅ Passed The description includes ticket link, change type (Refactor), and follows the template structure, but the General checklist items and optional reviewer notes are uncompleted/blank.
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.

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

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

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

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

@fxiang1
Copy link
Copy Markdown
Contributor Author

fxiang1 commented Apr 28, 2026

Put on hold until QE is ready

/hold

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)
frontend/src/wizards/Placement/PlacementSection.test.tsx (1)

348-349: Redundant mockSettings = {} assignments.

Lines 349, 370, 392, and 448 explicitly set mockSettings = {}, but this is already done in beforeEach (line 89). These lines can be removed for cleaner tests.

♻️ Remove redundant assignments
  it('sets footer content with single placement', () => {
-   mockSettings = {}
    mockResources = [

Apply similar removal to lines 370, 392, and 448.

Also applies to: 369-370, 392-392, 448-448

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Placement/PlacementSection.test.tsx` around lines 348 -
349, Remove the redundant in-test reassignments of mockSettings (e.g., the
explicit mockSettings = {} inside the test "sets footer content with single
placement" and the other tests that repeat this) because beforeEach already
initializes mockSettings; simply delete those assignments so tests rely on the
shared beforeEach setup (look for occurrences of mockSettings = {} in
PlacementSection.test.tsx and remove them).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/wizards/Placement/Placement.tsx`:
- Around line 118-119: The debug hook is being invoked unconditionally via
usePlacementDebug(placement) even when ownsDebugUI is false or
props.placementDebugState is provided; change the call to pass a guarded input
so the hook runs only when needed, e.g. const ownDebugState =
usePlacementDebug(ownsDebugUI ? placement : undefined), and keep the existing
fallback const { matched, notMatched, totalClusters, matchedCount, error } =
props.placementDebugState ?? ownDebugState so external placementDebugState still
overrides the guarded hook result.

---

Nitpick comments:
In `@frontend/src/wizards/Placement/PlacementSection.test.tsx`:
- Around line 348-349: Remove the redundant in-test reassignments of
mockSettings (e.g., the explicit mockSettings = {} inside the test "sets footer
content with single placement" and the other tests that repeat this) because
beforeEach already initializes mockSettings; simply delete those assignments so
tests rely on the shared beforeEach setup (look for occurrences of mockSettings
= {} in PlacementSection.test.tsx and remove them).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3ff6a85a-0d70-43d7-a2d5-15d1be60dceb

📥 Commits

Reviewing files that changed from the base of the PR and between ae9f374 and c5cc85e.

⛔ Files ignored due to path filters (1)
  • frontend/public/locales/en/translation.json is excluded by !frontend/public/locales/**
📒 Files selected for processing (23)
  • backend/config/enhancedPlacement
  • frontend/src/atoms.ts
  • frontend/src/routes/Applications/AdvancedConfiguration.test.tsx
  • frontend/src/routes/Applications/AdvancedConfiguration.tsx
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationDetails/ApplicationDetails.test.tsx
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationDetails/ApplicationDetails.tsx
  • frontend/src/routes/Applications/components/ToggleSelector.tsx
  • frontend/src/routes/Governance/policies/policy-details/PolicyDetailsOverview.test.tsx
  • frontend/src/routes/Governance/policies/policy-details/PolicyDetailsOverview.tsx
  • frontend/src/routes/Governance/policy-sets/components/PolicySetCard.test.tsx
  • frontend/src/routes/Governance/policy-sets/components/PolicySetCard.tsx
  • frontend/src/routes/Infrastructure/Clusters/ClustersPage.tsx
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/ClusterDetails/ClusterOverview/ClusterOverview.tsx
  • frontend/src/routes/Infrastructure/Clusters/Placements/CreatePlacement/EditPlacement.tsx
  • frontend/src/routes/Infrastructure/Clusters/Placements/CreatePlacement/PlacementWizard.tsx
  • frontend/src/routes/Infrastructure/Clusters/Placements/PlacementDetails/PlacementDetails.test.tsx
  • frontend/src/routes/Infrastructure/Clusters/Placements/Placements.test.tsx
  • frontend/src/wizards/Argo/ArgoWizard.tsx
  • frontend/src/wizards/Placement/Placement.tsx
  • frontend/src/wizards/Placement/PlacementSection.test.tsx
  • frontend/src/wizards/Placement/PlacementSection.tsx
  • frontend/src/wizards/Placement/usePlacementDebug.test.ts
  • frontend/src/wizards/Placement/usePlacementDebug.ts
💤 Files with no reviewable changes (2)
  • backend/config/enhancedPlacement
  • frontend/src/routes/Governance/policies/policy-details/PolicyDetailsOverview.test.tsx

Comment thread frontend/src/wizards/Placement/Placement.tsx Outdated
Signed-off-by: fxiang1 <fxiang@redhat.com>
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/lib/nock-util.ts`:
- Around line 401-406: The helper nockIgnorePlacementDebug() is returning an
empty shape that makes usePlacementDebug() compute totalClusters = 0 and alters
placement behavior; update nockIgnorePlacementDebug (or create a scoped variant)
to return a realistic placement-debug fixture that preserves expected keys and
non-empty arrays (matching what usePlacementDebug() expects), or rename/scope
the helper and use it only in tests that never consume placement results so it
doesn't affect placement flows.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2f9297e8-3c02-45e2-8044-4ccafb0ed7f2

📥 Commits

Reviewing files that changed from the base of the PR and between c5cc85e and eebc1a0.

📒 Files selected for processing (10)
  • frontend/src/lib/nock-util.ts
  • frontend/src/routes/Applications/CreateArgoApplication/CreatePullApplicationSet.test.tsx
  • frontend/src/routes/Applications/CreateArgoApplication/CreatePushApplicationSet.test.tsx
  • frontend/src/routes/Governance/policies/CreatePolicy.test.tsx
  • frontend/src/routes/Governance/policy-sets/CreatePolicySet.test.tsx
  • frontend/src/routes/Governance/policy-sets/EditPolicySet.test.tsx
  • frontend/src/routes/Infrastructure/Clusters/ManagedClusters/ClusterDetails/ClusterOverview/ClusterOverview.test.tsx
  • frontend/src/wizards/Argo/ArgoWizard.test.tsx
  • frontend/src/wizards/Governance/PolicySet/PolicySetWizard.test.tsx
  • frontend/src/wizards/Placement/Placement.tsx
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/routes/Governance/policy-sets/EditPolicySet.test.tsx

Comment thread frontend/src/lib/nock-util.ts
Signed-off-by: fxiang1 <fxiang@redhat.com>
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.

🧹 Nitpick comments (1)
frontend/src/wizards/Governance/Policy/policyWizard.test.tsx (1)

132-133: Centralize placement-debug mock setup in beforeEach for consistency.

nockIgnorePlacementDebug() is added in two tests, but a similar flow at Line [332] still renders without it. A suite-level setup avoids omissions and keeps test isolation consistent.

♻️ Suggested refactor
 describe('Policy wizard', () => {
+  beforeEach(() => {
+    nockIgnorePlacementDebug()
+  })
+
   test('can show correct cluster sets dropdown', async () => {
-    nockIgnorePlacementDebug()
     const { container } = render(<TestPolicyWizard />)
@@
   test('default tolerations are set when creating new placement', async () => {
-    nockIgnorePlacementDebug()
     render(<TestPolicyWizard yamlEditor={() => <WizardSyncEditor />} />)

As per coding guidelines, "Ensure proper mocking and isolation."

Also applies to: 301-302

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Governance/Policy/policyWizard.test.tsx` around lines
132 - 133, The test-suite is inconsistent in mocking placement-debug; call
nockIgnorePlacementDebug() from a suite-level beforeEach so every test
(including those rendering TestPolicyWizard at various places) gets the same
mock setup; locate usages of nockIgnorePlacementDebug and remove the duplicated
per-test calls, then add a beforeEach that invokes nockIgnorePlacementDebug so
all tests (e.g., those rendering TestPolicyWizard) run with consistent
placement-debug mocking and isolation.
🤖 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/src/wizards/Governance/Policy/policyWizard.test.tsx`:
- Around line 132-133: The test-suite is inconsistent in mocking
placement-debug; call nockIgnorePlacementDebug() from a suite-level beforeEach
so every test (including those rendering TestPolicyWizard at various places)
gets the same mock setup; locate usages of nockIgnorePlacementDebug and remove
the duplicated per-test calls, then add a beforeEach that invokes
nockIgnorePlacementDebug so all tests (e.g., those rendering TestPolicyWizard)
run with consistent placement-debug mocking and isolation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dd904041-208d-4387-86bb-a6e2809ff5e9

📥 Commits

Reviewing files that changed from the base of the PR and between eebc1a0 and ee10572.

📒 Files selected for processing (2)
  • frontend/src/wizards/Argo/ArgoWizard.test.tsx
  • frontend/src/wizards/Governance/Policy/policyWizard.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/wizards/Argo/ArgoWizard.test.tsx

Signed-off-by: fxiang1 <fxiang@redhat.com>
Signed-off-by: fxiang1 <fxiang@redhat.com>
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.

🧹 Nitpick comments (1)
frontend/src/routes/Applications/AdvancedConfiguration.tsx (1)

664-678: 💤 Low value

Wrap the Alert in a StackItem for consistent Stack gutter behavior.

<Stack hasGutter> applies its gutter via StackItem children. The ApplicationDeploymentHighlights and ToggleSelector siblings are both wrapped in StackItem, but the Alert is a bare child. Wrapping it maintains uniform spacing.

♻️ Proposed fix
-        <Alert
-          title={t('Page deprecation')}
-          isInline
-          variant="warning"
-          actionLinks={
-            <AlertActionLink component="a" target="_blank" rel="noreferrer" href={DOC_LINKS.DEPRECATIONS_ACM}>
-              {t('Learn more')}
-            </AlertActionLink>
-          }
-        >
-          <Trans
-            i18nKey="<bold>Deprecated:</bold> Placements are managed from the <italic>Placements</italic> tab of the <italic>Infrastructure</italic> page. Select <bold>Infrastructure</bold> > <bold>Clusters</bold> > <bold>Placements</bold>. You can also view placement details directly within individual applications or policies."
-            components={{ bold: <strong />, italic: <em /> }}
-          />
-        </Alert>
+        <StackItem>
+          <Alert
+            title={t('Page deprecation')}
+            isInline
+            variant="warning"
+            actionLinks={
+              <AlertActionLink component="a" target="_blank" rel="noreferrer" href={DOC_LINKS.DEPRECATIONS_ACM}>
+                {t('Learn more')}
+              </AlertActionLink>
+            }
+          >
+            <Trans
+              i18nKey="<bold>Deprecated:</bold> Placements are managed from the <italic>Placements</italic> tab of the <italic>Infrastructure</italic> page. Select <bold>Infrastructure</bold> > <bold>Clusters</bold> > <bold>Placements</bold>. You can also view placement details directly within individual applications or policies."
+              components={{ bold: <strong />, italic: <em /> }}
+            />
+          </Alert>
+        </StackItem>
🤖 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/src/routes/Applications/AdvancedConfiguration.tsx` around lines 664
- 678, The Alert currently sits directly under the Stack with siblings
ApplicationDeploymentHighlights and ToggleSelector wrapped in StackItem, which
breaks Stack's gutter spacing; wrap the Alert JSX in a <StackItem> so it becomes
a direct StackItem child (keeping the same Alert props and children) to restore
consistent spacing when using <Stack hasGutter>.
🤖 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/src/routes/Applications/AdvancedConfiguration.tsx`:
- Around line 664-678: The Alert currently sits directly under the Stack with
siblings ApplicationDeploymentHighlights and ToggleSelector wrapped in
StackItem, which breaks Stack's gutter spacing; wrap the Alert JSX in a
<StackItem> so it becomes a direct StackItem child (keeping the same Alert props
and children) to restore consistent spacing when using <Stack hasGutter>.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ae182f62-3022-4613-8555-b189843c45cf

📥 Commits

Reviewing files that changed from the base of the PR and between 70c8651 and 971e4de.

⛔ Files ignored due to path filters (1)
  • frontend/public/locales/en/translation.json is excluded by !frontend/public/locales/**
📒 Files selected for processing (2)
  • frontend/src/routes/Applications/AdvancedConfiguration.test.tsx
  • frontend/src/routes/Applications/AdvancedConfiguration.tsx
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/routes/Applications/AdvancedConfiguration.test.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant