Repository navigation
Store metadata based on setono/client's Metadata::hasChanged() - #29
Merged
Merged
Conversation
setono/client 1.2 tracks changes in Metadata itself, so the bundle no longer needs its ChangeAwareMetadata subclass, which only noticed dropped expired keys through the library's private call paths. The persister stores any Metadata only when hasChanged() is true, so a custom provider that returns plain Metadata no longer writes on every request, and setting a key to the value and expiry it already has writes nothing. LazyChangeAwareMetadata becomes an internal, final LazyMetadata. Closes #24
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
Closes #24. The persister asks setono/client 1.2's
Metadata::hasChanged()whether the metadata is changed metadata. It no longer reads a flag off the bundle'sChangeAwareMetadatasubclass (ADR-0002).setono/client^1.2EmptyMetadataProviderand the test app's client contexts create plainMetadataEvidence
MetadataTest::it_does_not_store_metadata_that_was_set_to_the_value_it_already_hasstores the row with its keys in another order, the way MySQL returns a JSON column, then sets a key to its current value:hasChanged()check removed, so the persister writes whenever the metadata was used (asChangeAwareMetadatadid after anyset()), the test fails inMetadataTest,CustomMetadataClassTestandInterfaceOnlyMetadataClassTest. The request runs an UPDATE.After: passes. The request only runs a SELECT.
On SQLite, Doctrine skips the UPDATE when the decoded JSON is identical, so without the reordered keys this test can't tell the two apart. CLAUDE.md now notes this.
composer validate --strict,composer normalize --dry-run, composer-dependency-analyser: passMerge Danger
Door: two-way
Blast Radius: metadata classes
2.x is unreleased. Apps that create
ChangeAwareMetadata, callisDirty()or referenceLazyChangeAwareMetadataswitch toMetadataandhasChanged()(UPGRADE-2.0.md). Requiring setono/client 1.2 also brings its null-TTL change:set($key, $value)without a TTL now removes the key's expiry. A new functional test pins that down, and UPGRADE-2.0.md describes it.