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
+2 -5
View File
@@ -116,11 +116,8 @@ export const SiteRenderer = ({ node }: { node: SiteNode }) => {
return (
<group ref={ref} {...handlers}>
{/* Render children (buildings and items) */}
{node.children.map((child) => (
<NodeRenderer
key={typeof child === 'string' ? child : child.id}
nodeId={typeof child === 'string' ? child : child.id}
/>
{node.children.map((childId) => (
<NodeRenderer key={childId} nodeId={childId} />
))}
{/* Ground fill: site polygon with slab holes, occludes below-grade geometry */}