Skip to content

fix: update mcp and nodes for SiteNode.children string[] schema change#325

Merged
wass08 merged 1 commit into
pascalorg:mainfrom
jelharou:fix/site-node-children-string-ids
May 21, 2026
Merged

fix: update mcp and nodes for SiteNode.children string[] schema change#325
wass08 merged 1 commit into
pascalorg:mainfrom
jelharou:fix/site-node-children-string-ids

Conversation

@jelharou
Copy link
Copy Markdown
Contributor

@jelharou jelharou commented May 21, 2026

What does this PR do?

Fixes breakage introduced by #320, which changed SiteNode.children from embedded BuildingNode | ItemNode objects to flat string[] IDs. Three call sites in packages/mcp and packages/nodes were not updated.

  • mcp/lib/rehydrate-site-children.ts — replace now-obsolete re-embedding logic with a passthrough (call-site compatible, callers become no-ops)
  • mcp/tools/variants/generate-variants.ts — drop the inline copy of the same function and its call
  • nodes/src/site/renderer.tsx — cast childId as AnyNodeId since SiteNode.children is now string[]

How to test

  1. bun dev — confirm the build completes with no TS errors in @pascal-app/mcp and @pascal-app/nodes
  2. Open the editor, load a scene with a site node — confirm site children render correctly
  3. Run the generate_variants MCP tool — confirm variants produce valid node counts

Screenshots / screen recording

N/A — non-visual fix (type correctness and schema alignment).

Checklist

  • I've tested this locally with `bun dev`
  • My code follows the existing code style (run `bun check` to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the `main` branch

Fixes breakage introduced by pascalorg#320 which changed `SiteNode.children` from
embedded `BuildingNode | ItemNode` objects to flat `string[]` IDs.

- `packages/mcp/src/lib/rehydrate-site-children.ts`: replace now-obsolete
  re-embedding logic with a no-op passthrough (call-site compatible)
- `packages/mcp/src/tools/variants/generate-variants.ts`: drop the inline
  copy of the same function and its call
- `packages/nodes/src/site/renderer.tsx`: cast `childId as AnyNodeId` since
  `SiteNode.children` is now `string[]`, not `AnyNodeId[]`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wass08
Copy link
Copy Markdown
Collaborator

wass08 commented May 21, 2026

Thank you!

@wass08 wass08 merged commit fb7d46d into pascalorg:main May 21, 2026
1 check failed
wass08 added a commit that referenced this pull request May 21, 2026
SiteNode.children is z.array(z.string()) (node ids), but the three scene
templates overwrote their inline string-id children with embedded
BuildingNode objects — leftover from the pre-PR-#325 schema where
children was a union of node objects. Against the current schema that
breaks AnyNode.safeParse in templates.test.ts.

Drop the stale post-build mutations; each site already declares the
correct string-id children inline. (Same fix as the in-flight PR #326;
carried here so this branch's CI is green when merged with current main.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
wass08 pushed a commit that referenced this pull request May 21, 2026
PR #320 changed SiteNode.children from embedded BuildingNode/ItemNode
objects to flat string[] IDs. PR #325 updated the runtime call sites
but missed the three scene templates, which still mutated the site
node's children array to embed full building objects after building
the flat dict. This caused AnyNode.safeParse to fail for site_empty,
site_2br, and site_garden in bun test --cwd packages/mcp.

Remove the obsolete mutation blocks; each template already initialises
site.children with the correct string id (e.g. ['building_empty']).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants