Skip to content

fix(runtime): adopt annotated scalar text runs - #2063

Closed
domgan-oai wants to merge 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-binding-text-runs-318
Closed

domgan-oai wants to merge 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-binding-text-runs-318

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

On hold for #2064. This PR expands accommodation for externally rewritten scalar text runs, which conflicts with the proposed removal of translation-specific support. Current evidence does not establish a separate compiler-generated or otherwise supported contract requiring its comment/text-run changes. The implementation and regression evidence are retained for reassessment.

Summary

adoptBindings rejects scalar text leaves containing Text + Comment + Comment or Text + FONT, even when their surrounding element tree matches. Merely accepting those nodes would leave another bug: updates write only the first child's nodeValue, leaving stale suffixes or writing invisibly into a comment.

Accept Text, Comment and HTML FONT runs inside compiler-proven scalar text hosts, and publish changes to the complete run. Initial FONT translation remains untouched; initial text/comment-only content synchronizes with the source. Element order, tag, namespace and closed-child checks outside those leaves remain strict.

Validation

  • Targeted compiler/runtime tests: 302 passed across scalar bindings, binding handoff, displaced-host handoff and signal bindings. The new cases produced 74 failures before the repair.
  • Targeted typecheck and formatting passed. All sync generators ran successfully using the existing installed tools directly; no generated tracked changes remained.
  • Isolated Chromium: 42 paired expectations passed against the released 0.13.5 runtime, current main and the candidate. Checks cover adoption, complete text publication, host identity, disposal/re-adoption and synthetic rewrites after adoption. Unsupported elements still reject before source reads or subscriptions.
  • Independent correctness/complexity review; perf-review scanner: no findings. Validation scans text children once during adoption; the writer retains the lone-Text path and introduces no state, allocation or scheduling mechanism.
  • Existing native-presentation benchmark: matching semantic counters and compiled output. Complete fixture gzip 24,473 → 24,491 bytes (+18); activation gzip 9,935 → 9,950 (+15); server unchanged. Timing was noisy; no speed claim or whole-application size claim.
  • concise-code: runtime +19/-13 lines; no new exports, options or runtime modules. Validator-only repair was rejected because it leaves stale text; a persistent run representation was unnecessary because existing previous-value state and DOM primitives suffice.
  • Full workspace format/typecheck/test: left to CI. A frozen install was blocked by an unrelated [email protected] minimum-release-age registry-manifest failure; no policy was relaxed. Focused validation used the already installed core 0.5.5 / oxc 0.20.0 toolchain.

Risk / follow-ups

The browser fixtures reconstruct DOM mutations; they do not identify a native translator or extension as the mutator. Arbitrary HTML wrappers and extra elements outside scalar text leaves remain rejected. Comments between fixed elements remain mismatches. This change is not deployed.

Provenance

  • An agent produced this diff (agent-authored)

Originating Codex task, host com-79386.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Changes core deferred-hydration text binding adoption and update paths; behavior shifts for annotated or translated scalar leaves, though scope is limited to compiler-proven text hosts with expanded tests.

Overview
Scalar DOM binding adoption now treats text leaves as runs of Text, Comment, and HTML <font> nodes instead of rejecting anything beyond a single text node or lone translator wrapper.

Adoption keeps those runs intact when the bound value already matches (including translated <font> trees), but syncs comment-only or mismatched text to the initial snapshot. Updates replace the entire run via textContent so partial nodeValue writes cannot leave stale suffixes or update invisible comment nodes. Element topology checks outside these leaves stay strict (non-HTML <font>, mixed elements like <b> still fail).

Docs and tests cover fixed and addressed views, pre/post-adoption rewrites, and unchanged-value publishes.

Reviewed by Cursor Bugbot for commit 5cad57c. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 14, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 14, 2026 20:27
@domgan-oai
domgan-oai marked this pull request as draft October 14, 2026 20:34
@domgan-oai domgan-oai closed this Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant