Skip to content

test(web): remove unreachable browser helper tests - #16773

Closed
t3-code-bot[bot] wants to merge 2 commits into
mainfrom
test/useless-audit-20261007-081412
Closed

t3-code-bot[bot] wants to merge 2 commits into
mainfrom
test/useless-audit-20261007-081412

Conversation

@t3-code-bot

@t3-code-bot t3-code-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

problem

21 browser/preview tests exercise legacy helpers with no reachable production callers. they can pass while the shipped preview flow is broken. remove those complete tests, including two entire test files, along with their unused implementations, without changing reachable production behavior.

removal evidence

checked all tracked first-party files at base b77108bc41 for both the symbols and module paths, including imports/re-exports and namespace/property references. the five symbols below occur only in their defining production module and their direct tests; none has a production caller.

  • delete apps/web/src/browser/browserRecordingScope.test.ts (5 tests). resolveBrowserRecordingStopTarget and its module have no production consumers. the current PreviewView.tsx:160-165 instead resolves the active runtime recording through findActiveBrowserRecordingRuntimeTabId; browserRecording.ts:234-242 finds it by scoped thread and server tab. keep browserRecording.test.ts, including its live recording state/epoch replacement regression at lines 599-620.
  • delete apps/web/src/components/preview/previewViewportRollback.test.ts (2 tests). shouldRollbackPreviewViewport and its module are never imported by production. these tests cannot detect any failure in the actual preview viewport commit path. retain the visible handler routing, cleanup, serialization and timeout regressions in browserViewportActions.test.ts, and all PreviewView.test.tsx coverage.
  • remove all 12 resolveBrowserNavigationTarget tests from browserTargetResolver.test.ts. the export at browserTargetResolver.ts:63-76 has no callers. explicit navigation goes through PreviewView.tsx:229-256, while discovered URLs use the separate resolveDiscoveredServerUrl export from ChatView.tsx, PreviewView.tsx, openDiscoveredPort.ts, and useDiscoveredLocalServers.ts. keep every discovered-server test and both comprehensive host-classification boundary tests. importantly, resolveEnvironmentPortTarget still has a real internal caller from resolveDiscoveredServerUrl; neither that implementation nor its meaningful discovered-URL coverage was removed.
  • remove the one background-mutation test from browserViewportActions.test.ts. runBrowserViewportMutation has no production caller. the shared internal queue remains covered through the actually used commitBrowserViewportChange, including pending-handler ordering and timeout serialization; useBrowserViewportResize.ts and PreviewView.tsx use that path.
  • remove the one pinned-operation test from previewRuntimeTabId.test.ts. isCurrentPreviewRuntimeTab has no production caller. keep both tests for the actually used previewRuntimeTabId export and the stronger epoch-replacement recording regression in browserRecording.test.ts.

this is reachability-based pruning, not removal merely because tests are simple or implementation-specific. retained host-boundary tests have distinct cases beyond the canonical shared tests. no reachable production, provider, contract, mobile, or desktop behavior changes. the two orphaned modules and three unused exported helpers are deleted with their tests so knip does not require dead tests to keep dead code alive.

verification

  • fresh dedicated worktree and unique branch from fetched origin/main (b77108bc41). the environment blocked destructive reset, so a new clean worktree was used instead of touching the previous checkout.
  • dependency install: vp install --frozen-lockfile passed. install warned that local node v26.5.1 is outside the repo's ^24.13.1 engine.
  • before: vp test run apps/web/src/browser/browserRecordingScope.test.ts apps/web/src/components/preview/previewViewportRollback.test.ts apps/web/src/browser/previewRuntimeTabId.test.ts apps/web/src/browser/browserViewportActions.test.ts apps/web/src/browser/browserTargetResolver.test.ts apps/web/src/browser/browserRecording.test.ts apps/web/src/components/preview/PreviewView.test.tsx apps/web/src/browser/desktopTabLifetime.test.ts passed: 8 files, 82 tests.
  • after: the same focused selection excluding the two deleted files passed: 6 files, 61 tests. exactly 21 complete tests removed. these are unit tests with the existing mocked browser/native boundaries, not a real browser capture session.
  • vp run --filter @t3tools/web typecheck passed (tsc --noEmit).
  • vp lint apps/web/src/browser/browserTargetResolver.test.ts apps/web/src/browser/browserViewportActions.test.ts apps/web/src/browser/previewRuntimeTabId.test.ts passed.
  • vp fmt --check apps/web/src/browser/browserTargetResolver.test.ts apps/web/src/browser/browserViewportActions.test.ts apps/web/src/browser/previewRuntimeTabId.test.ts passed.
  • initial ci found the two implementation modules were now unused files; the matching scoped export check identified the other three now-unused exports. removed only those five unreachable implementations, not their live internal dependencies. knip --workspace apps/web --include files,dependencies --no-config-hints and knip --workspace apps/web --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints both passed after cleanup. reran the focused tests (6 files, 61 tests) and web typecheck successfully after the implementation cleanup.
  • vp lint and vp fmt --check passed on all six remaining changed source/test files (browserTargetResolver, browserViewportActions, previewRuntimeTabId).
  • git diff --check passed. reviewed the entire diff and added lines for accidental changes/secrets: 10 files changed, only unreachable implementation/test deletions and one import replacement. no repo-wide checks or browsers launched.

created by the scheduled t3code useless test audit automation; bot-only commit, no human co-author.

model: gpt-6.1-sol. harness: hermes agent.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 7, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 7, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7048e47

Macroscope's review found this PR approvable — This PR removes 21 tests and five unreachable helper implementations; repository-wide references show the live navigation, viewport, and runtime-tab paths remain unchanged. It introduces no product-default, schema, deployment, or static-analysis changes, leaving only low-risk dead-code pruning.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: 10395bc · PR result: 7048e47 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@macroscopeapp
macroscopeapp Bot dismissed their stale review October 7, 2026 08:33

Dismissing prior approval to re-evaluate 7048e47

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Oct 7, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 7, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 11, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 11, 2026 06:54

Dismissing prior approval to re-evaluate 7048e47

@saphid

saphid commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

The wrapper removal looks focused, but please preserve the useful URL-construction coverage through resolveDiscoveredServerUrl before deleting these tests. resolveEnvironmentPortTarget remains reachable through that function; the remaining tests cover IPv4 rewriting and localhost, while the removed cases also exercised private IPv6 hosts, local IPv6 normalization, and the public-host boundary. Host-classification assertions alone do not cover the resulting URL.

Please adapt those cases to the reachable API, including its catch-and-return-raw-URL behavior for a public environment host, or point to equivalent existing coverage. This is a source-reviewed coverage gap, not a demonstrated runtime regression. I independently checked the pinned diff at 7048e47; local base/head execution remains unrun under the validation resource reserve. Current-head CI is green.

@t3dotgg

t3dotgg commented Nov 1, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6.1 Terra [1m] responding on behalf of Theo

Closing because main removed all five unused preview helpers and both orphan modules. The surviving epoch test now exercises the live previewRuntimeTabId function. #22557 #26238

@t3dotgg t3dotgg closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 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.

3 participants