Repository navigation
fix(react): include catalog event bindings in JSON Schema - #370
Open
armstrongsam25 wants to merge 1 commit into
Open
armstrongsam25 wants to merge 1 commit into
armstrongsam25 wants to merge 1 commit into
Conversation
Contributor
|
@armstrongsam25 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
armstrongsam25
marked this pull request as ready for review
October 1, 2026 05:03
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #356.
The React catalog leaves
onout of its spec schema. That meansjsonSchema()cannot describe event bindings, andvalidate()drops them from otherwise valid specs.This adds
s.eventsOf()and uses it for the React element's optionalonfield. Declared events accept a single action or an array. Actions and action callbacks are limited to the catalog and built-ins; nested JSON parameters and dynamic expressions survive validation. Confirmation, navigation, state callbacks, andpreventDefaultkeep their existing format.Event names are collected across the catalog, rather than narrowed by each element's component type. The existing strict-mode limitation for dynamic-key maps is unchanged. Package docs, API docs, skills, and the affected docs fixture are updated.
Fresh validation on this head:
pnpm test --maxWorkers=2passes 1,245 tests across 82 files (review probe removed), andpnpm type-checkpasses 60 tasks. Earlier validation on this same head also passedpnpm lint, the production web build, and both API-page content/Markdown parity checks.Reproducible before/after evidence (October 1, 2026)
Compared base
c2600d7with PR head11a5d81, using Node 24.19.0, pnpm 11.1.3 and Vitest 4.0.17 on Windows. Rebuilt@json-render/core,@internal/react-stateand@json-render/reactfor each comparison. The base run restores the two changed runtime files from the base commit; all remaining core/React runtime source is identical between those commits. Both runs use the same fixtures and renderer.The probe follows
defineCatalog→jsonSchema()/validate()→JSONUIProvider+Renderer→ a DOM button click → real action handlers/state updates. It imports the built packages through their public exports. The input hason.presscallinggowithname: { "$state": "/name" }; provider state suppliesname: "Ada".onpressand catalog/built-in action nameson.pressgo({name: "Ada"})oncego({name: "Ada"})oncesetState→go→ success callbacksavedstays falsesavedbecomes true;goreads the updated value; callback receives nested JSON intactononThe raw-spec control confirms that the renderer already handles the event. The failure is introduced by catalog validation dropping the binding. This is a deterministic React/jsdom integration proof; it does not claim a browser deployment or an external-model generation test.
Captured output and test totals
Exact probe output from the two runs (local paths, timings and terminal color codes omitted):
Those 18 cases comprise the 15 committed event-schema regressions plus the three review-probe cases below. All three probe cases fail on the base and pass on the head. Of the committed regressions, 14 fail on the base (including the new
s.eventsOfAPI being absent); the optional-oncase passes on both. The review probe is supplied here and is not an additional file in the PR diff.Reproduce with the same inputs and assertions
Use a disposable clone with Node 24 and pnpm 11.1.3:
git clone https://github.com/armstrongsam25/json-render.git json-render-pr370-evidence cd json-render-pr370-evidence git checkout --detach 11a5d81118feb0cd46efadfc85f75f456dbebf83 pnpm install --frozen-lockfileSave the test below as
packages/react/src/pr370-evidence.test.tsx, then run the base comparison. The test command is expected to exit 1:git restore --source=c2600d73908ed505e6d726f5b6f969ba8f597ce7 -- packages/core/src/schema.ts packages/react/src/schema.ts pnpm --filter @json-render/core build pnpm --filter @internal/react-state build pnpm --filter @json-render/react build pnpm exec vitest run packages/react/src/pr370-evidence.test.tsx packages/core/src/event-schema.test.ts --maxWorkers=1 --reporter=verboseRestore and rebuild the PR implementation. The same test command now exits 0:
git restore --source=11a5d81118feb0cd46efadfc85f75f456dbebf83 -- packages/core/src/schema.ts packages/react/src/schema.ts pnpm --filter @json-render/core build pnpm --filter @internal/react-state build pnpm --filter @json-render/react build pnpm exec vitest run packages/react/src/pr370-evidence.test.tsx packages/core/src/event-schema.test.ts --maxWorkers=1 --reporter=verboseVercel preview deployments still require authorization from a Vercel Labs Team member. The local evidence above does not depend on that deployment gate.
Contributed by @armstrongsam25 with PAIL. AstralDeep already defines and validates component actions in AstralProjection's component model. This adapts that approach to json-render's event bindings; no Astral source was copied.