diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index cac2fa3..1f7c2ea 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -790,3 +790,6 @@ rules: ## 2026-11-20 - /ship-feature advisor-subagent-scope (7979b9b 6be0669 b71db28): leak root cause = advisor server tool on every sub-agent, no filter, opus ignores CLAUDE.md attachment; rule moved into agent defs/briefs + SubagentStart hook + SDD sonnet pin; LRN-303; behavioural proof pending next usage table. - /feat done-triage-levers (19dfe7e 39cf9dd, docs e8c061e): six levers in verify-secure-loop/challenge-plan/capitalize-commit/verifier/CLAUDE.global + effort-shift citer. r1 3 lenses 9 MAJOR (unrecorded base), r2 2 MAJOR in r1 fixes; gates first pass. BDR-151 LRN-304 EVAL-060. Follow-up /feat (5 files) + MEASURE line in TODO. Branch UNMERGED. + +## 2026-11-21 +- /hotfix gates-abandon-id (5bba6ce, bugfix/gates-abandon-id UNMERGED): ABANDON regex anchored to numeric id, catch-all malformed ERROR, leading whitespace accepted (robustness challenger: game ledger indented handoff silently MET). 3 lenses + 1 confirmation, security PASS. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index b36e1a8..43ec2f8 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -104,7 +104,7 @@ Open children of the shipped phases (History 2026-11-12), text verbatim. - [x] D6 project rule (done c69ce9c; lead paragraph fixed too, follow-ups in BUGS-FOUND): .claude/rules/graphify-vendored.md says `graphify install --platform claude` "touches nothing else", but graphifyy 0.9.67 appends a `# graphify` block to ~/.claude/CLAUDE.md (= CLAUDE.global.md); `graphify claude install` writes into the caller's cwd, so the install-plugins.sh trap protects $REPO only when run from $REPO - [x] DONE c25a7ea, merged 2d8e457 (docs 15c6d09, memory 44dc0b3 482fd37 LRN-299) (bugfix/gates-label-timeout, user 2026-11-17 "reject"; also rejects a 2nd CHECK/EXPECT/EVIDENCE on one criterion: indented ` 2.`, `- `, `**2.**` gave the same false MET) gates.sh: warn or reject a criterion row labelled `^[0-9]+[a-z]\.` (LRN-284: `1b.` absorbed into criterion 1, its CHECK/EXPECT overwritten, false MET) - [x] DONE c25a7ea (user 2026-11-17: default 600 s, env override kept) gates.sh default `GATES_TIMEOUT=120` < full `make test` (~135 s on 2026-11-16): a "Full make test green" criterion goes NOT-MET on timeout alone (A6 run, re-run with GATES_TIMEOUT=400). Raise the default or have contract-interview write the timeout for full-suite criteria. -- [ ] gates.sh:93 ABANDON regex `([0-9]+)?` reads `ABANDON: 1b …` / `1.1` as id 1: after a renumber (LRN-284) criterion 1 is masked ABANDONED (rc 3) instead of "unknown criterion" ERROR. Anchor the id `([0-9]+)([[:space:]]|$)` + test (robustness challenger, gates hotfix 2026-11-17) +- [x] DONE 5bba6ce bugfix/gates-abandon-id (UNMERGED), /hotfix 2026-11-20: numeric id required, indented ABANDON counts (game ledger 2026-09-30-verify-qual-deparse MET → ABANDONED(1)), malformed → ERROR, 5 tests. Was: gates.sh:93 ABANDON regex `([0-9]+)?` reads `ABANDON: 1b …` / `1.1` as id 1: after a renumber (LRN-284) criterion 1 is masked ABANDONED (rc 3) instead of "unknown criterion" ERROR. Anchor the id `([0-9]+)([[:space:]]|$)` + test (robustness challenger, gates hotfix 2026-11-17) - [ ] gates.sh residual: a stray oracle (indented ` 2.`, `- `, `**2.**` label) after a MANUAL criterion still attaches to it, row MANUAL → MET/NOT-MET on an unrelated oracle (no red oracle overwritten; accepted 2026-11-17) - [ ] lib/verify-secure-loop.md:46-47 ERROR(n) cause list is examples, incomplete: missing "no numbered criteria", "ABANDON names unknown criterion", malformed label, second attribute (c25a7ea) - [ ] lib/design-tool-gate.sh:70 `perl -e 'alarm shift; exec @ARGV' 15 21st whoami` kills one process only (same limit as the old session-start runner, fixed 490ad83): reuse the group-kill runner when this file is next touched. diff --git a/.claude/tasks/contracts/2026-11-20-gates-abandon-id-1811.md b/.claude/tasks/contracts/2026-11-20-gates-abandon-id-1811.md new file mode 100644 index 0000000..daf8eae --- /dev/null +++ b/.claude/tasks/contracts/2026-11-20-gates-abandon-id-1811.md @@ -0,0 +1,37 @@ +# CONTRACT — gates-abandon-id +- date: 2026-11-20 | flow: hotfix | branch: bugfix/gates-abandon-id +- status: active +- run-base: 23c580249e20d3b185bd9278726b024b5729132b + +## REQUEST (verbatim — IMMUTABLE) +lib/gates.sh:110 ABANDON regex `([0-9]+)?` reads `ABANDON: 1b …` / `1.1` as criterion 1: after a renumber criterion 1 is masked ABANDONED (rc 3) instead of an "unknown criterion" ERROR. Reproduced 2026-11-20: contract with criteria 1 (runnable) and 2 (manual) + `ABANDON: 1b moved after renumber` → `gates.sh status` prints "1 ABANDONED", VERDICT ABANDONED(1), rc 3. Fix: anchor the id so `1b`, `1.1` and an id-less line give ERROR, `ABANDON: 1 reason` stays ABANDONED; regression test in lib/tests/gates.test.sh; real ledgers (git grep '^ABANDON:' .claude/tasks/contracts) keep their verdict. TODO .claude/tasks/TODO.md:107. + +## CLARIFICATIONS +none — request complete + +## ACCEPTANCE CRITERIA +1. Symptom gone: `ABANDON: 1b …`, `ABANDON: 1.1 …` and an id-less `ABANDON: reason` each give `GATES — VERDICT: ERROR` with "malformed ABANDON" (rc 2), never a masked ABANDONED; `ABANDON: 1 reason` still gives ABANDONED (rc 3) and `ABANDON: 1` still "blank reason". + CHECK: t=$(mktemp -d); for id in '1b moved' '1.1 moved' 'upstream offline'; do printf '## ACCEPTANCE CRITERIA\n1. ok\n CHECK: true\n EXPECT: x\n EVIDENCE: pending\n2. manual\n\nABANDON: %s\n' "$id" > $t/c.md; o=$(bash lib/gates.sh status $t/c.md 2>&1); rc=$?; [ $rc -eq 2 ] && [[ "$o" == *"malformed ABANDON"* ]] && [[ "$o" != *"ABANDONED"* ]] || { echo "BAD $id rc=$rc"; exit 1; }; done; printf '## ACCEPTANCE CRITERIA\n1. ok\n CHECK: echo M\n EXPECT: M\n EVIDENCE: pending\n2. manual\n\nABANDON: 2 upstream offline\n' > $t/v.md; o=$(bash lib/gates.sh run $t/v.md 2>&1); [ $? -eq 3 ] && [[ "$o" == *"VERDICT: ABANDONED(1)"* ]] && echo SYMPTOM_GONE + EXPECT: SYMPTOM_GONE + EVIDENCE: MET exit=0 marker-found :: SYMPTOM_GONE +2. Regression tests in lib/tests/gates.test.sh cover `1b`, `1.1` and the id-less line, and the suite is green. + CHECK: grep -q 'ABANDON: 1b' lib/tests/gates.test.sh && grep -q 'ABANDON: 1.1' lib/tests/gates.test.sh && grep -q '^ ABANDON: 1b moved' lib/tests/gates.test.sh && make test suite=lib/tests/gates.test.sh 2>&1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green +3. Real ledgers keep their verdict: phase2-guards ABANDONED(2) (the levers-followup ledger lives on its own branch). + CHECK: bash lib/gates.sh status .claude/tasks/contracts/2026-11-02-phase2-guards-1545.md 2>&1 | tail -1 + EXPECT: GATES — VERDICT: ABANDONED(2) + EVIDENCE: MET exit=0 marker-found :: GATES — VERDICT: ABANDONED(2) +5. [gated 2026-11-20 orchestrator, challenge robustness MAJOR] An `ABANDON:` line indented under its criterion counts as an abandonment (ABANDONED, rc 3), and an indented malformed one gives the malformed ERROR; the game ledger with the indented handoff reads ABANDONED(1). + CHECK: t=$(mktemp -d); printf '## ACCEPTANCE CRITERIA\n1. ok\n CHECK: echo M\n EXPECT: M\n EVIDENCE: pending\n2. manual\n ABANDON: 2 upstream offline\n' > $t/a.md; o=$(bash lib/gates.sh run $t/a.md 2>&1); [ $? -eq 3 ] && [[ "$o" == *"VERDICT: ABANDONED(1)"* ]] || exit 1; printf '## ACCEPTANCE CRITERIA\n1. ok\n CHECK: true\n EXPECT: x\n EVIDENCE: pending\n ABANDON: 1b x\n' > $t/b.md; o=$(bash lib/gates.sh status $t/b.md 2>&1); [ $? -eq 2 ] && [[ "$o" == *"malformed ABANDON"* ]] || exit 1; g=$t/game.md; git -C /home/bchanot/Documents/game show develop:.claude/tasks/contracts/2026-09-30-verify-qual-deparse-1925.md > $g && bash lib/gates.sh status $g 2>&1 | tail -1 + EXPECT: GATES — VERDICT: ABANDONED(1) + EVIDENCE: MET exit=0 marker-found :: GATES — VERDICT: ABANDONED(1) +4. Contract and gates suites stay green. + CHECK: make test suite="lib/tests/contract-verifier.test.sh lib/tests/loops-light.test.sh" 2>&1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green + +## FILE SCOPE +- lib/gates.sh +- lib/tests/gates.test.sh +- this contract and .claude/tasks/plans/2026-11-20-gates-abandon-id-1811.md (run artifacts) diff --git a/.claude/tasks/plans/2026-11-20-gates-abandon-id-1811.md b/.claude/tasks/plans/2026-11-20-gates-abandon-id-1811.md new file mode 100644 index 0000000..09ce19a --- /dev/null +++ b/.claude/tasks/plans/2026-11-20-gates-abandon-id-1811.md @@ -0,0 +1,87 @@ +# FIX — gates-abandon-id (/hotfix, 2026-11-20 18:11) + +Contract: `.claude/tasks/contracts/2026-11-20-gates-abandon-id-1811.md`. Branch bugfix/gates-abandon-id +off develop 23c5802. + +## Root cause +lib/gates.sh:110 `^ABANDON:[[:space:]]*([0-9]+)?[[:space:]]*(.*)$`: the id group is optional and +unanchored, so `ABANDON: 1b moved` captures id `1` and reason `b moved`. Criterion 1 is then +reported ABANDONED (rc 3) instead of a ledger error. Reproduced on a scratch contract. + +## Exact edit +lib/gates.sh, `_absorb`, replace the two ABANDON lines (110-111): + +``` + elif [[ "$1" =~ ^ABANDON:[[:space:]]*([0-9]+)?[[:space:]]*(.*)$ ]]; then + _ABANDON_ID+=("${BASH_REMATCH[1]}"); _ABANDON_WHY+=("${BASH_REMATCH[2]}") +``` +with +``` + elif [[ "$1" =~ ^[[:space:]]*ABANDON:[[:space:]]*([0-9]+)([[:space:]]+(.*))?$ ]]; then + _ABANDON_ID+=("${BASH_REMATCH[1]}"); _ABANDON_WHY+=("${BASH_REMATCH[3]}") + elif [[ "$1" =~ ^[[:space:]]*ABANDON: ]]; then + _err "malformed ABANDON at line $2 (want \`ABANDON: N reason\`)" +``` +The second branch is required: with only the anchored regex, `ABANDON: 1b` would match no branch +and be silently dropped, losing the handoff and letting the ledger read MET. + +lib/tests/gates.test.sh, after the "abandonment naming nothing" case, three cases of this +exact shape (same as gates.test.sh:277-287), the last line varying: + +``` +gate "abandonment id 1b is malformed" run "malformed ABANDON" 2 <<'EOF' +## ACCEPTANCE CRITERIA +1. green + CHECK: echo "M" + EXPECT: M + EVIDENCE: pending +2. manual + +ABANDON: 1b moved after renumber +EOF +``` +plus one valid case, same fixture with ` ABANDON: 2 upstream offline` (3 leading spaces), +label "indented abandonment counts", `run "GATES — VERDICT: ABANDONED(1)" 3`. +Malformed labels / last lines: "abandonment id 1.1 is malformed" / `ABANDON: 1.1 moved after +renumber`; "abandonment without id is malformed" / `ABANDON: upstream offline` (was +"unknown criterion: ''", now malformed); "indented malformed abandonment" / +` ABANDON: 1b moved` (3 leading spaces) expecting `run "malformed ABANDON" 2`. + +## Edge cases +- `ABANDON: 1` (no reason): still matches (group 2 optional) → existing "blank reason" test. +- `ABANDON: 1 reason` with extra spaces: `[[:space:]]+` then `(.*)` → reason trimmed by + `_trim` at the blank check. +- Both ABANDON branches accept leading whitespace: an `ABANDON:` written indented under its + criterion (the game ledger 2026-09-30-verify-qual-deparse-1925.md:31) was silently dropped + (status MET); it now counts (ABANDONED). Prose `ABANDONED`/`ABANDONMENT` never matches (the + colon is required). No attribute line starts with `ABANDON:`. +- Punctuation right after the id (`ABANDON: 4: reason`, `5, reason`, `3—reason`) was ABANDONED + and is now the malformed ERROR, on purpose: the documented form is `ABANDON: ` + (contract-interview.md), fail closed; no real ledger uses it (all refs grepped). + +## Challenge r1 (correctness SOLID, robustness CONCERNS(1), simplicity SOLID) +- robustness MAJOR: indented `ABANDON:` silently dropped, real instance in the game repo → + leading whitespace accepted in both branches + indented test case. +- simplicity MINOR: fixture spelled out literally (above). +- correctness MINOR: punctuation after the id declared malformed on purpose (Edge cases). +- MINOR dropped: ABANDON line outside `## ACCEPTANCE CRITERIA` ignored (no real instance found). +- MINOR dropped: bulleted `- ABANDON: …` still ignored (no real instance found). + +## Challenge r2 (confirmation, robustness: SOLID) +- MINORs taken: 5th test case (indented malformed); criterion 5 reads the game ledger at a + pinned revision (`git -C … show develop:…`). +- Limit named: an indented code fence under a criterion is not a fence to the parser + (`_parse` toggles column-0 fences only), so an example `ABANDON:` line nested there now + counts; no contract has one (10 repos grepped); indented CHECK lines already share this. +- MINOR dropped: indented ABANDON id not checked against its enclosing criterion (rc 3 still + routes to the human gate; no real ledger misplaces one). + +## Replay (real ledgers) +phase2-guards-1545 status ABANDONED(2) before; must stay. levers-followup-1725 lives on +feature/levers-followup (ABANDONED(1), `ABANDON: 4 deferred …`): matches the anchored form. +Cross-repo (robustness challenger, `^[[:space:]]*ABANDON` over the contracts of the 9 other +repos' working trees): only the game ledger above, which goes MET → ABANDONED(1). + +## Advisor +Covered by the end-of-run call of the levers-followup run, made just before this run started: +it named the silent fall-through and the replay. No second call.