Skip to content

feat(cli): standalone client fetch (decdn fetch) + config-sourced relays - #938

Merged
alpergundogdu merged 4 commits into
mainfrom
claude/friendly-newton-c54b2f
Jun 17, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
claude/friendly-newton-c54b2f

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

What

Adds the missing client-side paid fetch primitive — a plain client can now retrieve a content-addressed blob over cdn/client/v1 without running a node daemon.

Closes the buildable part of #391 (the decdn fetch engine that bundle pull will loop over) and implements #935.

Commits

  1. refactor(node) — extract the cdn/client/v1 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 without depending on the node daemon. Swaps iroh-blobs::Hash for blake3 directly (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 original client_requester path → all node call sites + integration tests unchanged.
  2. feat(cli) — decdn fetch: dial a node by explicit --node-id/--addr/--relay-url, pay per-MB from an open --channel-id, verify the delivery slash_sig against --provider-address, BLAKE3-check the whole blob, write atomically. Plus: source relays from config (network.relay_urls) for both fetch and probe, --relay-url as 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 --check all clean
  • #578 invariant holds — cargo tree -p decdn-cli -e normal -i iroh-blobs is empty
  • Tests: node loopback/origin-pull suites (49) pass unchanged after the extraction; new unit tests for the relay resolver + atomic write + hash parsing

Scope / deferred (each its own issue)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 17, 2026 15:03

@gemini-code-assist gemini-code-assist Bot 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.

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.

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.

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-pull crate and re-export it from decdn-node under the original client_requester module path.
  • Add decdn fetch CLI command (args in common, implementation in cli) to fetch a single BLAKE3-addressed blob over cdn/client/v1.
  • Update decdn probe (and shared helper) to resolve relays from config network.relay_urls with --relay-url override.

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.

@github-actions

github-actions Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 85.11% (was 85.25%, ▼ 0.14%) — 37651/44239 lines

File Coverage Lines Δ
crates/cli/src/commands/client_endpoint.rs 100.00% 71/71 new
crates/cli/src/commands/fetch.rs 29.46% 38/129 new
crates/cli/src/commands/probe.rs 69.50% 139/200 ● 0.00%
crates/cli/src/main.rs 68.97% 20/29 ▼ 1.40%
crates/client-pull/src/lib.rs 83.73% 427/510 new
History
Commit Total Δ vs base
b9467cd 85.60% ▼ 0.15%
3c5adfd 85.37% ▼ 0.14%
52f21fd (HEAD) 85.11% ▼ 0.14%

alpergundogdu added a commit that referenced this pull request Jun 17, 2026
- 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]>
@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Addressed both review comments in 03b451e (crates/cli/src/commands/client_endpoint.rs):

  • gemini — missing config file fails the command: fixed the robustness concern. An explicit --config path that doesn't exist now resolves to an empty relay list instead of erroring, so a client dialing a direct --addr needs no config; a present-but-malformed file still surfaces its parse error. I did not adopt the suggested partial-deserializer snippet — it uses serde_yaml, but this repo's config is TOML (load_file_config → toml::from_str). Reusing the existing loader keeps one parse path and avoids a second, drifting view of the config schema.
  • Copilot — credential leak in parse error: the malformed-entry error now runs the URL through decdn_common::redact::redact_userinfo before echoing it, mirroring node bring-up's parse_relay_urls.

Added tests for both (missing_explicit_config_path_yields_empty_not_error, malformed_relay_error_redacts_userinfo). cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check clean.

@alpergundogdu
alpergundogdu force-pushed the claude/friendly-newton-c54b2f branch from 03b451e to 3c5adfd Compare June 17, 2026 15:29
alpergundogdu added a commit that referenced this pull request Jun 17, 2026
- 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]>
alpergundogdu and others added 4 commits June 17, 2026 16:35
…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]>
@alpergundogdu
alpergundogdu force-pushed the claude/friendly-newton-c54b2f branch from 3c5adfd to 52f21fd Compare June 17, 2026 15:39
@alpergundogdu
alpergundogdu merged commit b842846 into main Jun 17, 2026
22 checks passed
@alpergundogdu
alpergundogdu deleted the claude/friendly-newton-c54b2f branch June 17, 2026 15:45
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.

2 participants