You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(octane): tolerate translated boundary whitespace in DOM bindings - #1978
Firefox page translation can move boundary spaces out of translated text hosts. A fixed div > span(text), button(text) view then has whitespace Text siblings before, between, or after its expected elements. DOM binding adoption currently throws #318 even though the element topology is intact.
Skip ASCII-whitespace Text siblings while resolving fixed and closed addressed children. Preserve those nodes and retain all checks for unexpected elements, comments, meaningful text, namespaces, ordering, and text-leaf shape. Add regression coverage, a short contract note, and an Octane patch changeset.
Validation
pnpm format:check (repository-wide check not run; changed files checked)
pnpm typecheck (repository-wide check not run; owning source/test files checked)
pnpm test (repository-wide suite left to CI)
Targeted regression: 10 new cases failed before the repair; 76 scalar DOM-binding tests pass after it, in development/production and scalar/general/addressed modes. Assertions cover exact node identity, text values, updates, cleanup, and rejected invalid topology.
Native Firefox 157, French-to-English translation, Octane 0.12.1 compiler/SSR: before, 6 of 40 view cases throw feat(base-ui): port the Menu item family (Phase 3f stage 2) #318; after, 40 of 40 pass 600 assertions. The same six failing cases contain browser-relocated whitespace and pass after the repair. A translation-mutation observer also captured seven candidate views with relocated whitespace, with no adoption errors. Updates and disposal pass; no page errors were captured.
All 14 pnpm sync script subcommands completed in declared order using existing local executables. Direct invocation avoided an unnecessary automatic dependency reinstall; no configuration/security policy changes. No generated tracked changes.
Independent read-only correctness/complexity review: no remaining findings. Validation and sync were repeated successfully on signed merged head 134387fd9 after incorporating the current base; worktree clean.
Current-head CI on 134387fd9: all required and relevant checks passed, including all runtime/parity shards, browser/integration suites, lint, typecheck, package validation, bundle checks, and benchmark gates. Bugbot completed without findings. CI run.
Perf review
Final scan against 2075c0e7: 0 candidates. resolveFixedNodes and resolveAddressedNodes run per descriptor node during adoption; the added sibling walk visits each skipped Text node once. No record shape changes, per-node allocations, DOM writes, geometry reads, scheduling changes, or new runtime imports. The regular signal-update path is unchanged. No must-fix findings. Current-head PR benchmark passed: all 64 production-call/DOM-mutation counters are unchanged; application bundle sizes (60 measured values) and public-import reachability bundle sizes (111 values) are unchanged. The advisory octane-tsrx select_lots timing result is +7.0% (approximately 0.005 to 0.006 ms, 95% interval +6.6% to +8.2%); the other 19 timed operations have no verdict. This is recorded without claiming a cause or a speed improvement. Benchmark report.
Concise-code
Runtime source +21/-7; one private helper shared by the existing resolvers, no new exports, options, modules, or hot-record fields. The only new file is the required patch changeset. nextElementSibling would also hide comments and meaningful text; trim/\s would accept extra Unicode whitespace. DOM normalization or fallback rendering would mutate/rebuild nodes unnecessarily. A matched fixture-adopter bundle grows by 125 raw bytes / 55 gzip bytes; this is a micro-bundle measurement, not a whole-application size claim.
Risk / follow-ups
The accepted exception is ASCII HTML whitespace only, including empty Text nodes. Non-whitespace text, NBSP, comments, extra/missing/reordered elements, and invalid text leaves remain errors. Open/opaque descendants retain their previous behavior. Browser translation can make other DOM changes; this repair does not claim to cover every #318 cause.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Note
Low Risk
Adoption-only sibling walking change with a strict ASCII-whitespace exception; binding updates and channel writes are unchanged, with broad regression coverage.
Overview DOM binding adoption no longer fails when closed child lists include extra ASCII-whitespace Text nodes (including empty nodes), which browser page translation can insert between expected elements.
resolveFixedNodes and resolveAddressedNodes in dom-bindings.ts now advance cursors with skipBindingWhitespace instead of treating those siblings as topology errors (#318/#321). The whitespace nodes are left untouched; meaningful text, comments, NBSP, extra elements, and invalid text leaves still reject adoption.
Docs in deferred-hydration.md document the contract; scalar DOM-binding tests add adoption/update/disposal coverage and tighten invalid-topology cases. Octane patch changeset included.
Reviewed by Cursor Bugbot for commit 134387f. Bugbot is set up for automated code reviews on this repo. Configure here.
Compares 2075c0e72, the merge commit's first parent with d71828e6c on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run
Good to go, with two optional nits and one follow-up question. The fix is in the owning resolvers (skipBindingWhitespace). The compiler forbids non-layout text siblings in fixed and addressed views, so skipping ASCII-whitespace Text nodes adopts nothing the template didn't prove, and server output never contains these nodes.
Question (follow-up, predates this PR): if Firefox writes translated text into the leaf's existing Text node rather than wrapping it in <font>, the first adoption write at L425 restores the source language. The new tests keep the leaf text untranslated. Does the Firefox run check that the translation survives? Structural programs also still reject both shapes (dom-binding-program.ts#L872). Both may warrant a follow-up issue.
Each skipped node is visited once with no allocation. An untranslated page pays one extra nodeType read per node, only during adoption. perf-review-scan is clean, and work counters are unchanged.
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
agent-authoredDiff or issue body substantially produced by an AI agentfixPR: bug fix
2 participants
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
Firefox page translation can move boundary spaces out of translated text hosts. A fixed
div > span(text), button(text)view then has whitespace Text siblings before, between, or after its expected elements. DOM binding adoption currently throws #318 even though the element topology is intact.Skip ASCII-whitespace Text siblings while resolving fixed and closed addressed children. Preserve those nodes and retain all checks for unexpected elements, comments, meaningful text, namespaces, ordering, and text-leaf shape. Add regression coverage, a short contract note, and an Octane patch changeset.
Validation
pnpm format:check(repository-wide check not run; changed files checked)pnpm typecheck(repository-wide check not run; owning source/test files checked)pnpm test(repository-wide suite left to CI)Targeted regression: 10 new cases failed before the repair; 76 scalar DOM-binding tests pass after it, in development/production and scalar/general/addressed modes. Assertions cover exact node identity, text values, updates, cleanup, and rejected invalid topology.
Focused binding/handoff suites: 220 tests pass. Scoped typecheck, changed-file formatting, and changeset policy pass.
Native Firefox 157, French-to-English translation, Octane 0.12.1 compiler/SSR: before, 6 of 40 view cases throw feat(base-ui): port the Menu item family (Phase 3f stage 2) #318; after, 40 of 40 pass 600 assertions. The same six failing cases contain browser-relocated whitespace and pass after the repair. A translation-mutation observer also captured seven candidate views with relocated whitespace, with no adoption errors. Updates and disposal pass; no page errors were captured.
All 14
pnpm syncscript subcommands completed in declared order using existing local executables. Direct invocation avoided an unnecessary automatic dependency reinstall; no configuration/security policy changes. No generated tracked changes.Independent read-only correctness/complexity review: no remaining findings. Validation and sync were repeated successfully on signed merged head
134387fd9after incorporating the current base; worktree clean.Current-head CI on
134387fd9: all required and relevant checks passed, including all runtime/parity shards, browser/integration suites, lint, typecheck, package validation, bundle checks, and benchmark gates. Bugbot completed without findings. CI run.Perf review
Final scan against
2075c0e7: 0 candidates.resolveFixedNodesandresolveAddressedNodesrun per descriptor node during adoption; the added sibling walk visits each skipped Text node once. No record shape changes, per-node allocations, DOM writes, geometry reads, scheduling changes, or new runtime imports. The regular signal-update path is unchanged. No must-fix findings. Current-head PR benchmark passed: all 64 production-call/DOM-mutation counters are unchanged; application bundle sizes (60 measured values) and public-import reachability bundle sizes (111 values) are unchanged. The advisoryoctane-tsrx select_lotstiming result is +7.0% (approximately 0.005 to 0.006 ms, 95% interval +6.6% to +8.2%); the other 19 timed operations have no verdict. This is recorded without claiming a cause or a speed improvement. Benchmark report.Concise-code
Runtime source +21/-7; one private helper shared by the existing resolvers, no new exports, options, modules, or hot-record fields. The only new file is the required patch changeset.
nextElementSiblingwould also hide comments and meaningful text;trim/\swould accept extra Unicode whitespace. DOM normalization or fallback rendering would mutate/rebuild nodes unnecessarily. A matched fixture-adopter bundle grows by 125 raw bytes / 55 gzip bytes; this is a micro-bundle measurement, not a whole-application size claim.Risk / follow-ups
The accepted exception is ASCII HTML whitespace only, including empty Text nodes. Non-whitespace text, NBSP, comments, extra/missing/reordered elements, and invalid text leaves remain errors. Open/opaque descendants retain their previous behavior. Browser translation can make other DOM changes; this repair does not claim to cover every #318 cause.
Provenance
agent-authored)Codex task · Host:
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Adoption-only sibling walking change with a strict ASCII-whitespace exception; binding updates and channel writes are unchanged, with broad regression coverage.
Overview
DOM binding adoption no longer fails when closed child lists include extra ASCII-whitespace
Textnodes (including empty nodes), which browser page translation can insert between expected elements.resolveFixedNodesandresolveAddressedNodesindom-bindings.tsnow advance cursors withskipBindingWhitespaceinstead of treating those siblings as topology errors (#318/#321). The whitespace nodes are left untouched; meaningful text, comments, NBSP, extra elements, and invalid text leaves still reject adoption.Docs in
deferred-hydration.mddocument the contract; scalar DOM-binding tests add adoption/update/disposal coverage and tighten invalid-topology cases. Octane patch changeset included.Reviewed by Cursor Bugbot for commit 134387f. Bugbot is set up for automated code reviews on this repo. Configure here.