Skip to content

test(e2e): size the bundle multi-source entry so a late holder splits it - #2743

Merged
thiras merged 1 commit into
mainfrom
fix/2741-bundle-multi-source-split
Oct 28, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/2741-bundle-multi-source-split

Conversation

@thiras

@thiras thiras commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Summary

cli_bundle_pull_multi_source asserted a split that ADR 039 does not promise for its 640 KiB large entry. The fix is in the test. The client and the ADR are unchanged.

Cause. A bundle entry's probe round streams (ProbeRound::Stream): the fetch starts at the first holder that answers, and the holders that answer later join it. With one lane, the first plan gives that lane the whole blob, and the lane opens one leg for it at once. The second holder joins a few milliseconds later. A late lane splits a range only while the range misses at least min_split_size (16 MiB, ADR 039 § Dynamic segmentation and tail-stealing, acceptance criterion 6). So the 640 KiB entry split only when both holders answered before the round returned, and both lanes landed in the first plan.

Client debug log of a typical attempt (large entry 4c40c3…, 656137 bytes):

23:12:46.089961 planned the missing ranges across the first lanes hash=4c40c3… total_bytes=656137 lanes=1 pending=0+656137
23:12:46.090150 opening a paid leg peer=205432… byte_offset=0 byte_len=656137
23:12:46.090351 a late holder joined provider=0xA187… rtt_ms=3.07 probed_holder=true
23:12:46.142640 a lane completed its range provider=0x23c3… offset=0 len=656137 landed=656137

Across 6 local runs on main (82 decdn get attempts), the large entry's first plan had lanes=1 in 76 attempts and lanes=2 in 6. The retry ladder passed each run only after up to 23 attempts (54 to 60 s of its 90 s budget). When the ladder ran out first, the run failed as in #2741.

Why not the client. The ADR states that a lane joins when discovery finds it, and that a late lane does not split a range below min_split_size. The objective is to fill the client's downlink, not to use N sources. Waiting for more probe answers before the first plan would add latency to every small fetch and undo the streamed round. Splitting a sub-16 MiB range that a lane already streams would open a new paid stream for a tail the ADR floor exists to refuse. The plan_pending doc ("a small blob still engages every full holder from the start") is about the lanes in the first plan. It holds.

Fix. The large entry is now 4 × min_split_size + 777 bytes (64 MiB). The split no longer depends on which holder answers first. When both holders are in the first plan, each gets half. When one holder joins late, it steals half of the missing bytes, unless the first lane has already fetched three quarters of the blob. In the runs below, the late holder joined about 35 ms after the plan, with 48 KiB fetched, and the first lane needed about 3.5 s for 48 MiB:

23:17:02.109896 planned the missing ranges across the first lanes hash=dca38f… total_bytes=67109641 lanes=1 pending=0+67109641
23:17:02.130570 a late holder joined provider=0x76B4…
23:17:02.145747 stole the tail of a lane's missing remainder … kind="covered_suffix" split=33570816 stolen=33538825 victim_frontier=49152

The retry ladder stays, because a holder whose watcher has not seen the new pool refuses the stream. It now covers only that readiness.

Test plan

Closes #2741

🤖 Generated with Claude Code

@thiras thiras self-assigned this Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 28, 2026 23:35
cli_bundle_pull_multi_source required one `decdn get` to split its
640 KiB large entry across both holders. An entry's probe round starts
the fetch at the first holder that answers, so the first plan usually
held one lane, and that lane opened one leg for the whole blob. The
other holder joined a few milliseconds later, but ADR 039 splits no
range below min_split_size (16 MiB) for a late lane. A pull split the
entry only when both holders answered before the round returned: 6 of
82 pulls across 6 local runs. The 90 s retry ladder sometimes ran out.

The client and the ADR agree: a small blob splits only across the lanes
of the first plan. The entry is now 4 x min_split_size (64 MiB), so the
late holder steals half of the missing bytes. 20 debug-logged runs each
split on the first pull, by that steal.

Closes #2741

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the fixture-size adjustment addressing the multi-source test flake.

No open issues 🎉

What changed in this PR

This PR addresses the flaky bundle multi-source end-to-end test in #2741 by enlarging its fixture to support late-holder splitting under the existing client behavior. Client code and ADR 039 remain unchanged.

Changes:

  • Increases the large entry from roughly 640 KiB to 64 MiB plus 777 bytes, giving a late holder more time to split the remaining range.
  • Explains the sizing rationale and retains retries for payment-pool watcher readiness.
File Description
crates/​e2e/​tests/​cli_bundle_pull_multi_source.rs Enlarges the large-blob fixture and documents late-holder splitting and readiness retries.
CHANGELOG.md Records the test flake’s cause and fixture-size fix.

Review effort: Balanced

@thiras
thiras force-pushed the fix/2741-bundle-multi-source-split branch from 7a83c81 to ac309db Compare October 28, 2026 23:37
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 2214834 fix/2741-bundle-mult... ac309db +/-
77% 77% 0%
View coverage of the 4 most impacted files.
File main 2214834 fix/2741-bundle-mult... ac309db +/-
crates/client/s...undle/engine.rs 65% 65% 0%
crates/node/src...s/client/mod.rs 91% 91% 0%
crates/node/src...gin/pull_leg.rs 84% 84% 0%
crates/node/src/dht/publish.rs 78% 80% +2%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@thiras
thiras merged commit bcf2760 into main Oct 28, 2026
37 checks passed
@thiras
thiras deleted the fix/2741-bundle-multi-source-split branch October 28, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e: cli_bundle_pull_multi_source flakes: no single pull splits the large entry across both holders

2 participants