Treat the status line as Cloudflare's primary purge signal - #8
Merged
Conversation
The adapter required the response envelope to be present and carry success: true, so any 2xx whose body a gateway rewrote, a proxy dropped, or a test double never sent was reported as a failed purge. Cloudflare signals failures with a non-2xx status; the envelope's verdict is kept as an override, so an explicit success: false inside a 2xx still fails, but the envelope's absence no longer does. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryThis PR makes Cloudflare purge handling treat an HTTP 2xx status as acceptance unless a parsed response envelope explicitly reports failure.
Confidence Score: 5/5The PR appears safe to merge with no blocking or independently actionable non-blocking issues identified. The changed logic rejects every non-2xx response and any parsed envelope whose explicit success verdict is not true, while intentionally accepting 2xx responses without a usable envelope as described and tested. Important Files Changed
Reviews (1): Last reviewed commit: "Treat the status line as Cloudflare's pr..." | Re-trigger Greptile |
TorstenDittmann
approved these changes
Aug 17, 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.
What
Aligns the Cloudflare adapter's success check with the Fastly adapter: an HTTP 2xx is acceptance, and the response envelope's explicit verdict is honored when present — a
success: falseinside a 2xx still fails the purge, but a 2xx without a parseable envelope no longer does.Why
Cloudflare's v4 API reports failures with non-2xx status codes; the envelope duplicates that verdict. Requiring the envelope to be present meant a 2xx whose body a gateway rewrote, a proxy dropped, or a test double never sent was reported as a failed purge that had actually been accepted — the caller then retries or alerts on nothing. Keeping the explicit-
success: falseoverride preserves the one real protection the body check provided.Tests
testAcceptsAPurgeWithoutTheEnvelope— 200 with an empty body is acceptancetestRejectsAPurgeTheBodyReportsAsFailed— unchanged: explicitsuccess: falsein a 2xx still rejectedtestRejectsAPurgeTheStatusReportsAsFailed— a failing status is not softened by the envelopeSuite: 52 tests, 115 assertions, green. Pint and PHPStan pass.
🤖 Generated with Claude Code