From 22eaaabeb2cacbcf970bb9922a06cfa024c230cc Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 21 Oct 2026 21:59:38 +0200 Subject: [PATCH] Caching docs: MarkWritten refuses an entry the store does not hold (contract, CHANGELOG) Co-Authored-By: Claude Opus 5.5 --- .../Contracts/cultcache-store-composition.md | 8 +++++--- unity/org.gamecult.cultlib/CHANGELOG.md | 11 ++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/GameCult.Caching/Contracts/cultcache-store-composition.md b/src/GameCult.Caching/Contracts/cultcache-store-composition.md index b64dde2d..2ca6b77a 100644 --- a/src/GameCult.Caching/Contracts/cultcache-store-composition.md +++ b/src/GameCult.Caching/Contracts/cultcache-store-composition.md @@ -232,9 +232,11 @@ not the one this cache decodes it as. A value change mints a `storedAt` strictly later than the record it replaces; writers bump a minted timestamp by one tick when it is not later. An entry loaded under compatible schema drift keeps its persisted id until its store rewrites it; a store records each -record its completed write rewrote with the protected -`CacheBackingStore.MarkWritten`, and one that does not leaves the entry's -`Expect` failing closed until the next pull. A whole-file flush or +record its completed write rewrote with the protected instance method +`CacheBackingStore.MarkWritten`, which refuses an entry that is not the one +the store holds in its own `Entries` at that key, so a store cannot mark +another store's or another cache's copy. A store that does not mark leaves +the entry's `Expect` failing closed until the next pull. A whole-file flush or unconditional commit rewrites every record under the writer's current schema and keeps its `storedAt`, so another cache's `Expect` on a drifted record it read before that rewrite fails until it re-reads the store. diff --git a/unity/org.gamecult.cultlib/CHANGELOG.md b/unity/org.gamecult.cultlib/CHANGELOG.md index 21a8227d..66b5af54 100644 --- a/unity/org.gamecult.cultlib/CHANGELOG.md +++ b/unity/org.gamecult.cultlib/CHANGELOG.md @@ -31,11 +31,12 @@ All notable changes to this package are documented in this file. stored under, as its backing store last read or wrote it. It differs from `Descriptor.SchemaId` only for a record loaded under compatible schema drift that its store has not rewritten since. -- `CacheBackingStore.MarkWritten(CultStoredDocument)` (protected): a backing - store records that its completed durable write stored a record under its - descriptor, so `PersistedSchemaId` follows the rewrite. The single-file and - directory stores mark every record they rewrite; a custom store calls it for - each record its own write rewrote. +- `CacheBackingStore.MarkWritten(CultStoredDocument)` (protected instance + method): a backing store records that its completed durable write stored a + record under its descriptor, so `PersistedSchemaId` follows the rewrite. It + throws `ArgumentException` for an entry that is not the one the store holds + in its own `Entries`. The single-file and directory stores mark every record + they rewrite; a custom store calls it for each record its own write rewrote. ### Changed