Repository navigation
id: keep versions and reports on disk through id_store::content_store - #12497
Conversation
…#12492) New federation::record_store module beside record_join: canonical encodings for the gate Envelope (none existed) and for StoredReport, a NodeStore that ingests version records and report records as verified content over iroh's FsStore behind id_store::content_store with a small index file naming them, and a StoredReplica that writes admissions and report changes through at produce/receive and at the end of every exchange. Opening a node replays its version records through Replica::receive and checks the persisted report records against the rebuilt reports. Nothing in b07/b09 changes. The substrate sync-path test gains a restart test: the same exchange between disk-backed nodes dropped and reopened between steps, reading from id:// addresses with no exchange after a restart, the conflict report surviving under the same id, and a post-restart resolution staying closed across a further restart. Plan step B2(b) ticked. Stacked on #12470 (B2(a)).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a575adc386
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- stale report record heals on open (thread 1, P1) - failed version/report persist rolls the admission back, retry succeeds (thread 2, P2); failed reconcile rolls both sides back - failed open releases the blob store (thread 4, P2) - proptest codec round-trips and restart-equivalence against the in-memory Replica model (thread 3, P1) These fail on the current head; the fixes follow.
…dmission rollback, backend shutdown on failed open - Thread 1 (P1): a write-through point now stages the version and the reports it changed and publishes them in one index update (write-then-rename), so a crash leaves the old index or the new one, never a version without its reports. Opening also heals a stale report record: a report id is the hash of its canonical bytes, so a record under a rebuilt id can only be stale in status and is re-written from the replay; an unknown id is still ReportDiverged. - Thread 2 (P2): a persist failure in produce/receive rolls the admission back (replica and index restored), so the envelope retries instead of being rejected as a replay and no child can be admitted on an unpersisted version; reconcile_with rolls both sides back. - Thread 3 (P1): the failing-first commit already added proptest codec round-trips (envelope, version record, report record) and a model-based restart-equivalence test against the in-memory Replica; verified adequate, no further coverage added. - Thread 4 (P2): DiskReplica::open_dir retains a backend handle and shuts it down when NodeStore::new or StoredReplica::open fails, so the directory can be retried in the same process. Tests in 099edca define the expected behavior; compile/test verification is by CI (no local rustc in this seat).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef127c76cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Picked up queue task 21071 to shepherd PR #12497. I found one new Codex review finding on cancellation during async persistence; validating it against current main and the existing branch before deciding the safe next action. |
…e-disk # Conflicts: # planning/plans/2026-11-21_results-first.md
…2232) README gains 'The #9106 walking skeleton, by hand' — the five steps as id walk commands, from a real run of the binary. Registry: walk_cli_path joins id.rust.substrate-path (the nightly runs it with the other substrate suites). Plan: B2(b) marked landed (PR #12497), B3 marked landed with this PR, and the Track B summary row updated. Plus rustfmt on the new code.
Closes #12492
Stacked on #12470 (B2(a)): this PR is based on
xaltha/id-record-join-admissionand retargets tomainwhen that merges. The diff againstmainincludes #12470 until then.Summary
pkgs/id/crates/id-sync/src/federation/record_store.rs(declared infederation/mod.rsin this change): a node keeps its versions and reports on disk throughid_store::content_store, so it restarts with what it had.Envelope— which had no canonical encoding — plus ingress path, source, and admitted-at time) and a report record (aStoredReport: the report's canonical bytes plus its status, with a decoder for the canonical form).NodeStoreingests both as verified content underraw-blake3-256content ids over iroh'sFsStore(the production on-disk backend), with a small index file in the node directory naming the records: version records in admission order, latest record per report id. Content is digest-verified again on every load byContentStore::get.StoredReplicaowns aReplicaand aNodeStoreand presents the sync path's surface. Write-through: admissions persist atproduce/receive; versions admitted during an exchange persist at the exchange's end, from the exchange's own outcomes; new or changed reports persist at the same points. Opening replays the version records throughReplica::receive(same gate, same join check, samenows) and rebuilds the store exactly; persisted report records are checked against the rebuilt reports, a record lost to a crash between the two writes is re-written, and any other divergence is an error.Replica, so replay reproduces the reports map exactly; one writer per node directory.planning/plans/2026-11-21_results-first.mdis recorded as landed; (c) transport between two processes is next.Evidence
cargo test --manifest-path pkgs/id/Cargo.toml -p id-sync --test substrate_sync_path— 5 passed. The new restart test runs the exchange between disk-backed nodes dropped and reopened between steps: B restarts and reads the record from its address with no exchange; both restart and keep the open report under the same id with the same conflict key, versions and base; a post-restart resolution stays closed across a further restart. The four existing tests pass unchanged.StoredReplica::opendisabled, the restart test fails at the first reopened-node assertion; restored, it passes.cargo test --manifest-path pkgs/id/Cargo.toml -p id-sync --lib record_store— 5 passed (envelope/version-record/report-record codec round-trips, report id preserved; node-store round-trip in admission order; stored-replica restart over an in-memory backend).cargo test -p id-sync --test federation_b07— 11 passed;--test federation_b09— 8 passed.bash .github/scripts/check-rust-module-reach.sh— OK (819 files in 91 crates, all reached).Merge Danger
Replica/ConflictStorebehavior is unchanged for in-process nodes.StoredReplica::shutdown, the in-process form of a process exit): iroh'sFsStorekeeps its database locked after a plain drop — found by the restart test hanging on the secondFsStore::load, isolated to the backend, and fixed by holding the api handle in the newFsBlobsbackend wrapper.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.