chore(memory): LRN-235 — feat extract-hardening, contract + plan + TODO follow-ups

This commit is contained in:
bchanot committed 2026-10-27 20:12:34 +01:00
1 parent 9160ce2826
commit 0d5f78b44f
5 files changed
+162 -1

No files matched your search

+1
View File
@@ -664,3 +664,4 @@ rules:
- /feat rules-h3-extract (feature/rules-h3-extract): extract takes `'### title'`, sections --depth 3, split S4/S0 rows; 3 lenses SOLID/CONCERNS(2)/CONCERNS(1) + confirmation FATAL(2) (LC_COLLATE glob order, re-emission leaked to ##) → r3; feater DONE 116/116; GATE 0 MET; verifier ECARTS(1 floor: SC2016 suppression) → CONFORME 8/8; auditor PASS (3 pre-existing MEDIUM queued); ab5049e. LRN-234. Merge on user go, then 0b.
- Phase 0b run (10 repos, faunosteo excluded: on the user's feature branch): 3 splits on chore/claude-md-split, merge on user go — zenquality 4 rules (Memory files 19.4k → 14.5k, project row 10k → 5k), game 2 rules (16k → 14.9k), angelscar356 1 rule (16.2k → 15.4k); 7 keep-everything (overview/stack/commands/structure/conventions only, S4 rule). `gitflow start` refreshed zenquality's own .githooks → S0 STOP on a dirty tree, committed as chore ed10340, re-dispatched. Three onboarder runs in parallel, one repo each, all clean first pass.
- faunosteo split on the user's feature branch (user choice): 11 rules (10 ### under Project conventions + Docker), Memory files 31.9k → 27.2k, project row 22.3k → 17.7k, 7a75974. Phase 0b done: 4 repos split, 7 keep everything.
- /feat extract-hardening (feature/extract-hardening 14a93e3 + docs 9160ce2): `_rules_out_path_ok` (absolute, `..`, exists or dangling link → rc 2, reason on stderr), mkdir + rule-write rc checked before the source rewrite, S0.3 prose in lib case order, 116 → 139 checks. Plan r1 `if ! { … } > "$out"` blind to a failed redirect (2 BLOCKER, bash 5.3.9 probe) → `|| { …; return 2; }`; r2 confirmation CONCERNS(1) (GNU mkdir stderr also says "cannot create"). Verifier CONFORME 8/8, security PASS. LRN-235. Three follow-ups in TODO (emit rc, rewrite keeps $tmp, lexical `..`). Merge on user go.
+5
View File
@@ -250,6 +250,7 @@ rules:
| LRN-232 | 2026-10-27 | Path rules load inside sub-agents (agent_id in hook log); a "does X load" proof prompt must name the Read tool call | per-repo split pass, any load proof |
| LRN-233 | 2026-10-27 | Bash under pipefail: head after producer = rc 141, blanked PATH hides bash (rc 127), unchecked mktemp+rewrite chain = rc 0 with source unchanged; compgen -G no braces, dotglob over-matches, globstar skips symlinks under ** | any bash lib with pipes, temp files, globs |
| LRN-234 | 2026-10-27 | Bash glob order follows LC_COLLATE, make test pins no locale: tests count or name files, never assert a listing; a new-case behaviour fix is gated on the case and proven by an old-vs-new differential on real files | any test listing a dir; any change to a lib with an existing output contract |
| LRN-235 | 2026-10-27 | bash `!` on a redirected compound command is blind to the redirect failure (rc 1 before `!`): catch with `cmd || { …; return 2; }`; a guard whose only observable is a stderr line is asserted on that line, anchored on the lib prefix | any `if ! { … } > f`; any test on a stderr reason |
---
@@ -1922,3 +1923,7 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
## LRN-234 — Glob order follows LC_COLLATE; gate a new-case fix on the case, prove the old contract by differential
- **Context**: feat rules-h3-extract 2026-10-27. Confirmation challenger ran the planned suite under en_US.UTF-8: `printf '%s ' *` gave `sub2.md sub.md `, want `sub.md sub2.md ` (punctuation ignored in UTF-8 collation; C order differs). `make test` (Makefile) pins no `LC_ALL`. Same pass: `###` separator re-emission written as `RLENGTH - 1 < lvl` also fired for `##` ended by an H1 → 5 of 2,162 `##` extracts on this repo's md files changed vs develop, against the immutable REQUEST "`##` behaviour unchanged"; the suite (T7-T13) stayed green either way.
- **Apply**: a test never asserts a glob listing order: count (`printf '%s\n' * | wc -l`), name files, or pin `LC_ALL=C` in the recipe. A fix for a new case is gated on that case (`lvl == 3 && …`) so the existing contract stays byte-identical, and the proof is an old-vs-new differential on real inputs (every `##` of every tracked md), not the suite alone. Also: a `# shellcheck disable` in a diff trips the floor guard unless the contract authorizes it; build the offending literal instead (`printf '\140\140\140'` for backticks). Links [[LRN-233]], [[BDR-128]], [[LRN-096]].
## LRN-235 — bash `!` blind to a failed redirect on a compound command; assert guards on their stderr line, anchored
- **Context**: feat extract-hardening 2026-10-27. Plan r1 wrote `if ! { printf …; body; } > "$out"; then … return 2`. Two challengers + own probe on bash 5.3.9: redirect fails → bash returns 1 BEFORE applying `!`, `if` sees false, source rewritten, rc 0 = the bug unchanged. `! { echo a; } > bad; echo $?` → 1. shellcheck clean, floor guard blind. LRN-233 form works only because its redirects sit INSIDE the group. Same pass: `grep -c 'cannot create'` on captured stderr = 2 on GNU coreutils (mkdir prints `mkdir: cannot create directory …`), 1 on uutils (this host) → host-dependent test. mkdir rc check + write rc check give same rc and same fs state; only the stderr line tells them apart.
- **Apply**: a redirected group is checked as `{ a && b; } > f || { cleanup; echo … >&2; return 2; }` (chain inside with `&&`, else the last command masks printf). Never `if ! { … } > f`. A guard whose only observable is a message gets a test on that message, `grep -c '^project-rules: …'` anchored on the lib's own prefix, never a bare word a system tool may also print. A fixture escape (`../x` from the fixture root, `ln -s /nonexistent`) runs from a subdir of the fixture and links inside it. Links [[LRN-233]], [[LRN-096]], [[BDR-128]].