C# write set: one re-mint for every store kind, and a foreign refusal carries its reload failure

The directory store wrote an earlier storedAt over a later record it replaced, against the contract.
CacheBackingStore.StoredAtOver is now the one re-mint; the single-file apply and the directory
generation write both call it. A foreign refusal passes the reload's cause to
CultSchemaConflictException as its inner exception. Per-commit build not verified.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 06:05:41 +02:00
commit 2e3312635d
3 changed files with 36 additions and 11 deletions

View file

@ -262,6 +262,7 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
{
Directory.CreateDirectory(_recordDirectory.FullName);
var currentIndex = currentManifest.Records.ToDictionary(record => record.Key, record => record, StringComparer.Ordinal);
var replaced = currentManifest.Records.ToDictionary(record => record.Key, record => record.StoredAt, StringComparer.Ordinal);
foreach (var key in _deletedKeys.Keys)
currentIndex.Remove(key);
foreach (var key in _dirtyKeys.Keys)
@ -280,6 +281,9 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
continue;
}
// A record this write replaces is stored later than it: the one re-mint every store kind shares (StoredAtOver).
if (replaced.TryGetValue(key, out var replacedAt))
stored.StoredAt = StoredAtOver(stored.StoredAt, replacedAt);
var record = ToPersistedRecord(stored, document =>
CultDocumentMessagePackSerialization.SerializeUntyped(
document,