You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
id(range-sync): Reader::varint accepts overlong encodings in all three positions — one flight has many wire spellings, the duplicate-spelling property tuple decoding already refuses #2596
The range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's tuple decoder already refuses for integers and floats.
Evidence (pkgs/id/src/event_store/range.rs, main 3a42555):
put_varint (lines ~400–408) always emits the minimal encoding: it stops as soon as the remaining value fits in one byte.
Reader::varint (lines ~497–508) accepts any encoding of up to 5 bytes whose final byte is under 0x80 — including overlong forms with leading zero groups (e.g. 0x81 0x00 for 1, or a 5-byte encoding of 5). It never checks that a multi-byte encoding was necessary.
The varint positions are: the frame entry count (decode_frame / frame_entry_count), the Fingerprint count, and the IDs count (Reader::entry).
Contrast in the same crate: tuple decoding rejects a second spelling on purpose — "The encoder emits the minimal byte count, so a leading zero payload byte … is an encoding no encoder produces. Reject it rather than accept a second spelling of the same key" (src/tuple.rs, positive-int branch; the negative-int and float branches do the same, and the float branch rejects the -0.0 stored form for the same reason — see id(tuple): decode admits the -0.0 stored form the encoder can never produce — phantom key sorts as negative, decodes equal to 0.0 #2421).
Verified this run (laptop probe, real crate, main 3a42555)
Probe: ~/git/fleet/probe-2026-10-30-laneA-rangeenc/ (id path dependency, default-features off):
Same frame with the count overlong-encoded as 0x81 0x00 → decode_frame Ok, 1 entry. Identical message, second spelling.
A Fingerprint entry whose count 5 is overlong-encoded as the 5-byte 0x85 0x80 0x80 0x80 0x00 → decode_frame Ok, 1 entry.
Why it matters
/id-range-sync/1 flights are the reconciliation wire format between peers that may run different builds. A decoder that accepts spellings no encoder produces makes byte-equality useless for comparing flights (dedup, transcript logs, test vectors, any future flight hashing/signing), and hides peer encoder bugs behind silent acceptance — the same reasoning the tuple decoder already applies. It also leaves the 5-byte cap doing double duty: a 5-byte varint can carry 35 bits, so non-canonical forms smuggle values the field widths never intended (the Fingerprint count narrows to u32 afterwards; the IDs count and frame count are used as usize loop/allocation drivers first).
Acceptance criteria
Reader::varint rejects a non-minimal encoding (a multi-byte varint whose value fits in fewer bytes), in all three positions: frame entry count, Fingerprint count, IDs count.
Tests: minimal encodings at each width boundary (0x7F, 0x80, 0x3FFF, 0x4000) still decode; overlong forms of the same values are refused in each position.
Session / ID: new-issue-creator-code-a cron run 2026-10-30 01:05 CDT
Found via: filed this run
Task: Filed: range-sync Reader::varint accepts overlong (non-minimal) encodings in all three varint positions (frame entry count, Fingerprint count, IDs count), so one flight has many wire spellings — the duplicate-spelling property tuple.rs decoding already refuses for ints/floats. Verified with a laptop probe against the real crate at main 3a42555 (overlong count 0x81 0x00 and a 5-byte Fp count both decode Ok).
Expectation: effort xs; done when Reader::varint rejects non-minimal encodings in all three positions, with width-boundary tests.
Session / ID: OpenCode scheduled lane 2026-11-01; queue task 5399
Reason: Added required 0x3fff / 0x4000 minimal and overlong cases at PR head 4ecb5513b. The previous run's range suite passed 18/18 at 98ab5efcc, but that does not cover the added assertions. The targeted rerun was canceled when the server restarted; its log /tmp/5399-lane-test-final.log contains compile output only, no test result.
🤖 Agent note · picked up — resuming at implementation_complete
Agent: queue worker (repo-worker-code), lane A
Session / ID: queue task 5399, lane A shift 2026-11-01 05:24 CST
Found via: queue claim (resume of prior checkpoint)
Task: PR id(range-sync): reject non-minimal varints in Reader::varint (#2596) #3470 already implements the non-minimal varint rejection at head 4ecb5513b with the added 0x3fff/0x4000 boundary tests. I will verify the targeted release-profile range tests at that head plus fresh PR/Codex state, and merge only if the boundary assertions pass.
What changed:Reader::varint in pkgs/id/src/event_store/range.rs now refuses a multi-byte varint ending in a zero payload group — the only non-minimal base-128 spelling — so the frame entry count, Fingerprint count, and IDs count each have exactly one wire spelling, matching put_varint. (Implementation by the prior lane at 98ab5efcc; boundary coverage added at 4ecb5513b.)
Verification:cargo test --offline --lib event_store::range on the laptop at head 4ecb5513b: 18 passed / 0 failed, including test_varint_refuses_non_minimal_encodings with the 0x3fff (2-byte accept / 3-byte refuse) and 0x4000 (3-byte accept / 4-byte refuse) width-boundary assertions and overlong refusals at all three wire positions. Codex review completed at the implementation head with no findings; the final head is test-only (+4 assertions). PR was MERGEABLE/CLEAN at merge.
Activity
dezren39 commentedon Oct 30, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 1, 2026
🤖 Agent note · picked up
23 remaining items
dezren39 commentedon Nov 1, 2026
🤖 Agent note · parked
0x3fff/0x4000minimal and overlong cases at PR head4ecb5513b. The previous run's range suite passed 18/18 at98ab5efcc, but that does not cover the added assertions. The targeted rerun was canceled when the server restarted; its log/tmp/5399-lane-test-final.logcontains compile output only, no test result.4ecb5513bbefore merging. Existing worktree:~/git/fleet/5399-2596-varint.dezren39 commentedon Nov 1, 2026
🤖 Agent note · picked up — resuming at implementation_complete
4ecb5513bwith the added 0x3fff/0x4000 boundary tests. I will verify the targeted release-profile range tests at that head plus fresh PR/Codex state, and merge only if the boundary assertions pass.queue/5399-2596-varint-minimalMerge pull request #3470 from developing-today/queue/5399-2596-varint…
dezren39 commentedon Nov 1, 2026
🤖 Agent note · done — fixed and merged
fixed_merged). PR id(range-sync): reject non-minimal varints in Reader::varint (#2596) #3470 merged as628c06ac85501e28c28341d2ab517e6b6aa3998d; this issue auto-closed by the merge.Reader::varintinpkgs/id/src/event_store/range.rsnow refuses a multi-byte varint ending in a zero payload group — the only non-minimal base-128 spelling — so the frame entry count, Fingerprint count, and IDs count each have exactly one wire spelling, matchingput_varint. (Implementation by the prior lane at98ab5efcc; boundary coverage added at4ecb5513b.)cargo test --offline --lib event_store::rangeon the laptop at head4ecb5513b: 18 passed / 0 failed, includingtest_varint_refuses_non_minimal_encodingswith the 0x3fff (2-byte accept / 3-byte refuse) and 0x4000 (3-byte accept / 4-byte refuse) width-boundary assertions and overlong refusals at all three wire positions. Codex review completed at the implementation head with no findings; the final head is test-only (+4 assertions). PR was MERGEABLE/CLEAN at merge.