Skip to content

fix(ci): select process tests when their descriptor-spawned fixtures change - #169767

Merged
steipete merged 1 commit into
mainfrom
fix/selector-runtime-worker-descriptors
Oct 12, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/selector-runtime-worker-descriptors

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 broke src/cli/gateway-cli/run-loop.forced-cron.process.test.ts, its CI never ran that test, and unrelated PRs touching src/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 in src/cli/cli-entrypoint.test-support.ts and resolves relative to that aggregator, which the selector's scanner never followed, so src/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.ts alone holds 54 descriptors read by 41 tests, and scripts/lib/vitest-worker-build-entries.mts imports nearly every aggregator to prebuild (not run) the fixtures.

  • An inline descriptor is an edge from its declaring module, like the existing new URL("./x", import.meta.url) edge.
  • An exported descriptor is an edge only from test code that reads it: group.member reaches that member's fixture, a whole-group read (Object.values(group), group[key]) reaches the group, and namespace/dynamic imports reach the whole module.
  • Non-test readers (the build manifest, production modules) keep only ordinary import edges.
  • The full graph, the forward target walk, and the local grep-based reverse scan all honor these edges. The grep scan falls back to the full graph when a fixture is reached only through a descriptor, because the consuming test never names the fixture.

Nearby repair: the full-inventory source-facts scan on main already emits 16,563,019 bytes against a borrowed 16 MiB git ls-files buffer, 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 3925af574f264 with resolveChangedNodeTestTargets([file]), the PR preflight entry point. "Naive" is a measured, unshipped variant that adds every aggregator descriptor as an edge from the aggregator:

Changed file Before This PR Naive Forced-cron before → after
src/cron/service/run-queue.ts 3126 3151 3196 no → yes
src/cron/service/ops-run.ts 3099 3124 3169 no → yes
src/gateway/server-cron-drain.ts 4470 4494 4537 no → yes
src/gateway/server-shutdown.ts 4112 4136 4185 no → yes
src/logging/logger-file-transport.ts 3431 3451 3466 no → yes
src/infra/restart.ts 3415 3441 3491 no → yes
src/process/gateway-work-admission.ts 3341 3359 3400 no → yes
src/cli/gateway-cli/run-loop.ts 302 308 374 yes → yes

The 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 passed
  • pnpm test test/scripts/ci-changed-node-test-plan.integration.test.ts --maxWorkers=1: 9 passed (new real-checkout case: run-queue.ts selects 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)
  • oxlint (scripts and test-root configs), oxfmt, tsgo for tsconfig.scripts.json and test/tsconfig/tsconfig.test.root.json, script erasability, git diff --check: clean

Codex 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-literal sourceWorkerName are still not followed.

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.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Changed-test selection omits src/cli/gateway-cli/run-loop.forced-cron.process.test.ts.
  • After: The descriptor edge selects that process test without connecting every build-manifest consumer to every fixture.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, coherent repair with no actionable finding; supplied behavioral evidence is at the planner boundary and broad CI is unfinished.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports real-checkout planner comparisons and focused regression results.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Relevant process tests can be skipped on the PR that breaks their child fixtures, leaving unrelated changes or main CI to discover the failure.
Reason: The maintainer-directed repair addresses an observed coverage failure through the existing selector without adding settings, jobs, or a competing planner.

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
Reviewed head: b390104450c31e238e8ca16e018b5b9ec1bbb207

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied selection replay invokes the production planner directly rather than showing the shipped preflight command for the same changed-path scenario.
Agent review details

How this fits together

CI 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]
Loading

Technical review

Best 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

  • Runtime source dependency parsing and graph traversal keeps the original intent (881ad1c: Select affected runtime consumers precisely while retaining canonical execution metadata and complete main coverage.)
  • Mock consumer selection keeps the original intent (2ed30d4: Retain tests affected by changed runtime exports and newly consumed mocked bindings.)
  • Targeted source scanning keeps the original intent (abb3703: Avoid parsing unmatched files without poisoning later complete graph reads.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 881ad1c adds scripts/lib/test-selector-source-facts.mts:616 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 881ad1ca49d8; files: scripts/lib/test-selector-source-facts.mts)
  • Dallin Romney: Raw commit 2159bb0 adds scripts/lib/test-selector-source-facts.mts:838 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2159bb07a628; files: scripts/lib/test-selector-source-facts.mts)

PR surface

Tests +421, Docs 0, Other +323. Total +744 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 435 14 +421
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 331 8 +323
Total 6 767 23 +744

Labels

Label changes:

  • add P2: The selector can omit relevant process tests and allow regressions onto main, but this PR does not change product runtime behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The selector can omit relevant process tests and allow regressions onto main, but this PR does not change product runtime behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 12, 2026, 4:38 AM ET / 08:38 UTC.

@steipete steipete self-assigned this Oct 12, 2026
@steipete
steipete merged commit 9ab74d1 into main Oct 12, 2026
121 of 122 checks passed
@steipete
steipete deleted the fix/selector-runtime-worker-descriptors branch October 12, 2026 08:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant