Repository navigation
test(cli): split and speed up update-cli tests - #157018
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 1:25 PM ET / 17:25 UTC (Revision 5). ClawSweeper reviewWhat this changesSplits the updater CLI test suite into independently scheduled files with shared fixtures, updates CI test ownership, and speeds up a fixture subprocess. Merge readiness✅ Ready for maintainer review Keep open. Current main and the latest release still have the large updater test file, so this remains a distinct contribution. The current head resolves the prior Git Priority: P3 Review scores
Verification
How this fits togetherThe updater CLI tests exercise Git and package updates, service handling, Doctor, and recovery through shared fixtures. A test registry assigns these files to CI shards, whose results guard updater changes. flowchart LR
A[Updater behavior] --> C[Split test cases]
B[Shared fixtures] --> C
C --> D[Test owner registry]
D --> E[CI test shards]
E --> F[Pass or fail results]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +2128, Other -1. Total +2127 across 32 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one shared fixture owner, retain every updater scenario in its owning test file, and run all split files through the existing database-worker CI route. Do we have a high-confidence way to reproduce the issue? Not applicable: this is test-suite maintenance. Current main's large single file and the PR's measured baseline establish the performance motivation. Is this the best way to solve the issue? Yes. The split preserves one fixture owner and the database-worker CI route, and the formerly mismatched Git refusal case now follows current main. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6e8d06876fd1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
a17562e to
2ab1bb8
Compare
Preserve all 515 update CLI cases while splitting orchestration coverage by owner boundary. Keep isolated writable state and live child admission, remove repeated fixture admission and Node startup, and synchronize completion without sleeps or polling. Update runtime behavior is unchanged.
bbf195e to
c310d8a
Compare
* test(cli): split and speed up update-cli tests Preserve all 515 update CLI cases while splitting orchestration coverage by owner boundary. Keep isolated writable state and live child admission, remove repeated fixture admission and Node startup, and synchronize completion without sleeps or polling. Update runtime behavior is unchanged. * chore(test): retire update-cli line-cap exemption * test(cli): fix updater fixture type and cycle checks
…ort #158414 to 2026.9.7) (#158910) * fix(plugins): recover missing retained capture directories (backport #158769) Recreate a lost payload directory under its existing native custody lease, without recreating the coordinator parent. Required by the native artifact admission backport so captures and native payloads can share one live instance. (cherry picked from commit 4543ce2) Conflict resolution: release/2026.9.7 predates the recovery test file; port only the missing-directory regression, without later main-only cleanup tests. Proof: focused regression passed (1 test, 87 ms; wrapper 2.39 s). Fresh Codex review found no actionable P0/P1 findings. Refs #158712; thanks @yihan331313. * perf(plugins): stop reading native plugin artifacts at startup Reuse installed native admission receipts and retained package payloads across artifacts and generations while preserving companion namespaces, mutable snapshots, worker publication, and install rollback ownership. (cherry picked from commit 9faa93d) Conflict resolution for release/2026.9.7: retain the release catalog-worker protocol, installed-index and lease helpers, and token-bearing cleanup policy. Adapt native footprint coverage to the existing catalog-capture integration suite. Exclude main-only updater extraction and later catalog/cleanup refactors. Reuse the release path-selection logic and extract the unchanged browser-asset predicate. Keep admission preparation and dispatch in a plugin-owned worker module to preserve the state-worker line cap. Prerequisite: #158769, 4543ce2, is backported separately so captures and native directories can share an existing custody lease. Refs #158414 #157815 #158738. Evidence: 18 touched files / 288 cases passed three times; 29 importer shards / 11,150 cases passed, plus 10 live cases. Build, release-base changed checks, and independent P1 review passed on this exact tree. Slow-test follow-up on release/2026.9.7: update-cli.test.ts, owner: CLI tooling; main has #157018. No unrelated test-performance changes are included.
Related: #156761
What Problem This Solves
The update CLI's 515-case test file took 244.99 seconds of summed test time, exceeded the per-file CI budget, and forced updater changes through one large serial test unit. This is maintainer-requested test performance work.
User Impact
Update behavior is unchanged. Current main coverage remains in normal per-PR CI across 23 independently scheduled files. The latest rebase passes all 532 cases; the count reflects main retiring one Git/no-restart matrix row when running-Git updates became an explicit refusal.
Why This Change Was Made
Split coverage by update ownership boundaries and keep one shared fixture implementation. Each case retains its private home and writable SQLite copy. The fixture reuses its already-prepared database bytes without reopening them for another admission, and its POSIX child-lifetime double resolves
catthrough the captured host PATH instead of booting Node. Real PID binding, lease checks, process-group settlement, and metadata subprocesses remain exercised. Windows retains its existing Node fixture.Explicit completion signals replace the taskkill sleep and exit-spy polling. All files retain the original isolated fork owner; the obsolete max-lines suppression and its baseline entry are removed.
Evidence
Latest rebase proof
Head: c310d8a, rebased onto main at 57a3051. Testbox run, provider blacksmith-testbox, lease tbx_01m3a4y5mewyj1x6ze752bhd2c. The single full pass used OPENCLAW_TESTBOX=1, Node 24.19.0, pnpm 12.4.2, and node scripts/run-vitest.mjs with --maxWorkers=1 and verbose/JSON reporters.
23 files / 532 tests passed, command exit 0. Summed test time: 313.69 s; wrapper wall: 392.84 s; slowest file: 28.67 s; slowest case: 4.32 s. The prior three-pass proof remains below. The fresh lease was stopped after verification.
Local pnpm tsgo passed in 18.58 s; pnpm check:madge-import-cycles passed in 29.64 s, reporting 0 cycles. Targeted lint and diff whitespace checks passed.
The #156996 monolith changes now live with their split owners:
All 269 main registrations are present exactly once, with no assertions lost during extraction. Every split file has one database-worker owner registration. New Git-current, artifact-provenance, and publication tests remain in their unchanged canonical owners. The copied-seed path normalization and the earlier type/cycle repairs are retained.
Main advanced to 54bec77 during proof; it has no further monolith or owner-list changes. This tested rebase stays pinned to 57a3051.
Previous CI-repair proof
Head: bbf195e. Fresh Linux Testbox run, provider blacksmith-testbox, lease tbx_01m3a1k5th7957rsfp1fxawsyr. The command exited 0, and the owned lease was stopped after proof completed.
The CI repair removes the unused first-argument binding from the buffered-command mock and replaces the lifecycle's reverse fixture import with a lifecycle-owned input type. Production LOC: 0; this follow-up changes test support only (+24 / −5). No cases, assertions, suppressions, baselines, or production behavior changed.
pnpm tsgo passed (21.63 s), pnpm check:madge-import-cycles passed with 0 cycles (89.34 s), targeted lint passed, and independent Codex autoreview was scoped-clean through P2.
All 23 split files ran 3× on the fresh lease with OPENCLAW_TESTBOX=1, Node 24.19.0, pnpm 12.4.2, and node scripts/run-vitest.mjs with --maxWorkers=1 and verbose/JSON reporters.
The Windows lifecycle file took 39.20 / 26.02 / 26.70 s of summed test time across the three runs.
The source capsule verified this head and the full transferred tree (40295a732dfeff835e360bd2c5c2d980bd632d23), omitting only the retired .artifacts/release-speedup-pr-body.md from tracked transfer source, matching #157308. The local document was restored byte-for-byte; test code stayed unchanged. An initial transport preflight incorrectly required that ignored hydration file to be physically absent; correcting the check to tracked-source membership allowed the proof to run.
Earlier local rebase proof
Rebased onto main at 9e00761; candidate 2ab1bb8. Main's candidate-admission registrar now runs once in update-cli.candidate-admission.test.ts. Its 18 new expanded cases and three existing refusal cases are preserved with their assertions; the shared invocation owner preserves main's installed-admission default and explicit option override. All 269 direct main registrations are accounted for across the split. Other upstream test owners remain unchanged.
23 files / 533 tests passed 3× in a bounded local loop using node scripts/run-vitest.mjs with --maxWorkers=1 and verbose/JSON reporters. Wrapper wall times: 1011.38 / 1026.82 / 1370.28 s. Largest per-file test time across all runs: 95.09 s; largest individual case: 16.30 s. These are macOS / Node 26.9.0 / pnpm 12.4.2 results on a shared 32-CPU host whose observed load ranged from about 39 to 93. They are separate from the historical Linux measurements below; no before/after speed claim compares those hosts. Local proof was explicitly requested for this rebase because Testbox sync was blocked by a tracked artifact on main.
Current changed-file gate: node scripts/check-changed.mjs passed locally with exit 0, including all 25 core test typecheck graphs, core/script lint, formatting, ratchets, boundary guards, and unused-export scans. Fresh Codex autoreview (--mode branch --base origin/main) is scoped-clean through P2. An initial spy-lifetime finding was resolved with inspected Vitest 5.0.1 dependency evidence: spyOn returns the existing factory-created vi.fn without installing a restorable wrapper. No assertions or source changes were needed to resolve it.
Relocated into update-cli.candidate-admission.test.ts via the unchanged main registrar:
Historical initial split proof (Linux)
All 515 case-name counts match the original suite in each of three complete runs: 22 files / 515 tests passed 3×. No coverage moved to the release-only tier.
Summed test time: 244.99 s before → 219.37 / 201.46 / 230.18 s after. Vitest wall time: 252.00 s before → 257.64 / 233.62 / 265.74 s after. The supported
pnpm testwrapper took 265.19 s before and 271.55 / 246.87 / 277.61 s after. Serial wall time remains around the original baseline; the split removes the long indivisible file and lowers summed test time while preserving file parallelism. These runs used Linux, Node 24.19.0, pnpm 12.4.2, one Vitest worker, and isolated Testboxes.Baseline:
82a518c90ca4e4ef7e7b19832954edb4c283e5be. The initial split candidate was rebased onto048cc4ec481af17d20a027f895c13ccef8fb6095before repeated proof. The baseline was measured before that rebase. The table groups its case timings by their new destination; all values are summed test seconds, separate from collection and build preparation.update-cli.admission-ledger.test.tsupdate-cli.already-current.test.tsupdate-cli.candidate-activation.test.tsupdate-cli.config-convergence.test.tsupdate-cli.finalizer.test.tsupdate-cli.fresh-doctor.test.tsupdate-cli.git-service.test.tsupdate-cli.node-runtime.test.tsupdate-cli.npm-runtime.test.tsupdate-cli.package-lifecycle.test.tsupdate-cli.plugin-convergence.test.tsupdate-cli.plugin-warnings.test.tsupdate-cli.post-core-handoff.test.tsupdate-cli.post-core-recovery.test.tsupdate-cli.reporting.test.tsupdate-cli.restart-sentinel.test.tsupdate-cli.service-authority.test.tsupdate-cli.service-scope.test.tsupdate-cli.target-schema.test.tsupdate-cli.test.tsupdate-cli.windows-lifecycle.test.tsupdate-cli.windows-recovery.test.tsBaseline ten slowest cases
Reproduction commands
OPENCLAW_TESTBOX=1 pnpm check:changedpassed on the initial split head 47f98ee, including all 25 core test typecheck graphs, all five core lint stripes, script lint, ratchets, boundary guards, and unused-export scans. The warning-only temp-directory report flags the pre-existing suite-owned root moved into the fixture helper; its original cleanup lifecycle is retained. Final-head remote proof completed with command exit 0. The current candidate uses the local rebase proof above.Independent Codex review on
47f98eeeafd00f963487b89240ec60bf887bc51f: scoped-clean through P2, using--mode branch --base origin/main.A bounded seven-case fixture profile measured 1.16 s waiting for 11 dummy Node children and 429 ms in seven state admissions; warm home creation was under 1 ms per case. Fresh per-case homes were retained. The initial full extraction run caught one stale service-port variable reference (514 passed / 1 failed); that reference was corrected before the three clean repetitions. The changed gate also required pruning the now-stale line-cap baseline entry.
Production LOC: +0 / -0. Test and test-support LOC: +15,577 / -13,471, largely relocation and imports. Test routing: +22 / -0. Line-cap baseline: +0 / -1.