AetherDb: ExpectUnchanged belongs to generic-designs' batch, not roles-migrate's

The previous sweep commit put the ExpectUnchanged batch in RolesMigrate's commit (first match of the anchor) and left GenericDesigns on a plain commit. RolesMigrate is restored to its base text; GenericDesigns now lands its batch onto the file as it is. Builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 22:52:24 +02:00
commit 7d1fa5ce60

View file

@ -607,14 +607,10 @@ public static class Program
// Validate comment) -- so it calls the same validation directly, right before the identity-preserving // Validate comment) -- so it calls the same validation directly, right before the identity-preserving
// write, instead of writing raw and unvalidated the way this line used to. // write, instead of writing raw and unvalidated the way this line used to.
foreach (var (document, _) in changed) CultRecordRefs.Validate(document); foreach (var (document, _) in changed) CultRecordRefs.Validate(document);
// ExpectUnchanged lands the batch onto the file as it is: every record the command did not author keeps the bytes it has, db.Cache.Commit(batch =>
// where a plain commit would re-encode the whole catalog through today's types.
if (!db.Cache.Commit(batch =>
{ {
batch.ExpectUnchanged();
foreach (var (document, key) in changed) batch.Upsert(document.GetType(), document, key); foreach (var (document, key) in changed) batch.Upsert(document.GetType(), document, key);
})) });
throw new InvalidOperationException("The catalog changed while the generic designs were being authored; nothing was written. Run it again.");
Console.WriteLine($"Landed {changed.Count} changed records in Aetheria.cc"); Console.WriteLine($"Landed {changed.Count} changed records in Aetheria.cc");
return 0; return 0;
} }
@ -2472,10 +2468,14 @@ public static class Program
return 0; return 0;
} }
foreach (var (document, _) in changed) CultRecordRefs.Validate(document); foreach (var (document, _) in changed) CultRecordRefs.Validate(document);
db.Cache.Commit(batch => // ExpectUnchanged lands the batch onto the file as it is: every record the command did not author keeps the bytes it has,
// where a plain commit would re-encode the whole catalog through today's types.
if (!db.Cache.Commit(batch =>
{ {
batch.ExpectUnchanged();
foreach (var (document, key) in changed) batch.Upsert(document.GetType(), document, key); foreach (var (document, key) in changed) batch.Upsert(document.GetType(), document, key);
}); }))
throw new InvalidOperationException("The catalog changed while the generic designs were being authored; nothing was written. Run it again.");
Console.WriteLine($"\nWrote {changed.Count} records to Aetheria.cc"); Console.WriteLine($"\nWrote {changed.Count} records to Aetheria.cc");
return 0; return 0;
} }