GeezerVison is showing github.com — fix(id): cut the interrupted sync session on committed state, not a record count (#188) by dezren39 · Pull Request #254 · developing-today/code
Conversation
Fixes #188.
Problem
test_an_interrupted_session_restarts_without_duplicates flakes under full-suite load (left 0, right 256). The test cut the connection after the sender had written 400 records. Closing a QUIC connection discards whatever stream data the peer has not read yet, so under load the receiver could read fewer than 256 records before the close landed — its first batch then never committed, and the restart assertions saw 0 committed events instead of exactly one batch. The issue's own suggested fix: cut on committed state, not on a record count.
Solution
- New
CommitSignal (shared Arc<AtomicUsize>): a session side reports each batch it commits (in flush, only after the batch's transaction succeeds — a failed batch commits nothing and reports nothing).
- New
Cut::AfterRecordsWhenCommitted { records, signal, committed }: the sender writes records events, then waits (5 ms poll, 30 s cap) until the peer's signal reaches committed before closing the connection. If the commit never comes, the cut still happens and the test's assertions report the state the peer actually reached.
- The loopback harness wires the acceptor's commit reports into the dialer's cut signal automatically when the cut carries one. Production sessions are untouched:
sync_over passes Cut::Never and no signal.
- The interrupted-session test now cuts at 400 records once B has committed
BATCH_EVENTS (256), so the "one whole batch committed, the other 144 died with the session" premise is deterministic under load.
- Two network-free unit tests cover the new plumbing: the signal counts batches across clones, and
wait_for_commit is released by the commit it waits for (and at once by one that already happened).
Cut loses its Copy/PartialEq derives (the signal is neither); the one comparison site now uses matches!. The unused flight/record variants are kept as interruption-test plumbing under an explicit #[allow(dead_code)] — previously the PartialEq derive was the only thing keeping them from reading as dead.
Verification
cargo test --lib --no-run ✓ — warnings back to the single pre-existing one (Staged::keeps in ingest.rs); same for cargo check --lib and cargo check --lib --no-default-features ✓.
rustfmt --check on the changed file ✓ clean.
- Network-free
event_store::sync tests 5/5 pass locally, including the two new ones.
- Honest limitation: the loopback test itself cannot run in my sandbox — UDP socket sends return EPERM there, so every iroh loopback test (including the untouched empty-store one) hangs to its 300 s timeout on unmodified main too. The interrupted-session test needs CI (or any UDP-capable host) for its end-to-end pass; the fix's moving parts are covered by the unit tests above and the compile checks.
Note: merged main's latest nix flake check (run 39081860390, head 5bddbd3) does not fail on the #240 fmt follow-up — the fmt stage passes now. It fails on rustc-LLVM ERROR: No space left on device while linking in the id-test/id-ci derivations run in parallel (--keep-going), plus one Firefox image-upload e2e failure in the same run. That disk failure is pre-existing infra, unrelated to this change; if this PR's check hits the same ENOSPC, the unit-test stage results are the signal to read.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

Note Currently processing new changes in this PR. This may take a few minutes, please wait...
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b009eaeb-619a-482e-a8f1-6d8d1eb9f148
📥 Commits
-
Reviewing files that changed from the base of the PR and between 5bddbd3 and a3e87e6.
📒 Files selected for processing: 1
-
pkgs/id/src/event_store/sync.rs
+---------------------------------------------+
| Because, no one wants to be a human linter. |
+---------------------------------------------+
\
\ (\__/)
(•ㅅ•)
/ づ
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 18, 2026
This was referenced Oct 27, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|