Core replaces a live description-registered Schema and migrates instances by field name (#75) #77

Closed
opened 2026-09-06 01:23:48 +00:00 by crowmaki · 0 comments
Owner

Parent

#75

What to build

Re-registering a description-registered Schema under a name that is already registered replaces it while instances are live, per ADR-0020. Existing instances migrate through the serializer by field name: a kept field with a compatible Kind carries its value over, a kept field with an incompatible Kind resets to zero, a removed field is dropped, an added field is zero. GameObject and Component Object Ids and Component Handles survive, so references into a migrated Component still resolve. Replacing an Odin-registered Schema remains illegal and fails with a logged error.

This is the Core half of hot reload. It needs no Luau.

Acceptance criteria

  • engine_register_component_schema with a name that names a description-registered Schema replaces it and returns the same Component_Type
  • Live instances keep values for fields present in both old and new description, matched by name and not by position
  • A removed field's data is dropped; an added field reads as zero; a field whose Kind changed reads as zero
  • Every migrated instance keeps its Component Handle and Object Id; component_is_alive stays true and reference fields still resolve
  • Attempting to replace an Odin-registered Schema fails, logs, and leaves the Schema and its instances untouched
  • A failed replacement (for any reason) leaves the previous Schema and every instance in force
  • Core tests cover every criterion, including migration while more than one Scene is loaded

Blocked by

## Parent #75 ## What to build Re-registering a description-registered Schema under a name that is already registered replaces it while instances are live, per ADR-0020. Existing instances migrate through the serializer by field name: a kept field with a compatible Kind carries its value over, a kept field with an incompatible Kind resets to zero, a removed field is dropped, an added field is zero. GameObject and Component Object Ids and Component Handles survive, so references into a migrated Component still resolve. Replacing an Odin-registered Schema remains illegal and fails with a logged error. This is the Core half of hot reload. It needs no Luau. ## Acceptance criteria - [ ] `engine_register_component_schema` with a name that names a description-registered Schema replaces it and returns the same `Component_Type` - [ ] Live instances keep values for fields present in both old and new description, matched by name and not by position - [ ] A removed field's data is dropped; an added field reads as zero; a field whose Kind changed reads as zero - [ ] Every migrated instance keeps its Component Handle and Object Id; `component_is_alive` stays true and reference fields still resolve - [ ] Attempting to replace an Odin-registered Schema fails, logs, and leaves the Schema and its instances untouched - [ ] A failed replacement (for any reason) leaves the previous Schema and every instance in force - [ ] Core tests cover every criterion, including migration while more than one Scene is loaded ## Blocked by - #76
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar#77
No description provided.