Skip to content

Refactor cache fixture & annotate differences#476

Merged
cceckman-at-fastly merged 7 commits intomainfrom
cceckman/outside-test
May 23, 2025
Merged

Refactor cache fixture & annotate differences#476
cceckman-at-fastly merged 7 commits intomainfrom
cceckman/outside-test

Conversation

@cceckman-at-fastly
Copy link
Copy Markdown
Contributor

@cceckman-at-fastly cceckman-at-fastly commented May 7, 2025

Refactor the cache test fixture so it can be run as a Compute service directly.

By doing so, I've found a few divergences. Some I've fixed in Viceroy, some have fixes rolling out in Compute, and some are just going to be a little different :(

  • Fix vary_by handling to match compute: don't infer any HTTP-like semantics of comma-separated values. Treat distinct headers as distinct, and encode more structure into the vary_by rule.
  • Note difference in reading cache bodies: Compute requires the entire Body is read before the re-retrieving the Body from a Found, Viceroy only requires that the Body is closed. I'm not trying to fix this at the moment.
  • Compute doesn't return Found for stale (not stale-while-revalidate); Viceroy does. I'm also not trying to fix this; Viceroy presents a superset of the behaviors that Compute could offer, so "it works on Viceroy" is sufficient for "it works on Compute".
  • Note the (fixed) erratum around CacheBusyHandle drops, but test the fixed behavior.

@cceckman-at-fastly cceckman-at-fastly changed the base branch from main to cceckman/cache-range May 7, 2025 18:32
@cceckman-at-fastly cceckman-at-fastly force-pushed the cceckman/cache-range branch 2 times, most recently from 5f34d05 to 474c7ce Compare May 7, 2025 18:34
@cceckman-at-fastly cceckman-at-fastly changed the base branch from cceckman/cache-range to main May 22, 2025 20:59
@cceckman-at-fastly cceckman-at-fastly marked this pull request as ready for review May 22, 2025 21:14
@cceckman-at-fastly cceckman-at-fastly requested a review from aturon May 22, 2025 21:24
@ulyssa ulyssa self-requested a review May 22, 2025 21:35
pub fn variant(&self, headers: &HeaderMap) -> Variant {
let mut buf = BytesMut::new();
// Include the count, to avoid confusion from values that might contain our marker phrases.
buf.extend_from_slice(format!("[headers: {}]", self.headers.len()).as_bytes());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure I'm understanding variant() correctly: it's okay for this format to change because this is just an internal detail we use to consistently map VaryRule/HeaderMap combinations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - the format is an implementation detail. We could replace headers here with MyFavoriteString and it wouldn't be a user-visible change.

"Whether two normalized forms match" is a behavioral change; and specifically, this is a behavioral change to match Compute's behavior. (This is based on the internal code.)

@cceckman-at-fastly cceckman-at-fastly merged commit 6f44fca into main May 23, 2025
15 checks passed
@cceckman-at-fastly cceckman-at-fastly deleted the cceckman/outside-test branch May 23, 2025 19:46
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.

2 participants