Preflight fixture self-tests: every silent-failure guard must fire on a canned fixture before a run #446

Closed
opened 2026-08-11 22:16:10 +00:00 by ben · 1 comment
Owner

Context

Learning L5 of docs/research/2026-08-11-software-factory-learnings.md: several swarm guards fail silently — if they break,
they simply never fire, and we learn during an incident. The limit-guard storm
(grep wording mismatch, 70 red runs / 92 min), GOTCHAS §17 (${VAR:?} inside
$(...) silently disabling the rail-6 backstop), GOTCHAS §16 (healer
signature collapse) are all this class. SSSF's rule: nothing spawns against a
half-valid config; health checks assert on output/content, never exit codes or
existence.

What to build

preflight-swarm.sh (same spirit as the existing zero-token
preflight-triage.sh), run at the top of run-swarm.sh before any real work.
For every guard whose failure mode is "silently never fires", feed it a canned
fixture it MUST fire on; silence = instant red, run aborts before spawning
workers.

Minimum fixture set:

  1. Limit detection (limit-lib.sh): a saved real Claude usage-limit block
    message → the detector must match it. (Would have caught the 70-red-run
    storm in 5 seconds.)
  2. Healer signature extraction (verdict-lib.sh / heal-lib.sh): a
    canned failing-stage log → non-empty, stable signature out.
  3. Rail backstops: each healer rail evaluated against a fixture that
    violates it → the rail must trip (catches the §17 class where shell
    quirks disable a rail).
  4. Verdict parsing: a canned verdict artifact → parses to the expected
    fields.
  5. Secrets presence as content: mounted secrets are non-empty files, not
    just present (check content/shape, never existence alone).

Rules: fixtures live in .sandcastle/tests/fixtures/; each is a REAL captured
artifact (or a documented minimal synthesis), dated; when a guard's target
format changes, the fixture changes in the same commit (same-commit law, as
GOTCHAS entries). Preflight red posts the failing guard name to the runlog and
Mattermost, exactly like other run-fail paths.

Acceptance criteria

  • preflight-swarm.sh wired at the top of run-swarm.sh, fails closed
  • Fixtures 1–5 present and passing on current guards
  • Deliberately breaking a guard (e.g. mangle the limit grep) turns the next
    run red at preflight with the guard named — demonstrated in a test
  • Runtime cost of a green preflight ≤ a few seconds (no network, no agent)
  • docs/GOTCHAS.md §16/§17 entries gain a "Rule" cross-reference to the
    preflight (same commit)

References

  • docs/research/2026-08-11-software-factory-learnings.md (L5)
  • Factory-in-a-Box "Where it can still fail" README section (exit-0-while-
    empty; content-not-existence) in
    disler/inkwell-agent-sandboxes-and-software-factory
## Context Learning L5 of `docs/research/2026-08-11-software-factory-learnings.md`: several swarm guards fail *silently* — if they break, they simply never fire, and we learn during an incident. The limit-guard storm (grep wording mismatch, 70 red runs / 92 min), GOTCHAS §17 (`${VAR:?}` inside `$(...)` silently disabling the rail-6 backstop), GOTCHAS §16 (healer signature collapse) are all this class. SSSF's rule: nothing spawns against a half-valid config; health checks assert on output/content, never exit codes or existence. ## What to build `preflight-swarm.sh` (same spirit as the existing zero-token `preflight-triage.sh`), run at the top of `run-swarm.sh` before any real work. For every guard whose failure mode is "silently never fires", feed it a canned fixture it MUST fire on; silence = instant red, run aborts before spawning workers. Minimum fixture set: 1. **Limit detection** (`limit-lib.sh`): a saved real Claude usage-limit block message → the detector must match it. (Would have caught the 70-red-run storm in 5 seconds.) 2. **Healer signature extraction** (`verdict-lib.sh` / `heal-lib.sh`): a canned failing-stage log → non-empty, stable signature out. 3. **Rail backstops**: each healer rail evaluated against a fixture that violates it → the rail must trip (catches the §17 class where shell quirks disable a rail). 4. **Verdict parsing**: a canned verdict artifact → parses to the expected fields. 5. **Secrets presence as content**: mounted secrets are non-empty files, not just present (check content/shape, never existence alone). Rules: fixtures live in `.sandcastle/tests/fixtures/`; each is a REAL captured artifact (or a documented minimal synthesis), dated; when a guard's target format changes, the fixture changes in the same commit (same-commit law, as GOTCHAS entries). Preflight red posts the failing guard name to the runlog and Mattermost, exactly like other run-fail paths. ## Acceptance criteria - [ ] `preflight-swarm.sh` wired at the top of `run-swarm.sh`, fails closed - [ ] Fixtures 1–5 present and passing on current guards - [ ] Deliberately breaking a guard (e.g. mangle the limit grep) turns the next run red at preflight with the guard named — demonstrated in a test - [ ] Runtime cost of a green preflight ≤ a few seconds (no network, no agent) - [ ] `docs/GOTCHAS.md` §16/§17 entries gain a "Rule" cross-reference to the preflight (same commit) ## References - `docs/research/2026-08-11-software-factory-learnings.md` (L5) - Factory-in-a-Box "Where it can still fail" README section (exit-0-while- empty; content-not-existence) in `disler/inkwell-agent-sandboxes-and-software-factory`
Author
Owner

