Skip to content

[scanner] fix: address Coverage Suite #4197 test failures#20879

Merged
clubanderson merged 2 commits into
mainfrom
scanner/fix-20877
Jul 12, 2026
Merged

[scanner] fix: address Coverage Suite #4197 test failures#20879
clubanderson merged 2 commits into
mainfrom
scanner/fix-20877

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #20877

Summary

Repairs test failures from Coverage Suite run #4197 across the mission-control and missions test suites. No production code was changed — only test files were updated to match current component APIs.

Root Causes Fixed

1. ClusterSelectionDialog props renamed

  • isOpenopen, onCloseonCancel
  • Added required missionTitle prop
  • Added missing useClusters hook mock

2. SaveResolutionDialog API changed

  • Now requires mission: Mission instead of resolution: string / onSave / initialTitle
  • Added useResolutions and wsAuth mocks

3. ShareMissionDialog / SubmitToKBDialog API changed

  • Both now take resolution: Resolution (not mission: MissionExport)
  • Added effectiveness required field to mock Resolution object

4. MissionDetailView rendering fixes

  • Loading skeleton uses .animate-shimmer not .animate-pulse
  • matchScore rendered as-is (e.g. 85% match), so pass 85 not 0.85
  • Fixed missing required props: rawContent, showRaw, onToggleRaw, onBack

5. LaunchSequence description not rendered in JSX

  • state.description is only used in the mission prompt string, not rendered
  • Added launchProgress entries so phase/project names actually appear in the DOM
  • Renamed tests to reflect what is actually asserted

6. PayloadGrid duplicate category text

  • Both cards render their category, causing getByText to throw on duplicates
  • Changed to getAllByText(...).toHaveLength(2)

7. RequestApprovalModal title text

  • Actual text is "Request Deployment Approval" not "Request Approval"

8. FlightPlanBlueprint project node selector

  • ProjectNode SVG element has data-testid; use getByTestId instead of text search

9. MissionLandingPage missing mocks

  • Added useParams to react-router-dom mock (required by the component)
  • Added analytics mock (emitPageView, emitMissionError)

10. OperatorDrillDown duplicate name text

  • Name appears in multiple places (h3 and subscription row); use getAllByText

Files Changed (test files only)

  • web/src/components/drilldown/views/OperatorDrillDown.test.tsx
  • web/src/components/mission-control/FlightPlanBlueprint.test.tsx
  • web/src/components/mission-control/LaunchSequence.test.tsx
  • web/src/components/mission-control/PayloadGrid.test.tsx
  • web/src/components/mission-control/RequestApprovalModal.test.tsx
  • web/src/components/missions/ClusterSelectionDialog.test.tsx
  • web/src/components/missions/MissionDetailView.test.tsx
  • web/src/components/missions/MissionDialogs.test.tsx
  • web/src/components/missions/MissionViews.test.tsx
  • web/src/components/missions/SaveResolutionDialog.test.tsx
  • web/src/components/missions/__tests__/ClusterSelectionDialog.test.tsx

Note on Remaining Failures

The 9 harness/groundtruth tests listed in the issue were already fixed by merged PR #20876 and are passing in the current main branch.

Fix 96 test failures across mission-control and missions test files:

- ClusterSelectionDialog: update props isOpen→open, onClose→onCancel,
  add required missionTitle, add useClusters mock
- MissionDetailView: fix .animate-pulse→.animate-shimmer skeleton selector,
  fix matchScore={0.85}→matchScore={85} for correct % rendering
- LaunchSequence: add launchProgress to mockState so phases render,
  rename tests to match what the component actually renders
- PayloadGrid: fix getByText→getAllByText for duplicate category text
- RequestApprovalModal: update title text to match 'Request Deployment Approval'
- FlightPlanBlueprint: use data-testid selector for project node
- SaveResolutionDialog: fix props to use mission:Mission instead of
  resolution/onSave/initialTitle; add useResolutions/wsAuth mocks
- MissionDialogs: fix all dialog props (ClusterSelection, SaveResolution,
  ShareMission, SubmitToKB); add effectiveness field to mock resolution
- MissionViews: fix MissionDetailView props; add useParams and analytics
  mocks needed by MissionLandingPage
- OperatorDrillDown: use getAllByText to handle multiple text matches

