Skip to content

Spoor: feasibility analysis and delivery plan

Selective CI that learns what each job depends on, so nobody has to keep path filters up to date by hand. "Spoor" is the folder name, used here as a working name (the earlier analysis called the CLI ci-select). Name availability has not been checked.

Status: analysis finished, nothing built. Measured on 6 November 2026 against mmornati/ai-running-coach at df0f1dc.

1. Verdict

Technically feasible, but the expected gain is moderate and depends on the repo. Build it in stages, with a go/no-go decision before any test is actually skipped.

Question Answer Evidence
Can file tracing find a test's real dependencies? Yes Identical footprints across two runs of 1,118 test classes
Is it safe? Promising, not proven 32 mutations: no real miss once one rule was fixed, but that fix was checked on the same sample
How much would it save? About 42% of test time per PR Replay of 200 merges. The median PR still runs 71%
What is the cheapest large win? Skip the post-merge run when the tree already passed 131 of 198 merges (66%) were identical to the PR head. Needs no tracing
Can the map maintain itself? Yes, but not with a weekly refresh A week-old map was missing 395 real dependencies
Is an LLM needed? No The decision is deterministic and cheap. An LLM could at most explain changes later

The main decision, in section 6, is how far to go. Phase 0 is small and useful on its own. The tracing engine only earns its cost if the shadow run in Phase 2 shows real savings on more than one repo.

2. The problem

Path filters have to be updated throughout a project's life, and a stale filter fails silently by skipping tests that should have run. An LLM could read each diff, but it would cost too much per commit and give non-deterministic answers.

ai-running-coach shows the problem well: its MACOS_PATHS regex is maintained by hand, while most other jobs already declare their inputs somewhere the CI never reads.

What is actually being saved. The repo is public, so its runners are free. The gain there is waiting time, not money. Spoor would save money only on private repos or paid runners.

3. How the original analysis held up

Claim Result Detail
Sandbox copies everything, so naive traces are useless Confirmed Median tier A footprint is 225 files with the copy included, 42 without
Tracing is deterministic enough Confirmed 0 of 1,118 classes differed between two runs
Docker chat depends only on its Dockerfile Confirmed Its only COPY is from another image
34 directory listings in scripts/ Confirmed Another 179 in tests/
MACOS_PATHS is the only mapping in use Mostly graft-yaml.yml also uses a paths: filter
Extractors "already cover Docker and docs" Incomplete, low value here The COPY lines miss the job's runtime use of tests/evals/fixtures/base-week. These jobs are also only about 6% of Ubuntu runner time
A cache marker works for PRs, pushes and reverts alike Wrong A PR's cache is only readable by re-runs of that PR, so main and sibling PRs can't see it
A new, unmapped file triggers everything Too blunt 143 of 200 merges add a file, so this would mean running nearly everything
A weekly refresh keeps the map current Too slow See section 4.4
Linux traces can be applied to every OS Not verified 24 files contain OS-specific code or launchctl. Kept out of scope for now
No tool combines these ideas Holds, narrowly See section 5. Based on a few searches, not an exhaustive survey

Extra traps the spike found, in addition to the four in the analysis:

  • Bytecode hides dependencies. Python loads .pyc files rather than sources, so the data tests first appeared to read nothing. Bytecode has to be mapped back to its source.
  • New directories. A new file in a new directory changes the listing of its nearest existing ancestor, not its direct parent. Missing this caused the only real misses in the spike.
  • Files nobody reads are not unknown files. Treating them as unknown forced 39 of 200 merges into a full run, mostly over tests/evals/RESULTS.md. The map must record "read by nothing" explicitly.
  • Absent files are dependencies too. Failed lookups have to be recorded, after removing import-machinery noise.
  • Flaky tests. Commit 7a83496 failed in three runs with different tests each time, in tests unrelated to its changes. This looks like flakiness under the new parallel mode, though I didn't diagnose it. A success marker could lock in a lucky pass.

4. Measurements

4.1 Where CI time goes

Median duration of successful jobs across the last 100 tests.yml runs. Almost all of them predate PR #349, which parallelized the tiers, so current times should be lower.

Group Runner time
Ubuntu tier A (3 shards) 17.1 min
Ubuntu tier D (2 shards) 4.7 min
Docker + docs + lint 1.4 min
macOS (3 test jobs + app) 26.9 min, already filtered by MACOS_PATHS

4.2 Tracing cost

Tier Untraced Traced Overhead
A (install, process-heavy) 732 s 2,735 s 3.7×
B (lint) 10 s 15 s 1.6×
D (data) 282 s 347 s 1.2×

Time is the sum per class. Elapsed time on 8 CPUs was 398 s traced and 132 s untraced. Raw traces reached about 2.5 GB, so they must be parsed as a stream and not stored. This used strace on an arm64 Linux container, not on a GitHub runner.

