GeezerVison is showing github.com — Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) · Issue #4592 · developing-today/code
Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) #4592Closed 3 / 33 of 3 issues completedClosed 3 / 33 of 3 issues completed Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/lLarge: multi-day or open-ended; expect staged check-insepicMeta-issue grouping multiple items (org Project Type=Epic)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item DescriptionDesign doc: files/designs/code-id-replication-admission.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main 73c0ec7466291b164b00f2fb3c911c2769997de2 — every defect below re-verified present at the cited sites this pass (2026-11-02).
Summary
ReplicationTracker::accept (pkgs/id/src/world/replication.rs) is the receiver-side trust boundary for world-journal replication (F12.13, #806, PR #4447): whatever it accepts, the durable receiver and spectator phases treat as a verified, restorable journal. The module's own rule, recorded when the PR #4447 follow-up closed the undecodable-entry hole, is that a verified cursor never covers data the restore path cannot read. That rule has been enforced leg by leg for the payload — entries must decode (chain_payload), and the payload's own journal header must be exactly one Created header for this world at the envelope's version (validate_payload_journal_header, #4486, landed today). The envelope's own header_version field is still held to neither of the two contracts WorldCore::restore and the journal writer jointly state:
Both are one unstated contract with two clauses: the envelope's header version is admitted only if the chain it names could exist — in the restore range, and never behind the chain the tracker already holds.
The contract
A frame is admitted only if its header version names a chain that could exist: inside the restore range JOURNAL_VERSION..=MAX_JOURNAL_VERSION, and — for a snapshot, the one frame kind allowed to change the chain's version — never lower than the version of the chain the tracker already holds.
Recorded decisions (full reasoning, alternatives and risks in the design doc):
- The range check lives in
accept, for every kind, before any state changes — header_version outside JOURNAL_VERSION..=MAX_JOURNAL_VERSION is refused with the existing UnsupportedJournalVersion variant, now applied to both ends. Snapshot, Tail and Terminal alike: a v0 Terminal against a v0 tracker is the same hole as a v0 Snapshot.
- Construction is made inert, not redesigned — id(replication): ReplicationTracker accepts journal header_version 0 — accept checks only the upper bound, so a signed Snapshot rebases a v1-v3 chain onto a version WorldCore::restore refuses (1..=3) #4471 offers two endings for
ReplicationTracker::new; this design records the second. With decision 1 in accept, an out-of-range session version makes the tracker inert: every frame kind carries its own header_version and is range-checked on the envelope, and tails/terminals must additionally equal the tracker's version, which no in-range frame can do against an out-of-range tracker. new's doc states this explicitly. A fallible constructor would ripple to every session bootstrap for a state that cannot arise from a real journal header — the session version comes from the local journal, whose header restore already range-checks.
- Snapshot monotonicity gets its own error — a snapshot whose
header_version is lower than the tracker's current header_version is refused with a dedicated variant (HeaderVersionRegressed), leaving cursor and header version untouched. Reusing HeaderVersionChanged loses: that variant's doc names the tail/terminal fact (any change on a frame kind that may not change version), while a snapshot regression is a different diagnosis — the one frame kind that may move the version moved it the one way journals never move — and the durable receiver's logging will want to tell a downgrading writer bug from a merely desynchronised peer.
- Equal and higher stay accepted — same-version snapshots remain the compaction rebase; higher in-range snapshots remain the header-bump rebase (both covered by existing tests). Only the lower direction is refused; no legitimate writer state is excluded, because no code path in the repo ever lowers a journal's header version.
Phased breakdown
Phases adopt the two open origins as sub-issues (no parallels); #4486 is the landed third leg, cited as the embodiment, not a phase. Phase 3 is a new closing-audit issue, gated on Phases 1–2.
- Phase 1 — the restore range at the envelope (adopted: id(replication): ReplicationTracker accepts journal header_version 0 — accept checks only the upper bound, so a signed Snapshot rebases a v1-v3 chain onto a version WorldCore::restore refuses (1..=3) #4471). Decisions 1–2: range-check every kind in
accept; new's inert-tracker doc. (id(replication): ReplicationTracker accepts journal header_version 0 — accept checks only the upper bound, so a signed Snapshot rebases a v1-v3 chain onto a version WorldCore::restore refuses (1..=3) #4471 is currently status/parked with a holder — its agent note under this design records the phase structure; the design does not reassign it.)
- Phase 2 — snapshot monotonicity (adopted: id(replication): ReplicationTracker accepts a snapshot with a lower header version — replica silently rolls back and re-admits old-version tails #4487). Decisions 3–4: refuse a lower-version snapshot with
HeaderVersionRegressed, state untouched. Independent of Phase 1 in logic; textually adjacent in accept (whichever lands second rebases a small diff — noted, not gated).
- Phase 3 — closing admission inventory + contract statement (new issue, gated on Phases 1–2): the contract statement lands in the
replication.rs module doc, and every precondition WorldCore::restore demands of a journal is dispositioned against a check in accept (holds at accept / holds at restore only, with the reason that is safe / gap filed as a named follow-up). Required dispositions: (a) entry-kind version gating — whether a signed in-range snapshot may carry an entry kind that requires a higher header version (header_version_for_entry) on a lower header, and what restore makes of it; (b) the session-bootstrap version source — where ReplicationTracker::new's header_version argument comes from in the serve wiring, and whether decision 2's inert-tracker reasoning holds at that call site, including whether a new session may legitimately start below a previous session's version; (c) Terminal frames carrying an out-of-range version against a tracker set by a pre-fix snapshot (expected covered by Phase 1 — confirm, don't assume); (d) any accept caller that pre-validates versions itself — disposition each as removed, delegated to accept, or named exception.
Open questions (in the design doc, not filed)
Whether the durable receiver (#806 phase 3) should persist a regression refusal as writer-misconduct evidence or merely log it; whether a future protocol revision wants an explicit reset/rebase frame kind for disaster recovery (snapshot regression is recorded as not that mechanism); the session-restart version question, assigned to Phase 3's disposition (b) to answer from the actual bootstrap code.
Related
- Origins adopted as phases: id(replication): ReplicationTracker accepts journal header_version 0 — accept checks only the upper bound, so a signed Snapshot rebases a v1-v3 chain onto a version WorldCore::restore refuses (1..=3) #4471 (Phase 1), id(replication): ReplicationTracker accepts a snapshot with a lower header version — replica silently rolls back and re-admits old-version tails #4487 (Phase 2).
- Landed sibling leg, cited not adopted: id(replication): ReplicationTracker::accept never checks the payload's own journal header — a snapshot with no header, a foreign world's header, a version-99 header or a duplicate header is verified and advances the cursor, though WorldCore::restore refuses every one #4486 (payload's own journal header, closed 2026-11-02) and the PR feat(id): F12.13 replication wire contract + crypto primitives (#806 phase 1) #4447 decode leg in
chain_payload.
- Sibling designs in the same crate: Design: reconstruction is admission — validate authority-bearing inputs where they are rebuilt (pkgs/id) #2898 / Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000 (journal reconstruction is admission — the restore side of this same rule), Design: a signed artifact is validated as strictly as it is built — one receipt contract for pkgs/id artifacts #3231 (signed-artifact receipt), Design: one guarded door — every gossip claim enters through its table (pkgs/id presence + peers) #4502 (gossip admission). This design is the replication-receipt gate; it does not re-audit the journal seams Design: reconstruction is admission — validate authority-bearing inputs where they are rebuilt (pkgs/id) #2898/Design: reconstruction is admission, continued — carried state, checked succession, and every restore's guards (pkgs/id follow-on to #2898) #4000 own.
- Feature epic: id: F12.13 journal replication (read replicas over a signed stream) #806 (F12.13 replication; phases 2–5 build on this contract).
Acceptance criteria
- Every acceptance leg named in the design audit is either implemented with tests or explicitly dispositioned on this issue: a verified cursor never covers journal data the restore path cannot read (headers, chain payload, and each leg the audit enumerates).
- Regression tests reproduce each audited defect against the pre-fix code and pass after the fix.
- The design doc (
files/designs/code-id-replication-admission.md in the goal workspace) and this issue agree at landing; any leg deferred is filed as a linked follow-up issue, not dropped.
Sub-issuesCollapse Sub-issuesSub-issues3 of 33 of 3 Issues completedLoading 3 sub-issues Activityadded app/idPackage/app: id (pkgs/ or apps/ in this repo) epicMeta-issue grouping multiple items (org Project Type=Epic) kind/designA design proposal (design-architect): multi-step, phased, decision-bearing on Nov 2, 2026dezren39 commented on Nov 2, 2026 agent-note:v1 — design architect, pass 40 (2026-11-02)
Design #4592 originated this pass from the replication-admission audit at origin/main 73c0ec74: ReplicationTracker::accept holds the envelope's header_version to neither the restore range (#4471) nor monotonicity (#4487), while the payload-side legs of the same rule already landed (chain_payload decode check, PR #4447; validate_payload_journal_header, #4486, closed today).
Structure: Phase 1 = #4471 (adopted), Phase 2 = #4487 (adopted), Phase 3 = #4593 (new closing audit, gated on Phases 1–2, triage packet → pilot task 6481). All three are linked as sub-issues. Full design: files/designs/code-id-replication-admission.md in the keep-the-four-repos-healthy goal workspace; register entry added (status: proposed). dezren39 commented on Nov 2, 2026 Intake review
Design issue from the design-architect audit at origin/main 73c0ec7, re-verified leg by leg in the issue body; companion to #806 / PR #4447 (the replication trust boundary it extends). Still live: no merged PR references this issue (filed today). Risks: the cursor/restore invariant spans several legs — a partial fix that covers only the named leg re-creates the hole the PR #4447 follow-up already closed once. Suggested approach: implement leg-by-leg with one failing test per leg before the fix, in the order the audit lists them.
🤖 Agent note · filed
- Agent: fleet monitor
- Session / ID: repo-fleet-monitor run 2026-11-02 16:12 CST
- Found via: monitor reconciliation
- Task: Intake enrichment (§5) for this issue — acceptance criteria appended, labels normalized, this review posted.
- Expectation: done = the acceptance criteria above; routing to a worker happens through the queue/feeder as usual.
dezren39 commented on Nov 10, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 10, 2026 🤖 Agent note · triaged (queue packet closed per runbook §1c) — Agent: queue worker (repo-worker-code), lane code-y — Session/ID: task 8414, repo-queue-worker-shift-y 2026-11-09 run.
- Task 8414 (triage) for issue Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) #4592: fresh check — issue Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) #4592 OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit), no status/needs-triage label, and it carries status/triaged.
- Per runbook §1c (Queue/lane design rules: no by-id blocking by default, optional platform selector, triage separate from fixes #8097 rule 3), a triage packet whose issue no longer carries status/needs-triage is bookkeeping only. Nearest triage record on the issue: the 2026-11-03 coverage-pass agent note Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) #4592 (comment) ("state: triaged (coverage pass) — Verdict: still live"). Gap noted: no dedicated triage-step agent note was found in a full comment search.
- Completing task 8414 with outcome
triaged; issue Design: a verified cursor covers only a restorable chain — replication admission, finished (pkgs/id) #4592 stays OPEN. Queue/status/work labels set by the queue are removed at this terminal transition.
dezren39 commented on Nov 10, 2026 🤖 Agent note · done (already_done at current main) — closing issue #4592 with evidence
MetadataMetadataapp/idPackage/app: id (pkgs/ or apps/ in this repo)effort/lLarge: multi-day or open-ended; expect staged check-insepicMeta-issue grouping multiple items (org Project Type=Epic)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item DevelopmentNo branches or pull requestsIssue actions
|