Skip to content

Add regression tests for seven cache and HTTP behaviours - #1036

Open
Trenyx wants to merge 1 commit into
cloudflare:mainfrom
Trenyx:test/cache-http-regression-tests
Open

Trenyx wants to merge 1 commit into
cloudflare:mainfrom
Trenyx:test/cache-http-regression-tests

Conversation

@Trenyx

@Trenyx Trenyx commented Oct 1, 2026

Copy link
Copy Markdown

Refs #1035

@andrewhavck: these are the tests from our email thread.

Tests only: seven unit tests (+123 lines) in the existing test modules. No change to library code, no new dependencies.

Test What it pins down
filters::tests::test_upstream_request_filter_revalidates_with_if_modified_since Revalidation sends Last-Modified as If-Modified-Since, so the origin can answer 304
variance::test::test_value_differentiates_key The header value is part of the variance key: gzip and br don't share a variant
meta::tests::test_cache_meta_serve_stale_window_end_is_inclusive Each serve-stale window includes its last second, as is_fresh includes fresh_until
tests::an_uncacheable_response_makes_waiting_readers_give_up An uncacheable response gives the cache lock up, so waiting readers all proceed uncached
authority::tests::classify_raw_target_authority_scheme_case_insensitive HTTP:// gets the same ambiguous-authority rules as http:// (RFC 3986 schemes are case-insensitive)
tests::test_remove_header_drops_case_name Removing a header also drops its case-preserved name
tests::test_ser_de_keeps_repeated_headers Repeated fields such as Set-Cookie survive a serialize/deserialize round trip

How they were checked

On a copy at 4487f7b (current main):

  • With the tests added to unchanged code, cargo fmt --all -- --check, cargo clippy --all-targets -p pingora-cache -p pingora-http -p pingora-header-serde -- --allow=unknown-lints --deny=warnings and cargo test --lib for those three crates all pass (193, 58 and 10 tests, including the new ones).
  • With each of the seven bugs from the issue applied one at a time, exactly its matching test fails and every other test still passes.

These tests were written with Claude Code during a planted-bug run by Trenyx.

Unit tests only, no library change: conditional revalidation header,
Vary value in the variance key, inclusive serve-stale window end,
uncacheable responses releasing waiting readers, case-insensitive
request-target scheme, remove_header dropping the case-preserved name,
and repeated headers surviving header-serde round trips.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant