Repository navigation
Conversation
…cleanup, sync delivery, upgrade recovery (#8160) (task 20078)
|
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 17 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: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Follow-up filed as #11299: the startup recovery currently materializes all stored events, waiting rows, and recovered operations in vectors, so peak memory grows with the full persistent history. This is a separate bounded-memory acceptance requirement; #11299 links this PR and tracks a streaming/batched recovery shape. Please cross-reference it from the PR/issue as appropriate. |
|
Closing as duplicate of #11265 (merged as 4fdbd89, with follow-ups d57a650 / 6a8ea29 / 3a9d1a6 / b5691b9 already on main). Per queue protocol, diffed this branch (queue/20078-8160-device-ops @ c7e98fe) against the canonical merged work by reading both implementations. All four #8160 items are already landed and tested on main:
The only differences are API shape (this branch exposes a public |
#8160 — DEVICE_OPS hardening follow-ups from PR #8144 review (all four items)
All four items land here, each with tests covering the named scenario. Test evidence:
cargo test -p id-events --libran the full pre-existing suite green (319 passed) on this implementation, and the 4 new tests below pass (323 total in the suite); a combined rerun was still queued behind the fleet build lock on the loaded laptop at ship time.Item 3 — the device operation is now written in the ingest transaction. The op decoded from a verified
group.eventbody is threaded throughingest_event/ingest_events_innerintosettle, which writes thedevice_opsrow in the same transaction as the decision, before the resolution reads the tables — on the stored, duplicate (late body), waiting and parked paths alike (waiting/parked only once the event is actually held, the #2916 rule the membership action already follows). A released event's op is re-derived from its stored verified body indrain, so the deciding transaction writes its row too. The old post-hocrecord_device_op(its own transaction after commit) is gone: a crash or a failed second write can no longer lose a grant or a revocation.Item 2 — rows no longer leak when held events expire or are dropped.
Mirror::flush_expiredremoves the expiring events'device_opsrows in the same transaction as their waiting rows; a released event that is then refused or forks also drops its row insettle. Rows for stored events and for held events that are released are kept.Item 1 — range sync delivers device operations. The sender already carried the stored body; the receiver's batch path (
ingest_events_with_bodies) stored it but never folded it. It now decodes each body's device operation in its pre-pass — a body that claims to be a device operation and does not decode refuses its event in place, exactly as the production path refuses it — and the batch transaction records the row (item 3's mechanism), so a fresh peer's default view matches a directly-ingesting peer's.Item 4 — recovery for upgraded stores. New
EventStore::recover_device_ops: scans stored events, rebuilds any missingdevice_opsrow from the verified body the store holds, and returns aDeviceOpsRecoveryreport — events whose headers commit to a body the store does not hold (or whose held body no longer decodes) are namedunrecoverableinstead of being passed over silently. It runs on every open (idempotent; a complete store scans clean), so an upgraded store's pre-change grants and revocations fold again without waiting for re-delivery.Tests (new): waiting-path row written + removed on expiry; row kept and grant applied on release; range-sync batch records the op + claimed-but-bad device body refused in place; recovery rebuilds a deleted row and reports a header-only event unrecoverable.
Queue: task 20078, lane code-d.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.