fix(887): withdraw the command parser — pin the command TEXT instead

Round 4, and the third cold review found the same mechanism failing again, so it is
removed rather than patched a tenth time.

WHAT KEPT BREAKING. Three versions of this guard asked "does this command RUN the suite,
and can its failure be swallowed?" of arbitrary shell text. That predicate was wrong NINE
times across three review rounds, and twice a clause added to remove a FALSE RED opened a
FALSE GREEN on the guard's headline assertion:

  * heredoc bodies were skipped as data, but BuildKit EXECUTES `RUN <<EOF` — and the
    opener regex also fired inside quotes (`echo "tags<<__EOT__"`), which blinded the
    whole-file scan over the last 303 lines of docker-build.yml. Wrong in both directions
    at once, and measurably live on this tree.
  * `shlex.shlex` does not clear `commenters` the way `shlex.split` does, so `#`
    truncated a command mid-word — including the live `${#reports[@]}` idiom — and made
    this file's own stated residual false.
  * compound punctuation (`);`) welded two commands into one segment.
  * `npm t`, `./node_modules/.bin/vitest`, `pnpm vitest`, `yarn vitest`,
    `node …/vitest.mjs`, `timeout …`, `su -c …`, `if npm test; then` — all invisible.
  * `true || npm test` counted as the gating run while never executing it.
  * `continue-on-error: ${{ … }}` passed a check written against two literals — a
    presence test that cannot see polarity, fail-OPEN in the one direction that matters.

WHAT REPLACES IT. Nothing in the file decides what a command means any more. The commands
that may run in the two risky places are PINNED as text: the `RUN` lines of every
SPA-carrying Dockerfile stage, and the gating step's `run:` body and `if:`. A suite run
re-added in ANY spelling is simply not equal to its pin — the pin does not have to
recognise a spelling in order to reject it. A pin cannot produce a false green, only a
false red, and a false red is a human reading a diff they should have read anyway.

The population/pin split is the load-bearing distinction, and it is now stated in the
inventory: a POPULATION decides what is CHECKED, so a hand-written one goes silently
short; a PIN decides what is EXPECTED, so a stale one goes loudly red. Only the second is
safe to write by hand. Populations stay derived from the git index.

Two premises that were prose are now assertions: the publish step keeps its own
`docs_only` gate (without it, a docs-only push skips the suite and publishes anyway), and
no step other than the pinned one mentions the suite — a SUBSTRING sweep, deliberately
not a predicate, whose failure mode is a false red asking someone to look.

41 mutants, 0 missed, including all nine spellings above and the three from the previous
round. Exactly ONE is declared in `mutation_manifest.py` and re-executed every suite; the
other 40 were witnessed during development and are NOT standing — stated in the row
rather than left to be assumed.

Also fixed: the truncated sentence the round-2 rewrite left in the Dockerfile comment,
and the `web/src/api/*.guard.test.ts` glob, which over-claimed — it matches three files
and only two of them need git.

Refs: #887
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019T79beF1Ufid3dXju4yqkF
This commit is contained in:
2026-08-30 13:37:58 +02:00
co-authored by Claude Opus 5
parent 090a29db3d
commit 376aad6774
6 changed files with 408 additions and 946 deletions
+9 -7
View File
@@ -408,18 +408,20 @@ MUTATIONS: tuple[Mutation, ...] = (
target="docker/Dockerfile",
clause="RUN npm run lint && npm run typecheck && npm run build",
replacement="RUN npm run lint && npm run typecheck && npm test -- --run && npm run build",
proof="test_image_build_delegates_the_spa_suite.py::test_no_DOCKERFILE_runs_the_spa_suite",
proof="test_image_build_delegates_the_spa_suite.py::test_every_SPA_CARRYING_STAGE_runs_exactly_its_pinned_commands",
granularity=CLAUSE,
expect="runs the SPA vitest suite in a stage that has neither a git CHECKOUT nor the git BINARY",
expect="docker/Dockerfile::web-build does not run its pinned commands",
why="The target is not the guard, per the checker-guard exception: the guard IS a test, so "
"disarming it makes it absent rather than red, and the mutation goes into the guarded "
"ARTIFACT. The clause is the web-build stage's whole command line, and the replacement is "
"the defect itself rather than a caricature of it — ersatztv#883 put a vitest run back into "
"a gitless stage, and every image build failed from that commit until #887. Mutating the "
"detector's own token list instead would prove only that the detector matches its own "
"constants; this proves it reads the real Dockerfile and reports the real shape. Note the "
"mutant is UNFILTERED: a filtered run is what actually broke, but the guard forbids the "
"class, and mutating to the narrower case would leave the broader one unproven.",
"a gitless stage, and every image build failed from that commit until #887. WHAT THIS PROVES "
"IS NARROWER THAN IT LOOKS, and saying so is the point: the guard no longer decides whether "
"a command RUNS the suite (that predicate was wrong nine times across three review rounds), "
"it compares the stage's commands against a pin. So this mutation proves the pin is "
"compared and reported — not that any particular spelling is recognised, because none needs "
"to be. The mutant is deliberately the UNFILTERED spelling: the filtered one is what broke, "
"but a pin rejects both identically and choosing the narrower case would suggest otherwise.",
),
)
File diff suppressed because it is too large Load Diff