feat(store): a tool call is one journal transaction (P15 T1, D-88)
Accounting reasoning: a write that is retried after a lost answer must happen once, and a call that dies between its journal lines must never be replayed as if whole. The journal feature `call_transactions` frames a call's lines with `call.begun` and `call.closed`; the lines between count only when the closing line says `ok`. Every replay (open, the viewer, verify, rebuild, the projection's catch-up) goes through one gate (`CallGate`), so no state is built from half a call and a replay of any prefix ending inside a call equals the replay of the prefix before it. A call that never closed is closed `unfinished` at the next open; a call that fails after writing lines is closed `failed`, its SQLite changes (one transaction per call) rolled back and the live ledger rebuilt without them. The closing line keeps the answer given, so a repeat of a request key returns it; the key table is rebuilt from the journal alone. The envelope is untouched. Lines outside a frame apply as ever, so every journal written before the feature replays as it was. Books get a unique id (`books_id`) at creation, and older books at the format upgrade, in the `journal.format_set` that declares the feature. The frame lines never move the audit's figure head. The upgrade's declaration now also carries the id, so the three tests that pinned its exact payload compare it without the id. No figure and no golden moved. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
7058fbd2b9
commit
2633109d55
15 files changed
+1375
-29
No files matched your search
@@ -196,6 +196,20 @@ a backup is then proven where it lands, by a drill (docs/mcp-interface.md,
|
||||
`method` ({model?, reasoning_effort?, adversarial?, verifier_agents?}) is
|
||||
that client's own word. Whether a claim counts is never journaled: it is
|
||||
derived against `policy.attestation_bar` when asked.
|
||||
- **A tool call is a frame, not a record** (plan P15 2a, D-88, feature
|
||||
`call_transactions`): a call that writes lines is framed by
|
||||
`call.begun {tool, token, key, args}` before its first line and
|
||||
`call.closed {tool, token, key, args, outcome, first_seq?, last_seq?,
|
||||
answer?, error?}` after its last. The lines between count only when
|
||||
`outcome` is `ok` (then `answer` is the text of the answer given, kept
|
||||
so a repeat of `key` returns it); `failed` and `unfinished` (written by
|
||||
the open that finds a call that never closed) say the lines in the frame
|
||||
never count, in any replay. A call that wrote no line is a closing line
|
||||
alone. A line outside a frame applies as ever, so every journal written
|
||||
before the feature replays as it was. `store.created` carries
|
||||
`books_id` (the books' own unique id) in books made since the feature;
|
||||
older books are given one in the `journal.format_set` of their upgrade.
|
||||
Neither frame line moves the audit's figure head.
|
||||
- The store is policy-free: it records attachments faithfully. Whether a
|
||||
posting *requires* a receipt is decided by the MCP layer's receipt policy
|
||||
(`docs/mcp-interface.md`), which reads the `attachments` table.
|
||||
|
||||
Reference in new issue
Block a user