Repository navigation
fix(ci): select process tests when their descriptor-spawned fixtures change - #169767
Conversation
Changed-test selection now follows runtime-worker descriptors (`currentModuleUrl: import.meta.url` with a literal `sourceWorkerName`). Inline descriptors are edges from their declaring module; exported descriptors are edges only from test code that reads that descriptor, so aggregators such as cli-entrypoint.test-support.ts and the worker build manifest do not fan out to every fixture. A change to a fixture's dependencies now selects the process tests that spawn it, e.g. src/cron/service/run-queue.ts selects run-loop.forced-cron.process.test.ts (missed by #169364's CI). Source facts also get their own scan buffer: the full inventory already emits ~16.56 MB against the borrowed 16 MiB git ls-files limit.
|
🦞👀 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. What this changesThis PR connects runtime-worker descriptors to their consuming tests so fixture dependency changes select the relevant process tests. Example: A PR changes src/cron/service/run-queue.ts.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a concrete CI coverage gap still present on main; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCI preflight feeds changed paths into the test selector, which combines source dependency facts and coverage policy to produce test targets. flowchart TD
A[Changed paths] --> B[CI preflight]
B --> C[Test selector]
D[Imports and worker descriptors] --> C
E[Test descriptor reads] --> C
C --> F[Selected test targets]
Technical reviewBest possible solution: Extend the existing dependency graph with precisely attributed descriptor edges while preserving ordinary imports and complete main coverage. Do we have a high-confidence way to reproduce the issue? Source tracing confirms the missing descriptor edge, and the author reports a before-and-after planner replay; this read-only review ran no target code. Is this the best way to solve the issue? The patch repairs the existing graph owner, covers forward and reverse discovery, and avoids the demonstrated fan-out from treating every exported descriptor as an aggregator dependency. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2fc20b367b69. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +421, Docs 0, Other +323. Total +744 across 6 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 12, 2026, 4:38 AM ET / 08:38 UTC. |
|
Merged via squash.
|
…nclaw#169767) Changed-test selection now follows runtime-worker descriptors (`currentModuleUrl: import.meta.url` with a literal `sourceWorkerName`). Inline descriptors are edges from their declaring module; exported descriptors are edges only from test code that reads that descriptor, so aggregators such as cli-entrypoint.test-support.ts and the worker build manifest do not fan out to every fixture. A change to a fixture's dependencies now selects the process tests that spawn it, e.g. src/cron/service/run-queue.ts selects run-loop.forced-cron.process.test.ts (missed by openclaw#169364's CI). Source facts also get their own scan buffer: the full inventory already emits ~16.56 MB against the borrowed 16 MiB git ls-files limit.
Related: #169364, #169613
What Problem This Solves
Fixes: PR CI skips process tests when a change only reaches their child fixture, because the test reaches the fixture through a runtime-worker descriptor (
currentModuleUrl: import.meta.url+sourceWorkerName) instead of an import.User Impact
No product change. Maintainers get the relevant process tests on the PR that breaks them instead of a silently red
main: #169364 changed cron run ownership and brokesrc/cli/gateway-cli/run-loop.forced-cron.process.test.ts, its CI never ran that test, and unrelated PRs touchingsrc/cli/gateway-cli(for example #169613) failed until 915c0d3 repaired the fixture.Why This Change Was Made
The forced-cron test calls
resolveRuntimeWorkerUrl(gatewayDirectStopEntrypoints.forcedCronFixture). The descriptor lives insrc/cli/cli-entrypoint.test-support.tsand resolves relative to that aggregator, which the selector's scanner never followed, sosrc/cron/**changes could not reach the test. The test is already a protected regression, and protected tests use an unfiltered transitive walk, so a correct graph edge is all that was missing.The edge is attributed precisely because the aggregator pattern fans out:
cli-entrypoint.test-support.tsalone holds 54 descriptors read by 41 tests, andscripts/lib/vitest-worker-build-entries.mtsimports nearly every aggregator to prebuild (not run) the fixtures.new URL("./x", import.meta.url)edge.group.memberreaches that member's fixture, a whole-group read (Object.values(group),group[key]) reaches the group, and namespace/dynamic imports reach the whole module.Nearby repair: the full-inventory source-facts scan on
mainalready emits 16,563,019 bytes against a borrowed 16 MiBgit ls-filesbuffer, about 210 KB from a preflight failure. Source facts now get their own 64 MiB limit, and rows omit the new field when empty, so this PR adds no per-row payload.Evidence
Selection on
3925af574f264withresolveChangedNodeTestTargets([file]), the PR preflight entry point. "Naive" is a measured, unshipped variant that adds every aggregator descriptor as an edge from the aggregator:src/cron/service/run-queue.tssrc/cron/service/ops-run.tssrc/gateway/server-cron-drain.tssrc/gateway/server-shutdown.tssrc/logging/logger-file-transport.tssrc/infra/restart.tssrc/process/gateway-work-admission.tssrc/cli/gateway-cli/run-loop.tsThe tests this PR adds are process, retention, and descriptor-spawning integration tests (for example
run-loop.forced-cron,run-loop.model-acquisition,doctor-config-preflight.process,sqlite-worker-shared-state-idle). The naive variant's extra ~45 tests per change are mostly expensive tooling suites reached through the build manifest (test-projects.test.ts,vitest-worker-artifacts*,run-vitest*,ci-*planner tests). No previously selected test is dropped.Cost: reads are computed lazily for the 253 test-only modules that import descriptor-exporting modules, about +0.3 to +0.6 s of single-threaded planning on cold selection (measured as parent-process CPU on a heavily loaded host; total CPU including the parallel scan was unchanged within noise). Computing reads inside the parallel scanner instead would have added about 15.7 MB of payload for all test-only files.
Tests:
pnpm test test/scripts/test-selector-source-facts.test.ts --maxWorkers=1: 10 passedpnpm test test/scripts/ci-changed-node-test-plan.integration.test.ts --maxWorkers=1: 9 passed (new real-checkout case:run-queue.tsselects the forced-cron test)pnpm test test/scripts/test-projects.test.ts --maxWorkers=1: 311 passed (synthetic regression for member, whole-group, single, inline, and build-manifest readers across Git and filesystem inventories; it fails on the original selector at the forward-impact assertion)tsgofortsconfig.scripts.jsonandtest/tsconfig/tsconfig.test.root.json, script erasability,git diff --check: cleanCodex autoreview (P1) on the committed branch: scoped-clean.
Known limitation: descriptors built by helper functions (for example
runtimeProcessEntrypoint(modulePath)in production) or with a non-literalsourceWorkerNameare still not followed.