Skip to content

test(octane): pin early host ownership in a container whose previous root fell back - #1826

Merged
trueadm merged 2 commits into
mainfrom
test/reused-container-fallback
Oct 6, 2026
Merged

trueadm merged 2 commits into
mainfrom
test/reused-container-fallback

Conversation

@trueadm

@trueadm trueadm commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1777 by pinning the behavior that #1784 already delivered. This PR changes only tests.

Before #1784, a root's per-site hydration repair left its container marked as repaired. A later root that reused the container could then accept an external change to an early host's site while it was suspended. It also retired the early binding instead of refusing. #1784 replaced per-site repair with React 19's boundary/root fallback. An early host's site check (valid() in dom-bindings.ts) is now purely structural: parent chain, both neighbors, and descriptor id. No state from an earlier root can authorize a changed site. The latest comment on the issue confirms the bug no longer reproduces.

Changes to packages/octane/tests/behavior-root.test.ts:

  • fallBackOnce hydrates and unmounts a root in the same container that really falls back. It checks for one recoverable error and that the server DOM was replaced.
  • The two suspended early-host groups now also run under Strong compilation and in a container whose previous root fell back. Existing test names are unchanged.
    • Root-level neighbor, unchanged or externally removed.
    • Stale nested neighbor that falls back the root across a suspension.
  • In the reused container, the issue's scenario now behaves as it does in a fresh one. An external removal while suspended reaches onUncaughtError once as Version Packages #75. Nothing commits, the early binding is not cleaned up, and a later publish still reaches the original button. The unchanged case hands off, and the nested case falls back the root.
  • The inferred useLayoutEffect deps replace [], because Strong rejects explicit deps.

The helper forces the fallback with a text mismatch. A stale element inside a template element, as in the issue's primer, causes no fallback. This is the documented intentional divergence that static template descendants are not walked.

Validation

  • pnpm format:check (scoped pnpm format:files:check on the changed file: clean)
  • pnpm typecheck (scoped pnpm typecheck:files on the changed file: the same 3 pre-existing errors as main, none new)
  • pnpm test (left to CI)
  • targeted tests: the affected groups, 64/64 across octane and octane-prod.
  • Mutation check: I temporarily made a root fallback's container excuse later neighbor changes. Exactly the 8 reused-container + external-removal cases failed; their fresh-container twins passed. The runtime was restored afterwards.
  • pnpm sync: no generated changes.

Risk / follow-ups

No runtime change, so there is no changeset.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


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


Note

Low Risk
Only test coverage changes; no production runtime or API changes.

Overview
Test-only expansion in behavior-root.test.ts to lock in #1777: early host behavior during suspended hydration must not depend on a prior root in the same container having fallen back.

Adds fallBackOnce to force a real hydration fallback (text mismatch → recoverable error, server DOM replaced) and unmount in container. The two suspended early-host suites now matrix over dev/prod, Strong compilation, and fresh vs reused container (via suspendedHandoffModes / suspendedHandoffMode in test titles), passing { strong } into authoredPresentation and calling fallBackOnce when reused is true.

Fixture sources drop explicit useLayoutEffect(..., []) deps so Strong compilation accepts the tests.

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

…root fell back

A previous root's hydration recovery once left its container marked as
repaired, so a later root reusing that container could accept an external
change to an early host's site while suspended (#1777). The boundary/root
fallback redesign (#1784) removed that state: an early host's site check is
now purely structural.

Run the two suspended early-host handoff groups in a container whose previous
root fell back (fallBackOnce, which verifies a real fallback first), and under
Strong compilation, so a lingering per-container exemption fails them.

Fixes #1777

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 6, 2026 19:28
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🟡 js-framework: 1 timed operation(s) slower beyond ±3%

Compares 6936de94f, the merge commit's first parent with d31f21efe on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. 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

js-framework: 1k/10k row operations

target operation base ms head ms head/base 95% CI
octane-tsrx add 2.958 3.267 +10.0% +3.3% … +14.3% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 4.550 4.575 −4.0% −14.8% … +18.2% ⚪ within noise
octane-tsrx replace 10.783 11.267 +0.6% −5.3% … +13.3% ⚪ within noise
octane-tsrx add 2.958 3.267 +10.0% +3.3% … +14.3% 🟡 slower
octane-tsrx update 0.172 0.165 −3.2% −9.1% … +7.1% ⚪ within noise
octane-tsrx select 0.008 0.008 +3.1% −4.9% … +5.7% ⚪ within noise
octane-tsrx swap 0.047 0.046 −1.4% −8.4% … +1.3% ⚪ within noise
octane-tsrx remove 0.034 0.032 −0.0% −10.1% … +6.0% ⚪ within noise
octane-tsrx runlots 38.717 39.058 −1.3% −7.9% … +11.2% ⚪ within noise
octane-tsrx select_lots 0.010 0.010 −4.4% −17.6% … +3.3% ⚪ within noise
octane-tsrx clear 73.967 72.800 −1.2% −6.2% … +6.8% ⚪ within noise
octane-jsx run 4.775 4.717 +2.3% −1.1% … +7.1% ⚪ within noise
octane-jsx replace 12.658 12.883 −2.6% −9.2% … +5.2% ⚪ within noise
octane-jsx add 3.933 4.100 −2.5% −5.2% … +2.4% ⚪ within noise
octane-jsx update 0.368 0.365 −1.4% −5.7% … +3.9% ⚪ within noise
octane-jsx select 0.168 0.161 +0.9% −1.2% … +6.1% ⚪ within noise
octane-jsx swap 0.298 0.284 +0.3% −3.9% … +2.3% ⚪ within noise
octane-jsx remove 0.220 0.212 −2.3% −6.7% … +0.0% ⚪ within noise
octane-jsx runlots 37.983 36.592 +2.0% −9.9% … +8.0% ⚪ within noise
octane-jsx select_lots 1.996 2.069 +3.7% +1.6% … +7.8% ⚪ within noise
octane-jsx clear 59.658 60.592 +2.4% −3.0% … +8.1% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 60 measured values.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp October 6, 2026 19:40 Inactive
@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
octane-website-mcp Skipped Skipped Oct 6, 2026 7:40pm UTC

Request Review

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
octane-website 0374489 Oct 06 2026, 08:12 PM

@trueadm
trueadm merged commit b52fbb0 into main Oct 6, 2026
32 of 33 checks passed
@trueadm
trueadm deleted the test/reused-container-fallback branch October 6, 2026 20:20

This branch was previously deployed

1 inactive deployment
Preview – octane-website-mcp — 03744896 Deployed Oct 6, 2026 by vercel[bot]
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 test PR: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prior hydration recovery can authorize a later external host-site change

1 participant