Skip to content

[scanner] fix: stabilize failing coverage suite test#21313

Merged
clubanderson merged 2 commits into
mainfrom
scanner/fix-21308
Jul 20, 2026
Merged

[scanner] fix: stabilize failing coverage suite test#21313
clubanderson merged 2 commits into
mainfrom
scanner/fix-21308

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #21308

The test 'refetches access entries after namespace changes' was using toHaveBeenCalledWith without accounting for the second argument (AbortSignal options object). The api.get mock is called with both a URL string and an options object, so the assertion must either check both arguments or access mock.calls directly to just verify the URL.

This fixes the flaky test by reverting to the approach from the previous stabilization commit that directly accesses mock.calls[0]?.[0] to check only the URL argument.

The test 'refetches access entries after namespace changes' was using
toHaveBeenCalledWith without accounting for the second argument (AbortSignal
options object). The api.get mock is called with both a URL string and an
options object, so the assertion must either check both arguments or access
mock.calls directly to just verify the URL.

This fixes the flaky test by reverting to the approach from the previous
stabilization commit that directly accesses mock.calls[0]?.[0] to check
only the URL argument.

Signed-off-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings July 20, 2026 09:16
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 20, 2026
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit bc35146
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a5df2c19e55ea00082c6ff3
😎 Deploy Preview https://deploy-preview-21313.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubestellar-prow kubestellar-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Check

All new source files in this PR have corresponding test files.

Checked web/src/hooks/ and web/src/components/ against origin/main.

@github-actions

Copy link
Copy Markdown
Contributor

♿ Accessibility Audit (WCAG 2.1 AA)

✅ No WCAG 2.1 AA violations detected in audited routes.


Powered by axe-core. Target: WCAG 2.1 AA compliance.

Copilot AI 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.

Pull request overview

This PR stabilizes the NamespaceAccessPanel test that verifies access entries are refetched when the selected namespace changes, aligning the assertion with the actual api.get(url, { signal }) call signature used by the component.

Changes:

  • Updates the test assertion to validate only the URL argument from api.get mock calls, avoiding brittleness around the AbortSignal options object.

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[quality] 🚨 Coordination issue: this PR is a duplicate + conflicts with #21299/#21302 (comment mode; self-approve blocked)

Duplicate finding

The NamespaceAccessPanel.test.tsx fix in this PR is byte-identical to the same change already in #21299. Both PRs open the same 3-line diff on the same file:

-    expect(api.get).toHaveBeenCalledWith(
-      expect.stringContaining('test-namespace')
-    )
+    expect(vi.mocked(api.get).mock.calls[0]?.[0]).toContain('test-namespace')

Whichever merges second becomes a trivial no-op. Not harmful, but wastes a review cycle and confuses the timeline.

Bigger conflict: PR#21318 reverses PR#21299's whole strategy for the SAME failing tests

While reviewing this batch I noticed:

  • #21299 (this PR's sibling) fixes CreateNamespaceModal + CanIChecker flakes by changing tests to expect empty-default: expect(comboboxes[0].value).toBe(''), renamed test to 'initializes with cluster placeholder selected', etc.
  • #21318 fixes the same components by changing the components to pre-select the first cluster (useState(clusters[0] ?? '') and useEffect(dispatch SET_FIELD/cluster)) and removing the disabled placeholder <option>.

These are incompatible strategies aimed at the same bug (#21083 vs #21297/#21298 which is the same failure mode). One or the other must be chosen — merging both will:

  • If #21299 merges first: #21318 will silently revert the test alignment, so tests once again expect .toBe('') but component sets to 'cluster-1' → 22 tests fail again.
  • If #21318 merges first: #21299's renamed test 'initializes with cluster placeholder selected' (asserting .toBe('')) will fail because component now pre-selects 'cluster-1'.

Recommendation: pick one. My preference is #21318 (fix at the source — the UX behavior of "auto-select the only reasonable default" is better than "force a click before submit"), close #21299 (or reduce #21299 to just this single-file NamespaceAccessPanel fix, which itself duplicates this PR).

If #21318 is the winner:

  • Close this PR (the NamespaceAccessPanel fix is fine but redundant with what will remain in #21299 or gets absorbed into #21318's follow-up).
  • Or keep this PR as the single-file NamespaceAccessPanel change and close #21299 entirely.

On the fix itself

Correct pattern (matches what I've now seen 3 times: mock.calls[0]?.[0] when the mock receives extra args like {signal}). Prior concern still stands: the sibling toHaveBeenCalledTimes(2) + mock.calls[length-1] from #21282 is still in this file, unchanged, and would benefit from the same explicit-length + explicit-index pattern.

Bead filed. Not merging.


Filed by quality agent (ACMM L4/L6 — full mode)

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

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

@clubanderson
clubanderson merged commit 315d26e into main Jul 20, 2026
13 of 16 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-21308 branch July 20, 2026 10:05
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 315d26e84fa415f14df23bc5cd262a22eca8376c.

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

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 1 test failure(s) in Coverage Suite run #4348

2 participants