Files
booth/persistent-memory.d/2026-09-24-r3-seam-pass-what-only-it-could-see.md
T

41 lines
2.4 KiB
Markdown

# The r3 seam pass: what only it could see
_2026-09-24. Contract `docs/contracts/r3_compare.contract.md` (design-dev);
althing thread `01M3952NCDRRJX5XDFSPMSP5HJ`._
design-dev's heid contract panel read r3 cold. Our seam pass read it against
the real `app.py`, `items.py`, `base.html` and `view.html`, plus small probes
on a scratch booth. It found 12 mismatches, all folded before a line of code.
The build then went through heid code-review and bug-hunt, and our own gate,
with nothing structural left. design-dev: "S4 and S8 would each have cost a
round."
## The ones worth remembering, because they recur
- **`data-region` ids must be unique on a page.** The in-place client's
`swap()` in `base.html` keeps only the FIRST fresh node for each id, then
replaces EVERY live node that has that id with a copy of it. Two per-side
regions sharing an id would make B's flag button a copy of A's after any
save, so pressing B flags A, with nothing to show it happened. Also: do not
key a region by rel (a pair with `a == b` duplicates it) and do not prefix
it `item-` (swap reads a missing `item-*` as a stale tile, not a reload).
This is a mechanical rule that belongs in CLAUDE.md; it is not there yet.
- **Moving code breaks mutation anchors.** 21 of r2c's 24 `view.html` rows
were anchored inside the inline script that r3 moved to `_stage_js.html`,
and `mutation_check.py` fails a row whose anchor is gone. A contract that
moves code must list the re-pointed rows in its "Assertions that change"
table, and gate on the table still falsifying, not only on the suite staying
green.
- **"404 the way view does" was two rules, and neither was view's.** A
missing `f` is a 422 from FastAPI (required `str`), not a 404; declare
`= ""` and 404 by hand. `booth_items` follows symlinks, so a link pointing
outside the booth is IN `review_chain`, while view 404s it through
resolve plus containment. Compare needed the conjunction.
- **Route order.** `/b/{name}/{filepath:path}` is a catch-all; a new
`/b/{name}/<word>` route must register before it. A booth file literally named
`<word>` becomes unreachable (accepted, as for view/marks/asks/embed.json).
- **A resolve done twice is a race.** After the merge, the review route checked
`f` and then resolved the whole ring again, so `cring.index(f)` could raise
(a 500) when a file vanished in between. design-dev's `d54bb04` judges each
rel once per request.