4.3 Replay on real history

Share of test time still run if selection had been active. Footprints from the latest commit were applied to older commits, which is optimistic.

Comparing Still runs (mean) Median Under 10% 90% or more
Each merge against its parent (200) 58% 71% 39 merges 25 merges
Each single commit against its parent (300) 43% 44% 93 commits 20 commits

Selecting whole jobs or tiers saves far less: about 86% of test time still ran. The saving comes from selecting test classes. Core modules limit it: coach_config.py reaches 831 of 1,118 classes.

The second repo points the same way. In Graft, vitest --changed would have selected 469–492 s of a 493 s suite, using its import graph rather than tracing. Coupling in the repo largely sets the gain, so a repo should be able to estimate it before adopting anything.

4.4 Safety and freshness

Mutation test. 32 scenarios, each breaking, adding or deleting one file and then running all 1,118 classes, plus one clean control run.

Result Count
Failures caused 1,684
Failures in classes not selected 6
...caused by the ancestor rule bug 5, now 0 with the fixed rule
...not reproducible 1 (TestClaudeApiMode: passed 3/3 clean and 3/3 mutated; it failed in the scenario the power cut interrupted)

Limits of this result:

  • It is a small sample on one commit, and the rule fix was checked on the same data.
  • The map was learned on the same commit, which is the best case.
  • The mutations are blunt: they detect that a file matters, not subtle behaviour changes.
  • 10 classes failed or flaked in the container even without a mutation, so they couldn't be checked.
  • Linux only.

Freshness. Comparing a map from 28 October with one from today, 12 merges later:

  • 677 of 1,088 classes gained a dependency. Most of those are harmless, because the files are new and any file the map has never seen can be handled by rule.
  • 395 links pointed to 7 files that already existed, which is the real blind spot. One new import of scripts/arc_block_timeline.py accounts for 385 of them.
  • A change to that file during the stale week would have skipped up to 385 classes that depend on it.

So the map must refresh on every push to main. This also makes a committed lock impractical at class level, since hundreds of entries change in a week and nobody could review that.

5. Existing tools

Tool What it does Why it isn't enough
Nx Traces task I/O and reports reads outside declared inputs Checks declarations instead of deriving them, and means adopting Nx. It does validate the mechanism. Its PR #37547 shows reads that vary between runs are a real issue
github-action-skip-if-passed Skips a job when its files already passed, using GitHub's run history Very close to Phase 0, but uses declared filters and is young (2 stars, 3 commits). Evaluate it before writing anything
s3-cache-action Skips on git tree hash Needs S3
dorny/paths-filter Path filters The manual approach this project wants to replace
Bazel, Pants, pytest-testmon, Datadog ITR, Develocity Declared graphs or coverage-based selection From the original analysis, not re-checked. Either costly to adopt or blind to what shell scripts read

Three layers, each usable without the next:

  1. Identical-tree skip. If the exact tree already passed a full run, report success without re-running. This is always sound for repo files.
  2. Traced selection. Trace test classes and select the ones whose footprint a change touches.
  3. Job-level extractors. Optional, for repos with slow image builds. Low value on this testbed.

Rules that the measurements forced:

Rule Why
Keep two kinds of "known" file: read by something, and read by nothing Otherwise documentation changes force full runs
A new file selects classes that list its nearest existing ancestor "Run everything" would fire on 143 of 200 merges
Run everything if the map is missing or can't be read, or the workflow or tool versions changed Failure must mean running too much, never too little
Compare a PR against its merge base, not the previous commit If commit 1 adds an import and commit 2 edits the imported file, a commit-by-commit comparison skips the affected test using an outdated map. This gives up the 43% figure and uses 58%
Refresh the map on every push to main, without blocking Weekly is too slow. About 7 minutes on 8 CPUs here
Store the class-level map as a generated cache from main Every PR can read it, and eviction just triggers a full run. It's too large to review as a committed file
Find passes through the Checks API, not the Actions cache Cache scope stops a PR's marker reaching main
Keep a single aggregate status GitHub reports skipped jobs as success, so the result job must separately check that a skip was justified. publish.yml and tag.yml depend on it
macOS stays on its current filter Linux traces aren't validated for macOS

Decision: which policy on main

The two savings don't add up. If PRs only run a selection, no full run exists for that tree, so main can't skip its own.

Policy Runner-time saved (estimate) PR feedback Tracing needed
A. PRs full, main skips identical trees about 18% No faster No
B. PRs selected, main always full about 26% About 42% less test time on average, 29% at the median Yes

Both estimates come from the 48 PR and 21 push runs that completed out of the last 100, and they exclude setup time. Recommendation: ship A now, because it costs little. Move to B only if Phase 2 justifies it.

