Skip to content

feat(cache): retain range-admitted partials across GC (#1607) - #1641

Merged
alpergundogdu merged 4 commits into
mainfrom
feat/1607-retained-partials
Aug 7, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
feat/1607-retained-partials

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What

#1607 (B0 of the #1621 Phase B node serve-miss). Range-admitted (partial) blobs now get a deterministic, idempotent protecting named tag on first import_bao_bytes, so iroh-blobs GC no longer reclaims held ranges. This is the prerequisite for the node's gap-driven serve-miss to durably skip ranges it already holds.

  • CacheEngine::admit_bao and the pull_through_range range import call a new protect_partial(hash) → tags().set("decdn-partial-<hash>", raw(hash)).
  • set overwrites by name → exactly one tag per partial, no proliferation.
  • drop_named_tags_for (evict) already removes it by hash — teardown composes.

Spike that justified this

iroh-blobs 0.103 GC marks a RAW root live unconditionally (no completeness check) and sweeps only non-live hashes, so a named tag protects a partial — confirmed empirically against a real FsStore GC loop.

Verification

  • admit_bao_tags_the_partial — a partial admit creates exactly one tag; a second (different) range admit keeps it at one (idempotent).
  • tagged_partial_survives_gc_untagged_is_reclaimed — a tagged partial survives real GC sweeps; an untagged, different-hash control is reclaimed on the same sweep (proves GC ran).
  • Full workspace: cargo build && cargo clippy --all-targets -- -D warnings, cargo nextest run (2824/2824), cargo fmt -- --check, and the decdn-e2e --features anvil-e2e compile gate — all green.

Not in this PR

B1 (ServeStore trait), B2 (route serve-miss through drive() + WindowPacer), B3 (multi-observer coalescing) — the rest of Phase B.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when caching partial content downloaded by ranges.
    • Partial content now remains available after garbage collection.
    • Repeated imports of the same partial content reuse consistent protection metadata.
  • Tests

    • Added coverage for consistent protection behavior and partial-content retention.

alpergundogdu and others added 3 commits August 7, 2026 11:25
admit_bao now gives each partial's raw hash a deterministic idempotent named
tag (decdn-partial-<hash>); drop_named_tags_for already removes it on evict.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…l test (#1607)

Range pull-through now protects the partial it imports; a control untagged
partial is reclaimed on the same sweep, proving GC runs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Use crate::range_pull::{align_range, encode_verified_range, IROH_BLOCK_SIZE}
and crate::CHUNK_GROUP_BYTES in the new retained-partials test helpers, matching
the rest of engine.rs; note the GC-test sleep must track the GC interval.
Addresses the final-review Minor findings; no behavior change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 7, 2026 10:43
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@alpergundogdu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 609ea5bf-ad2d-447c-aff3-a0ca1e69938b

📥 Commits

Reviewing files that changed from the base of the PR and between d7f6582 and 329367b.

📒 Files selected for processing (1)
  • crates/cache/src/engine.rs

Walkthrough

Partial blob imports now receive deterministic raw-hash tags through range pull-through and admit_bao. Tests verify tag idempotency and retention during garbage collection.

Changes

Partial blob protection

Layer / File(s) Summary
Add deterministic partial protection
crates/cache/src/engine.rs
The cache adds protect_partial and calls it after successful partial imports from range pull-through and admit_bao.
Validate tag and GC behavior
crates/cache/src/engine.rs
Tests verify that protection is idempotent and that tagged partial blobs survive periodic garbage collection. Test-module lint allowances support the new helpers.

Estimated code review effort: 3 (Moderate) | ~20 minutes


Note

🎁 Summarized by CodeRabbit Free

Your 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 @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 80.77% (was 80.74%, ▲ +0.03%) — 59435/73586 lines

File Coverage Lines Δ
crates/cache/src/engine.rs 91.89% 3455/3760 ▲ +0.20%
History
Commit Total Δ vs base
d7f6582 80.76% ▲ +0.03%
329367b (HEAD) 80.77% ▲ +0.03%

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 ensures range-admitted (partial) blobs are retained across iroh-blobs GC by assigning a deterministic, idempotent named tag (decdn-partial-<hash>) immediately after import_bao_bytes. This supports the cache engine’s ongoing move toward gap-driven serve-miss behavior (Phase B), where already-held ranges must remain durably available between retries/resumes.

Changes:

  • Added CacheEngine::protect_partial(hash) which sets a deterministic named tag pointing at the raw hash to prevent GC reclaim of partials.
  • Invoked protect_partial after partial-range imports in both pull_through_range’s import path and CacheEngine::admit_bao.
  • Added tests validating tag idempotence and that tagged partials survive real GC while untagged partials are reclaimed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/cache/src/engine.rs Resolved
Comment thread crates/cache/src/engine.rs Resolved
…review)

- pull_through_range doc no longer claims 'does not promote a named tag'; it now
  documents the decdn-partial-<hash> GC-protection tag while keeping the has()-
  false / not-DHT-advertised facts.
- GC-survival test polls for the control's reclaim (15s budget) instead of a
  fixed 1500ms sleep: fails fast, robust on slow CI, independent of the GC
  interval; the control's NotFound still gates the test.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu merged commit 63f9bea into main Aug 7, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the feat/1607-retained-partials branch August 17, 2026 17:48
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