Repository navigation
fix(net): a takeover tells the route node its successor before the predecessor ends - #9299
Conversation
…edecessor ends OwnClaims fed the route node the replaced instance's End as soon as the cursor reported a Restart, but the successor's Live only at the end of the poll. So every same-path instance swap went on the wire End(old) then Start(new). A receiver reading both before one flush still served a restart; one reading them apart told its viewers End, then Start, and a player stops on End. Removals now wait for the poll's Lives, and one that came back since is not sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. Deferring the predecessor's Ended until after the same poll's Lives fixes the order where it's created, in OwnClaims. It matches the move-between-keys order Node::own already uses, and the order the JS publisher sends.
Reviewed changes
This run reviewed the single commit, which reorders how OwnClaims feeds the route node.
- Deferred removals:
applynow records ended, lost, and displaced claims inOwnClaims::goneinstead of callingnode.ownright away. - Successor first:
feedsends the changed prefixes'Liveclaims first, then drainsgone. It skips any instance that is best at its prefix again, so a claim that leaves and comes back within one poll reaches the node only asLive. - Regression test:
a_takeover_tells_the_route_node_the_successor_firstchecks that the route stream carries(new, Live)before(old, End).
claude-opus-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughOwnClaims now queues route-layer claim removals and replacements. During Merge Risk:
|

Problem
When a route at a path is replaced by one with a new instance (a publisher republishing while its old route still holds the path),
OwnClaimssent the route node the old instance'sEndedas soon as the cursor reported the Restart, and the new instance'sLiveonly later, infeed()at the end of the poll. So every same-path takeover went on the wire as End(old), then Start(new).A receiving node that reads both before one flush still serves a restart, because
node.rs's flush serves staying broadcasts before going ones. One that reads them apart (a loaded relay, a slow socket) tells its viewers End, then Start, and an announcement-driven player stops on End. Measured downstream: a viewer two hops away saw End instead of Restart in 4 of 100 runs under CPU load.Approach
applyno longer callsnode.ownfor a removal. It records the claim inOwnClaims::gone, andfeedsends those after the Lives of the same poll, skipping any instance that is best at its prefix again by then (a route that left and came back within one poll never reaches the node as ended). This is the orderNode::ownalready uses for a claim moving between keys, and the order the JS publisher already sends (js/net/src/lite/publisher.test.ts: a successor starts before the one it replaces ends).Impact
Alternatives
Router::refresh(relay.rs), which iteratesdirtyin(path, instance)order. Not the cause here: a non-routing peer's messages each refresh on their own, so order follows the wire. The defect is the order this node puts on the wire.Caused by
Validation
model::origin_impl::tests::a_takeover_tells_the_route_node_the_successor_first: fails before the fix with[(old, End), (new, Live)], passes after.just ci: 10959 tests passed, 143 skipped.Follow-ups
None.
Models
Size: S
Implementer: Claude, claude-opus-5-5, unknown effort
(Written by Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 45c8a01
Base: origin/main at afa0ec7
Risk: medium,
This changes route announcement ordering and could disrupt takeover visibility for connected peers, but preserves the API and wire format and is fully undone by a revert.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a1fde0-5caf-7052-b176-65b5d8a80ccaReviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1fde0-749b-7aa0-90c0-b6220c6423cc, round 1Score: 9/10,
Source review found no actionable defects in the successor-first claim ordering and suppression of withdrawals for claims restored within the batch, though builds and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none