C# write set: tests for copy-forward, raw catalog carry, header rule and the inverted lay-back rules

New WriteSetTests (single-file and directory stores, flush and commit): another writer's write and
removal survive, a store that appeared after open is kept, an unstaged in-place change is not
written, a copied record keeps the catalog entry the store holds now, an entry's unknown trailing
fields survive byte for byte, conditional and unconditional commits write the same bytes, the
header drops only when every copied record is known id-free, v2 exactly with a variant. Mesh: a
write copies neighbours forward and replaces only its key. The lay-back and whole-view tests and
the flush-restamp tests are rewritten or removed with the rules they pinned.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 03:16:49 +02:00
commit a7114a1f9f
10 changed files with 641 additions and 167 deletions

View file

@ -304,9 +304,10 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
.ThenBy(entry => entry.SchemaId, StringComparer.Ordinal)
.ToArray();
var holdsIds = written.ToDictionary(key => key, key => Entries[key].HoldsIds, StringComparer.Ordinal);
var header = HeaderForWrite(
currentManifest.FormatVersion,
written.Select(key => (bool?)Entries[key].HoldsIds),
holdsIds.Values.Select(holds => (bool?)holds),
currentIndex.Values.Where(record => !written.Contains(record.Key)),
directoryStore: true,
holdsVariants: false);
@ -314,6 +315,9 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
.OrderBy(record => record.Key, StringComparer.Ordinal)
.ToArray(), header);
foreach (var key in written)
Entries[key].StoredHoldsIds = holdsIds[key];
DeleteUnreferencedRecordPages(currentIndex.Values);
_dirtyKeys.Clear();