Repository navigation
test(scripts): model AI declarations in bounded E2E preparation fixture - #160532
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. |
3d6fc7e to
fa078c4
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 11:52 AM ET / 15:52 UTC. ClawSweeper reviewWhat this changesThe branch makes the bounded E2E runner test simulate typed AI declarations produced by its stubbed build and by a complete prebuilt setup. Merge readiness✅ Ready for maintainer review Current main still has the clean-checkout fixture failure. The branch addresses that failure without changing the production declaration check, so this PR remains useful. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Vitest runner prepares shared runtime and AI package artifacts before starting E2E test readers. This fixture substitutes inexpensive build processes while exercising the runner’s real preparation decisions. flowchart LR
A[Vitest E2E command] --> B[Runtime preparation]
B --> C[AI declaration check]
G[Test fixture receipt] --> C
C --> D{Declarations available?}
D -->|No| E[Typed AI build]
D -->|Yes| F[Vitest readers]
E --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +18. Total +18 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the fixture tied to successful stub output while retaining the production missing-declarations repair and its separate regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. On a clean checkout without AI declarations, the existing stub produces no declaration files while the real prerequisite check looks for them; the PR body reports the resulting two test failures. This review did not run the test. Is this the best way to solve the issue? Yes. A temporary receipt makes the fixture model successful AI preparation without weakening the production declaration guard or changing its separate missing-file tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa63d9bb844b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Follow-up: #160392 is now merged. Its final main integration preserved this canonical AI-declaration fixture fix and dropped the duplicate repair. Relative to the integrated main version, |
…re (openclaw#160532) Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
Fixes red main.
test/scripts/run-vitest-bounded.test.ts› "prepares the direct E2E reader generation once" fails on clean checkouts in two cases:successandprebuilt. Commit 9c69495 added a check that runs the typed AI build again whenpackages/aideclarations are missing. That check is correct. The test's stub AI build never wrote declarations, and the test read the real checkout'spackages/ai/dist. On a clean CI checkout, the check therefore fired and started an extraaibuild. This PR changes only the test fixture so it models the declarations the real build writes.Root Cause
origin/main(nopackages/ai/dist),node scripts/run-vitest.mjs test/scripts/run-vitest-bounded.test.ts --maxWorkers=1gives2 failed | 37 passed:success:expected [ 'runtime', 'ai', 'ai' ] to deeply equal [ 'runtime', 'ai' ]prebuilt:expected [ 'ai' ] to deeply equal []checks-node-compact-small-17.fix(ci): prepare packed AI declarations before prebuilt tests) addedpreparePrebuiltAiPackageinscripts/lib/vitest-build-prerequisites.mts. It runs whenOPENCLAW_E2E_USE_PREBUILT_DIST=1and the e2e config selects the packed AI consumer. It checks everytypesentry inpackages/ai/package.jsonwithfs.existsSync. If any entry is missing, it runstsdown.ai.config.ts.success:prepareE2eVitestRuntimeruns the stubbed runtime and AI builds, then setsOPENCLAW_E2E_USE_PREBUILT_DIST=1. The stub writes no.d.mts, soprepareVitestRuntimesees missing declarations and starts a secondaibuild.prebuilt: the test says a prebuilt generation exists, but the checkout has no declarations, so the check runs oneaibuild.tsdown.ai.config.tssetsdtsunlessOPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1, and the test stripsOPENCLAW_*). A real run therefore finds complete declarations and does not rebuild. Only the fixture was wrong. The test also depended on localpackages/ai/diststate, which is why it passed on hosts that had built the AI package.Exact change
Test-only change in
test/scripts/run-vitest-bounded.test.ts:aibuild succeeds, it writes a declarations receipt file in the test temp dir.fs.existsSync. For<repo>/packages/ai/dist/*.d.mtsit returns whether that receipt exists. All other paths go to the realexistsSync. The test is now independent of the checkout'sdist.prebuiltcase pre-writes the receipt, because a complete prebuilt generation includes the typed AI package.Expectations are unchanged: still exactly
["runtime", "ai"]forsuccessand[]forprebuilt. No product code changed. The missing-declarations path stays covered bytest/scripts/vitest-prebuilt-ai.test.tsfrom 9c69495.Verification
Real behavior proof
On a clean worktree at
origin/main917e1b8 plus this commit (nopackages/ai/dist), Node from~/.local/share/openclaw-node/current:Tests 2 failed | 37 passed (39)(failures shown above).Tests 39 passed (39), exit 0. Wall is about 51s for the file, the same as before. No new tests were added and no subprocesses were added.packages/ai/distbehind.node scripts/check-changed.mjs: exit 0.What was not tested
checks-node-compact-small-17was not rerun. This PR's own CI will run it.Fixes red main.