Codex stop-hook review: add_bottom_nav_v0 (and siblings) advertised a
parent_id contract that could silently no-op. pen-core's
insertNodeInTree returns the original tree unchanged when parentId
doesn't match any node (tree-utils.ts:200-234), so batch_design's
downstream call produces a success-looking response {results, nodeCount}
with an orphaned node that never lands on disk.
- tools/element-tool-helpers.ts: new ensureParentExists() helper —
loads the target doc via openDocument + resolveDocPath, checks
getDocChildren(pageId) with findNodeInTree, throws a descriptive
Error listing parent_id and pageId if missing
- Apply to all 3 element tools (add_scroll_row_v0 / add_bottom_nav_v0 /
add_activity_ring_v0) at the top of each handler, before DSL
construction. Null parent_id short-circuits (root insertion is OK)
- routes/design-routes.ts: fix misleading "Page id" description on
add_bottom_nav_v0.parent_id → now matches siblings ("Target parent
node id (must exist...)")
- Tests: 4 new (throws on bogus parent_id for each of 3 tools, +
positive "inserts under valid parent" for add_scroll_row_v0). 86/86
pen-mcp suite pass
Bundle rebuilt. format + tsc green.
|
||
|---|---|---|
| .. | ||
| agent-native@e1f90cab96 | ||
| pen-acp | ||
| pen-ai-skills | ||
| pen-core | ||
| pen-engine | ||
| pen-figma | ||
| pen-mcp | ||
| pen-react | ||
| pen-renderer | ||
| pen-sdk | ||
| pen-types | ||
| CLAUDE.md | ||