Skip to content

--no-keep-blobs re-pays for a file duplicated at two bundle paths #1306

Closed

Description

@yigitdot

Found reviewing #1301.

A bundle may hold one file's content at two paths — ManifestEntry carries path + hash, and nothing dedupes entries by hash. When that hash names a DECDNMAN file manifest, both entries reconstruct it.

#1301 added a per-manifest-hash lock in PullCtx so the two reconstructions serialize rather than racing the same part directory. Under the default retention that also makes the second entry free: it finds the first's verified parts and pays nothing.

Under --no-keep-blobs it does not. The first entry deletes every part and the part directory before releasing the lock, so the second re-fetches — and re-pays for — every chunk. A 100 GB file at two paths costs 200 GB. Nothing in the output says so: both entries report Fetched(n) and the totals just add up.

The flag is documented (ADR 012 § Blob retention) as a disk option; this quietly makes it a billing one.

The reason #1301 did not simply fix it: ADR 012 § Blob retention pins the semantics as "delete immediately after reconstruction", so deferring the sweep contradicts the spec. That is a deliberate decision, not a code cleanup.

Options:

  1. Amend ADR 012 § Blob retention to "deleted when the invoking command completes", have bundle pull pass keep_blobs: true per entry and sweep recorded part dirs once after all entries drain. Smallest behavior change; makes the lock's benefit uniform across modes.
  2. Dedupe entries by blob hash before the fan-out: reconstruct once, then copy (or hardlink) to the other destination paths. Saves the paid re-fetch and the second concatenation pass in both modes, but appendix-bundles § Pull currently describes entries as independent (per-entry node selection, per-entry output, skip-existing per path), so it needs a note there and careful --overwrite/skip-existing interaction per destination.
  3. Warn only — tell the user at the point of re-fetch that N chunks already paid for this run were deleted by --no-keep-blobs.

Option 1 is the smaller change; option 2 is strictly better for the user and strictly more work.

Activity

  1. added
    kind:bug
    area:cli
    design:economics
    design:adr
    prio:medium
    on Jul 19, 2026
  2. altanoruc commented on Jul 20, 2026

    @altanoruc
    Contributor

    Automated triage note for a later run: this is small enough only after the behavior is chosen. Please select one outcome: command-lifetime retention plus an in-place ADR 012 amendment, per-hash entry deduplication, or warning-only. If deduplication is selected, pin copy vs hardlink and the per-destination overwrite/skip-existing behavior.

  3. self-assigned this
    on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clidesign:adrdesign:economicskind:bugprio:medium

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions