tests: two offline suites red on clean main — rehearsal-healer-test leaks the real .env drive issue (#492≠378), preflight-swarm-test asserts stale output #537

Closed
opened 2026-08-14 17:29:54 +00:00 by ben · 3 comments
Owner

Found 2026-08-14 while landing #510 (both reds reproduce on clean main BEFORE the #510 diff — baselined via stash).

  1. rehearsal-healer-test.sh — scenario 1 fails no #378 healer comment. The reporter under test echoes drive issue #492 stays armed: the test's fixtures expect REHEARSAL_DRIVE_ISSUE=378 but the harness lets the real .sandcastle/.env (492 today) leak through. Pin the env in the test harness (REHEARSAL_DRIVE_ISSUE=378 in the invocation env, or point at a fixture .env) so the suite is hermetic — the 378→492 re-mint broke it silently.
  2. preflight-swarm-test.sh — fails green preflight did not report all guards fired while the captured output ends all 6 guards fired. The assertion is drifted from the preflight's current output shape; re-pin it.

Both are offline suites — no lab needed. Acceptance: both suites green on clean main; the healer suite stays green with any REHEARSAL_DRIVE_ISSUE value in .sandcastle/.env.

Why human

Nothing — ready-for-agent; found by session, filed under ADR 0174.

Found 2026-08-14 while landing #510 (both reds reproduce on clean `main` BEFORE the #510 diff — baselined via stash). 1. **`rehearsal-healer-test.sh`** — scenario 1 fails `no #378 healer comment`. The reporter under test echoes `drive issue #492 stays armed`: the test's fixtures expect `REHEARSAL_DRIVE_ISSUE=378` but the harness lets the real `.sandcastle/.env` (492 today) leak through. Pin the env in the test harness (`REHEARSAL_DRIVE_ISSUE=378` in the invocation env, or point at a fixture .env) so the suite is hermetic — the 378→492 re-mint broke it silently. 2. **`preflight-swarm-test.sh`** — fails `green preflight did not report all guards fired` while the captured output ends `all 6 guards fired`. The assertion is drifted from the preflight's current output shape; re-pin it. Both are offline suites — no lab needed. Acceptance: both suites green on clean main; the healer suite stays green with any `REHEARSAL_DRIVE_ISSUE` value in `.sandcastle/.env`. ## Why human Nothing — `ready-for-agent`; found by session, filed under ADR 0174.
Author
Owner

Blocked — this is a protected-path (.sandcastle/) machinery change; a human must apply it.

Both target files live under .sandcastle/tests/, which is a fingerprinted protected path (protected-paths-lib.sh, ADR/#445). A Sandcastle agent cannot edit them: any change is rolled back and the run fails loud. #537 is itself a .sandcastle/ machinery-fix request and was mis-triaged as ready-for-agent; routing to ready-for-human per the escape path in CLAUDE.md rule 9.

I confirmed both reds reproduce on clean main and diagnosed both fixes precisely — they are one-liners:

1. preflight-swarm-test.sh:14 — assertion drifted. The preflight now fires 6 guards (a close_report guard was added; output ends all 6 guards fired), but the test asserts:

grep -q 'all 5 guards fired' <<<"$out" || fail "green preflight did not report all guards fired: ...

Fix: all 5 guards fired → all 6 guards fired.

2. rehearsal-healer-test.sh:12 — harness not hermetic. The export line sets PATH/FORGEJO_TOKEN/REHEARSAL_STATE etc. but never pins REHEARSAL_DRIVE_ISSUE, so rehearsal-report.sh falls back to its own : "${REHEARSAL_DRIVE_ISSUE:=492}" default (the current 378→492 re-mint) — 492 leaks past the fixtures, which are hardcoded to 378 (e.g. */issues/378/comments, and the assertion grep -q '378/comments' || fail "no #378 healer comment" at line 115). Fix: add REHEARSAL_DRIVE_ISSUE=378 to the exported env on line 12 so the suite is hermetic regardless of .sandcastle/.env.

Both suites are offline; no lab needed. After the two edits both go green, and the healer suite stays green for any REHEARSAL_DRIVE_ISSUE value in .sandcastle/.env (acceptance).

Reproduction evidence (clean main, this run):

rehearsal-healer-test.sh  → FAIL: no #378 healer comment
preflight-swarm-test.sh   → FAIL: green preflight did not report all guards fired  (output: "all 6 guards fired")

— found by run 6236 (#537), under ADR 0174.

**Blocked — this is a protected-path (`.sandcastle/`) machinery change; a human must apply it.** Both target files live under `.sandcastle/tests/`, which is a fingerprinted **protected path** (`protected-paths-lib.sh`, ADR/#445). A Sandcastle agent cannot edit them: any change is rolled back and the run fails loud. #537 is itself a `.sandcastle/` machinery-fix request and was mis-triaged as `ready-for-agent`; routing to `ready-for-human` per the escape path in `CLAUDE.md` rule 9. I confirmed both reds reproduce on clean `main` and diagnosed both fixes precisely — they are one-liners: **1. `preflight-swarm-test.sh:14`** — assertion drifted. The preflight now fires **6** guards (a `close_report` guard was added; output ends `all 6 guards fired`), but the test asserts: ``` grep -q 'all 5 guards fired' <<<"$out" || fail "green preflight did not report all guards fired: ... ``` Fix: `all 5 guards fired` → `all 6 guards fired`. **2. `rehearsal-healer-test.sh:12`** — harness not hermetic. The export line sets `PATH/FORGEJO_TOKEN/REHEARSAL_STATE` etc. but never pins `REHEARSAL_DRIVE_ISSUE`, so `rehearsal-report.sh` falls back to its own `: "${REHEARSAL_DRIVE_ISSUE:=492}"` default (the current 378→492 re-mint) — 492 leaks past the fixtures, which are hardcoded to **378** (e.g. `*/issues/378/comments`, and the assertion `grep -q '378/comments' || fail "no #378 healer comment"` at line 115). Fix: add `REHEARSAL_DRIVE_ISSUE=378` to the exported env on line 12 so the suite is hermetic regardless of `.sandcastle/.env`. Both suites are offline; no lab needed. After the two edits both go green, and the healer suite stays green for any `REHEARSAL_DRIVE_ISSUE` value in `.sandcastle/.env` (acceptance). Reproduction evidence (clean `main`, this run): ``` rehearsal-healer-test.sh → FAIL: no #378 healer comment preflight-swarm-test.sh → FAIL: green preflight did not report all guards fired (output: "all 6 guards fired") ``` — found by run 6236 (#537), under ADR 0174.
Author
Owner

Relabelled ready-for-session under ADR 0174: both suites live under .sandcastle/tests/ — a #445 protected path, so swarm workers must not fix them, but no Ben input is needed. The session-runner (or a live session) lands the hermetic-env pin + assertion re-pin.

Relabelled `ready-for-session` under ADR 0174: both suites live under `.sandcastle/tests/` — a #445 protected path, so swarm workers must not fix them, but no Ben input is needed. The session-runner (or a live session) lands the hermetic-env pin + assertion re-pin.
Author
Owner

Ruled by agent under ADR 0174 — veto anytime. Two-way door: both fixes are
test-file-only edits, revertible with a commit, proven by re-running the
suites (including under a fabricated ambient REHEARSAL_DRIVE_ISSUE=999 to
demonstrate hermeticity per the acceptance criteria). No production script
touched.

What landed (1f5444a on main):

  • .sandcastle/tests/rehearsal-healer-test.sh — the suite never exported
    REHEARSAL_DRIVE_ISSUE, so it inherited whatever the ambient host
    environment had (.sandcastle/.env's REHEARSAL_DRIVE_ISSUE, currently
    523 on this workstation, not the 492 the ticket cited — it's re-minted
    independently, #493). The suite's fixtures/assertions are hardcoded to
    #378. Fix: export REHEARSAL_DRIVE_ISSUE=378 at the top of the
    harness, alongside the other test-only env pins.
  • .sandcastle/tests/preflight-swarm-test.sh — asserted all 5 guards fired; preflight-swarm.sh now runs 6 (the close-report guard landed
    with #444 after this assertion was written). Re-pinned to all 6 guards fired.

Proof:

  • bash .sandcastle/tests/rehearsal-healer-test.sh → OK: 12 cases, exit 0.
  • REHEARSAL_DRIVE_ISSUE=999 bash .sandcastle/tests/rehearsal-healer-test.sh
    → same result, exit 0 — confirms hermeticity to any ambient value, per
    the ticket's acceptance criterion.
  • bash .sandcastle/tests/preflight-swarm-test.sh →
    preflight-swarm: 3 scenarios passed, exit 0.
  • Both reproduced red on clean main before the fix (stash-baselined),
    matching the ticket's own baseline.

Scope note: a full .sandcastle/tests/*.sh sweep on clean main found
3 more pre-existing reds outside this ticket's two suites — heal-test.sh,
list-ready-tasks-test.sh (both already flagged pre-existing by #531's
close-report), and session-runner-test.sh (newly observed, and
non-deterministic across two runs — looks racy). list-ready-tasks-test.sh's
failure (the standing drive issue #492 must not be surfaced) looks like
the same hardcoded-fixture-vs-ambient-env shape this ticket just fixed.
Filed as #586 to keep this ticket's diff scoped to the two suites it named.

STATUS.md updated in the same commit.

Ruled by agent under ADR 0174 — veto anytime. Two-way door: both fixes are test-file-only edits, revertible with a commit, proven by re-running the suites (including under a fabricated ambient `REHEARSAL_DRIVE_ISSUE=999` to demonstrate hermeticity per the acceptance criteria). No production script touched. **What landed** (1f5444a on `main`): - `.sandcastle/tests/rehearsal-healer-test.sh` — the suite never exported `REHEARSAL_DRIVE_ISSUE`, so it inherited whatever the ambient host environment had (`.sandcastle/.env`'s `REHEARSAL_DRIVE_ISSUE`, currently 523 on this workstation, not the 492 the ticket cited — it's re-minted independently, #493). The suite's fixtures/assertions are hardcoded to `#378`. Fix: `export REHEARSAL_DRIVE_ISSUE=378` at the top of the harness, alongside the other test-only env pins. - `.sandcastle/tests/preflight-swarm-test.sh` — asserted `all 5 guards fired`; `preflight-swarm.sh` now runs 6 (the close-report guard landed with #444 after this assertion was written). Re-pinned to `all 6 guards fired`. **Proof:** - `bash .sandcastle/tests/rehearsal-healer-test.sh` → `OK: 12 cases`, exit 0. - `REHEARSAL_DRIVE_ISSUE=999 bash .sandcastle/tests/rehearsal-healer-test.sh` → same result, exit 0 — confirms hermeticity to *any* ambient value, per the ticket's acceptance criterion. - `bash .sandcastle/tests/preflight-swarm-test.sh` → `preflight-swarm: 3 scenarios passed`, exit 0. - Both reproduced red on clean `main` before the fix (stash-baselined), matching the ticket's own baseline. **Scope note:** a full `.sandcastle/tests/*.sh` sweep on clean `main` found 3 more pre-existing reds outside this ticket's two suites — `heal-test.sh`, `list-ready-tasks-test.sh` (both already flagged pre-existing by #531's close-report), and `session-runner-test.sh` (newly observed, and non-deterministic across two runs — looks racy). `list-ready-tasks-test.sh`'s failure (`the standing drive issue #492 must not be surfaced`) looks like the same hardcoded-fixture-vs-ambient-env shape this ticket just fixed. Filed as #586 to keep this ticket's diff scoped to the two suites it named. STATUS.md updated in the same commit.
ben closed this issue 2026-08-15 08:44:44 +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#537
No description provided.