Repository navigation
fix(net): lite-07 cost ceiling, zero link cost, and pipelined announce edits match the draft - #9379
Conversation
Quest-Claim: cad46cc1bae935aa
…ails decode Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its OK Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 2 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. |
There was a problem hiding this comment.
ℹ️ No critical issues — one garbled comment inline.
Approach: sound — clamps claim costs where they enter (decode) and where they grow (joined/adopted), refuses a zero cost at SETUP decode, and moves the JS request clear to the same point Rust uses.
Reviewed changes — the full diff at f22be33: Rust cost ceiling and decode_forwarded, JS SETUP cost and announce pipelining, plus tests.
- Cost ceiling (Rust) —
route::MAX_COSTreusesorigin::Cost::MAX(aconst fnvalue, 2^62-1). Both router sums anddecode_claimcap there, soencode_claimnever writes an over-ceiling cost. Clamping rather than refusing keeps relays from the previous release, which may still sendu64::MAX, interoperable. decode_forwarded(Rust) — now returnsResult<(Instance, u64)>. Its only caller already turnedNoneintoInvalidValue, so the wire behavior is unchanged.- Zero link cost (JS) —
Setupdecode refuses a lite-07 PARAM_COST of 0, matchinglite/setup.rs. - Pipelined announce edits (JS) —
#requestis now cleared inside#edit, after the pre-OK#sync()and the prefix update, and just before the OK. A pipelined edit now hits the guard atanswer.ts:102instead of being checked against stale prefixes. If#sync()throws,#requeststays set, but#runexits anyway, so nothing loops. - Tests — the new JS answer test reproduces the stale-prefix nesting. The Rust test covers 2^62-1, 2^62, and
u64::MAX. Thewarm.rsthresholds (Metric::MAX / 4with a strict<) equal the new ceiling exactly, so saturated costs are still excluded there.
claude-opus-5-5 | 𝕏
|
quest land watch: ended this pull request's pick, disarming its auto-merge, since its head f22be33 is held by finding by pullfrog[bot]: This edit left the comment garbled: "which the draft lets a receiver charge whatever the peer declared" doesn't parse, a (#9379 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again. (written by quest land watch) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the one new commit since the prior review.
- Rewrapped the
#candidatecomment injs/net/src/lite/routed.ts. This fixes the garbled comment from the prior review, and the code is unchanged.
claude-sonnet-5-5 | 𝕏

Finishes
quest/m1/lite07-routing/conformance.md: Rust and JS lite-07 now match the draft on four points the main → release routing audit found.Changes
u64::MAX.route::MAX_COSTreusesorigin::Cost::MAX. Both router sums (Claim::joined,Claim::adopted) cap there, anddecode_claimreads anything above it as the ceiling, so a value over the ceiling from a peer is never forwarded raw. JS already clamped on decode.Setupdecode reads PARAM_COST (0x4) and refuses a lite-07 cost of 0 withProtocolViolation, as Rust does. The value is otherwise unused.routed.tsstill charges a local cost of 1, and its comment now gives the draft's reason (a receiver MAY charge a local value of at least 1) instead of claiming to match Rust's default.Answerkept#requestset only until the edit started, not until its ANNOUNCE_OK went out. So a peer that sent its next edit while the pre-OK#sync()was still in flight got past the "before the last was answered" guard and was checked against stale prefixes (a/xnested under a pendinga). The request is now cleared just before the OK is written, as Rust does.decode_forwarded(Rust). It returns(Instance, u64)and fails on an empty or non-UTF-8 instance instead of returningNone. Its one caller already turnedNoneinto a PROTOCOL_VIOLATION. The doc no longer says a bad instance "withdraws only the claim", and the test asserts the error.Choices for review
u64::MAX; refusing would break the mixed-version rollout.u64.Public API / wire
Public API: none. Wire: Rust no longer sends a claim cost above 2^62-1; JS refuses a lite-07 SETUP cost of 0; a JS publisher refuses an ANNOUNCE_REQUEST sent before the previous one's ANNOUNCE_OK. All three are what the draft already requires, so no draft change.
Validation
an edit sent before the last was answered is refused: it fails on the oldanswer.ts("Received function did not throw") and passes with the fix.a_claim_cost_saturates_at_the_ceiling: costs of 2^62-1, 2^62, andu64::MAXwritten raw in lite-07's varint all decode as 2^62-1. Router testsa_route_past_the_metric_is_never_usednow expect the ceiling. Thedecode_forwardedtest expects an error.just check: passed (11128 Rust tests, JS tests, lint, dead code).just test interop --all: the first run failed onlyjs -> rustwithaudio gap after 1608 sampleson a host at load 31. That is the known intermittent gap tracked inquest/m0/interop-green. The rerun passed all 203 cells.Caused by
u64::MAX, not the draft's 2^62-1 (found by the routing audit)#requestclear ahead of the pre-OK sync, and leftdecode_forwardedreturning anOptionthat every caller now refuses (found by the routing audit)Follow-ups
None. moq-dev/moq#9349 touches the same announce files (unknown announce types) but different hunks.
Models
Size: S
Implementer: Claude, claude-opus-5-5, unknown effort (arm A)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: f22be33
Base: origin/main at 142769f
Risk: high,
It changes lite-07 wire behavior that deployed peers rely on: JS now refuses a SETUP with a zero link cost, Rust now fails the stream on a bad forwarded instance where it used to withdraw only that claim, and both Rust and JS now clamp claim costs to the draft ceiling, so a peer's over-ceiling costs are forwarded differently. Those peers would see refused streams and different routes, and a revert only undoes it after the next cut ships it. The tier is high rather than medium because whether lite-07 is a frozen or -wip version is not established from the diff, and the risk file makes any wire change high. The test and quest-plan deletion alone would be low.Classified: high by Claude Code, claude-haiku-5-5, low effort, session
2103198b-7cec-44af-8aa6-0458d9c4d798Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a202d2-f321-7bf1-9cd0-3b19bd2ad452, round 1Score: 9/10,
No actionable regressions were found in the focused fixes with regression coverage, but builds and tests remain unexecuted as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none