chore(memory): db:trial first create, LRN-123..126, owner arbitrations

First create at 255dd67 done; post-create checks interrupted at check 3 (TR_PW in the db container log, written by the image's init). Contract records the owner's arbitrations of 2026-11-11; TODO lists the follow-up lots.
This commit is contained in:
bchanot committed 2026-11-11 15:54:33 +01:00
1 parent 255dd67f2c
commit c6c984b954
4 files changed
+70 -1

No files matched your search

+46
View File
@@ -832,3 +832,49 @@ Observation, not a routine: worktree held uncommitted format-only Prettier chang
- **Context**: V1-2.6 U1 Lot I. Implementer wait loop `while pgrep -f 'playwright.shell.config'; do sleep …; done` never ended: `pgrep -f` matched the loop's own shell command line, which contains the pattern.
- **Rule**: `pgrep -f` pattern must not match the caller: bracket trick `pgrep -f '[p]laywright.shell.config'`, or wait on a known PID (`wait $pid`, `kill -0`), or the harness Monitor / background notification.
- **Apply**: any wait-for-process loop in briefs and scripts.
## LRN-123 — docker inspect -f failure: bare newline on stdout, error sentence on stderr (2026-11-11)
Context: db:trial absent detection, `resource_exists` in scripts/db-trial.sh. Measured 2026-11-11 on this machine: docker client 29.9.3, rootless daemon 29.9.2, read-only inspect of absent name `faunosteo_probe_absent`.
Fact (demonstrated): `docker <container|volume|network|image> inspect -f '{{...}}' <absent>` -> rc 1, stdout exactly "\n" (template inspector flush), stderr one sentence:
- container: `Error response from daemon: No such container: <name>`
- volume: `Error response from daemon: get <name>: no such volume`
- network: `Error response from daemon: network <name> not found`
- image: `Error response from daemon: No such image: <name>`
Daemon unreachable: stdout also "\n", stderr = dial error.
Trap: `out="$(docker ... inspect -f ... 2>&1)"` then exact compare never matches (leading "\n"): every absent resource refused. Shipped in a fix round, stub printed stderr line only, 353 green tests missed it; fresh re-review caught it (d3bdbbe history).
Apply: absent = rc != 0 AND stderr alone (`2>&1 >/dev/null`) equals the per-kind sentence; anything else refuses. Stubs reproduce both streams (control: merged compare restored -> 288 harness fails). Measure real tool output stream by stream before freezing it in a stub.
Limit: sentences proven on this version pair only; a Docker upgrade may reword them (absent_answer then refuses everything, fail-closed).
## LRN-124 — bash 5.3 EXIT trap sees exit status 0 after SIGTERM (2026-11-11)
Context: db:trial backup_now EXIT trap (scripts/db-trial.sh ~1170 comment), lot B2.
Fact (demonstrated 2026-11-11, GNU bash 5.3.9): script with `trap '...' EXIT` and no TERM trap, killed by SIGTERM -> EXIT trap runs, `$?` inside it is 0, process still exits 143. With `trap 'exit 143' TERM` the EXIT trap sees 143.
Repro: `bash -c 'trap "echo \$?" EXIT; kill -TERM $$; sleep 2'` prints 0.
Apply: never decide success/failure from `$?` in an EXIT trap. Clear the trap on success (`trap - EXIT`) so any run of it means failure, or set a status variable, or add `trap 'exit 143' TERM` / `trap 'exit 130' INT`.
Limit: only bash 5.3.9 tested; other versions unproven.
## LRN-125 — psql single-transaction commits a truncated piped script (documented, unproven here) (2026-11-11)
Context: db:trial rotation and grant SQL (scripts/db-trial.sh ~1525 comment; plan .claude/tasks/plans/2026-11-09-db-trial-stack.md B2/B3 records).
Rule (NOT demonstrated here, derived from psql's documented behaviour): `psql --single-transaction` / `-1` wraps the whole input in BEGIN ... COMMIT. If the producer of stdin dies mid-script (pipe closed early), psql sees EOF and sends COMMIT: the truncated prefix commits. ON_ERROR_STOP stops on SQL errors only, never on a short input.
Apply: for multi-statement writes fed through a pipe, write explicit `begin;` ... `commit;` in the script itself (a truncated script then never reaches its commit and rolls back on disconnect), plus a commit marker checked afterwards when the outcome matters (db-trial rotation digest marker).
Limit: no run in this project reproduced the truncation; treat as design rule pending a real psql test. Note: seed_equine still uses `sb_psql --single-transaction < file` (file input, not a pipe: lower risk).
## LRN-126 — Docker daemon-down error contains no such file or directory (2026-11-11)
Context: db:trial daemon-down handling. Measured 2026-11-11, docker client 29.9.3, DOCKER_HOST=unix:///nonexistent/docker.sock.
Fact (demonstrated): every docker call with no daemon -> rc 1, stderr `failed to connect to the docker API at unix:///nonexistent/docker.sock; check if the path is correct and if the daemon is running: dial unix /nonexistent/docker.sock: connect: no such file or directory`.
Trap: substring tests like `*"no such"*` (meant for "No such container" / "no such volume") also match the dial error: daemon-down reads as "absent". On destructive paths (destroy, restore) that meant deleting live state or extracting into a non-empty volume.
Apply: never classify Docker errors by substring; exact whole-sentence match per kind on stderr, everything else refuses (see the inspect -f learning).
Limit: wording of this client version only.