Repository navigation
perf(test): reuse Skill Workshop module graphs - #123772
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 1:43 PM ET / 17:43 UTC. ClawSweeper reviewWhat this changesThis PR reuses one Gateway and one CLI module graph across the Skill Workshop cache-regression tests while retaining per-test state and mock resets. Merge readinessNo blocking findings. This remains useful as a narrowly scoped test-performance refactor; merge after normal exact-head CI completion. Priority: P3 Review scores
Verification
How this fits togetherThe Skill Workshop CLI tests model a short-lived CLI process calling a long-lived Gateway process. Each test creates isolated state and workspaces, then verifies proposal mutations reach the owner process and refresh its cached skill snapshot. flowchart LR
A[Vitest test cases] --> B[Per-test state and mocks]
B --> C[Persistent Gateway module graph]
B --> D[Persistent CLI module graph]
D --> E[Gateway call mock]
E --> C
C --> F[Workshop and snapshot assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +1. Total +1 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the separate Gateway and CLI graph model, retain the existing per-test workspace and mock cleanup, and merge once exact-head CI completes. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR changes test setup cost, and its body provides focused after-change timing and pass results. Is this the best way to solve the issue? Yes. Reusing the two exact process-role graphs is the narrowest optimization while unique workspaces, reset mocks, and fixture teardown preserve the cases’ behavioral boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e03d1a42f808. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready evidence for exact head
Controlled same-Testbox A/B on ClawSweeper reported no findings. Its dependency-source move is resolved by direct inspection of installed Vitest 4.1.10: Known gap: no full suite was run. The focused five-test suite, 19-test sibling proof, remote changed gate, and exact-head CI are the scoped evidence for this one-file test-only refactor. |
|
Merged via squash.
|
What Problem This Solves
The Skill Workshop ownership/cache regression suite rebuilt the full CLI module graph and reset Vitest's evaluated-module registry before and after each of five tests. That repeated setup made the suite slower and more memory-intensive without adding isolation relevant to the behaviors under test.
Why This Change Was Made
The suite now constructs one persistent Gateway module graph and one independent CLI module graph in
beforeAll, then reuses both while preserving per-test OpenClaw state, temporary workspaces, Gateway delegates, lock mocks, and runtime spies. All five regression tests and their process-ownership boundaries remain intact; no production path or test-only production seam was added.User Impact
This is test-only/internal. It shortens Skill Workshop regression execution and reduces memory use while preserving coverage. Production LOC: +0/-0. Tests: +26/-25. No changelog entry is required.
AI-assisted: yes. The patch was manually inspected and received a fresh clean Codex autoreview with no accepted or actionable findings. No agent transcript is included.
Evidence
All five protected behaviors remain independently covered: Gateway cache invalidation after apply, no local replay after a dispatched failure, Gateway-lock ownership for configless offline apply, no credential-based Gateway ownership bypass, and evaluation of the exact inspected revision through the Gateway plugin registry.
Same-Testbox controlled A/B on
tbx_01m00ky48qfty2y7x9dzrywk61(two warm samples per state; hydration run https://github.com/openclaw/openclaw/actions/runs/31822611793):Command:
/usr/bin/time -v node scripts/run-vitest.mjs src/cli/skills-cli.workshop-cache.test.ts --maxWorkers=1, with state-specific module-cache paths. Local controlled warm corroboration was wall 5.98s -> 5.48s (-8.4%) and max RSS 634.2 -> 601.2 MiB (-5.2%). Import timing varied, so no import improvement is claimed.node scripts/run-vitest.mjs src/cli/skills-cli.workshop-cache.test.ts --maxWorkers=1— 5/5 passed; Vitest 2.70s, wrapper 6.09s.node scripts/run-vitest.mjs src/cli/skills-cli.workshop-cache.test.ts src/cli/skills-cli.workshop.test.ts src/gateway/server-methods/skills.proposals.test.ts --maxWorkers=1— 19/19 passed.corepack pnpm check:changed— passed in 11m13.819s, including guards/ratchets, format, Knip, temp-report validation, core test typecheck, and focused oxlint.git diff --check origin/main...HEAD— clean.Vitest 4.1.10 contract inspection at
node_modules/vitest/dist/index.d.ts:602,node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js:29, andnode_modules/vitest/dist/chunks/test.DNmyFkvJ.js:3654confirms thatvi.resetModules()clears evaluated modules for future imports without clearing mocks or retained top-level namespace references. That supports the two persistent process-role graphs and shared hoisted mock delegates used here.No full suite was run; the focused suite, sibling owner-boundary suite, remote changed gate, and exact-head PR CI are the scoped proof for this test-only refactor.