Skip to content

cdn/client/v1: empty (0-byte) blob delivery errors on the bao path #1054

Closed

Description

@yigitdot

Spun out of CodeRabbit review on #1052 (ADR 038 bao verified-range streaming).

Under ADR 038 the cdn/client/v1 serve and receive paths both route through align_range(byte_offset, byte_len, total_bytes), which rejects byte_offset >= blob_size — so a 0-byte blob (align_range(0, 0, 0)) returns RangeOutOfBounds. The serve (CacheEngine::export_bao_range) and the receiver (decode_verified_range / fetch_inner) therefore both error on an empty blob, whereas the pre-bao get() / export_range path served it as empty bytes. This is a (degenerate) behavior change.

Decide and implement one of:

  1. Support empty blobs. Serve emits Bytes::new() after confirming BlobStatus::Complete { size: 0 }; the receiver verifies hash == blake3::hash(&[]) and returns empty (this is the root-verification CodeRabbit flagged for the empty case — an empty stream must still be proven against the empty root, not accepted for any root); the tee handles it; add a 0-byte round-trip regression test.
  2. Reject cleanly. Replace the confusing RangeOutOfBounds with an explicit "empty-blob delivery unsupported" error on the serve path.

Deferred from #1052 to keep that PR focused on the verified-range change.

Metadata

Metadata

Assignees

Labels

prio: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