Skip to content

fix: improve iri converter cache - #8472

Merged
soyuka merged 5 commits into
api-platform:4.3from
Johannes-Werbrouck:4.3
Sep 2, 2026
Merged

fix: improve iri converter cache#8472
soyuka merged 5 commits into
api-platform:4.3from
Johannes-Werbrouck:4.3

Conversation

@Johannes-Werbrouck

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.3
Tickets ticket
License MIT

The IriConverter's localOperationCache was always written and never read, because $operation being null short-circuits the cache read. This has been fixed.

  • Update Changelog.md

Johannes Werbrouck and others added 4 commits August 24, 2026 08:02
Reading the local operation cache on the no-operation path exposed a key
collision: an item_uri_template that resolves to no operation leaves
$operation null, so the key matches a plain call, while the skolem check
and the resource class promotion are both skipped. The first caller then
wins for the rest of the request.

Also drops the redundant "reuses the cached operation" tests and rewrites
the new Symfony ones with PHPUnit mocks instead of Prophecy.
@soyuka soyuka changed the title fix (IriConverter): localOperationCache is always written but never read fix: improve iri converter cache Sep 2, 2026
@soyuka
soyuka merged commit 3fe1838 into api-platform:4.3 Sep 2, 2026
110 of 112 checks passed
@soyuka

soyuka commented Sep 2, 2026

Copy link
Copy Markdown
Member

`thanks!

soyuka added a commit that referenced this pull request Sep 2, 2026
* fix(laravel): key the iri operation cache on Relation

#8472 added a localOperationCache read on the unnamed-operation path.
A Relation and its related model share a cache key but resolve
differently: the Relation skips the resource class promotion, so a
model-first call poisons the key and the Relation call then throws
instead of returning a skolem IRI.

* test(laravel): cover the Relation iri cache key end to end

The unit test stubs the decorated skolem converter, so it cannot
reproduce the actual failure: the promoted item operation makes the
identifiers extractor throw on the Relation. Resolve both inputs
through the container to pin the real chain.
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