Revision: 1 Last modified: 2026-12-04T19:00:00Z
backstop.sh is the fastcycle slow-but-always-complete lane, plus two smaller jobs that belong to
the same "hold the line" role.
The fast lane is fast because it selects: it runs only the gates that a change appears to affect, and
reuses cached verdicts. Selection and caching are both places where a gate can be missed. The backstop
exists to find exactly those misses. Its definition, from plan.md T-C10:
runs the full gate set and full mutation corpus with
--no-cacheand no selection: before every release tag, nightly when the fast lane ran that day, and on any change to the gate engine, I/O map or key definition; any verdict the full lane produces and the fast lane missed is a drift: release blocker, the offending gate markedforce-fulluntil re-traced.
Three subcommands:
| Subcommand | What it does |
|---|---|
run |
Executes every gate uncached and with no narrowing — the ground truth. |
compare |
Diffs the fast verdicts against the full verdicts and classifies drift. |
freshness-queue |
Drains the §11.4.226 guard-freshness queue: registered guards that have never run against the current artifact. |
Run compare after run on every release candidate. A drift is a release blocker, not a warning.
sh,python3(all three subcommands require it; absent → exit2).lib/backstop_run.py,lib/backstop_compare.pyandlib/backstop_freshness.pybeside it.gate_runner.shfor the actual execution.- A gate manifest JSON enumerating the gates for
run. - No environment variables are read directly.
# 1. full uncached lane — every gate, no selection, no cache
sh scripts/fastcycle/gates/backstop.sh run \
--config gate_config.json --manifest gates.json --no-cache \
--out full_verdicts.json --jobs 4
# 2. drift comparison against the fast lane's verdicts
sh scripts/fastcycle/gates/backstop.sh compare \
--fast fast_verdicts.json --full full_verdicts.json --out drift.json
# 2b. mark every drifting gate force_full until it is re-traced
sh scripts/fastcycle/gates/backstop.sh compare \
--fast fast_verdicts.json --full full_verdicts.json --out drift.json \
--apply --map gate_map.json
# 3. which registered guards have never run on this artifact?
sh scripts/fastcycle/gates/backstop.sh freshness-queue \
--registry registry.json --fingerprint "$(cat artifact.fp)" --out queue.jsoncompare prints NO_DRIFT on success, or one DRIFT gate=<id> fast=<verdict|ABSENT> full=FAIL line
per drifting gate plus a final DRIFT_COUNT=<n>.
The C-001 table (contracts/common-conventions.md):
| Code | Meaning |
|---|---|
0 |
Clean / no drift; or a successful ordering emission (freshness-queue). |
1 |
A finding: drift found, or a run / --determinism-check FAIL. |
2 |
Usage or config error. |
4 |
BLIND — a required input could not be read, or the registry/manifest is empty, so no honest verdict is possible. |
The empty-registry 4 is deliberate and matters: you cannot compute pressure over nothing, so an empty
queue is reported as BLIND rather than as a clean "nothing stale".
A drift is a gate whose full verdict is FAIL and whose fast verdict is anything other than
FAIL. That single rule covers three distinct fast-lane failures:
- the gate was absent from the fast run — a selection hole;
- the fast run said
PASS— a stale cache entry or a wrong input set; - the fast run said
SKIPorBLIND— the gate ran but was not judged.
--apply --map marks each drifting gate's map entry force_full: true so it is never selected away
again until it has been re-traced. That is the mechanism that stops the same hole reopening.
- Empty manifest or registry. Exit
4(BLIND), never0. - A gate present in full but absent from fast. Reported as
fast=ABSENT, not as an error and not as a pass. comparewith mismatched gate universes. Gates only infastare not drifts (the rule is one-directional: full said FAIL, fast did not).--applywithout--map. A usage error — the flag needs a document to write.- Scheduling is not wired here. The release-tag / nightly / gate-engine-change triggers are
documented as obligations, not implemented as a scheduler.
fixtures/backstop/README.mdexplicitly scopes automated scheduling out of the RED test, and inventing an unverified scheduler would itself be a §11.4.6 guess. Wiringruninto the real trigger points is a separate task. freshness-queueordering.reopens_countdescending primary (§11.4.189 most-reopened-first), staleness descending secondary. A guard whose stored fingerprint matches the current fingerprint is FRESH and excluded regardless of its reopen count;last_verdict_fingerprintabsent counts as stale.
- Dispatches on the subcommand (
run,compare,freshness-queue) — anything else isexit 2with usage on stderr. - Verifies
python3is onPATH, elseexit 2. run→lib/backstop_run.py: enumerates every gate from the manifest and executes each with the cache disabled, clamped byhost_guard.sh.compare→lib/backstop_compare.py: joins the two verdict documents bygate_id, applies the drift rule, optionally rewrites map entries toforce_full.freshness-queue→lib/backstop_freshness.py: joins the guard registry against the current artifact fingerprint and orders the stale entries.- Writes
--outand exits per the table above.
Calls scripts/fastcycle/gates/lib/backstop_run.py,
scripts/fastcycle/gates/lib/backstop_compare.py,
scripts/fastcycle/gates/lib/backstop_freshness.py, scripts/fastcycle/gates/gate_runner.sh.
Guarded by scripts/fastcycle/tests/test_backstop_red.sh (T060) with fixtures under
scripts/fastcycle/tests/fixtures/backstop/.
Referenced from scripts/fastcycle/gates/mutation_reuse.py (which reads the same drift/verdict
documents).
See also docs/scripts/gate_runner.sh.md, docs/scripts/verdict_cache.py.md (the key definition whose
change is itself a listed trigger) and docs/scripts/io_trace.sh.md (the I/O map, another trigger).
2026-12-04 — bash -n scripts/fastcycle/gates/backstop.sh → exit 0. sh scripts/fastcycle/gates/backstop.sh with no subcommand prints the three-subcommand usage block on
stderr and exits 2.