#446 landed on main in 4f64639.

What was built: .sandcastle/preflight-swarm.sh — a zero-token, ~0.2s self-test run at the very top of run-swarm.sh (before the janitor mutates a label, before pnpm install, before any worker spawns). It fires five silently-failing guards against canned fixtures each MUST match, and reds the run — naming the guard to the runlog (EXIT-trap reason preflight-red) and Mattermost — if any stays silent. Fails closed.

Guards / fixtures (all in .sandcastle/tests/fixtures/, dated, same-commit law):

  1. Limit detection — claude_limit_hit matches a real usage-limit block (claude-usage-limit.txt) and NOT a normal log. Would have caught the 2026-07-29 storm (70 red runs / 92 min) in 5s.
  2. Healer signature extraction — seam_verdict_signal/normalize_error_line/compute_signature non-empty + stable (swarm-verdict-fail.txt; GOTCHAS §16 class).
  3. Rail backstops — every heal_rails cap (nothing-committed, multi-commit, diff-cap, self-mod) tripped against a violating synthesised checkout, plus the §17 rail-6 counter reaching 2 after two marks.
  4. Verdict parsing — writer/parser round-trip (artifact on non-zero, silent on clean, error line recovered).
  5. Secrets as content — an empty secret (secret-empty.txt) is REJECTED, a non-empty one accepted (GOTCHAS §4 class).

AC evidence:

  • Wired at the top of run-swarm.sh, fails closed ✓
  • Fixtures 1–5 present and passing on current guards ✓ (bash .sandcastle/preflight-swarm.sh → all 5 fired, 0.24s)
  • Deliberate break → red at preflight with guard named ✓ (tests/preflight-swarm-test.sh: a mangled limit grep reds naming limit_detection; a disabled rail reds naming healer_rails)
  • Green preflight ≤ a few seconds, no network/agent ✓ (~0.2s)
  • GOTCHAS §16/§17 gain a preflight "Rule" cross-reference, same commit ✓

preflight-swarm.sh is per-repo (not harness-synced), matching preflight-triage.sh. STATUS.md header + milestone log updated in the same commit.

#446 landed on main in 4f64639. **What was built:** `.sandcastle/preflight-swarm.sh` — a zero-token, ~0.2s self-test run at the very top of `run-swarm.sh` (before the janitor mutates a label, before `pnpm install`, before any worker spawns). It fires five silently-failing guards against canned fixtures each MUST match, and reds the run — naming the guard to the runlog (EXIT-trap reason `preflight-red`) and Mattermost — if any stays silent. Fails closed. **Guards / fixtures (all in `.sandcastle/tests/fixtures/`, dated, same-commit law):** 1. Limit detection — `claude_limit_hit` matches a real usage-limit block (`claude-usage-limit.txt`) and NOT a normal log. Would have caught the 2026-07-29 storm (70 red runs / 92 min) in 5s. 2. Healer signature extraction — `seam_verdict_signal`/`normalize_error_line`/`compute_signature` non-empty + stable (`swarm-verdict-fail.txt`; GOTCHAS §16 class). 3. Rail backstops — every `heal_rails` cap (nothing-committed, multi-commit, diff-cap, self-mod) tripped against a violating synthesised checkout, plus the §17 rail-6 counter reaching 2 after two marks. 4. Verdict parsing — writer/parser round-trip (artifact on non-zero, silent on clean, error line recovered). 5. Secrets as content — an empty secret (`secret-empty.txt`) is REJECTED, a non-empty one accepted (GOTCHAS §4 class). **AC evidence:** - Wired at the top of `run-swarm.sh`, fails closed ✓ - Fixtures 1–5 present and passing on current guards ✓ (`bash .sandcastle/preflight-swarm.sh` → all 5 fired, 0.24s) - Deliberate break → red at preflight with guard named ✓ (`tests/preflight-swarm-test.sh`: a mangled limit grep reds naming `limit_detection`; a disabled rail reds naming `healer_rails`) - Green preflight ≤ a few seconds, no network/agent ✓ (~0.2s) - GOTCHAS §16/§17 gain a preflight "Rule" cross-reference, same commit ✓ `preflight-swarm.sh` is per-repo (not harness-synced), matching `preflight-triage.sh`. STATUS.md header + milestone log updated in the same commit.
ben closed this issue 2026-08-11 23:53:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#446
No description provided.