Skip to content

feat(client,cli): start a fetch on its first holder and join late holders as they answer - #2298

Merged
alpergundogdu merged 6 commits into
mainfrom
claude/growable-source-set
Oct 2, 2026
Merged

alpergundogdu merged 6 commits into
mainfrom
claude/growable-source-set

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Stacked on #2297; merge the two together.

Summary

A fetch starts on the first verified holder its probe round finds. Every holder that answers later joins the running fetch as a lane, and so does a late warming proxy that the rule picks. No rediscovery is needed.

decdn-client

  • New method: SourceProvider::arrivals(), a push stream of holders found after the set starts. It defaults to None.
  • Merging: SourceSet::holders_arrived merges like discovery and leaves the discovery backoff alone.
  • Acquire loop: takes the stream once, merges each arrival, and asks for growth. It asks for no rediscovery while the stream is open, because the pushed holders are the answer a discovery would wait for.
  • Public API: the snapshot is regenerated. It adds SourceStream, arrivals and holders_arrived.

CLI

  • Probe rounds take a ProbeRound:
  • The tail runs in a task from the end of the round. A slow signer unlock or pool open before the fetch reads the tail therefore neither times the probes out nor inflates their RTT. The task is aborted when the tail is dropped.
  • CliSources::arrivals yields:
    • each late holder;
    • each late non-holder the warming rule picks against the best holder known so far.
  • One node per operator. A late node of an operator already in the set never replaces the node the set has.
  • Unchanged: a round with no holder still waits for every probe. A cutoff for cold blobs is a planned follow-up.
  • Logging: fetch timings reports holders_start and holders_joined.

Measurement

--rediscover fetches of a 108 MiB blob on the testnet. Probe round = resolved_ms − probe_start_ms.

probe round (ms) first byte (ms) total (s) late joins
#2297 336, 1913, 332 1201, 3380, 954 8.8, 12.4, 7.0 n/a
this branch 54–176 (8 of 9 runs) 576–858 6.4–8.6 slow-connect holder joins at 2.4–2.7 s

The ninth run: the round took 1850 ms. Its only holder in the sample was the slow-connecting node, and four non-holders had answered in 410 ms. A round with no holder in hand waits for the first one; that's the cold-cutoff follow-up.

Tests

  • decdn-client:
    • a late holder takes a free lane beside a busy one;
    • a late holder rescues a faulted start with no discovery;
    • discovery resumes once the arrivals end;
    • holders_arrived adds a holder and updates a known one in place, without touching discovery.
  • CLI:
    • Probe round (settle_probes):
      • streams from the first holder;
      • collects answers that are already ready;
      • waits for every probe when there is no holder.
    • The tail task:
      • late probes keep running while nothing polls the tail;
      • they stop when the tail is dropped.
    • Who joins:
      • late_join applies the warming rule and ignores failed outcomes;
      • a late node joins only for a new operator.
    • fetch timings: the holder counts accumulate.
  • Gates:
    • clippy --all-features;
    • nextest for client and CLI (1421 tests);
    • the doc gate;
    • the anvil-e2e compile check;
    • the public API snapshot.

🤖 Generated with Claude Code

alpergundogdu and others added 5 commits October 2, 2026 11:09
probe_and_order waited for every probe with join_all, so one slow
connect held the fetch for up to the 5 s probe timeout. On the testnet
one node's first connect takes about 1.7 s while two holders answer
within 170 ms.

Each probe now verifies and classifies its own answer, and the round
ends 250 ms after the first verified holder answers, or when every probe
has answered. A round with no holder still waits for every probe, so a
cold blob sees every reachable pull-through target. A dropped holder
stays reachable through the fetch's later discovery.

Each probe's outcome and elapsed time log at debug.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st as they answer

The first probe round of a fetch, and of each bundle-pull entry, returns
at the first verified holder with any answers already in, and keeps its
pending probes as a tail. CliSources pushes each late holder through
SourceProvider::arrivals, and each late non-holder the proxy-warming
rule picks against the best holder known so far. Rediscovery keeps the
250 ms cutoff and drops its tail. A round with no holder still waits for
every probe.

fetch timings reports holders_start and holders_joined.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ode per operator

A task drives a streamed round's pending probes from the end of the
round, so a slow signer unlock or pool open between the round and the
fetch neither times them out nor inflates their RTT. Their answers wait
in a channel, and the task stops when the tail is dropped.

A late node of an operator the set already has never replaces the node
the set already has.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alpergundogdu
alpergundogdu added this pull request to stack #2301 October 2, 2026 12:20
Base automatically changed from claude/probe-first-good-holder to main October 2, 2026 12:21
…urce-set

# Conflicts:
#	crates/cli/src/commands/fetch.rs
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 6ac8eaf in the claude/growable-sour... branch remains at 87%, unchanged from commit 2366118 in the main branch.

Show a line coverage summary of the most impacted files.
File main 2366118 claude/growable-sour... 6ac8eaf +/-
crates/cli/src/.../bundle_pull.rs 81% 80% -1%
crates/client/src/sink.rs 97% 96% -1%
crates/cli/src/...mmands/fetch.rs 75% 75% 0%
crates/client/src/scheduler.rs 95% 95% 0%
crates/client/s...c/connection.rs 97% 97% 0%
crates/client/s...c/source_set.rs 97% 97% 0%
crates/client/src/streamer.rs 91% 92% +1%
crates/cache/src/engine.rs 94% 95% +1%
crates/node/src...nt/serve_leg.rs 91% 93% +2%
crates/cli/src/.../cli_sources.rs 53% 56% +3%

@alpergundogdu
alpergundogdu merged commit 4f2ef9c into main Oct 2, 2026
30 checks passed
@alpergundogdu
alpergundogdu deleted the claude/growable-source-set branch October 2, 2026 13:07
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.

1 participant