feat(serve): compile-time integrity witness on the streaming serve path - #964
Merged
Conversation
The buffered serve already discharges a compile-time witness (verified_body takes only Blob<Verified>). Streaming served bytes through a bare Body::from_stream, so a new streaming serve could forget the EOF digest check and still compile. Add sealed sole-sinks in verified.rs — stream_body(VerifiedByteStream) and reader_stream_body(VerifiedByteReader) — implemented only by the EOF-verifying types (raw VerifyingStream, docker VerifyingReader); a raw reader/stream is now a compile error at the sink (compile_fail doctests prove it). Byte-range serves take the explicit open_world_stream_body arm (a partial range has no whole-file digest). Body::from_stream is now confined to these sinks. Closes #849.
devitway
force-pushed
the
feat/849-streaming-typestate
branch
from
September 6, 2026 04:54
55def87 to
1cb776e
Compare
|
🐳 Test image pushed: docker pull ghcr.io/getnora-io/nora:pr-964
docker run --rm -p 4000:4000 ghcr.io/getnora-io/nora:pr-964 |
1 similar comment
|
🐳 Test image pushed: docker pull ghcr.io/getnora-io/nora:pr-964
docker run --rm -p 4000:4000 ghcr.io/getnora-io/nora:pr-964 |
ertime037
approved these changes
Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The buffered serve path already discharges a compile-time integrity witness:
Storage::get_verifiedyields aBlob<Verified>and the only response-body sink,verified_body, accepts nothing weaker — so serving unverified bytes there is a compile error.Streaming served its bytes through a bare
Body::from_stream, leaving that guarantee runtime-only on the growing streaming path: a new streaming serve could forget to wrap its reader in the EOF-verifyingVerifyingReader/VerifyingStreamand still compile.This restores the witness for streaming:
verified.rsgains sealed sole-sinksstream_body(accepts only aVerifiedByteStream) andreader_stream_body(accepts only aVerifiedByteReader), implemented solely by the EOF-verifying types (rawVerifyingStream, dockerVerifyingReader). Handing a raw reader/stream to them is a compile error — proven bycompile_faildoctests.open_world_stream_bodyarm (a partial range has no whole-file digest to verify against), so the open-world case stays named rather than silent.Body::from_streamis now confined to these sinks; the docker, raw and range serves route through them.No behavior change on the happy path — the EOF digest check and abort-on-mismatch are unchanged.
Closes #849.