Skip to content

Keep cache invalidations safe#185

Merged
timkelty merged 30 commits into
3.xfrom
timkelty/cache-tag-overflow
Jul 13, 2026
Merged

Keep cache invalidations safe#185
timkelty merged 30 commits into
3.xfrom
timkelty/cache-tag-overflow

Conversation

@timkelty

@timkelty timkelty commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Keeps cache-tagged responses within Cloudflare's limits while preserving invalidation with the overflow tag.

The Gateway purges the overflow tag with every cache-tag purge. Overflow fallback is logged at info level because invalidation remains safe.

Copilot AI review requested due to automatic review settings July 12, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures cache-tagged responses remain purgeable even when the set of tags would exceed Cloudflare’s documented Cache-Tag header value limits, by introducing an “overflow” fallback tag and stricter tag validation.

Changes:

  • Add Cloudflare-compliant cache tag validation/minification logic via StaticCacheTag.
  • Limit emitted Cache-Tag values to Cloudflare’s 16KB aggregate header value limit and emit an {environmentId}:overflow fallback tag when truncation occurs.
  • Remove response header “normalization” (joining/truncation) from ResponseEventHandler, shifting Cache-Tag safety into StaticCache, and add unit tests covering overflow + tag validation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/StaticCacheTest.php Adds tests asserting overflow tag emission + header length bounding, and that purges include the overflow tag.
tests/unit/StaticCacheTagTest.php Adds unit coverage for tag validation rules and minified tag generation.
src/web/ResponseEventHandler.php Removes header joining/truncation logic previously applied after response preparation.
src/StaticCacheTag.php Reworks tag sanitization into explicit Cloudflare-validity checking; preserves valid tags and drops invalid ones.
src/StaticCache.php Introduces Cloudflare Cache-Tag length limiting, overflow tag emission, and purge behavior that includes overflow fallback.
src/Module.php Removes an outdated comment tied to the now-removed header normalization behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c38ce09937

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/StaticCacheTag.php Outdated
Comment thread src/StaticCache.php Outdated
Copilot AI review requested due to automatic review settings July 12, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread src/StaticCache.php Outdated
Comment thread src/StaticCacheTag.php Outdated
Comment thread tests/unit/StaticCacheTagTest.php
Copilot AI review requested due to automatic review settings July 12, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/StaticCacheTag.php Outdated
Copilot AI review requested due to automatic review settings July 12, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/web/ResponseEventHandler.php
Copilot AI review requested due to automatic review settings July 12, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/web/ResponseEventHandler.php
Copilot AI review requested due to automatic review settings July 12, 2026 22:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 12, 2026 22:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/StaticCache.php Outdated
Comment thread src/StaticCache.php Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 03:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 03:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread tests/unit/StaticCacheTest.php
Comment thread src/StaticCache.php
Copilot AI review requested due to automatic review settings July 13, 2026 03:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 03:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/StaticCacheTag.php
Comment thread src/StaticCache.php Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 03:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 13, 2026 03:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@timkelty timkelty merged commit b8ed8d6 into 3.x Jul 13, 2026
10 checks passed
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