Repository navigation
feat(cli): standalone client fetch (decdn fetch) + config-sourced relays - #938
Conversation
There was a problem hiding this comment.
Code Review
This pull request extracts the paid-pull requester logic from the node into a new shared crate decdn-client-pull and introduces a new decdn fetch CLI command for standalone client-side paid pulls. It also refactors relay resolution into a shared module used by both probe and fetch commands. Feedback was provided regarding the shared relay resolution: if the configuration file is absent, load_file_config will fail and prevent the command from running even when a direct --addr is supplied. It is recommended to check for the file's existence and use a partial deserializer to parse only the required network relay URLs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR adds a standalone client-side paid fetch capability to the decdn CLI by extracting the existing cdn/client/v1 paid-pull requester from the node into a reusable leaf crate, then wiring a new decdn fetch command to use it. It also updates one-shot client commands to source iroh relay URLs from config (with --relay-url as an override), aligning with issue #935.
Changes:
- Extract paid-pull requester logic into new
decdn-client-pullcrate and re-export it fromdecdn-nodeunder the originalclient_requestermodule path. - Add
decdn fetchCLI command (args incommon, implementation incli) to fetch a single BLAKE3-addressed blob overcdn/client/v1. - Update
decdn probe(and shared helper) to resolve relays from confignetwork.relay_urlswith--relay-urloverride.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/node/src/lib.rs | Re-exports decdn-client-pull as client_requester to keep node call sites stable. |
| crates/node/Cargo.toml | Adds dependency on new decdn-client-pull crate. |
| crates/common/src/cli/probe.rs | Removes clap ArgGroup requirement; updates help text to reflect config-sourced relays. |
| crates/common/src/cli/mod.rs | Adds Fetch command plumbing and exports FetchArgs. |
| crates/common/src/cli/fetch.rs | Defines CLI argument surface for decdn fetch. |
| crates/client-pull/src/lib.rs | Updates paid-pull requester to use blake3 directly for content verification (no iroh-blobs dep). |
| crates/client-pull/Cargo.toml | New crate manifest for decdn-client-pull. |
| crates/cli/src/main.rs | Wires Command::Fetch and passes config path to probe/fetch. |
| crates/cli/src/commands/probe.rs | Sources relays via shared resolver and validates reachability at runtime. |
| crates/cli/src/commands/mod.rs | Registers new client_endpoint and fetch command modules. |
| crates/cli/src/commands/fetch.rs | Implements decdn fetch: voucher signing, stream fetch, atomic output write, unit tests. |
| crates/cli/src/commands/client_endpoint.rs | Adds shared relay resolution and RelayMode builder for one-shot clients. |
| crates/cli/Cargo.toml | Adds decdn-client-pull and alloy deps to support decdn fetch. |
| Cargo.toml | Adds crates/client-pull to workspace members and workspace deps. |
| Cargo.lock | Records dependency graph updates including decdn-client-pull. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 85.11% (was 85.25%, ▼ 0.14%) — 37651/44239 lines
History
|
- A missing config file no longer fails relay resolution: an explicit --config path that does not exist now resolves to an empty relay list (matching load_file_config's default-path leniency), so a client dialing a direct --addr needs no config. A present-but-malformed file still surfaces its parse error. - Redact user:pass@ userinfo before echoing a malformed relay entry into the parse error, mirroring node bring-up's parse_relay_urls, so a bad config entry cannot leak credentials to logs. Adds tests for both: missing-explicit-path leniency and userinfo redaction. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed both review comments in 03b451e (
Added tests for both ( |
03b451e to
3c5adfd
Compare
- A missing config file no longer fails relay resolution: an explicit --config path that does not exist now resolves to an empty relay list (matching load_file_config's default-path leniency), so a client dialing a direct --addr needs no config. A present-but-malformed file still surfaces its parse error. - Redact user:pass@ userinfo before echoing a malformed relay entry into the parse error, mirroring node bring-up's parse_relay_urls, so a bad config entry cannot leak credentials to logs. Adds tests for both: missing-explicit-path leniency and userinfo redaction. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…l crate Move the paid-pull requester (stream_fetch, open_progressive_pull, ChannelContext) out of crates/node into a new leaf crate decdn-client-pull so the CLI can reuse it for client-side fetches without depending on the node daemon. Swap its iroh-blobs::Hash use for blake3 directly (the same content hash) to keep the crate light and preserve the CLI's iroh-blobs-free dependency tree (#578). Node re-exports it under the original client_requester module path, so all node call sites and integration tests are unchanged. Refs #391 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add `decdn fetch`: a standalone client-side paid pull of a single content-addressed blob over cdn/client/v1, built on the extracted decdn-client-pull requester. Dials a node by explicit --node-id/--addr/--relay-url, pays per-MB from an open --channel-id, verifies the delivery slash_sig against --provider-address, BLAKE3-checks the whole blob, and writes it atomically. Assumes an already-open, unused channel; channel-open and provider discovery are deferred to their own issues (mirrors how bundle create defers publishing). Source iroh relays from config (network.relay_urls, with the deprecated singular relay_url folded in) for both fetch and probe, with --relay-url as an override. Reachability (a direct --addr or a relay) is now validated at runtime instead of by a clap ArgGroup, since config can supply the relay. Refs #391, #935 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- A missing config file no longer fails relay resolution: an explicit --config path that does not exist now resolves to an empty relay list (matching load_file_config's default-path leniency), so a client dialing a direct --addr needs no config. A present-but-malformed file still surfaces its parse error. - Redact user:pass@ userinfo before echoing a malformed relay entry into the parse error, mirroring node bring-up's parse_relay_urls, so a bad config entry cannot leak credentials to logs. Adds tests for both: missing-explicit-path leniency and userinfo redaction. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
main (#929, `decdn node register`) added alloy to crates/cli's [dependencies] and removed the old [dev-dependencies] entry. This branch had independently added alloy for `decdn fetch`, so rebasing produced two alloy keys in [dependencies] — a manifest duplicate-key error that broke `cargo metadata --all-features` and therefore every CI job. Keep main's single entry (its comment now notes fetch uses it too) and drop the redundant one. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
3c5adfd to
52f21fd
Compare
What
Adds the missing client-side paid fetch primitive — a plain client can now retrieve a content-addressed blob over
cdn/client/v1without running a node daemon.Closes the buildable part of #391 (the
decdn fetchengine thatbundle pullwill loop over) and implements #935.Commits
refactor(node)— extract thecdn/client/v1paid-pull requester (stream_fetch,open_progressive_pull,ChannelContext) out ofcrates/nodeinto a new leaf cratedecdn-client-pull, so the CLI can reuse it without depending on the node daemon. Swapsiroh-blobs::Hashforblake3directly (same content hash) to keep the CLI's iroh-blobs-free dep tree intact (CLI binary-split regression: publisher links cache crate (iroh-blobs/AWS SDK) #578). Node re-exports it under the originalclient_requesterpath → all node call sites + integration tests unchanged.feat(cli)—decdn fetch: dial a node by explicit--node-id/--addr/--relay-url, pay per-MB from an open--channel-id, verify the deliveryslash_sigagainst--provider-address, BLAKE3-check the whole blob, write atomically. Plus: source relays from config (network.relay_urls) for bothfetchandprobe,--relay-urlas override (decdn fetch/probe: source iroh relay URLs from config, not a CLI flag #935).Verification
cargo build --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --checkall clean#578invariant holds —cargo tree -p decdn-cli -e normal -i iroh-blobsis emptyScope / deferred (each its own issue)
bundle pull(decdn bundle subcommand: pull and create directory bundles #391) — now a thin loop overfetch+ path-safety; follow-up.fetchtakes an explicit target; registry-based discovery (ADR 012 §Bootstrap,CapacityBond.getActiveNodes) + probe-and-rank is the next PR.fetchassumes an already-open, unused channel (no client-side voucher-watermark store yet; documented in the module header).fetchitself — the engine is exhaustively covered by node's loopback suite; the new CLI code (arg→domain wiring + atomic write) is unit-tested.🤖 Generated with Claude Code