From 74f1db64afa642bcb770500f9034e5a4d26347ec Mon Sep 17 00:00:00 2001 From: Libby Date: Thu, 12 Nov 2026 00:31:01 +0000 Subject: [PATCH] CultCache: a mark is explained only up to the highest slot the catalog comparison reports Explained required only that some slot was reported, so a depth-0 slot the comparison never reported was consented to and dropped on write (finding unreported-slot-over-consent). Co-Authored-By: Claude Opus 5.5 --- src/GameCult.Caching/CultCache.cs | 7 +++++-- src/GameCult.Caching/CultUnreadSlots.cs | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/GameCult.Caching/CultCache.cs b/src/GameCult.Caching/CultCache.cs index da791b82..ebea77d4 100644 --- a/src/GameCult.Caching/CultCache.cs +++ b/src/GameCult.Caching/CultCache.cs @@ -4034,8 +4034,11 @@ namespace GameCult.Caching for (var cause = exception; cause != null; cause = cause.InnerException) causes.Add(cause.Message); throw new InvalidDataException($"Record '{record.Key}' (schema '{record.SchemaId}') cannot be decoded: {string.Join(" <- ", causes.Distinct())}", exception); } - // Explained only when every mark is at depth 0 and the schema comparison reported ignored slots under this id. - unread = decoded.UnreadSlots?.Explaining(decoded.UnreadSlots.AllAtDepthZero && report.IgnoredExtraSlots.Length > 0); + // Explained only when every mark is at depth 0 and the schema comparison under this id reported every slot the mark carries + // past the reader: consent reaches no slot above the highest reported (none when nothing was reported). + unread = decoded.UnreadSlots is { } marked + ? marked.Explaining(marked.AllAtDepthZero && marked.SlotCount <= report.IgnoredExtraSlots.DefaultIfEmpty(-1).Max() + 1) + : null; return new CultStoredDocument( new CultRecordKey(record.Key), record.StoredAt, diff --git a/src/GameCult.Caching/CultUnreadSlots.cs b/src/GameCult.Caching/CultUnreadSlots.cs index cbf46f3c..9e8412f7 100644 --- a/src/GameCult.Caching/CultUnreadSlots.cs +++ b/src/GameCult.Caching/CultUnreadSlots.cs @@ -31,9 +31,10 @@ namespace GameCult.Caching public int Occurrences { get; } /// - /// True only when every mark is at depth 0 and the schema comparison reported ignored slots under the id the record was stored - /// under: the loss a compatible-id declaration consents to (cultlib-gaps:ruling:slot-mark-consent). Any other mark leaves the - /// record read-only whatever is declared. + /// True only when every mark is at depth 0 and the schema comparison under the id the record was stored under reported every + /// slot the mark carries past the reader ( is at most the highest reported slot plus one): the loss a + /// compatible-id declaration consents to (cultlib-gaps:ruling:slot-mark-consent). Any other mark leaves the record read-only + /// whatever is declared. /// public bool Explained { get; }