Repository navigation
feat(cli): decouple --provider-address (#1492) + bundle pull --channel-id / --namespace - #1503
Conversation
…l-id (#1492) Relax the clap `requires = "node_id"` on `--provider-address` and move the pairing rule into `ClientFetchArgs::validate()`: the flag may now stand alone alongside `--channel-id` (where it only guards the adopted channel's on-chain provider), while the auto-open path still requires an explicit `--node-id`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…l reuse Widen hydrate_channel_by_id, resolve_node_for_provider, and attach_client_binding to pub(crate) so bundle pull can adopt a channel by id without duplicating the logic. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add a bundle-level --namespace flag to `decdn bundle pull`, reusing fetch's namespace parser. It threads through the single fetch_from choke point, so the manifest blob, DECDNMAN chunks, and every entry route their cache-miss origin pulls to the namespace's authorized origins. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… the bundle (#1481) Give `decdn bundle pull` the publisher-pays adopt-by-id path fetch already has: a Payment::{AutoOpen,Adopt} mode on PullCtx, resolved once in resolve_selection. In adopt mode the whole bundle pins to the channel's single on-chain provider (node derived from it, or an explicit --node-id), every entry pays from the adopted channel via hydrate_channel_by_id, and the on-chain open-lock is never taken. The keystore prompt is ordered per path so a failed discovery still never prompts. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (5)
WalkthroughBundle pull now resolves selection, signer, payment mode, and namespace once per run. It can adopt an existing channel without opening another channel, applies namespace routing to bundle fetch stages, and updates provider-address validation for channel-based fetches. ChangesBundle pull flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant bundle_pull
participant Channel
participant Provider
participant fetch_blob
CLI->>bundle_pull: parse namespace and channel options
bundle_pull->>Channel: resolve or adopt payment channel
Channel-->>bundle_pull: channel context and provider selection
bundle_pull->>Provider: fetch manifest, chunks, and entries
Provider->>fetch_blob: apply bundle namespace
fetch_blob-->>bundle_pull: return fetched bundle data
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Coverage reportTotal: 80.76% (was 80.81%, ▼ 0.05%) — 54052/66928 lines
History
|
…n-6164df # Conflicts: # crates/cli/src/commands/bundle_pull.rs
alpergundogdu
left a comment
There was a problem hiding this comment.
Review of the --provider-address decouple + bundle-pull --channel-id/--namespace work. Flag-combination logic in validate() is sound, voucher-nonce safety on the adopt path holds (per-provider lock + per-entry re-hydrate), and the namespace parser correctly rejects 0. Inline comments below; the first is a real functional gap.
Also (can't inline — unchanged context lines):
- [Low]
bundle_pull.rs--dry-runshort-circuits beforeargs.common.validate()?, sobundle pull --dry-run --provider-address 0x..alone now succeeds where clap previously rejected it. Fix: callvalidate()?before the dry-run branch (it's cheap and side-effect-free). - [your call] Moving the pairing rule from clap
requirestovalidate()changes the rejected-case exit code from clap's 2 (usage) to anyhow's 1 (plain message). More helpful message, but scripts keying on exit 2 will see a difference. No fix needed — just a conscious note.
Anvil-gated journey: a buyer opens one payment channel on-chain (not recorded in the client store), then `decdn bundle pull --channel-id` adopts it and pulls a two-entry manifest — hydrating the channel from chain on the first entry and reusing it for the second. Asserts both files land, the persisted watermark advanced (the adopted channel paid), and the store row carries the opened channel id against the node's operator. --provider-address is passed standing alone as the mismatch guard (#1492), recovering the coverage the adopt path lost. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ce routes origins Review fixes for PR #1503: - [High] The AutoOpen branch returned the open_or_reuse context WITHOUT the ADR 005 client binding, so the node's pull_authorized gate never fired a cache-miss origin pull on the default/--node-id path — making --namespace inert there. Attach the binding exactly as fetch::build_channel_ctx does (a latent pre-existing gap the new --namespace claim exposed). - [Low] Move common.validate() BEFORE the --dry-run short-circuit so the #1492 flag-combination rule (now in validate(), not clap) still rejects a dangling --provider-address under --dry-run. Regression test added. - [Low] Drop the stale `DECDNMAN` chunk reference from the --namespace doc (that format was retired in #1507); namespace now applies to the manifest blob + entries. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Thanks for the review — addressed the inline threads plus the two review-body points in d16bbd4:
All green locally: 804 unit tests + the adopt e2e ( 🤖 Addressed by Claude Code |
Summary
Two related CLI improvements to the paid client path, surfaced from #1492 and extended per review.
Part A — #1492: decouple
--provider-addressfrom--node-id. On thedecdn fetch --channel-idadopt path,--provider-addressis only a mismatch guard against the channel's on-chain provider, so forcing--node-idalongside it was pointless. The claprequires = "node_id"is dropped and the pairing rule moved into the sharedClientFetchArgs::validate():--provider-addressnow needs either--channel-id(guard) or--node-id(explicit node); standing alone is still rejected.Part B — feature parity for
decdn bundle pull. It gains both flagsdecdn fetchalready has:--channel-id(publisher-pays, Publisher-pays channels: open-on-behalf + adopt-by-id + reject-bundle resume #1481): adopts one publisher-opened channel and pins the whole bundle to its single on-chain provider (node derived from it, or an explicit--node-id). Every entry pays from the adopted channel; no per-entry discovery. A newPayment::{AutoOpen,Adopt}mode onPullCtxselects between auto-open and adopt; the on-chain open-lock is never taken in adopt mode. Reuses fetch'shydrate_channel_by_id/resolve_node_for_provider(widened topub(crate)) — no logic duplicated.--namespace(ADR 002): bundle-level routing. Threaded through the singlefetch_fromchoke point so the manifest blob,DECDNMANchunks, and every entry route their cache-miss origin pulls to the namespace's authorized origins. (The manifest format carries no per-entry namespace, so bundle-level is the only expressible shape.)Behavior change (intended):
bundle pull --channel-idwas previously a silently-ignored flag; it is now honored.Notes for reviewers
voucherSigner. The selection logic is factored intoresolve_selectionfor clarity.--node-idpinning.bundle pull --channel-idneeds anvil, and repo convention avoids always-on anvil tests. The wiring is unit-covered and the adopt machinery is the same code fetch's tested path uses. An anvil-gated e2e case indecdn-e2eis a reasonable follow-up.Test plan
cargo nextest run -p decdn-common -p decdn-cli— 830 passed (5 new tests: flag-combo validation, bundle-pull namespace parse, adopt target resolution)cargo clippy -p decdn-common -p decdn-cli --all-targets— cleancargo fmt -- --check— cleancargo test --no-run -p decdn-e2e --features anvil-e2e— compilesCloses #1492.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
--namespacesupport todecdn bundle pull, applying routing consistently across manifests, chunks, and entries.--channel-id, avoiding unnecessary channel creation.Bug Fixes
--provider-addressvalidation to work correctly with either--channel-idor--node-id.