Repository navigation
fix(test): report one final failure per invocation - #134850
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 3:21 AM ET / 07:21 UTC. ClawSweeper reviewWhat this changesThe branch makes public Vitest test commands print one final failure trailer after child cleanup and report publication while internal runners retain diagnostics and exit outcomes without competing trailers. Merge readinessKeep this maintainer-owned, protected PR open. Current main still has nested public failure reporters; the branch centralizes final reporting at the public boundary and adds real process-boundary coverage, with no blocking source defect found. Exact-head automation is still incomplete. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s repository test wrappers launch Vitest workers and project shards, then report the command outcome to developers and CI. The change separates public command reporting from internal child execution so one invocation has one final failure line. flowchart LR
A[Developer test command] --> B[Public test wrapper]
B --> C[Child test runner]
C --> D[Vitest workers and shards]
D --> E[Child diagnostics and exit outcome]
E --> F[Public final failure report]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +167, Docs +6, Other +46. Total +219 across 22 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single public-reporting boundary and merge after exact-head CI verifies the moved runner entrypoints, worker closure, and dead-code configuration. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s nested wrapper structure provides a high-confidence source path for duplicate trailers, and the PR’s boundary tests exercise the public commands with failure, startup, success, help, and signal scenarios. Is this the best way to solve the issue? Yes. Moving final reporting to a shared public CLI owner while leaving child runners responsible only for execution, cleanup, diagnostics, and outcome propagation is the narrowest maintainable fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4f8164436768. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Land-ready proof for candidate 8bfe7d058420302b4e29cb1fd1d03bb8efccbf8f, integrated against Exact-head CI is green: run 33480584284 completed successfully for this full head SHA. The required openclaw/ci-gate is Root cause: public shims, direct runners, and private helpers each emitted a final failure. Public invocation boundaries now own that report after the shared execution body settles. Internal child entrypoints preserve diagnostics and outcomes without competing trailers. Intentional assertion failure remains exit 1 and changes from three trailers to one; unknown-option startup changes from four to one. Success/help emit none. The private bootstrap/compiler/plugin final emitters are removed; the generic formatter and shim remain unchanged. The existing Final focused command: node scripts/run-vitest.mjs test/scripts/release-plan-producer.test.ts test/scripts/run-vitest-bounded.test.ts test/scripts/vitest-report-owner.test.ts test/scripts/pr-main-refresh.test.ts test/scripts/pr-merge-hosted.test.ts -- -t 'Vitest CLI final outcome ownership|preserves shard crashes|completes supervised prepare with three fresh checkpoints and exact stamps|revalidates prepared release-gate evidence without waiting for older stuck PR CI|ignores large runtime trees when collecting candidate metadata|rejects candidate metadata symlinks|matches the exact current publisher inventory'55 passed, 161 intentionally unselected: 40 real CLI route/outcome cases, seven crash cases, six release-producer cases, and two native fixture cases. Concrete Linux proof already passed all 33 artifact cases, including the verification-failure trailer in 11.387 seconds, and all 23 SQLite namespace cases on the unchanged runtime patch. These include borrower joins, cancellation, namespace disposal, and uncertain-join retention. Earlier local 120-second timeouts occurred on both candidate and untouched base; the local compilation/deletion performance cause remains a separate unproven follow-up. Earlier cancelled local fixture proof and retained evidence remain recorded; no timeout was raised and no cancelled suite is relabeled passing. The release-inventory CI blocker was resolved by merged canonical #134824, not by a release-source edit in this PR. #134914 was superseded and closed. All five commits are patch-identical after integration. Direct current-main inspection closed ClawSweeper's unavailable-source comparison gap; its sole rank-up request is addressed by final-head green CI. No actionable review finding remains. 22 files; tooling +573/-529 (net +44), tests/support +202/-33 (net +169), docs +6. The scheduler move accounts for most churn; remaining tooling growth preserves explicit public/internal subprocess and import-alias contracts. No dependency, baseline, suppression, timeout, schema, product configuration, or trust rule changed. Proceeding only through native preparation and merge under the explicit landing authorization. |
Make public test CLIs own the final failure trailer after child execution, cleanup, and report publication. Internal execution entrypoints preserve process and signal lifetimes without duplicate reporting. Closes #134841
b30d7e4 to
8bfe7d0
Compare
|
Merged via squash.
|
* fix(test): report one final failure per invocation Make public test CLIs own the final failure trailer after child execution, cleanup, and report publication. Internal execution entrypoints preserve process and signal lifetimes without duplicate reporting. Closes openclaw#134841 * fix(test): register spawned test runners with Knip * fix(test): classify spawned runners as development entries * fix(test): include trailer helper in native wrapper closure * test(pr): allow source directory in wrapper fixtures
Closes #134841 (duplicate final test-failure trailers).
Additional instructions
This same-repository branch is writable by maintainers.
What Problem This Solves
Fixes an issue where developers running a failing test command would see several competing final
FAILED (exit N)lines for one invocation. An intentional assertion failure produced three trailers; an unknown-option startup failure produced four. Nested runners made truncated output harder to interpret.Why This Change Was Made
The public JavaScript shim, direct TypeScript CLI, project scheduler, and private worker helpers each treated themselves as the final reporting owner. Public CLIs now report once after their execution body settles; internal child entrypoints execute the same bodies and propagate diagnostics, numeric failures, and signals without publishing another trailer.
The scheduler body moves to
test-projects-run.mts, while the publictest-projects.mtsremains import-executed for the serial/max/import aliases. Existing process topology, namespace/group/pipe lifetimes,p-mapjoins withstopOnError: false, compiler borrowers/disposal, report publication, and asynchronous signal re-raise are retained. The shared failure formatter and generic JavaScript shim are unchanged. Private bootstrap/compiler/plugin trailer emitters are removed; their diagnostics and failure status remain.Rebased onto
aadafdc198c062d61c0c4dc182d311232df6df03, containing canonical release-inventory fix #134824. This carries forward #134688 (preserve shard-crash exit codes and failure reports): the moved scheduler retainsgetForwardedSignal() ?? signal, signal-derived exit codes, and the requiredsignalExitCodeimport. Its existing seven crash cases now also require one trailer. Knip now registers the two path-spawned child modules as development entries in its existing executable roots, inherited by the full-tree and script-export scans; this models their actual consumers without adding ignore rules.User Impact
A failed test invocation ends with one
[test] FAILED (exit N)line; directrun-vitest.mtsuses[vitest]. Assertion/startup diagnostics and shard summaries remain visible. Successful and help invocations emit no failure trailer. No new options, suppression environment variables, output filtering, dependency changes, or timeout increases are introduced.Evidence
Observed before/after using an intentional
expect.fail("intentional trailer ownership failure")fixture:The temporary assertion fixture was removed after proof. The strengthened bounded-process failure/cancellation tests failed on the pre-fix implementation specifically because of duplicate trailer counts.
Integrated owner-split candidate (
f99ab67e305e69c5c6aac72f1ec5c4481044145f):node scripts/run-vitest.mjs test/scripts/run-vitest-bounded.test.ts test/scripts/run-vitest.test.ts test/scripts/vitest-process-diagnostics.test.ts— 183 passed. Includes 40 real CLI cases across eight routes covering assertion failure, startup failure, success, help, SIGTERM, finality, child death, and namespace/generation removal.node scripts/run-vitest.mjs test/scripts/vitest-report-owner.test.ts -- -t 'preserves shard crashes'— 7 passed, 59 intentionally unselected. Serial/parallel, direct/delegated, report/non-report, SIGABRT/SIGKILL preserve exit 134/137, incomplete native reports, and exactly one final trailer.node scripts/check-changed.mjs --dry-run --staged, followed bynode scripts/check-changed.mjs --staged— passed on the resolved rebase candidate, including both script/test-root typechecks, formatting, script erasability, coercion guard, and full script lint.node_modules/.bin/oxfmt scripts/test-projects-run.mts scripts/test-projects.mts test/scripts/vitest-report-owner.test.ts,git diff --check, andgit diff --cached --check— passed.git rebase --continue; that owner-split commit tree is identical to the reviewed staged tree.Earlier proof on the same repair before main integration: 66 build-admission cases passed; all 59 report-owner cases passed across a full run plus one unchanged isolated metadata retry (the full invocation itself was not green); four real SIGINT routes passed with exit 130 and cleanup; metadata/watch-source checks and the small namespace spawn-failure/uncertain-join cases passed.
Earlier local proof limitations: the heavy compiled-artifact test
ends verification failure with a failed trailerexceeded its unchanged 120000ms deadline on both this repair and an untouched same-base comparison. Real SQLite namespace cleanup cases also timed out. This establishes a baseline timeout, not correctness of those paths or a proven cause. Host load was high; compilation/deletion performance remains a separate named follow-up, Investigate compiled-worker test timeouts. No repeated heavy local retries or deadline increases were used. The Linux proof update below supersedes these execution gaps; the local performance cause remains unproven. Native preparation/merge gates remain outstanding.Size: 22 files. Executable tooling (including
test/vitest/vitest.worker-artifacts.ts) +573/-529, net +44; tests/test support +202/-33, net +169; docs +6/-0. Most tooling churn is the scheduler move. The remaining growth pays for explicit public/internal execution and signal boundaries while preserving the existing subprocess and imported-alias contracts; removing process boundaries or adding suppression flags would change those contracts or retain duplicate reporting policy.CI follow-up: the first run, https://github.com/openclaw/openclaw/actions/runs/33472445017, failed its dependency check because Knip did not know the two new path-spawned roots and consequently reported
runVitestas unused. The three-line entry registration fixes that integration gap. Before the corrective push:node --import ./scripts/tsx.mjs scripts/check-deadcode-unused-files.mts— both scans passed with zero entries.node --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mts— production, full-tree, and script scans passed with zero entries.node scripts/run-vitest.mjs test/scripts/check-deadcode-exports.test.ts test/scripts/check-deadcode-unused-files.test.ts test/scripts/check-deadcode-reporting.test.ts— 50 passed.node scripts/check-changed.mjs -- config/knip.config.tsand targeted formatting/diff checks — passed.The lead approved the owner-split repair and this registration, conditioned on green exact-head CI, completed native evidence, and native landing gates. The next CI run, https://github.com/openclaw/openclaw/actions/runs/33473875709, passed all unused-file/export scans but exposed a production-entry classification error: Knip's trailing
!forces development test helpers into the production dependency scan, which reportedrgandvitest. Both roots now remain registered without that production suffix. Knip 6.32.2'sWorkspaceWorker.getProductionEntryFilePatternsand normalgetEntryFilePatternsconfirm that this retains full-tree/script consumers while selecting the proper development graph. No dependency, ignore, baseline, or suppression rule was added.pnpm deadcode:fullpassed after this correction (production dependency audit and full-tree export audit).git diff --cached --checkpassed.Concrete Linux proof on runtime head
a116bc548299b0294ad33ffd789875dc5a64876dnow closes the earlier native execution gaps: worker-artifact lane passed all 33 cases, explicitly includingends verification failure with a failed trailerin 11.6 seconds; SQLite namespace lane passed all 23 namespace cases, including threads/forks, failures, paused teardown, explicit/sibling state preservation, and uncertain-join retention. This latest correction changes Knip configuration only. Final exact-head CI and native landing gates still need to complete.Test behavior is documented in https://docs.openclaw.ai/reference/test.
The next exact-head run, https://github.com/openclaw/openclaw/actions/runs/33474518696, passed
check-dependencies, all 33 artifact cases (lane), and all 23 SQLite namespace cases (lane). It also caught a missing dependency in the native wrapper's extracted-anchor inventory:run-vitest.mtsimportsvitest-cli.mts, which imports the existingsrc/cli/wait.ts. Both files are now included inwrapper-components.txt, so extraction and per-blob verification cover the complete imported closure. The existing real extracted-helper regression supplies the proof; its fixture allows thesrcdirectory created by that inventory. No trust-selection, guard, runner, or signal logic changed.The ClawSweeper review found no source-level blocker and asked for failed checks to be resolved and the public/child boundary to remain lean. The retained boundary preserves subprocess and import-alias contracts; the Knip and anchor-inventory changes model its real consumers. All failed exact-head checks remain landing gates.
node scripts/run-vitest.mjs test/scripts/pr-wrappers.test.ts— all 35 passed, including actual extracted tooling/publisher execution and tampered-anchor refusal.node scripts/check-changed.mjs --dry-run -- scripts/pr-lib/wrapper-components.txt test/scripts/pr-wrappers.test.ts, then the actual command without--dry-run— passed, including test-root typecheck, formatting, guards, and script lint.Shared native fixture follow-up, commit
b30d7e42764d458ae4b22c6051e77704c39c4bdb: the existing fixture createssrcrecursively because the verified wrapper inventory now includessrc/cli/wait.ts. This preserves the fixture's full native wrapper, gate, lock, and cleanup owners.node scripts/run-vitest.mjs test/scripts/pr-main-refresh.test.ts test/scripts/pr-merge-hosted.test.ts -- -t 'completes supervised prepare with three fresh checkpoints and exact stamps|revalidates prepared release-gate evidence without waiting for older stuck PR CI'— two selected tests passed, 51 intentionally unselected; both files passed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.root.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-root.tsbuildinfo, targeted formatting, and diff checks — passed.The earlier cancelled full fixture run remains recorded; the passing focused run closes the fixture-construction gap without claiming the entire cancelled suite passed. At that point, #134914 was the pending canonical release-planner fix. It has since been superseded by merged #134824, as recorded below. No release source was copied into this patch.
Final integration candidate
8bfe7d058420302b4e29cb1fd1d03bb8efccbf8fincludes merged #134824 (eaaa6da895f625a2421853587c3ef21286325b7c). #134914 was superseded and closed without merging. The landed producer enumerates immediate package directories and captures metadata only: the same 273 inventory entries now require 23,358 bytes instead of the 1,048,865-byte recursive listing. Its 6,000-file Git-object overflow regression and metadata-symlink checks pass. No release-runtime change is part of this PR's diff.git range-diffconfirms all five task commits are unchanged by this conflict-free rebase. Focused integration proof:node scripts/run-vitest.mjs test/scripts/release-plan-producer.test.ts test/scripts/run-vitest-bounded.test.ts test/scripts/vitest-report-owner.test.ts test/scripts/pr-main-refresh.test.ts test/scripts/pr-merge-hosted.test.ts -- -t 'Vitest CLI final outcome ownership|preserves shard crashes|completes supervised prepare with three fresh checkpoints and exact stamps|revalidates prepared release-gate evidence without waiting for older stuck PR CI|ignores large runtime trees when collecting candidate metadata|rejects candidate metadata symlinks|matches the exact current publisher inventory'Result: 55 passed, 161 intentionally unselected: 40 CLI route/outcome cases, seven shard-crash cases, six producer cases, and two native fixture cases.
node scripts/check-changed.mjs --dry-run --base aadafdc198c062d61c0c4dc182d311232df6df03, followed by the actual command without--dry-run— passed, including script/test-root typechecks, formatting, script erasability, coercion guards, and script lint.