Repository navigation
Fold the metadata provider and persister into one metadata store - #30
Merged
Merged
Conversation
The guarantee that a request which doesn't use metadata neither queries nor writes was a protocol split across two seams: the provider chose a lazy ghost, and the persister recovered that choice with instanceof. MetadataStoreInterface now owns both halves. Its docblock makes them the contract: load() doesn't touch storage until the metadata is used, and store() stores only changed metadata. DoctrineOrmBasedMetadataStore keeps both rules and looks up the entity manager only when it writes. A client without a stored row gets empty metadata. The fallback to a decorated provider is gone with no replacement. CookieBasedClientContext and StoreMetadataSubscriber inject the interface, so a decorator of the store handles both loading and storing. The provider and persister interfaces, their three classes and their service ids are removed. Their Prophecy tests, which doubled the entity manager, are replaced by functional tests on SQLite. Closes #23
This was referenced Nov 23, 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.
Summary
One seam,
MetadataStoreInterface, replaces the metadata provider and the metadata persister. The "no query, no write unless the metadata is used" guarantee now lives in one class instead of a protocol split across two.load()doesn't touch storage until the metadata is used, andstore()stores only changed metadata.CookieBasedClientContextandStoreMetadataSubscriberinject the interface, so an app's decorator of the store handles both loading and storing.UPGRADE-2.0.mdgets a "Metadata store" section with a porting guide. The README andCLAUDE.mddescribe the store.Closes #23
Evidence
it_does_not_start_the_entity_manager_when_the_metadata_is_not_usedandit_does_not_start_the_entity_manager_for_a_new_visitor_that_does_not_use_metadatafailed in all three kernel environments: 6 failures,Failed asserting that true is false. The old persister looked up the entity manager on every request.After: both pass. The full suite passes with 151 tests. PHPStan and ECS are clean.
MetadataStoreInterfacethat one of the classes skipped. To simulate this, I pointed eitherCookieBasedClientContextorStoreMetadataSubscriberatsetono_client.metadata_store.default.DecoratedMetadataStoreTestthen fails:Failed asserting that two arrays are identical.After: with the interface injected, the request loads and stores through the decorator.
Merge Danger
Door: two-way
2.x is unreleased, so a revert restores the provider and the persister.
Blast Radius: extension API
An app that implemented or decorated
MetadataProviderInterfaceorMetadataPersisterInterfacehas to port toMetadataStoreInterface. So does an app that relied on the provider fallback for a client without a stored row. Apps that only use$client->metadatasee no change.