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 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-27 18:24:16 +01:00
commit f80634df97

View file

@ -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<NoteNarrow>();
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<CultSchemaConflictException>(() => 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]