From 357ec57abae6857dd972f87c8bc93f8e15d8f50f Mon Sep 17 00:00:00 2001 From: repo-worker-code-k Date: Sun, 8 Nov 2026 03:42:11 -0600 Subject: [PATCH 1/4] =?UTF-8?q?doc(id):=20terminal=20participation=20in=20?= =?UTF-8?q?object=20discussions=20=E2=80=94=20decision=20record=20(#5873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decides the terminal surface for object discussions: the shared world_line grammar as the interface (participation parity, not a read-only mirror), id:// textual anchor rendering per the #2259 form, and offline compose via the existing durable Outbox (sign at compose, replay never rewrite). Consumes #5872's delegation of terminal rendering; re-decides no parent decision. Part-selector rendering is conditional on #5870's grammar, named as such rather than assumed. --- doc/2026-11-08_design_id5873.md | 364 ++++++++++++++++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 doc/2026-11-08_design_id5873.md diff --git a/doc/2026-11-08_design_id5873.md b/doc/2026-11-08_design_id5873.md new file mode 100644 index 0000000000..c50a96717b --- /dev/null +++ b/doc/2026-11-08_design_id5873.md @@ -0,0 +1,364 @@ +# Design: terminal participation in object discussions + +- Date: 2026-11-08 +- Status: **decision record** — the shape is decided (§2–§6), the + invariants are stated (§7), and the alternatives rejected are recorded + with reasons (§8). Two of the three facets are decided outright; the + third (textual anchor rendering for *part* anchors, §5.3) is decided + **conditionally** on #5870's part-selector grammar, which has not + landed. That conditionality is named here rather than papered over — + the same discipline #5866 used for its backend half. +- Issue: [#5873](https://github.com/developing-today/code/issues/5873), + follow-on of [#5682](https://github.com/developing-today/code/issues/5682) + (Chat next steps — conversation↔object linking, talk pages, terminal + participation), programme epic #2056. Chat v1: #2051. Protocol: #2036. +- Siblings consumed, **not re-decided**: [#5872](https://github.com/developing-today/code/issues/5872) + (chat ↔ talk-page unification — its 2026-11-05 decision record + explicitly delegates "Terminal rendering → #5873"), + [#5870](https://github.com/developing-today/code/issues/5870) (chat + anchor data model — owns link-type vocabulary and part-selector + grammar), [#5871](https://github.com/developing-today/code/issues/5871) + (talk-page semantics — owns lifecycle, binding authority, visibility + intersection), [#5874](https://github.com/developing-today/code/issues/5874) + (thread resolution / discussion→edit loop), [#5875](https://github.com/developing-today/code/issues/5875) + (notifications, watch/mute, presence). +- Already-decided inputs this record builds on rather than invents: + the `id://` textual reference form and its + `[surface](id://)` plain-text fallback (spec merged in + #2259 / PR #2742); the durable [`Outbox`](../pkgs/id/src/envelope_outbox.rs) + (`enqueue`/`due`/`record`/`withdraw`); the one-line grammar + [`world_line`](../pkgs/id/src/world_line.rs) shared by the SSH `cmd:` + surface, the `id world join` stdin pump and the `id world` CLI. + +## 1. What this record decides, and what it does not + +The issue asks for one thing: a recorded decision on **terminal +participation in object discussions** — TUI/CLI flows, textual anchor +rendering, and offline compose for chat and talk pages. It is a *surface* +design: it renders and composes against models its siblings define. So the +record's job is to fix **how a terminal client participates**, not to +re-invent the protocol underneath it. + +Three facets, decided in order: + +1. **Terminal flows** (§3–§4): what a terminal client can do, expressed as + the existing one-line grammar rather than a new TUI framework. +2. **Textual anchor rendering** (§5): how an anchor looks in a terminal, + given that a terminal has no object widgets. +3. **Offline compose** (§6): what happens when the terminal is + disconnected — queue, sign, replay, and reconcile. + +Everything about *what an anchor is* (link types, part selectors, survival +across edits) stays with #5870; everything about *who may bind a talk page +and who may see it* stays with #5871; resolution mechanics stay with #5874; +notification fan-out stays with #5875. This record constrains those only +where a terminal surface forces a requirement (noted inline as +**constrains #xxxx**). + +## 2. Decision: the terminal is a first-class participant, not a read-only mirror + +1. **Participation parity is the goal, at terminal fidelity.** A terminal + client must be able to do everything a GUI client does to a + conversation — read, compose, anchor, confirm an anchor, open a talk + page, resolve a thread — with the *presentation* degraded to text, never + the *capability*. A terminal that can only read is not participating; + it is spectating, and it makes every discussion that happens in a + terminal second-class. +2. **One protocol, many surfaces.** The terminal speaks the same signed + events as every other client (#5872 invariant 1: one log, projections + differ). Nothing in this record adds a terminal-only event kind, a + terminal-only store, or a terminal-only ordering. If a terminal needs + something the protocol does not carry, the answer is a protocol change + argued on its own merits, not a local workaround. +3. **The line grammar is the interface.** The terminal surface is the + existing [`world_line`](../pkgs/id/src/world_line.rs) grammar — a plain + line is chat, a `/`-prefixed line is a command — extended with the verbs + in §3. This is deliberate: the same sentence already works identically + as an SSH command, a piped script line, and a CLI one-off, and + scriptability is what makes a terminal surface worth having. A + full-screen TUI is a *rendering* of this grammar (a later, optional + layer), never a second, incompatible interface. +4. **No new client identity.** The terminal signs with the same key as any + other client of the same identity; presence, membership and history + policy apply unchanged. "Terminal" is a surface, not a principal. + +## 3. Decision: the terminal flow verbs + +The flow is expressed as additions to the shared grammar. Each verb maps to +protocol operations the siblings already define; none introduces new +protocol state. + +| Verb | Meaning | Protocol operation | +|---|---|---| +| a plain line | send a chat message to the current conversation | `chat.message.v1` (v1, unchanged) | +| `/anchor [type]` | anchor the current conversation (or a named message) to an object | `chat.anchor.v1` (#5872 §2) | +| `/anchor confirm ` | confirm a *proposed* anchor (see §5.4) | `chat.anchor.v1`, author-signed | +| `/anchor list` | list this conversation's anchors and their state | projection over `chat.anchor.v1` | +| `/talk ` | open (or create, per #5871) the object's talk page | `talk_for` binding (#5872 §3) | +| `/anchors ` | list conversations anchored to an object | application-layer index (#5872 §5) | +| `/resolve [into ]` | resolve a thread, optionally into an edit | #5874's mechanics | +| `/queue`, `/flush` | inspect and drain the offline outbox (§6) | local `Outbox` | +| `/quit` | end the session | — | + +1. **Verbs are additive to the existing set.** `chat`, `/input`, + `/records`, `/documents`, `/document`, `/stats`, `/logs`, `/caps`, + `/help`, `/quit` keep their current meaning. An unknown `/` verb remains + a `WorldLine::Message` shown to the user — never silently treated as + chat text, which would leak a mistyped command into a signed message. +2. **The verb boundary is uniform.** Every verb parses the same way on all + three surfaces (SSH command mode, stdin pump, CLI subcommand), because + all three already share one parser. A verb added for the terminal is + added for all three or not at all. +3. **Objects are named the way the repo already names them.** A `` + is an `id://` reference (§5.1) or a friendly-name phrase + resolved by #2259's local resolution. A terminal user never has to paste + a raw hash to participate. +4. **Destructive or irreversible verbs confirm.** Anything that appends a + permanent signed event to a conversation the user did not explicitly + name (e.g. `/talk` creating a binding, `/resolve into`) echoes the + intended action and requires confirmation unless `--yes` is passed on a + scripted surface. Signed events are immutable (#2036 chained permanent); + a terminal must not make an irreversible mistake one keystroke away. + +## 4. Decision: talk pages and chat are the same flow, distinguished by anchor + +1. **The terminal does not have two modes for chat and talk pages.** There + is one conversation view; whether it is "a chat" or "an object's talk + page" is a property of the conversation's anchors, shown as a header + line (§5.2), not a different screen or a different command set. +2. **Opening a talk page is opening a conversation.** `/talk ` + resolves the object's canonical `talk_for` binding and joins that + conversation; if #5871 decides creation is allowed for this user, it + offers to create it. The terminal never invents a second store for + object discussion. +3. **A terminal user sees the object's policy, not a copy of it.** + **Constrains #5871:** the visibility-intersection rules must be + expressible as a yes/no on "can this identity project this + conversation", because a terminal has no way to render a partial or + redacted object. If #5871's answer is ever "partially visible", the + terminal renders the conversation as not-visible rather than guessing + at a redaction. + +## 5. Decision: textual anchor rendering + +A terminal renders an anchor as **text that is also a valid reference**, +never as an opaque widget. This follows the reference representation the +repo already settled in #2259 rather than inventing a terminal-specific +syntax. + +### 5.1 The rendering form + +1. **Canonical text form is `id://`.** This is the merged #2259 + form; the terminal uses it verbatim so a reference copied from a + terminal pastes into any other client and resolves identically. +2. **Display form is `[surface](id://)`.** The `surface` is the + human-readable label (the object's friendly name, or a short prefix when + none resolves). This is #2259's plain-text fallback and is what a + terminal prints when it can resolve a surface, and what it falls back to + when it cannot. +3. **Anchors are marked, not hidden.** A conversation anchored to an object + renders a header line naming the anchor(s) and their link type, e.g. + `anchored: [Design doc](id://) (about)`. An unanchored + conversation renders no header — absence is a state, not an error + (#5872's "anchor absence is a state" rule, applied to the surface). +4. **Disputed bindings are loud.** A conversation whose `talk_for` binding + is in #5872's **disputed** state renders a visible `disputed` marker on + the header and on `/anchor list`. A terminal must never present a + silently-forked binding as settled — the whole point of the disputed + state is that a human sees it. +5. **Tombstoned anchors are shown as tombstoned, not dropped.** An anchor + whose object was deleted renders `[deleted](id://)` with a + marker; the conversation stays intact (#5872 invariant 8). Dropping it + would silently rewrite what the conversation was about. + +### 5.2 Part anchors — decided conditionally + +**Constrains #5870:** a *part* anchor (a range, block or region inside an +object) must have a **textual, by-reference selector form** — object ID plus +part identifier — that a terminal can print on one line and a human can +read. The terminal cannot render a highlighted region; it can print +`[Design doc §3](id://#)` and open the object at +that part with a follow-up command. + +- **Decided now:** the terminal renders part anchors as + `[ ](id://#)`, where + `` is #5870's grammar verbatim and `` is a + local, non-authoritative human label. +- **Conditional:** the exact `` grammar is #5870's to decide + and has not landed (verified 2026-11-08: #5870 OPEN, no decision record). + This record fixes only the *frame* (`#`-suffixed selector inside the + `id://` reference) and requires that #5870's grammar be URL-fragment-safe + so the same string works in a terminal and in a link. If #5870 chooses a + grammar that cannot be expressed as a fragment, **that is a change to + this record and must be recorded on #5873**, not silently absorbed. + +### 5.3 Rendering never changes meaning + +1. **Rendering is a projection, never a source of truth.** What a terminal + prints is derived from the event log; nothing a terminal prints is + admitted back as protocol state. Copying an anchor line out of a + terminal and pasting it into a message creates a *new* message with a + reference, not a re-anchoring. +2. **Unresolvable references degrade, never fail.** A reference whose + target the viewer cannot see renders as a plain `id://` + with no surface and no error — this is the no-capability-leak rule + (#5872 invariant 6) applied to the surface: the terminal must not reveal + that an object exists by erroring differently on "exists but hidden" + versus "does not exist". + +### 5.4 Proposal vs. confirmation is visible in the terminal + +#5872's rule is "recognition proposes, members dispose": a client may scan +for object references and *propose* anchors, but only a member's signed +event creates one. The terminal makes that distinction explicit: + +- Proposed anchors render with a `proposed` marker and are inert until + `/anchor confirm ` signs the `chat.anchor.v1` event. +- A proposal is local and ephemeral; it is never sent, never shared, and + never shown to another member as if it were an anchor. + +## 6. Decision: offline compose + +Offline compose is the facet most likely to be got wrong by treating the +network as a spinner. The decision is: **compose offline by signing locally +and queueing durably; reconcile on reconnect by replay, never by rewrite.** + +1. **Offline is a normal state, not an error state.** The terminal composes, + signs and appends to the local log while disconnected, exactly as it does + online. The UI difference is a visible `offline — N queued` indicator, + not a disabled input. +2. **The queue is the existing durable `Outbox`.** Messages and anchor + events are `enqueue`d with their target, survive process exit, and are + drained by `due`/`record` when connectivity returns. No new queue is + introduced; a terminal-only queue would be a second, divergent + delivery path. +3. **Events are signed at compose time, not at send time.** A message's + author is the key that signed it (#2051), and the signature must not + depend on when the network came back. Signing at send time would let a + reconnect reorder authorship relative to the causal frontier the author + saw when composing. +4. **Reconnect replays; it never rewrites.** Queued events are appended in + their composed causal order. If the local log advanced past a queued + event's `after` frontier (because the author composed more while + offline, or another local surface did), the queued event is still + appended with its *original* parents — the projection handles the + resulting concurrency by the existing event-ID tie-break. A queued event + is **never** re-parented, re-signed or dropped to "fit" the new + frontier. +5. **A queued event that the server refuses is reported, not silently + dropped.** Admission rules (membership under group policy, the 50/10s + send-rate limit, size bounds) can reject a queued event on reconnect. + The terminal surfaces the rejection per event with its reason and keeps + the event in the outbox for the user to withdraw or retry. Silent + discard is the failure mode that makes people distrust offline compose. +6. **Offline anchors are queued the same way.** `/anchor` and `/talk` + offline queue their `chat.anchor.v1` events. **Constrains #5871:** a + `talk_for` binding composed offline competes for the "one canonical + binding" rule (#5872 §3) at admission time — the terminal must show the + user that the binding is *pending* and may lose to a binding that + landed first, surfacing the resulting disputed state (§5.1.4) rather + than pretending it succeeded. +7. **Offline compose never fabricates a projection.** While offline the + terminal shows the local log plus queued events marked as pending. It + does not guess at what other members said, and it does not mark queued + events as delivered. + +## 7. Invariants an implementation must hold (testable) + +1. **One grammar, three surfaces.** Every verb in §3 parses identically + through the shared `world_line` parser on SSH command mode, the stdin + pump and the CLI. A test parses each verb on all three and asserts the + same `WorldLine`. +2. **No terminal-only protocol state.** No event kind, link kind, ordering + rule or store exists that only a terminal client produces. A log + produced entirely from a terminal projects identically in a GUI client, + and vice versa. +3. **Capability parity.** Every operation a GUI client can perform on a + conversation is reachable from the terminal grammar; a test enumerates + the operations and asserts a verb exists for each. +4. **Reference round-trip.** Any `id://` the terminal prints + parses back to the same target, and the `[surface](id://)` + form is byte-identical to what #2259's resolution produces. +5. **No capability leak in rendering.** An unresolvable or hidden target + renders identically whether it exists-but-hidden or does not exist + (no distinguishable error, timing or label). +6. **Proposal inertness.** A proposed anchor has no protocol effect until a + member's signed `chat.anchor.v1` event exists; a log with only proposals + projects identically to a log with none. +7. **Offline durability.** A queued message or anchor survives process + exit and is delivered exactly once on reconnect; a test kills the + process between compose and drain and asserts the event is still + delivered. +8. **No re-parenting.** A queued event is appended with the causal parents + it was signed with; a test advances the local frontier while an event is + queued and asserts the queued event's `after` is unchanged. +9. **Rejection is visible.** A queued event refused at admission is + reported with its reason and remains in the outbox until withdrawn or + retried; no path silently discards it. +10. **Disputed and tombstoned states are always rendered.** A conversation + with a disputed `talk_for` binding or a tombstoned anchor always shows + that state in the header and in `/anchor list`. +11. **Additivity.** A conversation with no anchors and no queued events + renders exactly as it does in v1 today. + +## 8. Alternatives rejected, and why + +- **A. A dedicated full-screen TUI as the terminal client.** Rejected as + the *primary* answer: it forks the interface from the SSH command mode, + the stdin pump and the CLI, none of which can render a full screen, and + it makes scripted terminal participation impossible. A TUI is allowed + later as a rendering over the same grammar (§2.3), not as the interface. +- **B. Terminal as read-only spectator** (post from a GUI, watch in the + terminal). Rejected: it contradicts §2.1 and makes any discussion held in + a terminal structurally second-class; it also guarantees the terminal + surface never gets the offline-compose work that makes it useful. +- **C. Terminal-local anchor metadata** (anchors kept client-side, never + synced). Rejected for the same reason #5872 rejected its alternative C: + replicas diverge, the object-side index is impossible, and terminal + clients can't participate on equal terms. It is the one alternative #5872 + named by name as disqualifying for this facet. +- **D. A terminal-specific anchor syntax** (e.g. `@obj:hash`). Rejected: + a second reference syntax means references copied between clients stop + resolving, and it silently forks the #2259 form. The terminal uses + `id://` verbatim. +- **E. Queue at send time / sign on reconnect.** Rejected: it lets a + reconnect change authorship ordering relative to the frontier the author + saw, and it makes an offline message's identity depend on network + timing. Sign at compose (§6.3). +- **F. Re-parent queued events on reconnect to "fit" the new frontier.** + Rejected: it rewrites causal history and can reorder a conversation after + the fact — exactly the history mutation #5872 invariant 3 forbids. +- **G. Drop events the server refuses.** Rejected: silent discard is the + failure mode that makes offline compose untrustworthy; §6.5 requires a + visible, retryable rejection. +- **H. Render a redacted object for partially-visible talk pages.** + Rejected: a terminal cannot render a redaction honestly; §4.3 requires a + binary visible/not-visible answer from #5871 instead of a guess. + +## 9. Parent decisions + +**Parent decisions changed: none.** #5682, #2051, #2036 and #5872's +2026-11-05 record all stand. This record *consumes* #5872's delegation +("Terminal rendering → #5873") and adds no protocol state. The single +constraint it places back on a sibling — that #5870's part selector be a +URL-fragment-safe textual form (§5.2) — is a requirement on #5870's +grammar, not a change to any decision already made. + +## 10. What remains, and the next action + +The design is recorded; it is not fully closed, and this record says so +plainly rather than claiming a completeness it does not have: + +1. **§5.2's part-selector frame is conditional on #5870.** When #5870 lands + its part-selector grammar, this record is amended on #5873 if the frame + needs to change. That amendment is the only open design item here. +2. **Implementation is a separate, gated track**, mirroring #5872's + disposition: the terminal verbs (§3), the rendering (§5) and the offline + compose (§6) are implementation work against the settled protocol, and + should be filed as an implementation issue gated on #5870 and #5871 + landing their decisions — the same gate #6222 carries for #5872. + **Linked next action:** implementation issue filed and linked from + #5873 (see the follow-on note on the issue). +3. **No further design splits.** The remaining #5682 decomposition items + already exist as #5870/#5871/#5874/#5875; this record does not grow the + issue. From 2b035a9b20cdc731ceae52c172a1cdf677abd88f Mon Sep 17 00:00:00 2001 From: repo-worker-code Date: Sun, 8 Nov 2026 04:07:02 -0600 Subject: [PATCH 2/4] doc(id): harden terminal participation record against review findings (#5873) Two review findings on the first draft, both now fixed in place rather than deferred: - Same-author offline signing is a FORK, not concurrency: two clients of one identity signing at the same next author sequence number are voided by event_store/ingest.rs. Section 2.5 restates #2051's single-active-device rule for the terminal, Section 6.8 makes a second live client compose read-only, and invariant 10 makes it testable. - The existing Outbox cannot express "retry or withdraw a refused event": record(Refused) is permanent, due() skips finished entries, withdraw() refuses attempted entries. Section 6.2 now names the additive extension the implementation needs, and invariant 9 requires the state to be recoverable. Also states that the presence roster is node-keyed, so the same-identity check needs a node-to-account binding before it is exact. --- doc/2026-11-08_design_id5873.md | 81 ++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/doc/2026-11-08_design_id5873.md b/doc/2026-11-08_design_id5873.md index c50a96717b..e41466bdbb 100644 --- a/doc/2026-11-08_design_id5873.md +++ b/doc/2026-11-08_design_id5873.md @@ -8,6 +8,12 @@ **conditionally** on #5870's part-selector grammar, which has not landed. That conditionality is named here rather than papered over — the same discipline #5866 used for its backend half. +- Review hardening (2026-11-08, after the first draft): two defects found + in review are fixed in place rather than deferred — same-author offline + signing is a **fork**, not concurrency (§2.5, §6.8, invariant 10), and + the existing `Outbox` API cannot express "retry or withdraw a refused + event" (§6.2, invariant 9). Both are now stated as constraints the + implementation must satisfy. - Issue: [#5873](https://github.com/developing-today/code/issues/5873), follow-on of [#5682](https://github.com/developing-today/code/issues/5682) (Chat next steps — conversation↔object linking, talk pages, terminal @@ -81,6 +87,20 @@ where a terminal surface forces a requirement (noted inline as 4. **No new client identity.** The terminal signs with the same key as any other client of the same identity; presence, membership and history policy apply unchanged. "Terminal" is a surface, not a principal. +5. **One active signer per identity, and that is a *restatement* of #2051, + not a new rule.** #2051 §2.1 already says v1 must "either constrain an + identity to one active chat device or explicitly extend the crypto + roster", and multi-device chat is *not* claimed. This matters more for a + terminal than for a GUI because §6 signs offline: two clients signing + the same account key produce two events at the same next author + sequence number, and that is a **fork**, not concurrency — the store + proves it, voids that author's events from the fork point on, and freezes + later author events (`pkgs/id/src/event_store/ingest.rs:10-16`). The + event-ID tie-break reconciles concurrent events from *different* + authors; it cannot reconcile same-author forks. So offline compose is + single-client-per-identity until #2051's multi-device work exists, and a + terminal that finds the identity already active elsewhere composes + read-only (§6.8) rather than forking its own chain. ## 3. Decision: the terminal flow verbs @@ -227,11 +247,33 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** signs and appends to the local log while disconnected, exactly as it does online. The UI difference is a visible `offline — N queued` indicator, not a disabled input. -2. **The queue is the existing durable `Outbox`.** Messages and anchor - events are `enqueue`d with their target, survive process exit, and are - drained by `due`/`record` when connectivity returns. No new queue is - introduced; a terminal-only queue would be a second, divergent - delivery path. +2. **The queue is the existing durable `Outbox`, extended where it falls + short.** Messages and anchor events are queued as signed records, survive + process exit, and are drained on reconnect. No new queue is introduced; a + terminal-only queue would be a second, divergent delivery path. + + The record's earlier draft said "drained by `due`/`record`" as if that + were free. It is not, and the gap is now stated rather than papered over: + the `Outbox` at `origin/main` is a **server-to-server envelope** queue + (`pkgs/id/src/envelope_outbox.rs:1-6`) whose `enqueue` takes an + `Envelope` or a `SignedArtifact`, not a chat event; and its state machine + is one-way — `record(Outcome::Refused)` commits `Finish::Refused` + permanently, `due()` excludes finished entries, `withdraw()` refuses any + attempted entry, and `enqueue` rejects a key already present + (`envelope_outbox.rs:191-294`, `:225-268`). So "retry or withdraw a + refused event" (§6.5, invariant 9) is **not implementable against that + API as it stands**. + + The decision is therefore a small, named extension rather than a second + queue: one payload variant for a locally composed event, and one + terminal-but-reopenable state (`refused → reopen`) that clears `finish` + without changing the event. Both are additive; the existing envelope and + artifact paths and their state machine are unchanged. Concretely for + implementation (not decided here, since this record is design-only): + the `refused` state must be distinguishable from `delivered`/`gave up` + and must admit both a *retry* (reset attempts, keep the record) and a + *withdraw* (delete the record) — a refused record a user can neither + retry nor withdraw is the silent dead end this record exists to forbid. 3. **Events are signed at compose time, not at send time.** A message's author is the key that signed it (#2051), and the signature must not depend on when the network came back. Signing at send time would let a @@ -249,8 +291,9 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** dropped.** Admission rules (membership under group policy, the 50/10s send-rate limit, size bounds) can reject a queued event on reconnect. The terminal surfaces the rejection per event with its reason and keeps - the event in the outbox for the user to withdraw or retry. Silent - discard is the failure mode that makes people distrust offline compose. + the event in the outbox in the reopenable `refused` state (§6.2) so the + user can retry or withdraw it. Silent discard is the failure mode that + makes people distrust offline compose. 6. **Offline anchors are queued the same way.** `/anchor` and `/talk` offline queue their `chat.anchor.v1` events. **Constrains #5871:** a `talk_for` binding composed offline competes for the "one canonical @@ -262,6 +305,16 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** terminal shows the local log plus queued events marked as pending. It does not guess at what other members said, and it does not mark queued events as delivered. +8. **Compose offline only as the identity's single active signer.** Per + §2.5, a terminal that detects another live client of the same identity + (the presence roster already tracks liveness, though per + `pkgs/id/src/chat_presence.rs:1-49` it is keyed by **node**, not by + account key, so the implementation needs a node→account binding before + this check is exact) composes **read-only** and says so, rather than + signing a second chain at the same sequence number. There is no merge of + two same-author chains, because the store treats that as a fork. This is + the honest limit of offline compose in v1, and it is inherited from + #2051, not invented here. ## 7. Invariants an implementation must hold (testable) @@ -292,13 +345,17 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** 8. **No re-parenting.** A queued event is appended with the causal parents it was signed with; a test advances the local frontier while an event is queued and asserts the queued event's `after` is unchanged. -9. **Rejection is visible.** A queued event refused at admission is - reported with its reason and remains in the outbox until withdrawn or - retried; no path silently discards it. -10. **Disputed and tombstoned states are always rendered.** A conversation +9. **Rejection is visible and recoverable.** A queued event refused at + admission is reported with its reason and remains in the outbox in a + state that supports both retry and withdraw until the user acts; no path + silently discards it, and no refusal is terminal before the user sees it. +10. **No same-author fork from offline compose.** Two surfaces of one + identity never both sign at the same author sequence number; a test + asserts the second surface composes read-only instead of signing. +11. **Disputed and tombstoned states are always rendered.** A conversation with a disputed `talk_for` binding or a tombstoned anchor always shows that state in the header and in `/anchor list`. -11. **Additivity.** A conversation with no anchors and no queued events +12. **Additivity.** A conversation with no anchors and no queued events renders exactly as it does in v1 today. ## 8. Alternatives rejected, and why From 832ad9f8f7d345ea467798a26292e600b5f26751 Mon Sep 17 00:00:00 2001 From: repo-worker-code Date: Sun, 8 Nov 2026 04:11:35 -0600 Subject: [PATCH 3/4] doc(id): make withdrawal chain-honest in the terminal record (#5873) Third review finding: withdrawing a refused event cannot be "delete the outbox record". A later offline message commits to it through the author backlink, so withholding it strands that author's chain, while the event already signed into the local store is carried by range sync independently of the outbox. Deleting the record therefore either blocks later delivery or does not prevent delivery at all. Section 6.2 now specifies the two legal withdrawal shapes (withdraw-the-tail, or send-as-is) and says an event with an admitted successor can only be retried, never withdrawn. Invariant 11 makes that testable, and rejected alternatives I and J name both this and the same-author fork explicitly. --- doc/2026-11-08_design_id5873.md | 57 +++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/doc/2026-11-08_design_id5873.md b/doc/2026-11-08_design_id5873.md index e41466bdbb..3d9d8a0e6b 100644 --- a/doc/2026-11-08_design_id5873.md +++ b/doc/2026-11-08_design_id5873.md @@ -8,12 +8,13 @@ **conditionally** on #5870's part-selector grammar, which has not landed. That conditionality is named here rather than papered over — the same discipline #5866 used for its backend half. -- Review hardening (2026-11-08, after the first draft): two defects found - in review are fixed in place rather than deferred — same-author offline - signing is a **fork**, not concurrency (§2.5, §6.8, invariant 10), and - the existing `Outbox` API cannot express "retry or withdraw a refused - event" (§6.2, invariant 9). Both are now stated as constraints the - implementation must satisfy. +- Review hardening (2026-11-08, after review): three defects are fixed in + place rather than deferred — same-author offline signing is a **fork**, + not concurrency (§2.5, §6.8, invariant 10); the existing `Outbox` API + cannot express "retry or withdraw a refused event" (§6.2, invariant 9); + and withdrawal cannot be "delete the queue record" because range sync + transmits stored events independently of the outbox (§6.2, invariant 11). + All three are stated as constraints the implementation must satisfy. - Issue: [#5873](https://github.com/developing-today/code/issues/5873), follow-on of [#5682](https://github.com/developing-today/code/issues/5682) (Chat next steps — conversation↔object linking, talk pages, terminal @@ -272,8 +273,28 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** implementation (not decided here, since this record is design-only): the `refused` state must be distinguishable from `delivered`/`gave up` and must admit both a *retry* (reset attempts, keep the record) and a - *withdraw* (delete the record) — a refused record a user can neither - retry nor withdraw is the silent dead end this record exists to forbid. + *withdraw*. + + **Withdrawal is not "delete the queue record".** A later offline message + B commits to A through its author-chain backlink (§6.3/§6.4), so two + mechanisms fight a naive withdrawal: withholding A leaves B and every + later same-author event waiting for a predecessor that will never arrive + (`pkgs/id/src/event_store/ingest.rs:17-22`), while A already signed into + the local store is transmitted by range sync independently of the outbox + (`pkgs/id/src/event_store/sync.rs:15-23`). Deleting the record therefore + either strands the author's chain or does not prevent delivery at all. + + So withdrawal takes one of exactly two shapes, chosen per event: + **withdraw-the-tail** — A and every later unsent event of the same author + are withdrawn together, which is safe because nothing after them has been + admitted and the chain simply ends earlier; or **send-as-is** — the event + is retried even though the user's intent changed, because §6.4 forbids + re-signing and the chain cannot be rewritten. An event with already-admitted + successors can only be retried, never withdrawn, and the terminal must say + which case the user is in rather than offering a button that cannot work. + A refused record a user can neither retry nor withdraw is the silent dead + end this record exists to forbid; a withdraw that *looks* successful while + the event still syncs is the same defect wearing a checkmark. 3. **Events are signed at compose time, not at send time.** A message's author is the key that signed it (#2051), and the signature must not depend on when the network came back. Signing at send time would let a @@ -352,10 +373,16 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** 10. **No same-author fork from offline compose.** Two surfaces of one identity never both sign at the same author sequence number; a test asserts the second surface composes read-only instead of signing. -11. **Disputed and tombstoned states are always rendered.** A conversation +11. **Withdrawal is chain-honest.** A withdraw removes the event *and* its + unadmitted same-author successors, or is refused outright when a + successor is already admitted; a test asserts a withdrawn event is + never delivered by either the outbox or a range-sync session, and that + a withdraw which would strand a later event is reported instead of + performed. +12. **Disputed and tombstoned states are always rendered.** A conversation with a disputed `talk_for` binding or a tombstoned anchor always shows that state in the header and in `/anchor list`. -12. **Additivity.** A conversation with no anchors and no queued events +13. **Additivity.** A conversation with no anchors and no queued events renders exactly as it does in v1 today. ## 8. Alternatives rejected, and why @@ -391,6 +418,16 @@ and queueing durably; reconcile on reconnect by replay, never by rewrite.** - **H. Render a redacted object for partially-visible talk pages.** Rejected: a terminal cannot render a redaction honestly; §4.3 requires a binary visible/not-visible answer from #5871 instead of a guess. +- **I. Withdraw a refused event by deleting its queue record.** Rejected: + the event is already signed into the local store and range sync does not + read the outbox, so deleting the record hides the event from the user + while still delivering it (§6.2, invariant 11). Withdrawal must be + chain-aware or refused. +- **J. Let two clients of one identity sign offline and reconcile later.** + Rejected: same-author sequence collision is a fork the store voids from + the fork point on, freezing that author (`pkgs/id/src/event_store/ingest.rs:10-16`). + §2.5 inherits #2051's single-active-device rule instead of inventing a + merge that the substrate cannot support. ## 9. Parent decisions From b1203bfa6af2775ed97f1782e2b9c5e9ae2aad09 Mon Sep 17 00:00:00 2001 From: repo-worker-code Date: Sun, 8 Nov 2026 04:14:55 -0600 Subject: [PATCH 4/4] doc(id): fix stale section cross-reference in the terminal record (#5873) --- doc/2026-11-08_design_id5873.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/2026-11-08_design_id5873.md b/doc/2026-11-08_design_id5873.md index 3d9d8a0e6b..15da597fbd 100644 --- a/doc/2026-11-08_design_id5873.md +++ b/doc/2026-11-08_design_id5873.md @@ -4,7 +4,7 @@ - Status: **decision record** — the shape is decided (§2–§6), the invariants are stated (§7), and the alternatives rejected are recorded with reasons (§8). Two of the three facets are decided outright; the - third (textual anchor rendering for *part* anchors, §5.3) is decided + third (textual anchor rendering for *part* anchors, §5.2) is decided **conditionally** on #5870's part-selector grammar, which has not landed. That conditionality is named here rather than papered over — the same discipline #5866 used for its backend half.