Core registers a Component Schema from a description (#76) #88
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/cinnabar!88
Loading…
Reference in a new issue
No description provided.
Delete branch "register-component-schema-from-description"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #76.
What
engine_register_component_schemaregisters a Component Schema from aComponent_Schema_Desc: a name,Component_Field_Descentries naming aComponent_Field_Kind(F64,Bool,GameObject_Reference), and optionalon_add/on_removeHooks. Each Kind maps to the Odin type the serializer already covers, so the Schema is first-class for both Scene Encodings and Play Mode capture. The three types are declared in the ABI Surface and closed over Boundary Types.Registration is legal after startup (ADR-0020). A name collision, a duplicate field name, or an unknown Kind fails the call with a logged error and leaves the running Scene untouched. Odin-derived Schemas keep their
typeidinside Core and report no Kind (ADR-0022).How
schema_commit(name ownership, Schema append, storage open) andschema_storage_alloc. Neither calls the other.engine_register_componentalone.engine_register_componentto the Odin-only table with the new proc as its boundary counterpart, and retires the "no boundary route" table.Tests
tests/core/component_schema_test.odincovers: registration at startup with layout, registration after startup, collision after startup, the.Referenceflag withcomponent_reference/component_set_reference, text and binary round-trips, Play Mode capture and restore, Hooks on a described Schema, and rejection of a duplicate field name and an unknown Kind. No Luau involved.One criterion is verified by inspection rather than by test: "Odin-type registration after startup still panics under
ODIN_DEBUG". An Odin test cannot survivelog.panic; the panic block is unchanged and runs before the shared tail.just checkandjust testpass (core: 325 tests).