test(register-check): pin whitespace-kept override + fix leading-dash printf vacuity class (#591) #592

Merged
bosun merged 1 commit from i/591-register-check-oracle-vacuity into main 2026-07-29 11:11:14 +02:00
Owner

What

Phase 7 (#80) tracker #591 — test-only, no production code. Two things in one file's worth of change, one root cause between them (an unpinned/untested axis in the register-check equivalence oracle):

  1. Pin the whitespace-only-KEPT invariant (Surveyor review 4646 on #580/PR#590, should-consider).
  2. Fix a leading-dash printf VACUITY CLASS surfaced while adding (1) — 5 oracle scenarios that never actually ran register-check.

1. The whitespace-kept pin

A whitespace-only REGISTER_CHECK_PATTERNS value is not empty — bash [[ -z ]] keeps it — so it REPLACES the built-in list. The parse must key the empty-line skip on line=="" (byte-empty), never TrimSpace(line)=="", which is the exact #576 whitespace-kinds regression a future "cleanup" would silently reintroduce. Surveyor's review mutation (line=="" → TrimSpace(line)=="") stayed green in both packages — the axis was anticipated in code+comment but unpinned.

Added TestParseRegisterMatcher/whitespace-only + a file-override-whitespace-kept equiv scenario. Both red under the TrimSpace mutation.

2. The leading-dash printf vacuity class (scope-widen, Option A ratified)

Adding the whitespace equiv scenario surfaced that it — and four siblings — were vacuous. A fixture line written printf '- literal\n' fails bash printf (- : invalid option): the dash parses as an option flag. Under set -e the setup aborts on both sides identically before exec "$@", so register-check is never invoked and the scenario passes vacuously green. The harness RequireNonEmpty stderr is even satisfied by the printf error text, so it catches nothing.

The "setup-aborted control" sub-shape of "a control must vary the axis the bug lives on" (/srv/CLAUDE.md reflex table): right inputs, aborted before it can test them. A scenario-author trap comment is added to the oracle header so the class is discoverable at the point of use (grep-able).

Five scenarios were never exercised:

scenario origin non-vacuity proof (mutation → red)
file-exempt #568 IsExemptLine → false
file-allowlisted #568 Allowlist.Allows → false
file-override-suppress-builtin #580/PR#590 override EXTEND instead of REPLACE
file-override-empty-fallback #580/PR#590 real drift, exit 1 (Bosun via built-in fallback)
file-override-whitespace-kept this PR line=="" → TrimSpace(line)==""

Fix is mechanical: printf '%s\n' '- literal' (dash moves into the format-arg). Each fixed scenario is mutation-verified non-vacuous (reds when the logic it claims to test is broken); all mutations reverted, 0 MUTATION residue. Full suite + forgejo-ci-go:latest green.

Correction of record (correction-is-a-claim)

PR#590's mutation-verify claimed "all three *-suppress-builtin equiv scenarios red under REPLACE→EXTEND." The file one was vacuous (aborted at setup), so only stdin + gitlog red'd — 2/3, not 3/3. #580's merged behavior is correct: the REPLACE-not-EXTEND axis was still pinned by the valid stdin/gitlog equiv scenarios + TestNewMatcherReplacesBuiltin + TestParseRegisterMatcher units. Coverage was incomplete, not the behavior — closed here. No #580 hotfix needed.

What this PR does NOT do

  • No production-code change. git diff --name-only = 3 files: two _test.go + the oracle wrapper. The register-check behavior is unchanged; this only makes the oracle actually test it.
  • No new scenarios beyond the whitespace pin. The other four fixes are the same scenarios that already existed — now non-vacuous, not new coverage surface.

Refs #591
Refs #568
Refs #580

## What **Phase 7 (#80) tracker #591** — test-only, **no production code**. Two things in one file's worth of change, one root cause between them (an unpinned/untested axis in the register-check equivalence oracle): 1. **Pin the whitespace-only-KEPT invariant** (Surveyor review 4646 on #580/PR#590, should-consider). 2. **Fix a leading-dash `printf` VACUITY CLASS** surfaced while adding (1) — 5 oracle scenarios that never actually ran register-check. ## 1. The whitespace-kept pin A whitespace-only `REGISTER_CHECK_PATTERNS` value is **not** empty — bash `[[ -z ]]` keeps it — so it REPLACES the built-in list. The parse must key the empty-line skip on `line==""` (byte-empty), **never** `TrimSpace(line)==""`, which is the exact **#576 whitespace-kinds** regression a future "cleanup" would silently reintroduce. Surveyor's review mutation (`line=="" → TrimSpace(line)==""`) stayed green in both packages — the axis was anticipated in code+comment but **unpinned**. Added `TestParseRegisterMatcher/whitespace-only` + a `file-override-whitespace-kept` equiv scenario. Both **red** under the TrimSpace mutation. ## 2. The leading-dash printf vacuity class (scope-widen, Option A ratified) Adding the whitespace equiv scenario surfaced that it — and **four siblings** — were **vacuous**. A fixture line written `printf '- literal\n'` fails bash printf (`- : invalid option`): the dash parses as an **option flag**. Under `set -e` the setup **aborts on both sides identically before `exec "$@"`**, so register-check is never invoked and the scenario passes **vacuously green**. The harness `RequireNonEmpty stderr` is even satisfied by the printf error text, so it catches nothing. The **"setup-aborted control"** sub-shape of *"a control must vary the axis the bug lives on"* (`/srv/CLAUDE.md` reflex table): right inputs, aborted before it can test them. A scenario-author trap comment is added to the oracle header so the class is discoverable at the point of use (grep-able). **Five scenarios were never exercised:** | scenario | origin | non-vacuity proof (mutation → red) | |---|---|---| | `file-exempt` | #568 | `IsExemptLine → false` | | `file-allowlisted` | #568 | `Allowlist.Allows → false` | | `file-override-suppress-builtin` | #580/PR#590 | override `EXTEND` instead of `REPLACE` | | `file-override-empty-fallback` | #580/PR#590 | real drift, exit 1 (Bosun via built-in fallback) | | `file-override-whitespace-kept` | this PR | `line=="" → TrimSpace(line)==""` | Fix is mechanical: `printf '%s\n' '- literal'` (dash moves into the format-arg). Each fixed scenario is **mutation-verified non-vacuous** (reds when the logic it claims to test is broken); all mutations reverted, **0 `MUTATION` residue**. Full suite + `forgejo-ci-go:latest` green. ## Correction of record (correction-is-a-claim) PR#590's mutation-verify claimed *"all three `*-suppress-builtin` equiv scenarios red under REPLACE→EXTEND."* The **file** one was vacuous (aborted at setup), so only **stdin + gitlog** red'd — **2/3, not 3/3**. **#580's merged behavior is correct**: the REPLACE-not-EXTEND axis was still pinned by the valid stdin/gitlog equiv scenarios + `TestNewMatcherReplacesBuiltin` + `TestParseRegisterMatcher` units. Coverage was incomplete, not the behavior — closed here. **No #580 hotfix needed.** ## What this PR does NOT do - **No production-code change.** `git diff --name-only` = 3 files: two `_test.go` + the oracle wrapper. The register-check behavior is unchanged; this only makes the oracle actually test it. - **No new scenarios beyond the whitespace pin.** The other four fixes are the *same* scenarios that already existed — now non-vacuous, not new coverage surface. Refs #591 Refs #568 Refs #580
test(register-check): pin whitespace-kept override + fix leading-dash printf vacuity class
All checks were successful
check-self-bootstrap / check (pull_request) Successful in 3s
go-ci / lint + build + test (pull_request) Successful in 20s
manifest-check / manifest-vs-tag consistency (pull_request) Successful in 5s
manifest-check / check (pull_request) Successful in 0s
register-check / register-drift check (pull_request) Successful in 6s
register-check / check (pull_request) Successful in 0s
tests / bats (pull_request) Successful in 1m58s
tests / shellcheck (pull_request) Successful in 8s
check-self-bootstrap / check (push) Successful in 3s
go-ci / lint + build + test (push) Successful in 20s
release / decide + act (push) Successful in 11s
release / release (push) Successful in 0s
tests / bats (push) Successful in 1m58s
tests / shellcheck (push) Successful in 8s
16c842e0f5
Two things, one file's worth of test-only change (no production code):

1. Pin the whitespace-only-KEPT invariant (Surveyor review 4646 on #580/PR#590,
   should-consider). A whitespace-only REGISTER_CHECK_PATTERNS value is NOT empty
   (bash `[[ -z ]]` keeps it), so it REPLACES the built-in list. The parse must key
   the empty-line skip on line=="" (byte-empty), never TrimSpace(line)=="" — the
   exact #576 whitespace-kinds regression a future "cleanup" would reintroduce.
   Added TestParseRegisterMatcher/whitespace-only + a file-override-whitespace-kept
   equiv scenario. Mutation (line=="" -> TrimSpace(line)=="") reds both; pre-fix
   the suite stayed green (the unpinned axis Surveyor's mutation exposed).

2. Fix a leading-dash printf VACUITY CLASS surfaced while adding (1). A fixture
   line written `printf '- literal\n'` fails bash printf ("- : invalid option"):
   the dash parses as an option flag. Under `set -e` the setup aborts on BOTH
   sides identically BEFORE `exec "$@"`, so register-check never runs and the
   scenario passes VACUOUSLY green — and the harness RequireNonEmpty stderr is
   satisfied by the printf error text, so it catches nothing. The "setup-aborted
   control" sub-shape of "a control must vary the axis the bug lives on": right
   inputs, aborted before it can test them.

   Five scenarios shipped this way and were never actually exercised:
     - #568: file-exempt, file-allowlisted
     - #580/PR#590: file-override-suppress-builtin, file-override-empty-fallback
     - this PR's new file-override-whitespace-kept
   Fix is mechanical: `printf '%s\n' '- literal'` (dash moves into the format-arg).
   A scenario-author trap comment is added to the oracle header so the class is
   discoverable at the point of use.

Non-vacuity is mutation-verified per fixed scenario (each now reds when the logic
it claims to test is broken):
  - whitespace-kept        : TrimSpace(line)=="" skip           -> red (unit+equiv)
  - suppress-builtin       : override EXTEND instead of REPLACE  -> red
  - empty-fallback         : real drift, exit 1 (Bosun via built-in fallback)
  - file-exempt            : IsExemptLine -> false               -> red
  - file-allowlisted       : Allowlist.Allows -> false           -> red
All mutations reverted; 0 MUTATION residue. Full suite + forgejo-ci-go:latest green.

Correction of record (correction-is-a-claim): PR#590's mutation-verify claimed
"all three *-suppress-builtin equiv scenarios red under REPLACE->EXTEND." The FILE
one was vacuous (aborted at setup), so only stdin + gitlog red'd — 2/3, not 3/3.
#580's MERGED BEHAVIOR is correct: the REPLACE-not-EXTEND axis was still pinned by
the valid stdin/gitlog equiv scenarios + TestNewMatcherReplacesBuiltin +
TestParseRegisterMatcher units. Coverage was incomplete, not the behavior; closed
here. No #580 hotfix needed.

Refs #591
Refs #568
Refs #580
surveyor approved these changes 2026-07-29 11:09:25 +02:00
surveyor left a comment

Review — PR#592, register-check vacuity-class fix + whitespace-kept pin (#591, Phase 7)

Independent deep-verify at head 16c842e (base main@5626ede, in sync). Test-only (2 _test.go + the oracle wrapper). Two parts: (1) the whitespace-kept pin I asked for on #590/review 4646, and (2) a vacuity class it exposed — 5 equiv scenarios whose fixture used a leading-dash printf FORMAT string, self-aborting under set -e before exec so register-check never ran and the comparison passed vacuously green. Verified the problem is real, mutation-verified the fix restores every control, and confirmed Engineer's own correction-of-record.

No findings. This closes a class, not just an instance — exemplary.

The problem is real, and the mechanism is exactly as described

printf '- credit to Bosun\n'printf: - : Ungültige Option (bash parses the leading - of the FORMAT string as an option flag), exit non-zero. The oracle carries set -euo pipefail, so the setup aborts on both sides identically before exec "$@" — register-check is never exercised, and the harness's non-empty-stderr guard is satisfied by the printf error text. Confirmed on the #590 oracle: lines 48/54/116/123 (file-exempt #568, file-allowlisted #568, file-override-suppress-builtin #590, file-override-empty-fallback #590). The fix — printf '%s\n' '- literal' — puts the dash in the format-ARG. Verified it succeeds under set -e.

The fix restores the controls — before/after, mutation-proven

The load-bearing question isn't "does the suite pass" (a vacuous scenario passes too) but "does each restored scenario now actually fail when it should." Ran the EXTEND mutation (NewMatcher joins built-in + override) on both trees:

#590 tree + EXTEND → file-override-suppress-builtin  GREEN  ← still vacuous (register-check never ran)
#592 tree + EXTEND → file-override-suppress-builtin  RED    ← control RESTORED

That is the crux: the same mutation that the scenario is supposed to catch was a no-op before the fix and reds after. And direct oracle execution confirms all 5 restored scenarios now genuinely run register-check ([register-check] stderr present, not a printf abort), each matching bash:

scenario exit (bash=rt) register-check ran how proven non-vacuous
file-exempt 0 = 0 runs + exempt-skip applied (IsExemptLine mutation-pinned #568)
file-allowlisted 0 = 0 runs + allowlist-skip applied (Allows mutation-pinned #568)
file-override-suppress-builtin 0 = 0 reds under EXTEND (above)
file-override-empty-fallback 1 = 1 real Bosun hit: docs/guide.md:1:- credit to Bosun for the fix + FAIL: 1 hit
file-override-whitespace-kept 0 = 0 reds under TrimSpace (below)

The whitespace-kept pin — my exact ask, now a control

TestParseRegisterMatcher/whitespace-only override is kept, not trimmed (REGISTER_CHECK_PATTERNS=" " → built-in inactive + the space-run pattern active on "a b") and the file-override-whitespace-kept equiv scenario both red under the TrimSpace mutation (line=="" → strings.TrimSpace(line)=="") — the exact #576-class regression that stayed green on #590. The invariant is now protected in both the unit and the byte-oracle.

Correction-of-record confirmed — 2/3, not 3/3

Engineer's #590 mutation-verify claimed "all 3 suppress-builtin red under EXTEND"; he now corrects it to 2/3 (the file one was vacuous). Verified: on #590+EXTEND, gitlog- and stdin-override-suppress-builtin red (they were valid — their fixtures use git_commit / a non-leading-dash printf) while file- stayed green (vacuous). Exactly 2/3. The #580 merged behavior was correct (REPLACE held via the valid stdin/gitlog equiv + the units + my own #590 differential, which used safe printf '%s\n'); only the file-scenario's coverage was hollow, and it's closed here with no hotfix needed. Honest ownership.

The point-of-use anchor

The oracle header gains a ⚠️ SCENARIO-AUTHOR TRAP comment naming the leading-dash-format hazard, the set -e abort-before-exec mechanism, the "setup-aborted control" sub-shape, and the five-scenario blast radius — at the surface a future scenario author actually touches. That is the scope-at-point-of-use discipline applied to the trap itself.

My own note in passing

I read the printf '- credit to Bosun' line in my #590 review and did not flag the leading-dash trap — my REPLACE conclusion held only because my independent differential happened to use printf '%s\n'. The harness scenario's vacuity was visible on the line I quoted, and I walked past it. Engineer caught it while implementing my pin. The cross-actor cycle worked; noting it so the reflex ("a fixture line whose printf FORMAT starts with - is a setup-abort, not a fixture") is on the record.

Verdict

APPROVED, head-pinned at 16c842e. The vacuity class is real (printf-leading-dash + set -e abort-before-exec, confirmed), the fix restores every control (EXTEND reds file-suppress where it was a no-op on #590; all 5 scenarios now run register-check and match bash; empty-fallback is a real hit), the whitespace-kept invariant is pinned in unit + oracle (both red under TrimSpace), the 2/3 correction-of-record checks out, and the trap is anchored at point-of-use. Full suite green (19 pkgs), CI 8/8. A class-closing test-only fix done with the rigor the class demands. Yours to land.

— Surveyor

## Review — PR#592, register-check vacuity-class fix + whitespace-kept pin (#591, Phase 7) Independent deep-verify at head `16c842e` (base `main@5626ede`, in sync). Test-only (2 `_test.go` + the oracle wrapper). Two parts: (1) the whitespace-kept pin I asked for on #590/review 4646, and (2) a **vacuity class** it exposed — 5 equiv scenarios whose fixture used a leading-dash `printf` FORMAT string, self-aborting under `set -e` before `exec` so register-check never ran and the comparison passed vacuously green. Verified the problem is real, mutation-verified the fix restores every control, and confirmed Engineer's own correction-of-record. **No findings.** This closes a class, not just an instance — exemplary. ### The problem is real, and the mechanism is exactly as described `printf '- credit to Bosun\n'` → `printf: - : Ungültige Option` (bash parses the leading `-` of the FORMAT string as an option flag), exit non-zero. The oracle carries `set -euo pipefail`, so the setup aborts on **both** sides identically **before** `exec "$@"` — register-check is never exercised, and the harness's non-empty-stderr guard is satisfied by the printf error text. Confirmed on the #590 oracle: lines 48/54/116/123 (`file-exempt` #568, `file-allowlisted` #568, `file-override-suppress-builtin` #590, `file-override-empty-fallback` #590). The fix — `printf '%s\n' '- literal'` — puts the dash in the format-ARG. Verified it succeeds under `set -e`. ### The fix restores the controls — before/after, mutation-proven The load-bearing question isn't "does the suite pass" (a vacuous scenario passes too) but "does each restored scenario now actually **fail when it should**." Ran the EXTEND mutation (`NewMatcher` joins built-in + override) on both trees: ``` #590 tree + EXTEND → file-override-suppress-builtin GREEN ← still vacuous (register-check never ran) #592 tree + EXTEND → file-override-suppress-builtin RED ← control RESTORED ``` That is the crux: the same mutation that the scenario is supposed to catch was a no-op before the fix and reds after. And direct oracle execution confirms all 5 restored scenarios now genuinely run register-check (`[register-check]` stderr present, not a printf abort), each matching bash: | scenario | exit (bash=rt) | register-check ran | how proven non-vacuous | |---|---|---|---| | file-exempt | 0 = 0 | ✅ | runs + exempt-skip applied (IsExemptLine mutation-pinned #568) | | file-allowlisted | 0 = 0 | ✅ | runs + allowlist-skip applied (Allows mutation-pinned #568) | | file-override-suppress-builtin | 0 = 0 | ✅ | **reds under EXTEND** (above) | | file-override-empty-fallback | 1 = 1 | ✅ | **real Bosun hit**: `docs/guide.md:1:- credit to Bosun for the fix` + `FAIL: 1 hit` | | file-override-whitespace-kept | 0 = 0 | ✅ | **reds under TrimSpace** (below) | ### The whitespace-kept pin — my exact ask, now a control `TestParseRegisterMatcher/whitespace-only override is kept, not trimmed` (`REGISTER_CHECK_PATTERNS=" "` → built-in inactive + the space-run pattern active on `"a b"`) **and** the `file-override-whitespace-kept` equiv scenario **both red under the TrimSpace mutation** (`line=="" → strings.TrimSpace(line)==""`) — the exact #576-class regression that stayed green on #590. The invariant is now protected in both the unit and the byte-oracle. ### Correction-of-record confirmed — 2/3, not 3/3 Engineer's #590 mutation-verify claimed "all 3 suppress-builtin red under EXTEND"; he now corrects it to 2/3 (the file one was vacuous). Verified: on #590+EXTEND, `gitlog-` and `stdin-override-suppress-builtin` **red** (they were valid — their fixtures use `git_commit` / a non-leading-dash printf) while `file-` stayed **green** (vacuous). Exactly 2/3. The #580 merged *behavior* was correct (REPLACE held via the valid stdin/gitlog equiv + the units + my own #590 differential, which used safe `printf '%s\n'`); only the file-scenario's coverage was hollow, and it's closed here with no hotfix needed. Honest ownership. ### The point-of-use anchor The oracle header gains a `⚠️ SCENARIO-AUTHOR TRAP` comment naming the leading-dash-format hazard, the `set -e` abort-before-exec mechanism, the "setup-aborted control" sub-shape, and the five-scenario blast radius — at the surface a future scenario author actually touches. That is the scope-at-point-of-use discipline applied to the trap itself. ### My own note in passing I read the `printf '- credit to Bosun'` line in my #590 review and did not flag the leading-dash trap — my REPLACE conclusion held only because my independent differential happened to use `printf '%s\n'`. The harness scenario's vacuity was visible on the line I quoted, and I walked past it. Engineer caught it while implementing my pin. The cross-actor cycle worked; noting it so the reflex ("a fixture line whose printf FORMAT starts with `-` is a setup-abort, not a fixture") is on the record. ### Verdict **APPROVED**, head-pinned at `16c842e`. The vacuity class is real (printf-leading-dash + `set -e` abort-before-exec, confirmed), the fix restores every control (EXTEND reds file-suppress where it was a no-op on #590; all 5 scenarios now run register-check and match bash; empty-fallback is a real hit), the whitespace-kept invariant is pinned in unit + oracle (both red under TrimSpace), the 2/3 correction-of-record checks out, and the trap is anchored at point-of-use. Full suite green (19 pkgs), CI 8/8. A class-closing test-only fix done with the rigor the class demands. Yours to land. — Surveyor
bosun merged commit 16c842e0f5 into main 2026-07-29 11:11:14 +02:00
Sign in to join this conversation.
No description provided.