7. Implementation plan

Effort figures are rough guesses for one person working with an agent.

Phase 0: identical-tree skip (1–2 days)

  • First evaluate github-action-skip-if-passed, and only write a small action if it doesn't fit.
  • On a push to main: find the PR behind the merge, compare trees, and confirm that a full Tests run passed there.
  • Never skip for schedule or workflow_dispatch runs.
  • Decide how publish.yml and tag.yml treat a skipped run. They must still receive a trustworthy success.

Done when: a clean merge skips the suite and :edge still publishes, while a merge whose tree differs from the PR head runs everything.

Phase 1: spoor learn and spoor estimate (1 week)

  • Turn the spike into a Python CLI: tracing, parsing, path mapping and the bytecode rule.
  • Use a generic way to discount copying, since the spike patched Sandbox directly. This is the main unknown in making it generic.
  • Add a test-runner adapter: unittest first, then pytest.
  • spoor estimate replays git history and prints the expected saving, so a repo can see whether Spoor is worth adopting.
  • Compare strace with fsatrace and eBPF, to reduce the 3.7× overhead.

Done when: estimate matches this document's numbers on the testbed and produces a result on a second repo.

Phase 2: shadow mode (2–4 weeks, mostly elapsed time)

  • spoor plan records what it would select, while CI still runs everything.
  • Each run compares actual failures with the selection. Any failure outside the selection is logged as a miss.
  • Refresh the map on each push to main, and run scheduled mutations.

Then make the go/no-go decision (section 9).

Phase 3: enforce on PRs (1 week)

  • A composite action feeds the selected classes into the matrix, rebalancing shards by measured duration.
  • A label or commit trailer can force a full run.
  • main always runs in full, and a weekly full run stays.
  • Add a flake quarantine: a class that failed on the same inputs is never treated as passing.

Phase 4: optional extensions

  • Dockerfile, mkdocs and hashFiles() extractors.
  • A macOS map, if it can be derived safely.
  • A second language adapter, such as Vitest for Graft.
  • A public write-up. This would also suit a blog post, whatever the final numbers.

8. Testing plan

Level What it covers
Parser unit tests Recorded strace fixtures: interrupted calls, AT_FDCWD, failed opens, paths with special characters
Rule tests Table-driven: modify, add, delete, rename, new nested directory, unread file, empty map, unknown workflow change
Fixture repos Small repos for each trap: copy before read, directory listing, read only when a file is absent, bytecode, reads by a child process, symlinks
Determinism Same commit traced twice gives the same map, with any variation listed
Failure modes Missing or corrupt map, API errors, cache eviction, shallow clone: each must lead to running everything
Workflow tests actionlint, plus a sandbox repo running real PRs: docs-only, core change, new directory, revert, fork PR
Security review Whether a fork or PR can forge a pass or poison the map. Injection through file names. Least-privilege token scopes

9. Validation plan and decision criteria

Safety. Run a fresh random sample of at least 100 mutations, not reusing the spike's sample, with maps of realistic age. Zero misses in 100 would put the true miss rate below about 3% at 95% confidence (treating mutations as independent). Natural failures alone can't show this, since only 5 of the last 100 runs had failing test jobs.

Value. Measure elapsed PR time on real GitHub runners, including setup and the refresh job, not just test time.

Go to Phase 3 only if all hold Threshold
Confirmed misses in shadow mode 0
Mutation misses on the fresh sample 0 of 100 or more, each one explained and fixed
Median PR feedback time saved At least 25%
Testbeds with useful savings At least 2, or an explicit decision to serve only one
Full runs caused by missing maps Under 10%

Stop at Phase 0 if median savings stay under 25% or misses keep recurring. Phase 0 is still worth having, and spoor estimate could stand on its own.

After enforcement. Track misses caught by the post-merge full run, the share of test time skipped, and how often maps go stale. Roll back to full runs on any miss that reaches main without a known cause. The switch should be one repository variable, like the existing ARC_MACOS_ON_GITHUB.

10. Main risks

Risk Likelihood Mitigation
Stale map skips a needed test Medium Refresh on every main push, merge-base comparison, full run on main
Savings too small High on tightly coupled repos spoor estimate first, with a clear stop criterion
Copy handling doesn't generalize Medium Validate on a second repo in Phase 1, before the shadow phase
Tracing overhead on real runners Medium Non-blocking refresh, faster tracers. ptrace availability on hosted runners is still unverified
Non-file inputs (network, clock, image version) Medium Include versions in the key, keep full runs, quarantine flakes
Flakes make results untrustworthy Medium, already visible Fix or quarantine first. This helps the repo regardless of Spoor
macOS-specific regressions Low while out of scope Keep the current filter and weekly full run

Sources