Skip to content

refactor(client): splice bundle donors into an assembly file, not the store - #2945

Merged
alpergundogdu merged 1 commit into
mainfrom
bundle-splice-at-assembly
Nov 23, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
bundle-splice-at-assembly

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Step 1 of moving the client store onto iroh-blobs (#2881). An iroh-blobs store only takes bytes that come with a bao proof, and a bundle donor has none. This change makes the ranged store hold only bao-verified bytes, on today's store, before the swap.

What changes

  • A dedup entry splices its donor bytes into <hex>.assembly beside its staging file instead of into the store's .partial.
  • Before the whole-file BLAKE3, the store's present ranges are copied over the splices. A verified byte always wins over a spliced byte at the same offset.
  • On a match the assembly is renamed to the staging file and the store (.partial + .partial.ranges) is removed. On a mismatch the self-heal re-drive is unchanged.
  • The assembly file is rebuilt every run (donors are re-checked every run anyway), so it is not fsynced. remove_staging and the CLI's leftover scan know the new name.
  • ensure_partial goes away: with no splices in the store, a later drive can no longer truncate spliced bytes.

Behavior difference

A donor whose own chunk verifies but whose placement in this entry is wrong, over a range the store already holds, no longer triggers a whole-blob re-drive. The store's bytes overwrite it and the hash matches.

Tests

  • New: spliced_bytes_never_enter_the_store (an interrupted entry leaves no donor byte in .partial) and verified_store_bytes_win_over_a_spliced_byte (no self-heal re-drive; assembly promoted; store removed).
  • The fake RecordingDriver now admits real bao into the store, so the record names driven ranges present, as a real drive does.
  • cargo nextest run -p decdn-client -p decdn-cli: 2566 passed. Workspace clippy (--all-features) and workspace cargo doc clean.

🤖 Generated with Claude Code

… store

A dedup entry splices its donor bytes into `<hex>.assembly` beside its
staging file. The ranged store's `.partial` holds only bao-verified bytes
from paid legs. Before the whole-file BLAKE3, the store's present ranges
are copied over the splices, so a verified byte always wins over a spliced
one at the same offset. On a match the assembly is promoted and the store
removed.

This is step 1 of moving the client store onto iroh-blobs (#2881): an
iroh-blobs store only takes bytes with a bao proof, and a donor has none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 5173506 bundle-splice-at-ass... d40c2a0 +/-
77% 77% 0%
View coverage of the 5 most impacted files.
File main 5173506 bundle-splice-at-ass... d40c2a0 +/-
crates/client/src/lib.rs 89% 89% 0%
crates/client/s...undle/engine.rs 61% 61% 0%
crates/node/src...s/client/mod.rs 88% 88% 0%
crates/cli/src/.../bundle_pull.rs 63% 63% 0%
crates/node/src...nt/serve_leg.rs 94% 95% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@alpergundogdu
alpergundogdu merged commit 409cf15 into main Nov 23, 2026
37 checks passed
@alpergundogdu
alpergundogdu deleted the bundle-splice-at-assembly branch November 23, 2026 17:33
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.

1 participant