Title: 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) · Issue #4471 · developing-today/code · GitHub
Open Graph Title: 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) · Issue #4471 · developing-today/code
X Title: 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) · Issue #4471 · developing-today/code
Description: Summary ReplicationTracker::accept in pkgs/id/src/world/replication.rs (F12.13 replication contract, landed today in PR #4447 for issue #806) refuses a journal header version only when it is newer than this binary supports — it has no lo...
Open Graph Description: Summary ReplicationTracker::accept in pkgs/id/src/world/replication.rs (F12.13 replication contract, landed today in PR #4447 for issue #806) refuses a journal header version only when it is newer ...
X Description: Summary ReplicationTracker::accept in pkgs/id/src/world/replication.rs (F12.13 replication contract, landed today in PR #4447 for issue #806) refuses a journal header version only when it is newer ...
Opengraph URL: https://github.com/developing-today/code/issues/4471
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"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)","articleBody":"## Summary\n\n`ReplicationTracker::accept` in `pkgs/id/src/world/replication.rs` (F12.13 replication contract, landed today in PR #4447 for issue #806) refuses a journal header version only when it is **newer** than this binary supports — it has no lower bound. A correctly signed frame with `header_version = 0` is accepted:\n\n- `replication.rs:626`: `if envelope.header_version > MAX_JOURNAL_VERSION { return Err(UnsupportedJournalVersion(...)) }` — `0` passes.\n- A `Snapshot` frame with `header_version = 0` then rebases the tracker: the Snapshot branch computes the chain base for version 0, chains the payload, and sets `self.header_version = envelope.header_version` (0).\n- A `Tail` frame with `header_version = 0` is likewise accepted by a tracker constructed with header version 0 (`ReplicationTracker::new` performs no range check either).\n\nBut journal header version 0 does not exist and can never be restored:\n\n- `pkgs/id/src/world/mod.rs:928`: `pub const JOURNAL_VERSION: u32 = 1;` — journals are created at version 1; `mod.rs:946`: `MAX_JOURNAL_VERSION = 3`.\n- `pkgs/id/src/world/core.rs:217`: `WorldCore::restore` accepts only `(JOURNAL_VERSION..=MAX_JOURNAL_VERSION).contains(&version)`, i.e. `1..=3`, and refuses any other header version before applying entries.\n\nSo the replication receiver's verified state can advance onto a chain (and a stored header version) that the restore path — phase 3's durable receiver — must refuse wholesale. That is the same class of divergence the follow-up fix on PR #4447 closed for undecodable entries (\"a verified cursor never covers data the restore path cannot read\"), one check earlier: the envelope's own header version is never held to the restore range.\n\n## Evidence (verified this run, laptop probe)\n\nProbe: `~/git/fleet/probe-2026-11-02-laneA-replhdr/` on the laptop — `replication.rs` copied **verbatim** from current main `4843f2e21` (md5 `f807510cedc0884c513f5a49ea81bfe6`, matched against the sandbox clone), with only a minimal `JournalEntry` stub (the three variants the module's own tests use, same serde tagging) and the real `MAX_JOURNAL_VERSION = 3` around it. `cargo test --offline`:\n\n- `probe_header_version_zero_snapshot_is_accepted` — a signed `Snapshot` envelope with `header_version = 0`, sent to a tracker on a legitimate v1 chain, returns `Ok`, and the tracker's `header_version()` becomes `0`.\n- `probe_header_version_zero_tail_is_accepted` — a signed `Tail` envelope with `header_version = 0` returns `Ok` from a tracker constructed at version 0.\n- Controls pass: `header_version = 4` (`MAX + 1`) is refused with `UnsupportedJournalVersion(4)`, and a legitimate v2 snapshot is accepted and rebases to 2 — so the gap is exactly the missing lower bound, not the version machinery in general.\n- The module's own in-file tests also pass in the probe (no other behavior disturbed).\n\nThe signing key in the probe is the pinned source, so this is not a forgery scenario: it is a writer bug / downgrade / confused peer producing a frame the contract says the receiver verifies — and the receiver's verified cursor then describes a journal no binary can restore.\n\n## Why it matters\n\nThe tracker is the trust boundary for replication (design `pkgs/id/doc/2026-11-01_design_id806.md`): phases 2–5 build the writer feed, durable receiver, and spectator serving on the guarantee that accepted frames form a restorable journal. Accepting header version 0 breaks that guarantee at the first field the receiver checks, and a Snapshot makes it worse by silently **downgrading** an established v1–v3 chain to 0. Every later phase that trusts `tracker.header_version()` or the verified cursor inherits the poisoned state.\n\n## Acceptance criteria\n\n- [ ] `ReplicationTracker::accept` refuses any envelope whose `header_version` is outside `JOURNAL_VERSION..=MAX_JOURNAL_VERSION` (i.e. `0`, and any future below-minimum value) with `ReplicationError::UnsupportedJournalVersion`, for all three kinds (Snapshot, Tail, Terminal — a Terminal with header version 0 against a v0 tracker is the same hole).\n- [ ] `ReplicationTracker::new` cannot be constructed on an out-of-range header version, or its construction is documented/checked so a v0 tracker can never accept frames (choose the shape that matches the crate's conventions; the accept-side check above is the mandatory part).\n- [ ] A Snapshot can no longer move a tracker to a header version below `JOURNAL_VERSION`.\n- [ ] Regression tests in `replication.rs`: signed Snapshot and Tail frames with `header_version = 0` are refused and leave tracker state (cursor + header version) unchanged; the existing v2-snapshot rebase test and the `MAX + 1` refusal test still pass.\n- [ ] `cargo test -p id --lib world::replication` passes.\n\nDistinct from: issue #4454 / issue #4455 (references.rs, PR #2756 — different module), and the two PR #4447 Codex fixes already on main (trailing frame bytes, undecodable entries — both payload-side; this is the envelope header-version bound).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-02T17:00:07Z","url":"https://github.com/developing-today/code/issues/4471"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dc98423e-bb0b-5167-0d3b-fa53b9b9d0f8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84CC:17A21E:9EF55F:CDD22F:6B0633C9 |
| html-safe-nonce | 97cc337be6c0eef7e2ac4bb159f7a8d59ec330d153fa127303c1c86c14a935b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NENDOjE3QTIxRTo5RUY1NUY6Q0REMjJGOjZCMDYzM0M5IiwidmlzaXRvcl9pZCI6IjE4OTM4MzA3NDEwODM5NjAyNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7aa7a1b917f81a48d644c2d115e725727a5a6f841aebb1314894e9de0f92043e |
| hovercard-subject-tag | issue:6167109987 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/4471/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c5207f5425cb14959770f8d3a4ecddb01b29bb01feda7cfa74fbf425a512901/developing-today/code/issues/4471 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c5207f5425cb14959770f8d3a4ecddb01b29bb01feda7cfa74fbf425a512901/developing-today/code/issues/4471 |
| og:image:alt | Summary ReplicationTracker::accept in pkgs/id/src/world/replication.rs (F12.13 replication contract, landed today in PR #4447 for issue #806) refuses a journal header version only when it is newer ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | c3584c853cd39700ecff6e2cf8364295ffdb5313e571046c41cd2479270f7df0 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9eb3bb1597d09170a5f282cd38ae376dee1a5ec1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width