Conversation
7 of 8 tasks
…the node When Value.Parse rejected a node's props, validateNodeProps replaced every declared prop with the module default, so a link with one unsupported target published as "Click here" pointing at "#" while its href and text sat valid in the store. The catch branch now parses each declared prop on its own and falls back to the default only for the props that still fail. Fast path, successful slow path, optional props and injected keys are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tommy230
force-pushed
the
fix/validate-node-props-per-prop
branch
from
September 29, 2026 00:02
9d48f30 to
8b18ab6
Compare
tommy230
marked this pull request as ready for review
September 29, 2026 04:47
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.
Summary
When a single prop on a node fails its TypeBox schema at publish time, the whole node is published with module defaults. A link whose stored
targetis a value the schema does not model (for example""from an HTML import, or a value left behind after a schema was tightened) renders as "Click here" pointing at#, even though itshrefand text are valid and still in the store. Nothing fails, so the only way to notice is to read the published page.The cause is the catch branch of
validateNodePropsinsrc/core/module-engine/validateNodeProps.ts: whenValue.Parsethrows for the node, it returns{ ...rawProps, ...def.defaults }, which overwrites every declared prop, not just the one that failed.The fix:
Kindsymbol (for example a plugin schema rebuilt from JSON), keeps the old wholesale fallback.Trade-off: a node with one broken prop now publishes with the rest of its content instead of a visibly default block. That fits the boundary's stated purpose (normalise "stale, missing, or lightly malformed" props before render), but it makes a bad stored value quieter, not louder. I did not add a dev warning: the publisher has no logging or warnings channel today and
render()runs once per node per publish, so aconsole.warnhere would be noise on large sites. If you would rather surface these repairs, a count on the publish result is the place, and I am happy to add it.#575 stops the HTML importer from storing unsupported
targetvalues in the first place; this PR covers nodes that already carry one, or any other single bad prop.Verification
bun run buildbun run lintbun test: 7062 pass, 0 failNew tests in
src/__tests__/module-engine/validateNodeProps.test.ts: 5 of 9 fail onmainand pass with this change. The non-throwing check also passes onmain, which spreadundefineddefaults harmlessly.Checklist
🤖 Generated with Claude Code