rehearsal healer: rule 1 refuses a MOVED assertion (and a fixture literal → parameter) as a weakened check — two harness reds on phase 9 were refused, then landed verbatim by a session; narrow the rule's edge (drive refinement) #1501

Closed
opened 2026-09-15 19:31:36 +00:00 by ben · 1 comment
Owner

Symptom

On phase 9 (#1491, GREEN 2026-09-15) the healer diagnosed two harness reds correctly, proposed the right fix, and then refused its own fix under rule 1 ("never weaken what a check proves") because the diff touched an expect(...) line — and a session-runner agent later landed the identical change verbatim, ruling the healer right under ADR 0174. Each round trip cost the drive a re-stage and a rental:

fire red what the fix did refused as filed landed verbatim red → refire
1 place-files moved the read-back (assertion text + expected value unchanged) below the Continue that saves the placement rule 1 (healer: fix would weaken a check (assertion/leg/skip)) #1493 15:42Z 41fe5cea 15:53Z, #1493 closed 15:54Z ~14 min (refire 20260915T155605Z)
4 sign-in replaced a hardcoded expected value ('E2E Drive') in a shared fixture with a per-call parameter, the caller passing the name the journey actually types rule 1 ("The fix changes an expectation VALUE") #1498 17:41Z 14e37aae 17:50Z ~19 min (refire 20260915T180007Z, part of it waiting on the capacity slot the fixing session itself held)

For comparison the confident fast-lane landing on fire 3 (#1497, a887852b) went red → refire in ~1 min. Rule 1 exists for the #1113 lesson (the cheap move on a real defect is to loosen the assertion) and must keep biting on that; the two cases above are not that.

Where it bites

.sandcastle/rehearsal-heal-lib.sh:52 — the rule is a diff grep: any removed line matching expect( / .toBe / .toContain / assert… / require.… trips it. That cannot tell a weakened check from:

  1. A moved check — the same assertion line is removed at one place and added back, byte-for-byte (modulo indentation), elsewhere in the same diff. Fire 1. Nothing about what the check proves changed; only when it runs.
  2. A fixture literal replaced by the caller's own truth — an expected value that was a hardcoded string in a shared fixture becomes a parameter, and the added lines pass the journey's actual input (here the slug-derived community name). Fire 4. This one is a genuine expectation change and arguably still deserves a second pair of eyes — but the healer had already found the in-tree precedent (journey.device.spec.ts:1032-1035 fixed the same drift the same way).

Proposal (two-way door; the rule stays, its edge narrows)

  • Case 1 (moved check): not a weakening. In rehearsal_heal_weakens_check (or wherever :52 lives), pair each removed assertion line with the added lines: if every removed expect/assert/require line reappears as an added line with identical content after trimming leading whitespace, the diff moved checks and rule 1 does not fire. A removed assertion with no verbatim twin still trips the rule. Add the case to .sandcastle/tests/rehearsal-healer-test.sh beside healed-assertion: a healer diff that moves expect(count).toBe(1) down three lines must LAND; one that changes it to toBe(2) must still be refused.
  • Case 2 (expectation value → parameter): keep refusing, but route it faster. Leave rule 1 as is for value changes. Instead have the refusal ticket carry ready-for-agent when the healer's own diagnosis names an in-tree precedent for the same change (as #1498's did), so the swarm plugs it on its next 2-minute tick instead of the session-runner's 10-minute tick — or, if Ben prefers, keep ready-for-session and accept the tax. State which in the close-report.

Acceptance

  • rehearsal-healer-test.sh gains a "moved assertion lands, changed assertion refused" pair, green.
  • rehearsal-heal-prompt.md rule 1 wording tells the healer a moved check is allowed so it stops pre-emptively choosing file for that case.
  • A retrospective line in the ticket's close-report re-runs fire 1's diff (41fe5cea) through the rule offline and shows it now passes; fire 4's (14e37aae) still trips it.

Evidence

Phase 9 drive #1491: artifacts/healer-refusal.json in runs 20260915T151406Z (fire 1) and 20260915T172007Z (fire 4) on matou-workstation; executor log lines healer: fix would weaken a check (assertion/leg/skip) — reverting and filing; tickets #1493, #1498; the p4-archive retrospective's healer baseline (confident 0/11) for the wider picture.

## Symptom On phase 9 (#1491, GREEN 2026-09-15) the healer diagnosed two harness reds correctly, proposed the right fix, and then **refused its own fix under rule 1** ("never weaken what a check proves") because the diff touched an `expect(...)` line — and a session-runner agent later landed the **identical change verbatim**, ruling the healer right under ADR 0174. Each round trip cost the drive a re-stage and a rental: | fire | red | what the fix did | refused as | filed | landed verbatim | red → refire | |---|---|---|---|---|---|---| | 1 | `place-files` | **moved** the read-back (assertion text + expected value unchanged) below the `Continue` that saves the placement | rule 1 (`healer: fix would weaken a check (assertion/leg/skip)`) | #1493 15:42Z | `41fe5cea` 15:53Z, #1493 closed 15:54Z | ~14 min (refire `20260915T155605Z`) | | 4 | `sign-in` | replaced a **hardcoded** expected value (`'E2E Drive'`) in a shared fixture with a per-call parameter, the caller passing the name the journey actually types | rule 1 ("The fix changes an expectation VALUE") | #1498 17:41Z | `14e37aae` 17:50Z | ~19 min (refire `20260915T180007Z`, part of it waiting on the capacity slot the fixing session itself held) | For comparison the confident fast-lane landing on fire 3 (#1497, `a887852b`) went red → refire in ~1 min. Rule 1 exists for the #1113 lesson (the cheap move on a real defect is to loosen the assertion) and must keep biting on that; the two cases above are not that. ## Where it bites `.sandcastle/rehearsal-heal-lib.sh:52` — the rule is a diff grep: any **removed** line matching `expect(` / `.toBe` / `.toContain` / `assert…` / `require.…` trips it. That cannot tell a weakened check from: 1. **A moved check** — the same assertion line is removed at one place and added back, byte-for-byte (modulo indentation), elsewhere in the same diff. Fire 1. Nothing about what the check proves changed; only *when* it runs. 2. **A fixture literal replaced by the caller's own truth** — an expected value that was a hardcoded string in a shared fixture becomes a parameter, and the added lines pass the journey's actual input (here the slug-derived community name). Fire 4. This one is a genuine expectation change and arguably still deserves a second pair of eyes — but the healer had already found the in-tree precedent (`journey.device.spec.ts:1032-1035` fixed the same drift the same way). ## Proposal (two-way door; the rule stays, its edge narrows) - **Case 1 (moved check): not a weakening.** In `rehearsal_heal_weakens_check` (or wherever `:52` lives), pair each removed assertion line with the added lines: if every removed `expect/assert/require` line reappears as an added line with identical content after trimming leading whitespace, the diff moved checks and rule 1 does not fire. A removed assertion with no verbatim twin still trips the rule. Add the case to `.sandcastle/tests/rehearsal-healer-test.sh` beside `healed-assertion`: a healer diff that moves `expect(count).toBe(1)` down three lines must LAND; one that changes it to `toBe(2)` must still be refused. - **Case 2 (expectation value → parameter): keep refusing, but route it faster.** Leave rule 1 as is for value changes. Instead have the refusal ticket carry `ready-for-agent` when the healer's own diagnosis names an in-tree precedent for the same change (as #1498's did), so the swarm plugs it on its next 2-minute tick instead of the session-runner's 10-minute tick — or, if Ben prefers, keep `ready-for-session` and accept the tax. State which in the close-report. ## Acceptance - `rehearsal-healer-test.sh` gains a "moved assertion lands, changed assertion refused" pair, green. - `rehearsal-heal-prompt.md` rule 1 wording tells the healer a *moved* check is allowed so it stops pre-emptively choosing `file` for that case. - A retrospective line in the ticket's close-report re-runs fire 1's diff (`41fe5cea`) through the rule offline and shows it now passes; fire 4's (`14e37aae`) still trips it. ## Evidence Phase 9 drive #1491: `artifacts/healer-refusal.json` in runs `20260915T151406Z` (fire 1) and `20260915T172007Z` (fire 4) on matou-workstation; executor log lines `healer: fix would weaken a check (assertion/leg/skip) — reverting and filing`; tickets #1493, #1498; the p4-archive retrospective's healer baseline (confident 0/11) for the wider picture.

Closed — landed + proven under ADR 0174.

What landed

Refusal rule 1's edge narrowed so a MOVED assertion is no longer mistaken for a weakened one (Case 1 of the proposal). This landed in the factory core and was re-vendored, because rehearsal-heal-lib.sh + both test files are FACTORY_MANIFEST-managed — the pre-push drift gate byte-compares them against Matou/dev-factory@FACTORY_REF, so hand-editing them in this repo fails the push.

  • dev-factory Matou/dev-factory@41495283 — _heal_weakens_check now exempts a diff in which every removed expect/assert/require line reappears byte-for-byte (indentation aside) as an added line — a move — via a new _heal_assertions_all_moved helper (multiset cover, so a duplicated-then-half-deleted assertion cannot slip through). A changed value, a twin-less removal, and a mixed move+weaken all still trip (the #1113 backstop).
  • idss 90ef7a30 — FACTORY_REF bumped 9055eb55→41495283, the four files re-vendored, the heal prompt re-rendered, STATUS.md updated. Pre-push drift gate green.

Tests (the acceptance pair)

rehearsal-healer-test.sh case 19 (a moved assertion LANDS) is the LAND twin of the existing case 13 (healed-assertion, toBe(1)→toBe(2), still refused). Unit rehearsal-heal-lib-test.sh gains R1e (moved passes) and R1f (move-one-weaken-another still refused). Both suites green — in dev-factory and after re-vendor here: rehearsal-heal-lib-test.sh 31→33, rehearsal-healer-test.sh 21→22.

Prompt

rehearsal-heal-prompt.md rule 1 now tells the healer a MOVED check is allowed, so it stops pre-emptively choosing file for that case.

Retrospective (offline, run against the pushed tree)

fire 1  41fe5cea (moved read-back):   PASSES  (was REFUSED before this fix)  <- the bug, fixed
fire 4  14e37aae (landed commit):     PASSES  (and PASSED under the old rule too)
fire 4  original value-change shape:  FIRES / refused  (value changes still trip)

Correction to the Acceptance premise. The acceptance predicted "fire 4's (14e37aae) still trips it." It does not — and never did. The landed fire-4 commit is a fixture parameterisation-with-default (nextcloudChromeBrand(name = 'E2E Drive'), callers passing communityNameForSlug(slug)); it removes no single-line assertion, so _heal_weakens_check was already blind to it under the OLD rule (verified: the old rule finds zero removed assertion lines in 14e37aae). What actually tripped rule 1 on fire 4 was the healer's original proposal — changing the asserted VALUE (toContainText('E2E Drive') → the slug name). That one-line value change still trips after this fix (shown above), so Case 2's invariant ("keep refusing value changes") is fully preserved.

Case 2 routing — left as ready-for-session (status quo), a Ben preference

The proposal's Case 2 offered to route a value-change refusal ready-for-agent when the healer's diagnosis names an in-tree precedent — "if Ben prefers." That is an explicit human-preference / triage-policy choice, not a two-way door for an unattended session under ADR 0174, so I did not change the routing: value-change refusals keep going ready-for-session and accept the ~10-min tax, exactly as today. Rule 1 itself is unchanged for value changes. If Ben wants the faster lane, it is a small follow-up on the ticket-on-refusal filing (route by HEAL_RAIL_SWARMABLE plus an "in-tree precedent named" signal) — say the word and I will file it.


Ruled by agent under ADR 0174 — veto anytime. Two-way door: revertible factory commit + re-vendor; proven by the red→green test suites and the offline retrospective above. Advances #1501.

**Closed — landed + proven under ADR 0174.** ## What landed Refusal rule 1's edge narrowed so a **MOVED** assertion is no longer mistaken for a **weakened** one (Case 1 of the proposal). This landed in the **factory core** and was re-vendored, because `rehearsal-heal-lib.sh` + both test files are `FACTORY_MANIFEST`-managed — the pre-push drift gate byte-compares them against `Matou/dev-factory@FACTORY_REF`, so hand-editing them in this repo fails the push. - **dev-factory** `Matou/dev-factory@41495283` — `_heal_weakens_check` now exempts a diff in which every removed `expect/assert/require` line reappears byte-for-byte (indentation aside) as an added line — a *move* — via a new `_heal_assertions_all_moved` helper (multiset cover, so a duplicated-then-half-deleted assertion cannot slip through). A changed value, a twin-less removal, and a mixed move+weaken all still trip (the #1113 backstop). - **idss** `90ef7a30` — `FACTORY_REF` bumped `9055eb55`→`41495283`, the four files re-vendored, the heal prompt re-rendered, `STATUS.md` updated. Pre-push drift gate green. ### Tests (the acceptance pair) `rehearsal-healer-test.sh` **case 19** (a moved assertion **LANDS**) is the LAND twin of the existing **case 13** (`healed-assertion`, `toBe(1)`→`toBe(2)`, still **refused**). Unit `rehearsal-heal-lib-test.sh` gains **R1e** (moved passes) and **R1f** (move-one-weaken-another still refused). Both suites green — in dev-factory and after re-vendor here: `rehearsal-heal-lib-test.sh` 31→33, `rehearsal-healer-test.sh` 21→22. ### Prompt `rehearsal-heal-prompt.md` rule 1 now tells the healer a MOVED check is allowed, so it stops pre-emptively choosing `file` for that case. ## Retrospective (offline, run against the pushed tree) ``` fire 1 41fe5cea (moved read-back): PASSES (was REFUSED before this fix) <- the bug, fixed fire 4 14e37aae (landed commit): PASSES (and PASSED under the old rule too) fire 4 original value-change shape: FIRES / refused (value changes still trip) ``` **Correction to the Acceptance premise.** The acceptance predicted "fire 4's (`14e37aae`) still trips it." It does not — and never did. The **landed** fire-4 commit is a fixture *parameterisation-with-default* (`nextcloudChromeBrand(name = 'E2E Drive')`, callers passing `communityNameForSlug(slug)`); it removes **no single-line assertion**, so `_heal_weakens_check` was already blind to it under the OLD rule (verified: the old rule finds zero removed assertion lines in `14e37aae`). What actually tripped rule 1 on fire 4 was the healer's **original proposal** — changing the asserted VALUE (`toContainText('E2E Drive')` → the slug name). That one-line value change **still trips** after this fix (shown above), so Case 2's invariant ("keep refusing value changes") is fully preserved. ## Case 2 routing — left as `ready-for-session` (status quo), a Ben preference The proposal's Case 2 offered to route a value-change refusal `ready-for-agent` when the healer's diagnosis names an in-tree precedent — **"if Ben prefers."** That is an explicit human-preference / triage-policy choice, not a two-way door for an unattended session under ADR 0174, so I did **not** change the routing: value-change refusals keep going `ready-for-session` and accept the ~10-min tax, exactly as today. Rule 1 itself is unchanged for value changes. If Ben wants the faster lane, it is a small follow-up on the ticket-on-refusal filing (route by `HEAL_RAIL_SWARMABLE` plus an "in-tree precedent named" signal) — say the word and I will file it. --- Ruled by agent under ADR 0174 — veto anytime. Two-way door: revertible factory commit + re-vendor; proven by the red→green test suites and the offline retrospective above. Advances #1501.
matou-build-agent 2026-09-15 19:50:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1501
No description provided.