Skip to content

Hydration: check the text marker's closer before binding anything - #22

Merged
lannbot merged 1 commit into
mainfrom
fix/hydration-review
Sep 4, 2026
Merged

Hydration: check the text marker's closer before binding anything#22
lannbot merged 1 commit into
mainfrom
fix/hydration-review

Conversation

@lannbot

@lannbot lannbot commented Sep 4, 2026

Copy link
Copy Markdown
Owner

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 with next === null, wrote null into the node table, 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 malformed markup leaves the table and document untouched. New test covers three malformed shapes and fails against the previous code.

Doc: the normative hydrate doc in wit/world.wit spelled the markers with a space (<!--node-id n-->), a form pre_render never 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.

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
lannbot enabled auto-merge September 4, 2026 17:53
@lannbot
lannbot merged commit 0063886 into main Sep 4, 2026
1 check passed
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.

2 participants