Skip to content

API Platform dev-main buffers purges on kernel.response: a failed purge after a write is a 500 again #610

Done

Description

@silverbackdan

The `PHPUnit (Symfony NEXT 8.2)` leg, which runs api-platform/core `dev-main` (5cb0849), fails `HttpCachePurgeFailureTest` on `main` (54f0caf) and every open PR:

  • `test_creating_a_resource_while_the_http_cache_is_unreachable_returns_201_logs_the_failure_and_still_publishes_to_mercure`: 500 instead of 201.
  • `test_purging_the_rendered_html_while_the_http_cache_is_unreachable_is_a_502_not_a_success`: 500 instead of 502.

Cause: dev-main adds `ApiPlatform\HttpCache\BufferedPurger`, flushed by `ApiPlatform\Symfony\EventListener\HttpCachePurgeBufferListener::onKernelResponse()`. The purge now runs from AP's own listener instead of inside the bundle's `HttpCachePurger`, so the bundle's #311 rule (a failed purge after a write is logged at error and swallowed; an explicit purge is a 502) no longer applies, and the `PurgeFailedException` escapes as a 500.

Not in any release yet (latest is v5.0.9). Before it ships, the bundle needs to keep #311 on it: e.g. make the bundle's purger the inner purger of the buffer, or decorate/replace the buffered purger or its listener so the failure is caught as before, and keep the explicit purge endpoints' 502. Check what upstream intends (the PR that added the buffer) and whether it offers a hook.

Activity

  1. silverbackdan commented on Nov 26, 2026

    @silverbackdan
    CollaboratorAuthor

    Fix in #618: the bundle's HttpCachePurger and HttpCacheFlusher now purge through the inner purger of API Platform's BufferedPurger (api-platform/core#8869) whenever that service decorates something, so #311 holds on dev-main and nothing changes on 4.4/5.0.x.

  2. added a commit that references this issue on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions