Repository navigation
fix(cli): stop gating client fetch on blob size by default - #1891
Merged
Merged
Conversation
`decdn fetch` and `bundle pull` defaulted `--max-blob-mb` to 1024 MiB, refusing to download a blob whose signed `total_bytes` exceeded that ceiling before pulling any bytes. For an explicit client fetch that is the wrong default: the user named a content hash and an output file, the common case (AI model delivery) is multi-GB blobs, and the ceiling's stated purpose — guarding client memory against an over-claimed `total_bytes` — does not hold on this path. The fetch path streams to the on-disk ranged store, allocates only for received bytes, and a provider that over-claims `total_bytes` fails bao verification against the requested hash regardless of the ceiling. Flip the shared `ClientFetchArgs::max_blob_mb` default 1024 -> 0 (0 = no ceiling). Both commands flatten this one field, so they behave identically. The gate already treats 0 as unlimited and no resolver rejects it, so this is a default change only; the flag stays as an opt-in user budget guard. Reword its doc to describe it as a size ceiling and budget guard rather than a memory safeguard, and fix two comments that still called it a memory ceiling. The node's `cache.max_blob_size_mb` serve/buyer ceiling is untouched: a shared cache pulling untrusted node-to-node claims still needs it. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR adjusts the shared CLI fetch argument defaults so the client-side --max-blob-mb ceiling no longer blocks large content-hash downloads by default, while keeping the flag available as an opt-in size/budget guard for decdn fetch and bundle pull.
Changes:
- Change
ClientFetchArgs::max_blob_mbclap default from1024MiB to0(unlimited). - Reword
--max-blob-mbhelp text to describe it as an optional size/budget ceiling rather than a memory safeguard. - Update related comments/tests to reflect the new semantics (no longer tying timeout rationale to
--max-blob-mb).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The `--max-blob-mb` doc said the streaming pull "allocates only for received bytes", which understated one on-disk cost: the ranged store pre-sizes a sparse bao outboard sidecar (~0.4% of total_bytes) via set_len before verification runs. With the unlimited default an absurd `total_bytes` claim can still surface a local disk/quota error even though RAM stays bounded. Say so, and point at the flag as the bound. Co-Authored-By: Claude Opus 4.8 <[email protected]>
An unlimited (`0`) `--max-blob-mb` leaves the ranged store pre-sizing a sparse bao outboard sidecar (~0.4% of `total_bytes`) via `set_len` from a provider-claimed size with no bound. RAM is unaffected (the pull buffers only received bytes), and an over-claim fails bao verification against the requested hash — but on a non-sparse filesystem or an apparent-size quota an absurd claim could still surface a local disk error before verification rejects it. Default `--max-blob-mb` to 1 TiB (1,048,576 MiB) instead. That is far above any real blob, so normal fetches still need no tuning, while the existing pre-pull `BlobTooLargeClaim` gate refuses an over-claim before `set_len` runs — capping the outboard pre-size at ~4 GiB. `0` still disables the ceiling for anyone who wants it unbounded. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 82.60% (was 82.59%, ● 0.00%) — 70754/85662 lines
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Change the shared
ClientFetchArgs::max_blob_mbdefault from 1024 MiB → 1 TiB (1,048,576 MiB), sodecdn fetchandbundle pulldownload normal content by its hash without tuning, while an over-claimed size is still bounded.Both commands flatten the same
ClientFetchArgs, so this single-field change moves them identically.Why
--max-blob-mbdefaulted to 1024 MiB and was enforced before pulling any bytes: a delivery whose signedtotal_bytesexceeded the ceiling was refused withBlobTooLargeClaim. For an explicit client fetch that's the wrong default — the user named a content hash and an output file, and the common case (AI model delivery) is multi-GB blobs, so the default silently refused legitimate downloads and forced users to discover--max-blob-mb.The ceiling's original stated purpose — guarding client memory against a provider that over-claims
total_bytes— does not hold on the fetch path:ClientRangedStore(.partial), not a RAM buffer;total_bytesfails bao verification against the requested hash almost immediately, so the phantom tail is never written or paid.Why 1 TiB and not unlimited
An earlier revision defaulted to
0(unlimited). Review flagged the remaining edge: with no ceiling the ranged store still pre-sizes a sparse bao outboard sidecar (~0.4% oftotal_bytes) viaset_lenat creation, sized from the provider-claimed total. RAM is unaffected, and verification rejects a lying size — but on a non-sparse filesystem or an apparent-size quota an absurd claim could surface a local disk error before verification runs.1 TiB is far above any real blob (so normal fetches need no tuning) yet low enough that the existing pre-pull
BlobTooLargeClaimgate refuses an over-claim beforeset_len, capping the outboard pre-size at ~4 GiB.0still disables the ceiling for anyone who wants it unbounded.Scope
0as unlimited and no resolver rejects any value.hard_caprationale, and themax_blob_mb_does_not_influence_the_deadlinestest comment) that called the flag a "memory ceiling".cache.max_blob_size_mbserve/buyer ceiling is untouched — a shared cache pulling untrusted node-to-node claims still needs it.Where the partial + sidecars live
For
decdn fetch -o <output>the store sits beside the output file, fully visible (no hidden cache dir):<output>.partial(blob),<output>.partial.obao4(outboard),<output>.partial.ranges(resume record).finalizepromotes.partialin place to exactly<output>and cleans up the sidecars. Resume is location-based: re-running the same command re-pulls only the missing ranges. So the outboard pre-size the 1 TiB bound caps lands on whatever volume-otargets.Reviewer notes
--max-blob-mb Nstill works exactly as before for anyone who wants a tighter (or looser, or0) ceiling; only the default moved.crates/cli/src/commands/fetch.rs) still constructs an explicitmax_blob_mb: 1024; it's a literal, not a default assertion, so it stays valid.Verification
cargo build -p decdn-common -p decdn-cli— passedcargo nextest run -p decdn-common -p decdn-cli— 864 passed, 0 skippedcargo clippy -p decdn-common -p decdn-cli— clean🤖 Generated with Claude Code