Harness/groundtruth tests (#20876 already fixed these in main).

Fixes #20877

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 12, 2026 00:39
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 12, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson 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

@netlify

netlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit 8b071ed
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a52f981fc0d5f00089fb986

@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 github-actions Bot added the ai-generated Pull request generated by AI label Jul 12, 2026
@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.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 12, 2026
@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

Updates unit tests to align with recent component API changes and UI rendering behavior across the Missions and Mission Control areas, resolving Coverage Suite #4197 failures without modifying production code.

Changes:

  • Updated dialog-related tests for renamed/required props and added missing hook/module mocks (clusters, resolutions, ws auth, analytics).
  • Adjusted test assertions to match current DOM output (skeleton class, match score formatting, modal title text, duplicate text queries, SVG node selection).
  • Refreshed Mission Control test fixtures (e.g., launchProgress) so expected phase/project content is present in the rendered output.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/src/components/drilldown/views/OperatorDrillDown.test.tsx Adjusts assertion to avoid duplicate-text failures when operator name appears in multiple locations.
web/src/components/mission-control/FlightPlanBlueprint.test.tsx Switches to a stable data-testid selector for SVG project nodes.
web/src/components/mission-control/LaunchSequence.test.tsx Updates fixture state + assertions to reflect current LaunchSequence rendering behavior.
web/src/components/mission-control/PayloadGrid.test.tsx Updates category assertion to handle duplicate category text rendered per card.
web/src/components/mission-control/RequestApprovalModal.test.tsx Updates expected modal title text to match current UI copy.
web/src/components/missions/ClusterSelectionDialog.test.tsx Updates tests for renamed props and adds useClusters hook mock.
web/src/components/missions/MissionDetailView.test.tsx Aligns assertions with updated loading skeleton class and match score formatting.
web/src/components/missions/MissionDialogs.test.tsx Updates dialog props and adds required mocks (useClusters, useResolutions, wsAuth, scanner).
web/src/components/missions/MissionViews.test.tsx Adds missing router params and analytics mocks; supplies newly required props to MissionDetailView.
web/src/components/missions/SaveResolutionDialog.test.tsx Updates tests to new mission-based API and adds required mocks for resolutions + ws auth.
web/src/components/missions/tests/ClusterSelectionDialog.test.tsx Updates smoke test to provide required dialog props instead of rendering with an empty props cast.

it('renders operator name in the header', () => {
render(<OperatorDrillDown data={OPERATOR_DATA} />)
expect(screen.getByText('cert-manager')).toBeInTheDocument()
expect(screen.getAllByText('cert-manager').length).toBeGreaterThan(0)
)

expect(screen.getByText('Observability')).toBeInTheDocument()
expect(screen.getAllByText('Observability')).toHaveLength(2)

@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] Test-only PR that catches tests up to production API drift — exactly the right kind of fix. +152/-65 across 11 files, all in web/src/components/{mission-control,missions,drilldown}/**/*.test.tsx. No production behavior change.

Diagnoses are correct:

  • API rename (isOpen/onCloseopen/onCancel, missionTitle required) — real prop-signature drift on ClusterSelectionDialog.
  • SaveResolutionDialog shift from raw resolution: string to mission: Mission — matches the hook rework in useResolutions. New Mission mock includes required messages, createdAt, updatedAt — good.
  • ShareMissionDialog / SubmitToKBDialog switch from mission: MissionExportresolution: Resolution — the added effectiveness: { timesUsed, timesSuccessful } required field is included.
  • MissionDetailView skeleton class animate-pulseanimate-shimmer — matches the actual class in the loading skeleton.
  • matchScore semantics fix: passing 85 for "85% match" instead of 0.85 — real bug in the previous test (silent misuse).
  • LaunchSequence.description was never rendered in JSX (only in prompt string) — replacing the assertion with launchProgress-driven DOM checks + renaming the test to match is honest.

Two minor nits (non-blocking):

  1. PayloadGrid.test.tsx: expect(getAllByText('Observability')).toHaveLength(2) is exact-count and will silently break if a third card is added later. Consider toHaveLength(mockProjects.length) or .toBeGreaterThanOrEqual(1) if the intent is just "renders at least once per card".

  2. ClusterSelectionDialog.test.tsx — the old test found the close button by any svg icon, which is loose. The new getByRole('button', { name: /close modal/i }) is stronger — good — but note it depends on the modal exposing that accessible name. Once #20879 lands, worth a one-line comment in the mock about that contract.

Note on MissionDialogs.test.tsx: the getWsAuthParams: vi.fn().mockRejectedValue(new Error('AI unavailable')) mock is a nice touch for isolating the render path from network side effects.

Coverage Suite #4197 root causes fully explained. mergeable_state: unstable — waiting on remaining checks. LGTM.


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

@clubanderson clubanderson merged commit 3fb6062 into main Jul 12, 2026
31 of 32 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the scanner/fix-20877 branch July 12, 2026 02:19
@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 Verification: passed

Commit: 3fb606227d0117abe34b733ac0c85e5b8ac58417
Specs run: DrillDown.spec.ts Missions.spec.ts mission-import.spec.ts smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/29176588876

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 3fb606227d0117abe34b733ac0c85e5b8ac58417.

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

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 96 test failure(s) in Coverage Suite run #4197

2 participants