Repository navigation
feat(id): generic event-body persistence, retrieval and range-sync (#4837) - #7657
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
…4837) Port of PR #7657 commit 8ae8bd2 onto main across the pkgs/id crate split: FORMAT v9 bodies table, EventStore::event_body/stored_body, ingest_with_body, range-sync body carriage. StoreError::MissingBody lands in id-store event_types.rs; the SharedEventStore range_body/range_ingest_with_bodies surface lands in id-store store_traits.rs over the generic EventStoreBackend seam (new stored_body/ingest_events_with_bodies backend methods, delegated by the id-events impl); ingest reconciled with the current flow (body passed through to ingest_event, writer-body retention and device ops unchanged); ported test constructor gains the chat field main added to ChainExt.
8ae8bd2 to
9650bf7
Compare
|
Agent note — ported onto current main across the crate split (task 15861, lane any-d, 2026-11-13) This PR's original commit (8ae8bd2) predated the pkgs/id crate split and no longer applied to main. It has been ported in a dedicated worktree and this branch force-updated (force-with-lease against 8ae8bd2) to the ported head 9650bf7 — a single commit on current main (46bf43a) with the same change, re-seamed:
Verification on the laptop at head 9650bf7:
No prior review findings existed on this PR to disposition (no formal reviews; CodeRabbit skipped the old head). Merging on local verification per standing fleet practice while Actions checks are stalled fleet-wide. |
Closes #4837
Generic event-body persistence for
pkgs/id's event store — the prerequisite the didit tracker phases (#2031) were missing:store_eventpersisted headers only, ingest verified bodies against the header and dropped them, and range sync carried no bodies.What changed
event_store/mod.rs): newbodiestable (event ID → body bytes); store format bumped toid.events.store.v9(previous-format stores are refused and keep their data, as with prior bumps — covered by the existing format test).event_store/ingest.rs): the verified body fromingest_with_bodyis threaded throughingest_event/ingest_in/settleand stored when its event is accepted, held, or parked; a body arriving later for a header-only stored event is stored on the duplicate path (and counts as a change, so the transaction commits). Newingest_events_with_bodiesbatch entry point verifies every body against its signed header (BLAKE3 hash + size) before storing — a non-committed body refuses its event in place and stores nothing.EventStore::event_body(id)returns the body byte-identically, or the new typedStoreError::MissingBodywhen the event is header-only, its body never arrived, or the ID is unknown. Header-only events are otherwise unaffected.event_store/sync.rs,store_traits.rs): data-phase records now carry the body after the event bytes (length-prefixed by the event length); the receiver checks the body against the header commitment before ingest and stores it through the batch path. The now-unused body-lessRangeStore::ingest_eventsshim was removed.Tests
cargo test --lib event_storeinpkgs/id: 134 passed, 0 failed (was 133 + this change's new tests net +5, one pre-existing test adapted to the batch tuple shape).New tests:
MissingBodynot-found (stored header-only and unknown ID)Queue task 13568 (lane code-w).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.