Skip to content

🐛 fix: revert vi.restoreAllMocks() breaking 265 tests#20435

Merged
clubanderson merged 1 commit into
mainfrom
scanner/fix-20434
Jul 7, 2026
Merged

🐛 fix: revert vi.restoreAllMocks() breaking 265 tests#20435
clubanderson merged 1 commit into
mainfrom
scanner/fix-20434

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #20434

Root Cause

PR #20425 added vi.restoreAllMocks() to the global afterEach in web/src/test/setup.ts. This restores all spy/mock implementations to their original values after every test, which breaks any test that:

  • Sets up spies in beforeAll expecting them to persist
  • Relies on vi.mock() factory return values that get cleared

Also reverts the pool: 'threads' change since threads share memory and can cause mock cross-contamination between test files.

Fix

  • Remove vi.restoreAllMocks() from afterEach (keep vi.clearAllMocks() which is safe)
  • Revert pool to default (forks) for better isolation

vi.restoreAllMocks() in afterEach restores spy/mock implementations to
originals, breaking tests that set up mocks in beforeAll or rely on
module-level vi.mock() declarations. Also reverts threads pool change
since forks provides better test isolation.

Fixes #20434

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

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit a86aa35
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a4c4bcd37d2640008a4ca1a
😎 Deploy Preview https://deploy-preview-20435.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

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 eeshaansa 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

@github-actions

github-actions Bot commented Jul 7, 2026

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 commented Jul 7, 2026

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 7, 2026

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 fixes widespread Vitest failures introduced by PR #20425 by undoing aggressive global mock restoration in the test setup, and it reverts the CI test worker pool away from threads to avoid shared-memory mock contamination.

Changes:

  • Removed vi.restoreAllMocks() from the global afterEach test cleanup (keeps vi.clearAllMocks()).
  • Reverted the Vitest pool: 'threads' CI configuration back to the default pool behavior (forks).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
web/vite.config.ts Stops forcing the CI threads pool (reverts to default pool) to improve isolation between test files.
web/src/test/setup.ts Removes global vi.restoreAllMocks() from afterEach to prevent breaking tests that rely on persistent spies/mocks.

Comment thread web/vite.config.ts
Comment on lines 322 to +324
// CI: use threads pool instead of forks to prevent OOM from subprocess spawn storm (#20007)
// Threads share memory, no fork overhead. Local dev uses default (forks) for stronger isolation.
pool: process.env.CI ? 'threads' : undefined,
// pool: process.env.CI ? 'threads' : undefined, // Reverted: threads share memory, can cause mock cross-contamination
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

❌ Playwright Tests Failed

📊 View Full Report

Download the playwright-report artifact from the workflow run for screenshots and detailed traces.

To view the report locally:

# Download and extract playwright-report.zip
npx playwright show-report path/to/playwright-report

@clubanderson clubanderson merged commit b48b23a into main Jul 7, 2026
54 of 59 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the scanner/fix-20434 branch July 7, 2026 02:43
@github-actions

github-actions Bot commented Jul 7, 2026

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

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: b48b23aa00f45cafbf80ec0a91a677bf37b12119
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/28837727866

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit b48b23aa00f45cafbf80ec0a91a677bf37b12119.

clubanderson added a commit that referenced this pull request Jul 7, 2026
…low (#20440)

PR #20435 reverted pool:'threads' in vite.config.ts but workflow still
hardcoded --pool=threads on line 69, forcing threads mode despite config.
Threads share memory → mock cross-contamination → 265 test failures.

Fixes #20439

Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
Co-authored-by: sec-check <sec-check@hive.kubestellar.io>
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.

🐛 265 test failure(s) in Coverage Suite run #4113

3 participants