Repository navigation
fix(node): de-flake ranking, frame-read and duplicate-draw loopback tests - #2311
Merged
Merged
Conversation
…l rank on price A probe faster than 1 ms truncates to rtt_ms = 0, which zeroes the selection score for any rate. Two such peers tied whatever they quoted, and a dear one outranked every cheaper peer at 1 ms or more. The score now uses max(rtt_ms, 1) (ADR 001), applied in compute_score so cached candidates get it too. The loopback tests that rank on price no longer depend on probe timing: the NotFound-refusal test seeds its ranking, and the three cold-path tests quote rate 1 against RANK_LAST_RATE (1000), which outweighs any RTT ratio two accepted probes can show (< 500x under PROBE_TIMEOUT). Closes #2268 Co-Authored-By: Claude Opus 5.5 <[email protected]>
read_frame reads a varint length and then read_exacts the payload, so it is not cancel-safe. Three test loops wrap it in a timeout and read the same stream again after the timeout fires: under load a ChunkData frame straddles the deadline, its prefix is lost, and the next read decodes garbage (postcard decode error). support::BufferedClientReader keeps every byte it reads in a buffer that outlives each call, mirroring the node's BufferedProofReader. The sliver-voucher test and client_loopback's pay_range_to_end and pay_and_read_to_end read through it. Sites that stop reading after a timeout are unchanged. Closes #2306 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…way tears down first When the throwaway open's client closes, its serve leg sees send.stopped() at once, and the last-out lease release cancels the fill and aborts the in-flight first draw. wiremock has already recorded that GET. A real open that claims after the cancel owns a fresh fill and GETs the first draw again: the one duplicate draw that PrimedSource documents and that the sibling torn-down test already allows. The shared-fill test now accepts exactly that: at most one repeat, of the draw that starts at byte 0. Every later draw must still be fetched once. The stale "learns of it on its next write" comment now names send.stopped(). Closes #2307 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The duplicate-draw assertion can mistakenly permit a repeated serviceability probe instead of only the aborted data draw.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Stabilizes node tests by preserving ranking signals, making timed frame reads cancellation-safe, and allowing the documented duplicate first draw.
Changes:
- Floors ranking RTT at 1 ms and updates tests/docs.
- Adds buffered client-frame reading for timeout loops.
- Relaxes the throwaway-fill assertion for one duplicate initial draw.
| File | Description |
|---|---|
crates/node/src/selection.rs |
Applies the RTT floor and adds regression tests. |
crates/node/src/node_origin/mod.rs |
Documents RTT truncation behavior. |
crates/node/tests/support/mod.rs |
Adds the cancellation-safe frame reader. |
crates/node/tests/node_origin_pull.rs |
Stabilizes ranking and timed-read tests. |
crates/node/tests/client_loopback.rs |
Uses buffered reads across timeouts. |
crates/node/tests/origin_range_pull.rs |
Allows one repeated initial range. |
adr/001-network.md |
Documents the RTT floor. |
CHANGELOG.md |
Records the ranking correction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…e draw The probe range also starts at byte 0, so a doubled probe satisfied the one-repeat exception for the aborted first draw. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit abae6bd in the Show a line coverage summary of the most impacted files.
|
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Three intermittent
decdn-nodetest failures, one commit each.#2268: sub-ms probe RTT erases the price signal (product fix)
compute_scoremultiplies the rate byrtt_ms, and a probe faster than 1 ms truncates to 0. That has two effects:The score now uses
max(rtt_ms, 1)(ADR 001 sentence + CHANGELOG). The floor is applied incompute_score, so cached candidates get it too.The tests no longer depend on probe timing:
node_origin_not_found_refusal_does_not_tar_upstreamnow usesbuild_origin_seeded_ranking.Three tests must rank on a live cold probe:
a_probe_cache_hit_still_honours_the_negative_cachea_partial_cached_budget_falls_through_to_the_cold_path_and_meters_oncea_probe_cache_hit_still_honours_the_wedged_provider_filterEach pits rate 1 against
RANK_LAST_RATE = 1000.PROBE_TIMEOUTis 500 ms and the floor is 1 ms, so two accepted probes differ by less than 500× in RTT. That makes the order provable under any load.#2306: cancel-unsafe frame reads under
timeoutsupport::BufferedClientReaderkeeps every byte it reads in a buffer that survives across calls, mirroring the node'sBufferedProofReader. Three loops read the same stream again after a timeout, and they now use it:window_pull_through_sliver_voucher_leaves_the_rest_owedclient_loopback::pay_range_to_endclient_loopback::pay_and_read_to_endSites that stop reading after a timeout are unchanged.
#2307: duplicate first draw after a throwaway teardown
The duplicate is documented product behaviour (
PrimedSource), and the sibling torn-down test already allows it. The shared-fill test now accepts at most one repeat, and only of the draw that starts at byte 0. Every later draw must still be fetched once. A stale comment ("learns of it on its next write") now namessend.stopped().Verification
cargo nextest run -p decdn-node: 1561/1561 passed.--all-targets --all-features -D warningsandcargo doc -D warningsare clean.binary(client_loopback)with--retries 0, each run alongside a concurrent full-p decdn-nodesuite. 25/25 clean, 158 tests per iteration.Closes #2268
Closes #2306
Closes #2307
🤖 Generated with Claude Code