Skip to content

test(octane): pin Activity effects for updates under a held visibility change - #2248

Merged
domgan-oai merged 1 commit into
mainfrom
test/activity-held-visibility-effects
Oct 27, 2026
Merged

domgan-oai merged 1 commit into
mainfrom
test/activity-held-visibility-effects

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1351.

#1351 reported two symptoms. Both happen when a root render changes an Activity's visibility and a later sibling then suspends with no Suspense boundary:

  1. Hidden → visible: the panel was revealed before the render committed, while its ref stayed detached.
  2. Visible → hidden: an update accepted inside the still-visible Activity ran no layout or passive effects until the held render was cancelled.

Neither reproduces on current main. The runtime redesign (#2103, 175b85dfcf) fixed both by making visibility a commit op: "A changing Activity journals its visibility record, its Block's inactive flag and its suspense handler, and reveals at commit, so a dropped render leaves it as it was." #2103 also added structure-commit.test.ts's "a dropped … render leaves a … Activity …" cases, which pin the first symptom. Nothing pinned the second.

This PR adds that coverage. While the root render that changes visibility is held, an update inside the Activity runs its effects when the committed screen is visible and keeps them disconnected when it is hidden. It covers both directions at urgent and transition priority. It is test-only.

Changes

  • packages/octane/tests/_fixtures/structure-commit.tsrx: adds ActivityCounterApp, a counter inside an Activity that logs layout and passive effects, with the file's existing never-settling Gate sibling. ActivityLeaf is unchanged, so the existing dropped-render cases log the same entries.
  • packages/octane/tests/structure-commit.test.ts: adds four cases (two directions × two priorities) to "Activity visibility changes at commit".

Validation

  • pnpm format:check (not run; pnpm format:files:check on both changed files is clean)
  • pnpm typecheck (not run; pnpm typecheck:files on both changed files exits 0)
  • pnpm test (not run; the local machine is too loaded for the full suite)
  • targeted tests: vitest run --project octane --project octane-prod over structure-commit, activity, activity-suspense-retry and style-hidden-commit: 148/148 pass, including the 8 new runs.
  • Red before the fix: standalone copies of the new cases failed 8/8 against e43390610c, the parent of refactor: integrate next runtime redesign #2103, in both compile modes.
    • Hidden direction: expected '' to be 'none'.
    • Visible direction: expected [] to deeply equal ['layout:1', 'passive:1'].
    • The issue's own minimal repro, run in jsdom, also fails on e43390610c (display: '', ref detached) and passes on 175b85dfcf and main.
  • pnpm sync leaves the tree clean.

Risk / follow-ups

  • The new cases don't show that the held request survives the accepted inner update. A regression where an inner update silently cancels a held visibility change would still pass them.

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.


Note

Low Risk
Test and fixture changes only; no runtime or production code paths modified.

Overview
Adds test-only coverage for #1351: while a root render that toggles Activity visibility is held (never-settling sibling Gate), an update inside the Activity must follow committed visibility—layout and passive effects run when still visible, and stay skipped when still hidden.

The fixture gains ActivityCounterApp with a clickable counter that logs useLayoutEffect / useEffect on count changes, mirroring the existing ActivityApp + Gate suspend pattern. structure-commit.test.ts adds four cases (visible↔hidden × urgent/transition) under Activity visibility changes at commit, asserting DOM display, counter state, and effect logs during the held render.

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

…y change

Issue #1351 reported two symptoms of a root render that changes an
Activity's visibility and then suspends with no boundary: the hidden panel
was revealed before commit, and an update accepted inside a still-visible
Activity ran no effects until the held render was cancelled. The runtime
redesign (#2103) fixed both; its dropped-render test covers the first.

Cover the second in both directions and at both priorities: while the
visibility change is held, an update inside a visible Activity runs its
layout and passive effects, and one inside a hidden Activity keeps them
disconnected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Oct 27, 2026
@jonkwheeler
jonkwheeler marked this pull request as ready for review October 27, 2026 11:48
@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 Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 3b5bc8b Commit Preview URL

Branch Preview URL
Oct 27 2026, 11:50 AM

@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 Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 3b5bc8b Commit Preview URL

Branch Preview URL
Oct 27 2026, 11:49 AM

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

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

Compares 232464b39, the merge commit's first parent with 7bba5ff96 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

js-framework: 1k/10k row operations

target operation base ms head ms head/base 95% CI
octane-tsrx select_lots 0.005 0.006 +9.3% +6.4% … +10.0% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.342 2.283 ±0.0% −3.8% … ±0.0% ⚪ within noise
octane-tsrx replace 4.542 4.567 −0.0% −3.2% … +2.3% ⚪ within noise
octane-tsrx add 2.142 2.108 ±0.0% −0.0% … +0.0% ⚪ within noise
octane-tsrx update 0.090 0.093 +1.8% +0.9% … +3.0% ⚪ within noise
octane-tsrx select 0.005 0.005 +0.3% −0.0% … +0.6% ⚪ within noise
octane-tsrx swap 0.016 0.015 −2.2% −2.8% … −1.6% ⚪ within noise
octane-tsrx remove 0.012 0.012 +0.5% −1.5% … +2.1% ⚪ within noise
octane-tsrx runlots 21.442 20.133 +0.5% −6.2% … +3.8% ⚪ within noise
octane-tsrx select_lots 0.005 0.006 +9.3% +6.4% … +10.0% 🟡 slower
octane-tsrx clear 39.875 40.792 +0.0% −1.2% … +2.0% ⚪ within noise
octane-jsx run 3.483 3.508 −1.5% −5.7% … +5.3% ⚪ within noise
octane-jsx replace 5.775 5.600 −1.7% −6.8% … +5.2% ⚪ within noise
octane-jsx add 2.958 2.958 +0.0% −0.0% … +3.6% ⚪ within noise
octane-jsx update 0.175 0.173 −0.3% −1.7% … ±0.0% ⚪ within noise
octane-jsx select 0.091 0.089 ±0.0% −1.3% … +0.6% ⚪ within noise
octane-jsx swap 0.130 0.132 +0.3% −0.5% … +1.6% ⚪ within noise
octane-jsx remove 0.123 0.125 −0.7% −1.3% … +0.7% ⚪ within noise
octane-jsx runlots 27.017 27.867 +1.0% −2.1% … +4.1% ⚪ within noise
octane-jsx select_lots 0.893 0.901 −0.3% −0.9% … +2.2% ⚪ within noise
octane-jsx clear 44.008 43.775 −0.0% −0.9% … +2.0% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 111 measured values.

Public-import reachability bundles (bytes)

No changes across 129 measured values.

@domgan-oai
domgan-oai merged commit fcb0224 into main Oct 27, 2026
55 checks passed
@domgan-oai
domgan-oai deleted the test/activity-held-visibility-effects branch October 27, 2026 12:45
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.

Suspended root updates reveal hidden Activity content before commit

2 participants