From f80634df97b7f3b3118a29b3820c3f7d9bd84a4c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 27 Oct 2026 18:24:16 +0100 Subject: [PATCH] Caching tests: an unattached store's Delete then PushAll writes no entry and so owns no stored record A cacheless call that writes nothing declares nothing and no written entry can claim the record, so the removal is refused and the file left as it was. Red under the Any-to-All mutant of the declared predicate in OwnsOnDisk, which owns every id when no entry is written. Co-Authored-By: Claude Opus 5.5 --- .../RestampOnWriteTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/GameCult.Caching.Tests/RestampOnWriteTests.cs b/tests/GameCult.Caching.Tests/RestampOnWriteTests.cs index 561db4fa..b90f4336 100644 --- a/tests/GameCult.Caching.Tests/RestampOnWriteTests.cs +++ b/tests/GameCult.Caching.Tests/RestampOnWriteTests.cs @@ -652,6 +652,22 @@ namespace GameCult.Caching.Tests Assert.That(Fingerprint(path), Is.EqualTo(before)); } + // An unattached store's Delete then PushAll is a cacheless write that writes no entry, so nothing is declared and no written + // entry can claim the stored record: the removal is refused and the file left as it was. A call that writes nothing owns nothing. + [Test] + public void AnUnattachedStoresRemovalWithNoWrittenEntryOwnsNothing() + { + var path = SeedNarrow(directory: false); + var before = Fingerprint(path); + var descriptor = NarrowRegistry.GetRequired(); + var store = new SingleFileMessagePackBackingStore(path); + + store.Delete(new CultStoredDocument(Note, "2026-10-22T00:00:00.0000000+00:00", descriptor, new NoteNarrow { Name = "note", Value = 1 })); + + Assert.Throws(() => store.PushAll()); + Assert.That(Fingerprint(path), Is.EqualTo(before)); + } + // The shadow, where it is decided: a written entry answers for its schema id whatever the registry holds, and the registry // still adds its other types. [Test]