test: harden clear() namespace isolation, tag invalidation and deleteItem() return value - #124
Open
GromNaN wants to merge 3 commits into
Open
Conversation
Add an optional createCachePoolWithOtherNamespace() extension point and a test that saves the same key in two pools sharing the same storage under different namespaces. The test is skipped when the implementation returns null.
The test used overlapping tags, so an implementation that only invalidates the first tag of the list still passed. Use disjoint tags plus a control item tagged with none of the invalidated tags.
The return value was ignored, so an implementation returning false while the deletion actually happened still passed.
GromNaN
force-pushed
the
test/namespace-isolation-and-tag-invalidation
branch
from
August 24, 2026 09:59
9f64b72 to
e61cecb
Compare
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.
Three small additions to the contract, found while implementing a PSR-6 adapter for MongoDB (symfony/symfony#65468). In each case the current tests pass on an implementation that is actually wrong.
clear() must not touch another namespace on the same storage
When several pools share a single storage, a table or a collection for instance, clearing one pool must only remove its own keys. Nothing checks that today, because the tests only ever use one pool.
CachePoolTestgains an optionalcreateCachePoolWithOtherNamespace(), which returns a second pool on the same storage under another namespace. It returns null by default, and the newtestClearDoesNotAffectOtherNamespacesis then skipped, so existing implementations are unaffected. When a pool is given, the test writes the same key in both, clears the first one, and checks that the second still holds its own value.testInvalidateTags now uses disjoint tags
keywas tagged with tag1 and tag2 whilekey2was tagged with tag1, so invalidating tag1 alone was enough to pass. Each item now carries a single distinct tag, and a third item, tagged with none of the invalidated tags, checks that the invalidation does not reach too far.deleteItem() return value on a tagged item
testRemoveTagWhenItemIsRemovedignored whatdeleteItem()returned. It is now asserted to be true.