docs(saves): note the failure mode if the type-table invariant guard fires

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kamron Batman 2026-07-16 12:33:40 -07:00
parent 3b11a376f0
commit 5b74a346df
No known key found for this signature in database
GPG key ID: 7D81DF26D9A5D94A

View file

@ -293,6 +293,10 @@ public class GenericEntityPersistence<T> : GenericPersistence, IGenericEntityPer
private ushort GetTypeIndex(T entity)
{
// Every path into EntitiesBySerial registers the type first, so this cannot fire.
// If it ever does, the segment-level catch in WriteSnapshot logs it and moves on —
// the failed segment's records are dropped from the idx while binPosition rewinds,
// so treat any occurrence as a serious bug in an insertion path, not a bad entity.
if (!_typeIndexes.TryGetValue(entity.GetType(), out var typeIndex))
{
throw new InvalidOperationException(