Skip to content

test(web): migrate browser tests to the disposable render helper (1/8) - #22268

Merged
juliusmarminge merged 2 commits into
test/web-test-auditfrom
test/web-migrate-1
Oct 20, 2026
Merged

juliusmarminge merged 2 commits into
test/web-test-auditfrom
test/web-migrate-1

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Slice 1 of 8 of the move to the disposable render helper from #22187. This slice is the first 17 of the 132 files that t3code/require-disposable-render still flagged, in sorted order.

None of these files uses react-dom/client, React's act, IS_REACT_ACT_ENVIRONMENT, or lifecycle hooks any more. Each test acquires its own render with await using, and mock state is reset by a setup() call at the top of the test. Every test and assertion is kept, and the count is 230 tests before and after.

Files

  • src/browser/ElectronBrowserHost.browser.test.tsx
  • src/browser/HostedBrowserWebview.browser.test.tsx
  • src/cloud/useCloudLinkController.browser.test.tsx
  • src/components/ChatMarkdown.assets.browser.test.tsx
  • src/components/ChatMarkdown.browser.test.tsx
  • src/components/ChatMarkdown.permissions.browser.test.tsx
  • src/components/CommandPalette.focus.browser.test.tsx
  • src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx
  • src/components/ComposerPromptEditorTiptap.input.browser.test.tsx
  • src/components/ComposerPromptEditorTiptap.navigation.browser.test.tsx
  • src/components/DiffPanel.browser.test.tsx
  • src/components/HostedEmptyState.browser.test.tsx
  • src/components/KeybindingsConfigWarning.browser.test.tsx
  • src/components/PermissionUpdateNotice.browser.test.tsx
  • src/components/ReopenClosedViewShortcut.browser.test.tsx
  • src/components/RightPanelTabs.browser.test.tsx
  • src/components/ServerUpdateAction.browser.test.tsx

Left unmigrated: none.

router: false

Only CommandPalette.focus uses it, for the same reason as RightPanelTabs: its timers are fake, its navigation hooks are mocked, and the test router would load on the fake clock.

Changes beyond swapping in the helper

  • CommandPalette.focus: the file mocked all of @tanstack/react-router, and that mock had no RouterProvider, so the helper failed to import. The mock now spreads the real module and overrides only useNavigate, useParams and useLocation.
  • ComposerPromptEditorTiptap.citationDraft: removed the useNavigate/Link mock. It existed only because no router was mounted, and the helper's default router now provides both.
  • ElectronBrowserHost, HostedBrowserWebview: the old afterEach unmounted under fake timers and flushed them, so the desktop tab-release timer could not fire during a later test. A render wrapper now does the same when it is disposed.
  • ChatMarkdown.permissions: the right panel store's openFile is now put back after the test. The old file never restored it.

Verification

Three consecutive runs of the 17 files with vp test run --project browser --reporter=verbose:

Run Files Tests act warnings act-environment warnings router warnings
1 17/17 230/230 0 0 0
2 17/17 230/230 0 0 0
3 17/17 230/230 0 0 0
  • Lint: vp lint on these files reports 0 warnings, including require-disposable-render.
  • Typecheck: tsc-rs --noEmit in apps/web reports 0 errors.

Done by Claude Opus 5.5 in Claude Code (running inside T3 Code).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Oct 20, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f17df35

Macroscope's review found this PR approvable — This is a test-only migration across browser specs, replacing manual rendering and cleanup with a disposable test helper. Its effects are confined to the test harness and do not alter product runtime behavior or defaults.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 20, 2026 10:37

Dismissing prior approval to re-evaluate f17df35

@juliusmarminge
juliusmarminge merged commit 6ddbb10 into test/web-test-audit Oct 20, 2026
29 checks passed
@juliusmarminge
juliusmarminge deleted the test/web-migrate-1 branch October 20, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant