fix(canvas): capture schema migration data before lossy serialization

This commit is contained in:
2026-11-11 18:27:51 +08:00
parent b34dc6089a
commit b05058a955
4 changed files with 96 additions and 6 deletions
+15
View File
@@ -37,6 +37,21 @@ The React adapter has an explicit entry and optional peer dependencies; portable
consumers do not load it. No registry publication, release support promise, server
deployment or full-goal completion is implied by this local package.
### Explicit component-data migration
`migrateElement(record, registry)` prepares a detached record; it does not write
the document or migrate storage on read. The ID, incarnation, component and owner
stay unchanged. Each version converter receives frozen detached data and must
return a JSON object. Missing converters, thrown reference mapping, invalid schema,
undefined/function/non-finite values and malformed object/array data reject rather
than being erased or coerced by JSON serialization. Field values are captured once,
then frozen, so a getter cannot return one value for validation and another for
serialization. Unknown components and future versions remain unchanged.
Use an editor transaction when several prepared migrations must publish together:
an error after a staged edit leaves document, history, operations and indexes at
their original Root. Progressive imports still use their declared per-record
failure boundaries; this helper does not promise whole-import rollback.
Experimental partial-model runtime: pass a validated prefix plus `loading` in
`EngineOptions`. Version 1 uses recovery format 7; version 2 carries snapshot-bound direct canvas
membership counts and uses format 8. Both keep the scheduler held. Version 3