Skip to content

test: pin derived sub-object serialization chaining (NestedInheritance snapshot) - #56

Merged
kamronbatman merged 1 commit into
mainfrom
feat/nested-serializable-inheritance
Sep 9, 2026
Merged

test: pin derived sub-object serialization chaining (NestedInheritance snapshot)#56
kamronbatman merged 1 commit into
mainfrom
feat/nested-serializable-inheritance

Conversation

@kamronbatman

@kamronbatman kamronbatman commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds a NestedInheritance snapshot fixture that pins the generator's behaviour for a derived non-ISerializable sub-object (DerivedEntry : BaseEntry, both [SerializationGenerator], tracked through a [DirtyTrackingEntity] on the base) owned through a List<DerivedEntry> on a derived owner.

The fixture asserts, byte for byte, that:

  • the derived sub-object emits public override void Serialize/Deserialize and calls base.Serialize(writer) / base.Deserialize(reader) before writing its own version and fields;
  • MarkDirty() is inherited from the base (not re-emitted), and [DirtyTrackingEntity] resolves through the base;
  • the owner's list deserialization constructs new DerivedEntry(this) via the parent-accepting constructor found on the base chain;
  • each class's [AfterDeserialization] runs after its own fields, base first.

No generator code changes. This shape is about to be relied on by a spawner subclass with its own entry type, so it should be a regression guard rather than an accident.

Tests

dotnet test — 115 passed (114 existing + the new fixture).

…e snapshot)

Guards that a [SerializationGenerator] class deriving from another non-ISerializable
generated class emits override Serialize/Deserialize that chain to base, inherits
MarkDirty and the dirty-tracking parent, and that a List<Derived> owner constructs
elements through the base-chain parent constructor.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ug9bDSDgecZNYdk9j7QE38
@kamronbatman
kamronbatman merged commit b806bf9 into main Sep 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant