Repository navigation
Description
Context
#3657 (fixed by #3659, 501e93e21) was one instance of a bug class. The media card focused an element in a requestAnimationFrame callback scheduled before React committed that element. Under load the frame ran first, the ref was null, and focus stayed put. Separately, the layout test's teardown (stop) drained held fixture requests before releasing holdPlans, so a failing assertion turned into a 30 s timeout with no failure detail.
#3659 fixed both only in hygiene-media.tsx's stale-apply path and in hygiene-media.layout.tsx's teardown.
Other frame-scheduled focus calls on main 1619741f2:
packages/ui-react/src/components/activity/hygiene-media.tsx:197,:421-422and:730packages/ui-react/src/components/activity/activity-page.tsx:495packages/ui-react/src/components/files/file-panel.tsx:193packages/ui-react/src/components/files/untrusted-marks.tsx:411packages/ui-react/src/components/settings/modules-tab.tsx:149and:157packages/ui-react/src/lib/local-work.ts:611
Other browser fixtures may also hold requests across teardown (packages/ui-react/tests/fixtures/hygiene-browser-server.ts owns holdPlans).
Scope
- Classify each site above. Does its focus target mount in the same commit that schedules the frame? A site is only at risk when the target is rendered conditionally by a state change made in the same handler or effect.
- Fix each at-risk site so focus happens after the commit that mounts the target, the way fix(ui-react): focus the stale-apply banner after it renders #3659 did.
- Make teardown release held fixture requests before draining, for every browser fixture that can hold one. A failing assertion must report its own failure, not a timeout.
Out of scope
- Raising test timeouts, retries, or skipping variants.
- Sites where the target is always mounted before the frame is scheduled; record those as not at risk.
Acceptance criteria
- Every site above is recorded in the PR as at risk or not at risk, with the reason.
- Each at-risk site has a failing-first receipt under a forced frame-before-commit order, using the fix(ui-react): focus the stale-apply banner after it renders #3659 technique, and passes after the fix.
- A deliberately failing held-plan assertion in a hygiene layout test reports its assertion within the test timeout, instead of hanging until
HeadersTimeoutError. The mutation is recorded and restored. - The affected layout files pass in hosted
layoutjobs on the ready candidate.
Verification
bun run build && bun run test:layout
bun run check:pr --base origin/mainThe pinned browser runs are offline and keyless.
Contract impact
None.
Activity
schlessera commentedon Nov 8, 2026
Claiming (token
claim-3665-cc9d) on branchtest/3665-focus-teardown-audit. Collision check on the cited files: closure-only overlaps with long-running draft PRs (#3054, #3056, #3059, #3069 …), no direct path collision with a live ready PR.fix(ui-react): audit frame-scheduled focus and release held fixture r…
schlessera commentedon Nov 8, 2026
Delivered in #3671, squash a63e564 on main. Candidate proof: run 42469832210 at head 85fa6b6, base 1619741, all 17 selected jobs green, including
layout (1)andlayout (2).untrusted-marks.tsx:411, the clear's asynconDonepath. It now focuses after the commit, with a failing-first receipt under a forced late Scheduler task.useSyncExternalStoreupdates commit in a microtask, targets are already mounted, or the site polls.stop. A held-plan failure reports its assertion in 627 ms, against a 30 s hook timeout before.Claim
claim-3665-cc9dis done.