evals: map-diff selection — a touchfiles-data edit runs only what changed

Editing the eval dep-list data no longer forces the full ~$38 /
30-45min suite (measured on 21.9% of recent commits). When
touchfiles-data.ts is in the diff, selection now evaluates the BASE
version (git show -> mkdtemp -> spawnSync bun child printing the four
maps as JSON — sync because e2e-helpers selects at module scope) and
JSON-diffs per key: added entries, edited dep lists, and tier flips are
selected; keys removed from all maps are reported, never silently
dropped; a GLOBAL_TOUCHFILES edit still runs everything.

FAIL-CLOSED with named causes: missing-base-ref, git-show-failed,
import-failed, shape-mismatch each degrade to run-all and print
'selection: global — touchfiles-data changed (<cause>)' (D9 — silently
expensive beats silently wrong, but never silently). eval:select prints
'selected N of M, reason: ...' + removed tests; --base scopes the
map-diff too.

The temporary conservative GLOBAL entry for touchfiles-data.ts is gone —
its changes route through the map-diff. 23 new free tests: pure-core
fixtures, selectTests wiring incl. a poison-injection guard, and a temp
git repo exercising every fail-closed cause end-to-end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-15 08:30:09 -07:00
co-authored by Claude Fable 5
parent f23b2263bc
commit 820afa26e8
5 changed files with 646 additions and 17 deletions
+5 -5
View File
@@ -812,9 +812,9 @@ export const GLOBAL_TOUCHFILES = [
'test/helpers/hermetic-env.ts', // Changes every E2E child's environment
'test/helpers/eval-store.ts', // All E2E tests store results here
'test/helpers/test-selection.ts', // Selection logic itself — a bug here mis-selects every test
// TEMPORARY — maximally conservative until map-diff selection lands: any
// edit to the data maps still forces a full run. A later change-set
// replaces this entry with map-diff (evaluate the old git version of this
// literal-only file, diff the maps, run only the affected tests).
'test/helpers/touchfiles-data.ts',
// NOTE: this file (touchfiles-data.ts) is deliberately NOT a global
// touchfile. Changes to it route through map-diff selection in
// test-selection.ts: the old git version is evaluated and the maps are
// diffed per key, so a data-only edit runs just the affected tests.
// Map-diff fails CLOSED — any error on that path still runs everything.
];