Skip to content

Origin range pull-through: wire range_pull helper into Origin adapters + engine (#823 follow-up) #962

Closed

Description

@thiras

Activity

  1. added
    kind:feature
    on Jun 20, 2026
  2. added
    prio:medium
    rust
    on Jun 20, 2026
  3. github-actions commented on Jun 20, 2026

    @github-actions

    🎯 Triage report

    Implementation follow-up to #823: the design is resolved and crates/cache/src/range_pull.rs is already complete (with align_range, encode_verified_range, AlignedRange, and a full test suite including the end-to-end iroh-blobs store round-trip). This issue tracks the remaining wiring step — extending the Origin trait with a range parameter and plumbing it through the three adapters (HTTP, S3, filesystem) and the cache engine so cold range requests fetch and verify only the chunk-group-aligned span instead of the whole blob.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Pure implementation wiring; design and verification primitives already exist
    Labels rust, medium added; enhancement, technical retained Rust code changes across crates/cache; medium priority (efficiency improvement, no correctness regression)
    Coding agent Needs more info The helper and code entry points are clear (#823 §Evidence in code), but the body leaves several wiring decisions implicit: (1) fallback when an origin doesn't serve {H}.obao4, (2) how blob_size is known for a cold hit before the outboard fetch, (3) composition with the engine's buffer-vs-stream retry strategy, (4) SSRF policy for the extra outboard request (#579)

    🔗 Similar issues

    💡 Notes and suggestions

    What's already done:

    • crates/cache/src/range_pull.rs — align_range, encode_verified_range, AlignedRange, IROH_BLOCK_SIZE re-export
    • crates/cache/tests/range_pull.rs — covers alignment, tampered data/outboard/root rejection, wrong-length outboard, end-to-end import_bao_bytes → export_ranges roundtrip (sync + async)

    What needs wiring (per #823 §Evidence in code):

    1. crates/cache/src/origin/mod.rs — Origin::fetch signature (~line 230). Add range: Option<(u64, u64)> or a separate fetch_range(hash, aligned, max_bytes) method. Also needs fetch_outboard(hash) -> Bytes to retrieve {H}.obao4.
    2. crates/cache/src/origin/http.rs — add Range: bytes={start}-{end-1} header on range fetch; issue a separate GET for {base_url}/{blake3_hex}.obao4 to retrieve the outboard.
    3. crates/cache/src/origin/s3.rs — populate GetObjectRequest.range for ranged fetch; fetch the sibling {key}.obao4 object for the outboard.
    4. crates/cache/src/origin/fs.rs — seek to fetch_start, read fetch_len bytes; open {path}.obao4 for the outboard.
    5. crates/cache/src/engine.rs — pull_through/pull_through_attempt: when a range is present, call origin.fetch_outboard, origin.fetch_range, then range_pull::encode_verified_range, then blobs.import_bao_bytes with the chunk ranges. Route export_ranges to the client rather than get(hash).

    Open decisions to resolve before a PR:

    • Fallback policy: when {H}.obao4 is absent (404), degrade to whole-blob pull or reject? Degrading preserves current behaviour; rejecting enforces the publishing convention. Needs a config flag or hard policy.
    • blob_size provenance for cold range hits: encode_verified_range and align_range both need the known blob_size. For manifest content this is in the manifest entry; for bare hashes the node may not know it before fetching. Decide whether blob_size must be carried in the StreamRequest (it already exists as total_bytes in ADR 005) or whether the node must HEAD/probe first.
    • SSRF hardening (Origin pull-through SSRF + metrics_bind non-loopback warning #579): the outboard fetch is a second request to the origin; apply the same redirect/SSRF controls as the data fetch.
    • Buffer-vs-stream retry composition: the existing origin_retry.buffered_max_bytes path in the engine buffers small blobs before import. Ranged imports go through import_bao_bytes (not add_stream); make sure the retry classifier handles RangeVerifyError::Verification as non-retryable and RangeVerifyError::Verification { source: EncodeError::Io } as retryable.

    Generated by Agentic Triage for issue #962 · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featureprio:mediumrust

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions