Skip to content

fix(test): preserve failed shard diagnostics - #116289

Merged
vincentkoc merged 1 commit into
mainfrom
fix/test-runner-digest-flush-20260730
Jul 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/test-runner-digest-flush-20260730

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #115696

What Problem This Solves

Fixes an issue where maintainers running parallel Vitest shards could lose the failed-shard digest and rerun commands when the dispatcher exited nonzero with buffered stderr.

Why This Change Was Made

The dispatcher now sets process.exitCode after writing summaries instead of forcing immediate termination with process.exit(). A regression guard keeps direct forced exits out of this output-producing script.

User Impact

Maintainers get the actual failed shard and focused rerun command after long parallel test runs instead of only a generic nonzero summary. No product runtime behavior changes.

Evidence

AI-assisted: yes; maintainer reviewed the implementation and evidence.

@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Jul 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 30, 2026 07:36
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 3:40 AM ET / 07:40 UTC.

ClawSweeper review

What this changes

This PR updates the Vitest project dispatcher so failed parallel shards can print their diagnostic summary and rerun commands before the command exits nonzero, with a regression guard against direct forced exits.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch is a focused, plausible repair for a maintainer test-runner failure: it lets Node finish writing failed-shard diagnostics while preserving the nonzero exit status. It should remain open because it is a current maintainer-authored PR with pending CI, not a cleanup-close candidate; I found no concrete defect in the proposed change.

Priority: P3
Reviewed head: f91d8593fc48fc64faf4957f1c49faf428d6ddca

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow implementation and concrete forced-failure result support a normal mergeable-quality rating, subject to the pending exact-head checks.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This repository-MEMBER PR includes focused test and forced-failure evidence in its body; the external-contributor real-behavior-proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-MEMBER PR includes focused test and forced-failure evidence in its body; the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 5 items Proposed failure-path behavior: The patch replaces the dispatcher’s direct forced exits with process.exitCode assignments in the parallel failure path, non-continuing serial failure path, final aggregate result, and top-level error handler; the serial path also returns so a non-continuing failure does not run later targets.
Regression guard: The added test reads the dispatcher source and rejects direct process.exit calls, protecting the output-drain invariant across the script rather than only one failure branch.
Contributor-provided behavior evidence: The PR body reports a focused dispatcher test run with 256 passing tests, a forced two-shard failure that retained both rerun commands while exiting 1, and an exact-head Testbox changed gate.
Findings None None.
Security None None.

How this fits together

The Vitest project dispatcher expands requested test targets into child test runs, aggregates their exit results, and prints failure diagnostics for maintainers. Its final exit status is consumed by local test commands and CI after summaries and rerun instructions have been emitted.

flowchart TD
  A[Requested test targets] --> B[Vitest project dispatcher]
  B --> C[Child shard runs]
  C --> D[Aggregate failures and timings]
  D --> E[Print failed-shard diagnostics]
  E --> F[Release test lock]
  F --> G[Nonzero command exit status]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and its required CI matrix was still pending in the supplied state, so the exact merge result should be refreshed before landing.
  • Complete next step (P2) - No mechanical defect is identified; a maintainer should refresh the behind branch and rely on the pending required checks before merging.
Agent review details

Security

None.

PR surface

Tests +6, Other +1. Total +7 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 6 0 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 5 4 +1
Total 2 11 4 +7

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or refresh against current main, retain the deferred-exit behavior and regression guard, then land after the required checks confirm the exact head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or refresh against current main, retain the deferred-exit behavior and regression guard, then land after the required checks confirm the exact head.

Do we have a high-confidence way to reproduce the issue?

No high-confidence independent live reproduction was established in this read-only review. The failure mechanism is source-reproducible, and the PR provides a concrete forced two-shard failure result plus focused-test evidence.

Is this the best way to solve the issue?

Yes. Setting process.exitCode after the script has emitted diagnostics is the narrow Node-compatible repair; retaining the explicit return in the serial non-continuation path preserves the existing stop-after-failure behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c8f0db2c24eb.

Labels

Label changes:

  • add P3: This is a narrow maintainer test-diagnostic improvement with no product-runtime behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-MEMBER PR includes focused test and forced-failure evidence in its body; the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P3: This is a narrow maintainer test-diagnostic improvement with no product-runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-MEMBER PR includes focused test and forced-failure evidence in its body; the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

  • Proposed failure-path behavior: The patch replaces the dispatcher’s direct forced exits with process.exitCode assignments in the parallel failure path, non-continuing serial failure path, final aggregate result, and top-level error handler; the serial path also returns so a non-continuing failure does not run later targets. (scripts/test-projects.mjs:369, f91d8593fc48)
  • Regression guard: The added test reads the dispatcher source and rejects direct process.exit calls, protecting the output-drain invariant across the script rather than only one failure branch. (test/scripts/test-projects.test.ts:3286, f91d8593fc48)
  • Contributor-provided behavior evidence: The PR body reports a focused dispatcher test run with 256 passing tests, a forced two-shard failure that retained both rerun commands while exiting 1, and an exact-head Testbox changed gate. (f91d8593fc48)
  • Related work is distinct: The linked open PR concerns bounding long-lived Testbox suite processes; this PR addresses preserving diagnostics after a shard failure, so the two changes are adjacent rather than duplicates. (54d66dd71a7d)
  • Current review state: The PR is authored by a repository MEMBER, carries the protected maintainer label, is cleanly mergeable, and has pending checks. Those signals require maintainer handling rather than an automated close. (f91d8593fc48)

Likely related people:

  • vincentkoc: Authored this focused dispatcher repair and the related active Testbox test-topology work, indicating current involvement in the test-runner surface; deeper local history inspection was unavailable in this read-only environment. (role: current test-runner contributor; confidence: medium; commits: f91d8593fc48, 54d66dd71a7d; files: scripts/test-projects.mjs, test/scripts/test-projects.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and let the required CI matrix complete on the resulting head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-30T07:35:21.579Z sha f91d859 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 30, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

ClawSweeper rank-up moves addressed:

Focused tests, forced-failure diagnostics, Testbox changed gates, review artifacts, and autoreview are all clean.

@vincentkoc
vincentkoc merged commit ea894bb into main Jul 30, 2026
473 of 497 checks passed
@vincentkoc
vincentkoc deleted the fix/test-runner-digest-flush-20260730 branch July 30, 2026 09:17
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant