Hydration: check the text marker's closer before binding anything - #22
Merged
Conversation
Review follow-ups to #21. A `<!--node-idN-->` that is the last child of its parent — or followed by anything other than text-then-`<!--#-->` — took the "real text" branch with `next === null`, wrote `null` into the node table, and then died on `textNode.nextSibling` with a raw TypeError instead of the intended "not closed by <!--#-->" diagnostic. The closer is now located and checked before either marker is consumed or any id is bound, so a malformed marker leaves the table and the document exactly as they were. Error path only; the happy path is unchanged and the new test fails against the previous code. Doc corrections: the normative `hydrate` doc in wit/world.wit spelled the comment markers with a space (`<!--node-id n-->`), a form `pre_render` never writes and the host rejects; and src/hydrate.rs listed the four counter-bump sites in one order and their line numbers in another.
lannbot
enabled auto-merge
September 4, 2026 17:53
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.
Review follow-ups to #21 (Fable review of
8163a3a). Both ports were confirmed faithful; these are the three findings.Error path (behaviour): a
<!--node-idN-->that is the last child of its parent — or followed by anything other than text-then-<!--#-->— took the "real text" branch withnext === null, wrotenullinto the node table, then died ontextNode.nextSiblingwith a rawTypeErrorinstead of the intended "not closed by<!--#-->" diagnostic. The closer is now located and checked before either marker is consumed or any id is bound, so malformed markup leaves the table and document untouched. New test covers three malformed shapes and fails against the previous code.Doc: the normative
hydratedoc inwit/world.witspelled the markers with a space (<!--node-id n-->), a formpre_rendernever writes and the host rejects.src/hydrate.rs's module doc listed the four counter-bump sites in one order and their line numbers in another.Gates:
just check,just test(103),just e2e(9) green.