Skip to content

fix(validator): catch dangling children references in validateStructure#142

Open
CryptoExplor wants to merge 1 commit intofarcasterxyz:mainfrom
CryptoExplor:patch-3
Open

fix(validator): catch dangling children references in validateStructure#142
CryptoExplor wants to merge 1 commit intofarcasterxyz:mainfrom
CryptoExplor:patch-3

Conversation

@CryptoExplor
Copy link
Copy Markdown

Fixes #136

Adds a pass inside validateStructure that checks every element's children array against the keys of ui.elements. If a child ID is referenced but not defined, a descriptive ZodIssue is pushed with the path to the offending element.

Previously, measureDepth would silently short-circuit on missing IDs (if (!el?.children?.length) return 0), allowing dangling references to pass validation undetected. This could cause the client renderer to crash or silently skip elements at runtime.

Fixes farcasterxyz#136

Adds a pass inside `validateStructure` that checks every element's `children` array against the keys of `ui.elements`. If a child ID is referenced but not defined, a descriptive `ZodIssue` is pushed with the path to the offending element.

Previously, `measureDepth` would silently short-circuit on missing IDs (`if (!el?.children?.length) return 0`), allowing dangling references to pass validation undetected. This could cause the client renderer to crash or silently skip elements at runtime.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 11, 2026

@CryptoExplor is attempting to deploy a commit to the farcaster Team on Vercel.

A member of the Team first needs to authorize it.

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.

validator: dangling children references (element IDs that don't exist in elements) are not caught

1 participant