Repository navigation
fix(cache): include exchange delay in response age - #82
Merged
Merged
Conversation
The macOS default Test and Build job lost the "response body failed" trace event. tracing-core 0.1.36 keeps a process-wide callsite interest, and with one registered dispatcher the first thread to execute the event caches Interest::never(). A parallel body-failure test can do that before the capturing subscriber runs. Bring main's fresh-process capture harness onto this branch so the existing assertions run without shared callsite state. Cache Age behavior is unchanged. Co-authored-by: peter rich <fannnzhang@users.noreply.github.com>
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.
Cached responses could be reported and reused as younger than RFC 9111 permits because the Age calculation omitted request-to-response delay and restarted residence at storage. The fixed regression now produces 205 seconds instead of 203; buffering the body also retains the time already elapsed since response headers.
The transport attaches per-attempt
ResponseTimingto HTTP/1 and HTTP/2 responses. The cache uses that metadata for corrected initial age, freshness and generated Age, including 304 validation with its own timestamps and missing-Date normalization. Valid oversized Age values saturate instead of becoming zero. Synthetic responses without trustworthy timing are returned without automatic storage; existing connector and constructor signatures remain unchanged.Added 15 focused tests covering literal RFC vectors, fractional and buffering time, validation, malformed/oversized Age, incomplete wire bodies, missing timing, H1 headers before a gated body, negotiated H2 and final-hop redirect timing. The requirement matrix and evidence describe the verified scope.
Validation on macOS arm64, Rust 1.99.1:
RUST_TEST_THREADS=1 cargo test --workspace --all-targets: 579 passed, 16 ignored.RUST_TEST_THREADS=1 cargo test --workspace --all-targets --all-features: 620 passed, 16 ignored.cargo test --workspace --all-features --doc: 2 passed.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --all --check: passed.The initial parallel default run encountered the existing tracing capture race (
spans = []), reproduced on unmodifiedorigin/main; complete suites were therefore also verified serially. The separate existing 304 strong-ETag eligibility gap is explicitly recorded as a conformance/release blocker in the evidence document; this PR verifies Age/Date reconstruction, not complete cache conformance.