From bc3407d017cfc96394bf2b853fa14b6b84f644ed Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 21 Oct 2026 21:06:29 +0200 Subject: [PATCH] Caching tests: a directory re-read refreshes a record another writer rewrote under another schema The directory store's pull filter compares the persisted schema id too; without a same-storedAt rewrite on that store nothing pinned it. Co-Authored-By: Claude Opus 5.5 --- .../ConditionalCommitTests.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs b/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs index 27138f4a..04b77cca 100644 --- a/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs +++ b/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs @@ -97,14 +97,19 @@ namespace GameCult.Caching.Tests Assert.That(DriftCommit(cache, observed, 2), Is.False, "a record rewritten under another schema passed Expect on storedAt alone"); } - [Test] - public void AnotherWritersNormalisingFlushFailsExpectUntilReRead() + // The directory store rewrites only what is pushed to it, so the other writer pushes the record it read unchanged. + [TestCase(false)] + [TestCase(true)] + public void AnotherWritersNormalisingFlushFailsExpectUntilReRead(bool directory) { - SeedDrift(directory: false); - using var cache = Drift(false, NarrowDrift).Open(); + SeedDrift(directory); + using var cache = Drift(directory, NarrowDrift).Open(); var observed = cache.Get(DriftKey)!; - using (var other = Drift(false, NarrowDrift).Open()) + using (var other = Drift(directory, NarrowDrift).Open()) + { + other.BackingStores[0].Push(other.GetStored(DriftKey)!); other.BackingStores[0].PushAll(); + } Assert.That(DriftCommit(cache, observed, 2), Is.False, "Expect held across a rewrite under a schema id this cache did not read"); cache.BackingStores[0].PullAll();