Files
gstack/test/helpers/touchfiles.ts
T
Garry TanandClaude Fable 5 820afa26e8 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>
2026-08-15 08:30:09 -07:00

44 lines
1.4 KiB
TypeScript

/**
* Diff-based test selection for E2E and LLM-judge evals — compatibility facade.
*
* This module is split into three files:
*
* - ./touchfiles-data.ts — the four touchfile/tier maps (E2E_TOUCHFILES,
* E2E_TIERS, LLM_JUDGE_TOUCHFILES, GLOBAL_TOUCHFILES), LITERALS ONLY.
* Map-diff selection evaluates OLD git versions of that file standalone
* to diff the maps across commits, so it must stay importable pure data
* (zero imports, zero executable logic).
* - ./test-selection.ts — the logic: matchGlob, detectBaseBranch,
* getChangedFiles, selectTests.
* - this facade — re-exports everything so the ~dozen existing import
* sites (e2e-helpers, eval-select, e2e-tier-alignment, paid-test-set,
* the *-e2e test files, …) keep importing from './touchfiles' unchanged.
*
* test/touchfiles-facade.test.ts pins the shape: the literal-only tripwire
* on the data file, and export parity (every export of both halves is
* re-exported here by identity).
*/
export {
E2E_TOUCHFILES,
E2E_TIERS,
LLM_JUDGE_TOUCHFILES,
GLOBAL_TOUCHFILES,
} from './touchfiles-data';
export {
matchGlob,
detectBaseBranch,
getChangedFiles,
selectTests,
diffTouchfileMaps,
diffTouchfileMapsCore,
TOUCHFILES_DATA_PATH,
} from './test-selection';
export type {
TouchfileMaps,
MapDiffCause,
MapDiffOutcome,
} from './test-selection';