Repository navigation
Closed
Description
Deferred items from the multi-agent review of #1052 (ADR 038 bao verified-range streaming). The blockers (reputation inversion, mid-stream corruption misclassification, DecodeError taxonomy, truncated-export guard) were fixed in 80d0c80; these are the agreed follow-ups.
Type design
AlignedRangeshould carry itsblob_sizeand gainwire_len()(replacing free-standingbao_encoded_size(total, ranges)at its 4 call sites). A mismatched(total, ranges)pair silently yields a plausible-but-wrong payment bound with no runtime backstop — the one misuse seam the crypto never sees. Also drop the now-redundantblob_sizeparam fromencode_verified_range.- Dedicated
StreamCommitOutcome::VerifyFailed(oractual: Option<Hash>) instead of theHash::EMPTYsentinel inHashMismatch— the sentinel is the real hash of the empty blob and renders as 'origin returned blob af1349…' (currently documented inCacheError::HashMismatch::actual). - Rename
expected→expected_wire_bytesthroughUpstreamPull/NodeProgressivePull/receive_and_pay— the wire-vs-content unit lives only in comments today (the exact 1,572,864-vs-1,578,944 confusion the test suite hit). A fullWireBytes/ContentBytesnewtype split was evaluated and recommended AGAINST (the window-budget code intentionally mixes units through the agnosticBytes). TeeSinktakes the content size at open instead of as a magic first 8-bytewrite— removes an untyped calling convention.
Deferred tests
- E2e resume with a non-empty proof spine: the only wire-level resume test uses a single-leaf 4 KiB blob (zero parent nodes). Re-point
client_byte_offset_returns_suffix(or add a sibling) at a ~200 KiB blob withoffset = 70 * 1024so the productionexport_bao_range↔decode_verified_rangepair is exercised with real proof parents. - One golden wire-number assertion (e.g. 1.5 MiB blob → 1,578,944 wire bytes): every current expectation is computed with the same helpers production uses, so a
bao-treebump changing the encoding shape would pass all tests while breaking cross-version wire compat (ADR 038 §Risks names this).
Docs / polish
- Remaining stale 'whole-blob hash' comments in
client-pull(HashMismatchdocs,fetch_innerguard rationale,UpstreamPullstruct doc,receive_and_pay) andnode_origin(buffered-path region-accounting comment —bytes.len()is content while the watermark is wire;AcquisitionObserver::on_pull'delivered length'), plusnode_to_node_pull_through.rsnarratives ('whole-blob integrity check', stalehash-mismatchclose-reason mention). - Four comments referencing 'the tee's
import_bao' — the tee path is the verifying-decoder +import_and_verify_stream, notimport_bao_*. import_and_verify_streamdoc: on the tee pathpull_through_bytesmeters decoded plaintext, slightly under the wire that left the upstream.- Deposit pre-flight guard (
guard_bytes) uses content size while billing is wire bytes (~0.4% higher) — benign (mid-stream exhaustion is bounded to one window), note or widen. ChannelRecvStream::stop/idinert-by-design comments;recv_byteszero-length-chunk note.crates/cache/tests/range_pull.rscomment 'strictly more' should be 'at least as much' (single-leaf wire == data).
Reacted by github-actions
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
refactor(bao): tighten types for verified-range streaming (#1060)
test(bao): cover multi-group resume and pin a golden wire number (#1060)
docs(bao): sweep stale whole-blob-hash and import_bao narratives (#1060)
docs(bao): drop private intra-doc link from public HashMismatch (#1060)
docs(bao): fix bao_decoded_source content_size provenance (#1060)
refactor(bao): dedup wire-len derivation and header-strip (#1060)
refactor(bao): defensive corruption routing + doc accuracy (#1060)
refactor(bao): type-design tightenings, deferred tests, doc sweep (#1060