C#: a rewrite keeps the catalog entry that publishes a record's schema as a compatible id

The single-file and directory writers dropped an entry whose own id no record carried, leaving a record under a compatible id with
no catalog entry that publishes it: the same store nothing could open. An entry now stays while it publishes any id a record
carries. The conditional-commit readability test over compatible-id-only-v3 pins it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 07:02:06 +02:00
commit 2647f10d20
2 changed files with 3 additions and 2 deletions

View file

@ -259,7 +259,7 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
.ToArray();
var usedSchemaIds = currentIndex.Values.Select(record => record.SchemaId).ToHashSet(StringComparer.Ordinal);
var targetCatalog = catalogCandidates
.Where(entry => usedSchemaIds.Contains(entry.SchemaId))
.Where(entry => usedSchemaIds.Contains(entry.SchemaId) || entry.CompatibleSchemaIds.Any(usedSchemaIds.Contains))
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
.ToArray();
var keysToWrite = _dirtyKeys.Keys

View file

@ -3640,7 +3640,8 @@ namespace GameCult.Caching
SchemaCatalog = catalog
.GroupBy(entry => entry.SchemaId, StringComparer.Ordinal)
.Select(group => group.First())
.Where(entry => used.Contains(entry.SchemaId))
// An entry stays while it publishes a schema id some record carries, as its own id or a compatible one.
.Where(entry => used.Contains(entry.SchemaId) || entry.CompatibleSchemaIds.Any(used.Contains))
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
.ToArray(),
Records = ordered