You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 119a339
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ Every change that reaches `main` adds a line under **Unreleased**. When a versio
5
5
## Unreleased
6
6
7
7
### Fixed
8
+
- On API Platform versions that buffer HTTP cache purges until the response (`BufferedPurger`, api-platform/core#8869), the bundle purges through the unbuffered purger, so a failed purge after a write is still logged rather than a 500 and an explicit purge is still a 502 ([#618](https://github.com/components-web-app/api-components-bundle/pull/618))
8
9
- A page data class's to-many associations, and associations to a class that is not an API resource, are no longer page data properties, so writing an entity such an association holds no longer 500s ("SingleValuedAssociationField expected" on flush) and the page data metadata no longer lists them ([#617](https://github.com/components-web-app/api-components-bundle/pull/617))
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,7 +240,7 @@ Resources are fetched and cached **individually**. Never embed related data outs
240
240
-**Scoped purge endpoint (#484):**`POST /_/http_cache/purge` flushes only when the request has **no body at all** (empty content). Any body is a scoped purge or a 422, never a flush: `{}`, `null`, `[]`, malformed JSON, an unknown key, an empty or non-list `paths`/`tags`, or a bad item are violations on `paths`/`tags`/`paths[i]`/`tags[i]` (the root for a body that is not an object or names neither key). `paths` and `tags` may both be sent; the union is purged once. `ScopedPurgeRequest` is the one parser and applies the command's rules: a path starts with `/` and resolves through `getRouteTag()` only (no expansion), a tag (given or resolved) with whitespace or a comma is refused. The operation keeps `input: false` and reads `$context['request']`'s content itself, because a deserialized body could not tell no body from `{}` nor make malformed JSON a 422. Scoped with no purger is 501, unlike the command's exit 0, because the endpoint's flush is 501 when unsupported.
241
241
- **Warm after a full flush (#484):** `http_cache.warm_after_flush` (off by default) makes `HttpCacheFlusher::flush()`, after every invalidation URL succeeded, call `HttpCacheWarmDispatcher`, which dispatches one `WarmHttpCacheMessage` per encoding (`gzip` for SSR, `br` for browsers and the CDN) on `messenger.default_bus`; `WarmHttpCacheHandler` runs `HttpCacheWarmer` over `PublicRoutePaths` (shortest first) with the configured `base_url`, `max_time` (per encoding), `concurrency`, `timeout` and `limit`. So the endpoint, `purge-http-cache` with no options and the fixture load flush all warm, and a scoped purge never does. **Never run the warm without a bus or in the flusher itself:** with no bus it logs a warning and warms nothing (unlike the orphan scan, which runs its handler inline), because a warm inside a php worker request holds the worker for up to `2 × (max_time + timeout)`. A site that enables it routes the message to an async transport; a synchronous route still runs it inline, which is the site's choice. A failed dispatch (Messenger's `ExceptionInterface` only) is logged at error and never fails the flush or the other encoding. It changes no response.
242
242
- **Cache warm (#442):** `silverback:api-components:warm-http-cache` (`HttpCache\Warm\HttpCacheWarmer`) requests through the cache what SSR requests: the route, then its manifest, then every manifest IRI, a redirect only its route. **A warm request is useful only under the exact key SSR uses, and a wrong key still returns 200**, so the headers are pinned request by request in `HttpCacheWarmerTest`. The key is the template's Souin `key` template plus the response's `Vary`: `Accept` (`/_api` only), the host (any dotless or `.local` host maps to `BROWSER_SERVER_NAME`), the normalised `Accept-Encoding` (Node 26's fetch sends `gzip, deflate`, so `gzip`), `path` (`Vary: path` on a page data position) and `preload`: Vulcain runs inside the cache and adds `Vary: Preload` whenever it answers with `Link` headers, which over SSR's plain HTTP is always. **`ModuleRequestHeaders` is a cross-repo contract** with the module's `cwa-fetch.ts` (`Accept`), `preload-headers.ts` and `manifestDepthPath()`/`createRequestHeaders()` (`path`: the route path at the IRI's deepest manifest depth, else that depth's page data IRI, else the route path); change both together. Routes come from `PublicRoutePaths`, which applies `RouteExtension` as an anonymous caller would see `GET /_/routes`, shortest first. Requests are anonymous. Follow-ups jump the queue of routes so each route is warmed whole before a `--max-time` stops it. **At `--max-time` it starts no new request and never cancels one in flight**: each finishes, bounded by `--timeout`, and counts as completed or failed by its real outcome, because a cancelled request is logged by Caddy as a 500. So a warm can run up to `max_time + timeout`, and it is reported as stopped only when something was left unstarted. `WarmHttpCacheHandler` runs the same warmer. After the command starts, nothing fails it: invalid options exit 2, and everything else exits 0. **A warm that cannot decode what it asks for never runs** (#488): `HttpCacheWarmer::canDecode()` is false when the `Accept-Encoding` lists `br` and `brotli_uncompress` is not callable (the function name is a constructor argument, so tests pass `base64_decode` or a missing name, never the machine's extension), and then the command refuses with exit 2 and `WarmHttpCacheHandler` logs at error and requests nothing; the check is in the handler, not the dispatcher, because the handler's process is the one that decodes. **A route or manifest body it cannot decode counts as failed, with the reason as the request's error**, so a skipped follow-up never reads as a normal request in the summary. **Spreading a warm across pods is `--requests-per-connection=N` (`warm_after_flush.requests_per_connection`), off by default** (#553): a Kubernetes Service balances per TCP connection and the client keeps connections alive, so every Nth request started carries `Connection: close`, the only header it may add (hop-by-hop, never part of a cache key), and 1 closes every connection. It is a request header, not a client reset or a curl option: `reset()` closes no connection on any Symfony client, it works on every HTTP/1.1 client, and curl closes the connection itself even when the server ignores it. Over HTTP/2 it does nothing, so it is for a plain-HTTP Service URL. `HttpCacheWarmerConnectionTest` counts real connections on curl against `tests/HttpCache/Warm/assets/keep-alive-server.php`, a keep-alive server the test starts (`php -S` closes every connection, so it cannot tell). `KernelHttpClient` sends a functional test's warm into its kernel.
243
-
-**Purge failures (#311):** after a write, a failed purge is logged at error and swallowed, and later propagators (Mercure) still run. `reset()` runs in a `finally`. An explicit purge fails loudly: exit 1, or 502. Catch only HttpClient's `ExceptionInterface` and AP's `RuntimeException` (tag too long), never `\Throwable`. On API Platform 5.0.7+ a failure is a `PurgeFailedException`, which is both, thrown after every chunk × invalidation URL was attempted; its message is only "N of M HTTP cache purge requests failed." with the first failure as `previous`, so a test asserts the cause on the exception chain, never on the message or the exception's class. Before that, `SurrogateKeysPurger` throws the first failure inside `purge()` itself, because the discarded response's destructor runs there.
243
+
- **Purge failures (#311):** after a write, a failed purge is logged at error and swallowed, and later propagators (Mercure) still run. `reset()` runs in a `finally`. An explicit purge fails loudly: exit 1, or 502. Catch only HttpClient's `ExceptionInterface` and AP's `RuntimeException` (tag too long), never `\Throwable`. On API Platform 5.0.7+ a failure is a `PurgeFailedException`, which is both, thrown after every chunk × invalidation URL was attempted; its message is only "N of M HTTP cache purge requests failed." with the first failure as `previous`, so a test asserts the cause on the exception chain, never on the message or the exception's class. Before that, `SurrogateKeysPurger` throws the first failure inside `purge()` itself, because the discarded response's destructor runs there. **The bundle never purges through API Platform's `BufferedPurger`** (`api_platform.http_cache.purger.buffered`, api-platform/core#8869, which decorates `api_platform.http_cache.purger` and, during a main request, holds every purge until its `kernel.response` listener, where a failure is a 500 no bundle code can catch): `ApiPlatformCompilerPass` gives `HttpCachePurger` and `HttpCacheFlusher` the buffer's inner purger whenever that service decorates something, so each purge fails inside the bundle's own call. The bundle already purges once per flush, so the buffer adds nothing to it; an `instanceof SouinPurger` on the buffered purger would also be false.
244
244
-**Route write tags (#313):**`<route import prefix>/_/routes` plus `…/_/routes/<path>` (e.g. `/_api/_/routes//my-route`), and the old path's IRI on a path change. The tags are identical from HTTP and CLI. A sub-directory deployment needs `framework.router.default_uri` for CLI purges to match.
245
245
- Response tag headers are unbounded; the limit is the proxy's buffer (a 502 at the proxy, never truncation).
0 commit comments