editor: gate Load Build behind a verification dialog

Loading JSON previously called setScene blindly and crashed when
the file held schema-invalid nodes (e.g. items missing `asset`).
The new dialog parses the file, runs validateBuildJson in core,
and surfaces structure counts (site/building/levels/walls/doors/
windows/items/slabs/ceilings/zones/scans), floor area, and a
per-node Schema Details list grouped by type. Import is blocked
when any hard error exists.

Two schema bugs the validator surfaced are fixed here too:

- SiteNode.children is now an id array like every other node
  (was a discriminatedUnion of full objects; three readers carried
  a string-or-object ternary that's now dropped). migrateNodes
  flattens legacy nested-object children on load. Default-scene
  seed and photo-to-scene MCP builder updated to pass `building.id`.
- LevelNode.children now includes shelf — the editor allowed it
  but the schema didn't. The schema-vs-registry-as-source-of-truth
  discussion is captured in plans/editor-node-registry.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-05-20 10:31:02 -04:00
co-authored by Claude Opus 4.7
parent 42bf025cad
commit ffc497c67a
11 changed files with 642 additions and 27 deletions
@@ -229,7 +229,7 @@ function buildSceneGraphFromVision(
// Build the skeleton: site → building → level.
const building = BuildingNode.parse({})
const level = LevelNode.parse({ level: 0 })
const site = SiteNode.parse({ children: [building] })
const site = SiteNode.parse({ children: [building.id] })
// Link parent ids so downstream traversal works.
const siteId = site.id as AnyNodeId