feat(marks): one primitive for operator judgment, so the loop stops running through chat
Five mechanisms existed to get one question next to one artifact. Three of
them were the same thing wearing different clothes, and the third of the three
had no code at all: the operator picked winners out of a 270-image set and
told the session in conversation. `sindra-finalists` is 86 items, every one
captioned, with the selection encoded in the booth's NAME.
A MARK is operator judgment attached to a target — the booth, or one item in
it, addressed by the `rel` U1 established as item identity. Three shapes:
pick — one of N options a session declared in advance (was: an ask)
note — free text the operator volunteered (had nothing)
flag — this one (had nothing)
One file per booth, one read path, one place openness is computed, one slot
beside the artifact. The storage shape is the operator's call (2026-09-21) and
follows from U4: "does this booth still owe an answer?" gets asked per booth
per sweep tick and per card per index render, so it has to be one read and not
a walk of a booth holding 270 files. Marks are also not links.md — that is an
O_APPEND content-hash log because 17 handles write it concurrently, whereas a
booth's marks see one session and one operator, so locking the common path
costs nothing.
The 2026-09-09 pick semantics are preserved by NOT rewriting them: partial
answers legal, a blank question lands in `unanswered`, `complete` false until
every question has a pick, the only refusal a submission carrying nothing.
`write_answer` split into the pure `build_answer` plus the storage that went
away with the sidecar; `normalize_ask` untouched.
Three findings worth naming, because each was caught by a gate rather than by
reading the diff again:
* The seam review found `inline.place` indexes asks by SUBSCRIPT — the only
consumer in the service that does — so a frozen dataclass breaks it, and
`inline.py` had been missing from the contract's scope entirely.
* A retargeted test found a regression in the legacy importer: a malformed
sidecar that renders "broken" today would have silently vanished on
migration. It now imports carrying its reason.
* A partially-answered pick counted as CLOSED on the index while the panel
beside it rendered it "partial" — the two disagreed about one booth. Open
is the reading U4 needs, and it is declared rather than smuggled in.
`GET /b/<n>/marks.json` is new and load-bearing: sessions on other hosts polled
`<stem>.answer.json` over HTTP, so removing the sidecar without it would have
taken that capability away. `/b/<n>/asks` 308s to `/marks`. Legacy sidecars are
imported, never deleted — four are live and unanswered.
Also records the operator's deterministic-order directive as a cross-cutting v1
invariant, in ROADMAP.md with the per-collection rule table and as CLAUDE.md
invariant 6. The Booth's job is comparison; an order that moves between renders
does not crash, it misfiles the judgment.
242 tests. No version bump — a release tier for this is the operator's call.
This commit is contained in:
@@ -35,31 +35,35 @@ When you commit, include any pending `persistent-memory.md` and
|
||||
floating uncommitted change while shipping other work — durable memory that
|
||||
lags the code defeats its own purpose.
|
||||
|
||||
## The five invariants
|
||||
## The six invariants
|
||||
|
||||
These are the ones a casual change breaks silently. Each has a test.
|
||||
|
||||
### 1. `links.py` and `asks.py` are stdlib-only, on purpose
|
||||
### 1. `links.py`, `asks.py` and `marks.py` are stdlib-only, on purpose
|
||||
|
||||
`scripts/booth` — the CLI every fleet session uses — imports them directly:
|
||||
|
||||
```sh
|
||||
BOOTH_SRC=… python3 -c 'import sys; sys.path.insert(0, …); from booth.asks import write_ask'
|
||||
BOOTH_SRC=… python3 -c 'import sys; sys.path.insert(0, …); from booth.marks import declare_pick'
|
||||
```
|
||||
|
||||
It runs under the system `python3` with **no venv**. A single third-party
|
||||
import in either module breaks `booth ask` / `booth answer` / `booth unlink`
|
||||
on every host, and the failure surfaces in an agent's session, not in ours.
|
||||
import in any of the three breaks `booth ask` / `booth marks` / `booth answer` /
|
||||
`booth unlink` on every host, and the failure surfaces in an agent's session,
|
||||
not in ours.
|
||||
|
||||
`items.py` and `app.py` are free to import what they like. Those two are not.
|
||||
`items.py` and `app.py` are free to import what they like. Those three are not.
|
||||
`test_stdlib_only` walks each module's AST imports and asserts it — the CLI
|
||||
imports through a `python3 -c` heredoc that no AST extractor can see, so that
|
||||
test is the only thing standing here.
|
||||
|
||||
### 2. The filesystem is the state
|
||||
|
||||
No database. `ls ~/booth-data` tells you everything the service knows.
|
||||
|
||||
Per-booth operator state is a **dotfile inside the booth**: `.forever` (keep),
|
||||
`.blurred` (one rel per line), `.pins` (link-board pin ids), `.uploaded`
|
||||
(upload-booth marker). `booth_items()` skips `name.startswith(".")`, so a new
|
||||
`.blurred` (one rel per line), `.marks.json` + `.marks.lock` (judgment), `.pins`
|
||||
(link-board pin ids), `.uploaded` (upload-booth marker). `booth_items()` skips `name.startswith(".")`, so a new
|
||||
dotfile costs nothing in item counts, galleries or zips. That skip is why the
|
||||
dotfile is the right shape for new operator state — use it rather than
|
||||
inventing a sidecar-per-item.
|
||||
@@ -91,12 +95,39 @@ would be found by a consumer, not by us.
|
||||
### 5. Sidecar writes are atomic; text bodies stay raw
|
||||
|
||||
Anything a session may read while the browser writes it goes through temp file
|
||||
+ `os.replace` (see `asks.write_answer`). A reader never sees a partial file.
|
||||
+ `os.replace` (see `marks._write_raw`). A reader never sees a partial file, and
|
||||
a crash mid-write cannot truncate a file into a shorter — and therefore quieter
|
||||
— set of marks or a more revealing blur set.
|
||||
|
||||
`render_doc` returns **raw** text for the non-markdown case on purpose: the
|
||||
template escapes it inside `<pre>`, and pre-escaping here double-encodes under
|
||||
Jinja autoescape.
|
||||
|
||||
### 6. Every ordered collection has a stated, deterministic order
|
||||
|
||||
Operator directive, 2026-09-21. Not "usually stable" and not "whatever `rglob`
|
||||
yields" — a rule you can write down in one line, producing the same sequence on
|
||||
every render of the same state. Any defensible rule qualifies: byte order over a
|
||||
path, creation time, an explicit number, an arbitrary-but-recorded sequence. No
|
||||
rule at all does not.
|
||||
|
||||
The Booth's job is comparison, which makes this load-bearing rather than tidy.
|
||||
The operator judges tile 47 of `pancake-v3-full` against tile 47 of
|
||||
`pancake-v4-full`, and refers to artifacts positionally — "the third one", "the
|
||||
one after the banded one". If the order moves between renders, or differs
|
||||
between the gallery, the zoom ring, the zip and the `marks` read, a flag or a
|
||||
note lands on the wrong artifact. It never shows up as a crash; it shows up as
|
||||
the operator's judgment being quietly misfiled.
|
||||
|
||||
Current rules: items `sorted(rel)`; the zoom ring is that order filtered to
|
||||
images; captions resolve over a sorted scan; marks `(created, id)`; legacy
|
||||
import `(mtime, name)`; link rows pinned-then-newest. `ROADMAP.md` carries the
|
||||
table and the two places still undecided (U7 sections and compare pairing, U6
|
||||
bench listing).
|
||||
|
||||
When you add an ordered surface, state its rule in the docstring. If you cannot
|
||||
state it in one line, it does not have one.
|
||||
|
||||
## Multi-writer vs single-writer — don't inherit the wrong shape
|
||||
|
||||
`links.md` is a **multi-writer** append log: 17 agent handles post to it
|
||||
|
||||
Reference in New Issue
Block a user