chore(memory): BDR-129 + LRN-236 + LRN-237 + EVAL-052 — ship-feature memory-v2-write, TODO phase 4a checked + follow-ups
This commit is contained in:
1 parent
870cdf444e
commit
5f0d848ce4
5 files changed
+27
-1
No files matched your search
@@ -1825,3 +1825,11 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Date**: 2026-10-27
|
||||
- **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]].
|
||||
|
||||
## LRN-236 — uutils mkdir 0.10 is not atomic: lock with bash noclobber (O_EXCL), token unlock (2026-10-28)
|
||||
- **Context**: memory v2 lock proof 2026-10-27. 5 concurrent `memory.sh add` lost 2-4 entries, silently. `/usr/bin/mkdir` = uutils coreutils 0.10.0: two concurrent `mkdir x` both rc 0 (`for i in $(seq 20); do (mkdir y && echo won) & done` → 2 wins). Lock-by-mkdir unsafe on this host.
|
||||
- **Apply**: atomic create lock = bash noclobber: `(set -C; printf '%s\n' "$token" > "$lock") 2>/dev/null` (open O_EXCL by bash itself, no external tool, portable to macOS). Unlock only on token match; steal through a second noclobber guard. Race test with ≥5 writers is the flip test (red with mkdir). Never `rm -rf` a lock dir through a variable. [[BDR-129]], [[BDR-110]].
|
||||
|
||||
## LRN-237 — A migration oracle sharing the transform reader proves nothing: own range per reader, assert on the entry, prove with the user invocation (2026-10-28)
|
||||
- **Context**: memory v2 `upgrade` verdict oracle, 2026-10-28. Oracle compared each blocker's open/closed verdict, legacy reader before vs strict reader after. Four review rounds each found a range leak the oracle shared: `###` entry invisible to v1 reader counted closed → `resolved` written on an open blocker; `## BLK-003` range swallowed a following `### BLK-001`; a `### ` heading quoted in a fence ended the range; status lines inside a fence read. Tests stayed green because they checked the reconcile enumerator, blind to `###`. Separately: template path derived after `-C` cd → upgrade rc 2 only when the lib is called by relative path; implementers always used absolute paths.
|
||||
- **Apply**: an oracle sharing the transform's reader proves nothing: give each reader its own entry range (end at next heading of any level, fence-aware, skip fenced status). Assert on the entry itself, not via an enumerator. Prove a CLI on real data copies with the invocation users type (relative path + `-C`). Resolve a lib's own dir at source time (`cd -P` before any `cd`). [[BDR-129]], [[LRN-096]].
|
||||
Reference in new issue
Block a user