test: delete 11k low-signal tests so CI runs faster and flakes less #22557
main fromrefs/pull/22557/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub
Our test suite got huge and noisy. Release runs fail most of the time on flaky browser tests, and a lot of tests check things types already guarantee, mirror the code, or wait on real timers. They cost time and give no signal.
This deletes them: about 11,000 of 25,928 tests (43%). 456 test files are deleted outright and 1,195 more are trimmed. Summed test-file time drops 59%.
How the tests were picked#
- A swarm of Claude Haiku 5.5 agents read every test file against one rubric. Delete: type-redundant, trivial logic, basic DOM behavior, real or fake timers, mock-call mirrors, smoke tests, duplicate table cases, and wall-clock perf asserts. Keep: orchestration and event-sourcing correctness, provider protocol translation, auth and permission guards, persistence and migrations, external-format parsing, and deterministic race fixes.
- About half the files (987) got two independent passes. There a test is deleted only when both agree, and a third Haiku vote settled the ~1,900 disagreements. The other files got one pass.
- Deletions are applied with the TypeScript AST, matched by test title, not by hand. Imports and helpers left unused afterwards are removed the same way.
Follow-on cleanup#
- knip
--exportsfailed on ~420 exports that only deleted tests used. Those are un-exported now, and ~48 declarations nothing calls are deleted, so there is no production behavior change.builtInProviderAdapterDrivers.tsonly fed a test, so it is gone andadding-a-provider.mdis updated to match. - Orphaned test fixtures are removed.
provider-testingandmarketinglose their now-emptytestscripts, andprovider-testingdrops dev deps it no longer uses. - Kept on purpose: both
reactCompilerCoverage.test.tsfiles (documented perf guard), and slimmed copies ofbundledDev.test.tsandfileEditorVirtualization.test.ts, which guard a Vite upgrade and a patched dependency. - Updated the
test:perf:v2-wirefile list, the mobile react-test list, the knip entry forsign-macos.ts, and doc references to deleted files.
Verification#
- Typecheck (all packages), lint, fmt check, and
knip:checkpass locally on the rebased head. - Local before/after, same commands and machine (vitest JSON reporter):
| Package | Tests before → after | Wall time before → after |
|---|---|---|
| server | 7,478 → 4,840 | 1,040s → 564s |
| web (unit + browser) | 8,509 → 4,240 | 132s → 53s |
| mobile | 3,478 → 2,199 | 34s → 27s |
| client-runtime | 2,261 → 1,260 | 8s → 6s |
| desktop | 1,665 → 934 | 20s → 5s |
| shared | 1,842 → 1,235 | 5s → 3s |
| contracts | 695 → 139 | 1s → 1s |
| total | 25,928 → 14,847 | summed file time 1,205s → 490s |
- The server failures that remain locally (
pinnedRuntime,ServerEnvironment,ProviderInstanceRegistry,AcpSessionRuntime.processTree) fail the same way onmainon this machine. One web browser test,TelemetryExportSettings, timed out once under load; this PR does not touch it. shardWeights.jsondrops deleted files and scales trimmed ones by their measured speedup, so server shards stay balanced.- Review restored 22 auth boundary tests the swarm had cut as "timing" (they use the deterministic Effect clock): session and websocket credential expiry, desktop bootstrap expiry and rotation, MCP credential liveness and thread isolation, the one-scope-per-RPC guard, and a few scope-narrowing checks.
- Browser tests pre-bundle
@base-ui/react/autocomplete. With fewer tests, Vite's dependency scan no longer found it and reloaded mid-run, which broke a test iframe. maincurrently fails typecheck and web tests on a stalemermaidimport inMessagesTimeline.browser.test.tsx(from #21472). This PR removes that warmup along with the Mermaid tests it served.
Reviewed with sol-loop: 2 rounds with GPT-6.1 Sol. Sol verdict: approved
Created with Claude Opus 5.5 (test selection by Claude Haiku 5.5) in Claude Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
juliusmarminge added labelsmacroscope-review
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 +7 B (+0.1%) 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 +7 B (+0.6%) 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 −24 B (−0.5%) 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 −24 B (−2.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB −41 B (−0.2%) 29.3 KiB ✅ Claude Live turn messages 2 1 −1 (−50.0%) 8 ✅ Baseline:
c3540a7· PR result:1061079· Source CI: successScenario 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.
t3dotgg(GitHub profile, opens in a new tab) changed the title
t3dotgg(GitHub profile, opens in a new tab) closed this
Show me: PR #22557 in one look#
Legend: 🟥 red = removed · 🟩 green = new · 🟨 amber = changed · ⬜ grey = no change
1. From trigger to outcome#
sequenceDiagram autonumber participant Dev as Developer participant CI as Release CI participant V as Vitest participant K as knip participant P as Production code rect rgb(236,236,236) Note over Dev,CI: ⬜ no change: the trigger Dev->>CI: 0. push to main / start release end rect rgb(253,226,226) Note over CI,V: 🟥 removed: 11,081 tests, 456 test files CI-xV: BEFORE: 25,928 tests, flaky browser test fails the run end rect rgb(255,241,194) Note over CI,V: 🟨 changed: 1,195 test files trimmed, shard weights rebalanced CI->>V: AFTER: 14,847 tests, 59% less file time end rect rgb(255,241,194) Note over K,P: 🟨 changed: ~420 symbols lose "export", ~48 dead declarations deleted K->>P: no caller outside tests → un-export end rect rgb(220,245,227) Note over V,Dev: 🟩 new: 22 auth tests restored, base-ui pre-bundle fix V-->>CI: pass CI-->>Dev: release ships end2. Context and the win#
The test suite had 25,928 tests. Many tested what TypeScript already guarantees, or waited on real timers. Release runs failed most of the time on flaky browser tests.
The win you can build on: a repeatable recipe. One rubric, a swarm of small agents, a two-pass vote, and AST-based deletion. No hand edits. The same recipe fits any suite with
pytestorvitest.3. Decision card#
# Problem Outcome Now After Cost 1 Release CI fails on flaky browser tests Fewer flakes, fast releases 25,928 tests 14,847 tests 1 PR, 1,895 files 2 Tests check what types guarantee Only behavior tests stay 1,205 s file time 490 s file time Lost 11k low-signal checks 3 Exports exist only for tests Smaller public surface ~420 test-only exports Un-exported, 0 runtime change knip rule now strict 4 Swarm cut real auth tests Review restores them 0 22 auth tests back Manual review round 4. How it was built#
flowchart TB subgraph SEL["Selection (AI)"] direction TB R["Rubric: delete vs keep"]:::grey H1["Haiku 5.5 pass A"]:::amber H2["Haiku 5.5 pass B"]:::amber VOTE["Third Haiku vote on ~1,900 disagreements"]:::amber R --> H1 & H2 --> VOTE end subgraph APPLY["Apply (deterministic)"] direction TB AST["TypeScript AST: delete test by title"]:::red IMP["Remove unused imports and helpers"]:::red KNIP["knip --exports: un-export test-only symbols"]:::amber SHARD["shardWeights.json rebalance"]:::amber AST --> IMP --> KNIP --> SHARD end subgraph VERIFY["Verify"] direction TB TC["Typecheck, lint, fmt, knip:check"]:::grey VT["Vitest before/after on same machine"]:::grey SOL["Sol-loop review: 2 rounds"]:::green FIX["Restore 22 auth tests, base-ui pre-bundle"]:::green TC --> VT --> SOL --> FIX end VOTE -->|"list of test titles"| AST SHARD --> TC classDef red fill:#FDE2E2,stroke:#8B0000,color:#000 classDef green fill:#DCF5E3,stroke:#0B5D1E,color:#000 classDef amber fill:#FFF1C2,stroke:#7A4E00,color:#000 classDef grey fill:#ECECEC,stroke:#444,color:#0005. Where the change lands#
t3code/ ├── apps/server/ # 🟥 7,478 → 4,840 tests · 🟨 cli, cloud, device files lose exports ├── apps/web/ # 🟥 8,509 → 4,240 tests · 🟩 base-ui pre-bundle fix ├── apps/mobile/ # 🟥 3,478 → 2,199 tests · 🟨 react-test list updated ├── apps/desktop/ # 🟥 1,665 → 934 tests · 🟨 preview, snapShot files lose exports ├── packages/shared/ # 🟥 1,842 → 1,235 tests ├── packages/contracts/ # 🟥 695 → 139 tests ├── provider-testing/ # 🟥 builtInProviderAdapterDrivers.ts and empty test script └── docs/ # 🟨 adding-a-provider.md points to new path
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This is primarily a large test-pruning and dead-export cleanup change, with limited intended runtime impact. It also modifies authentication-directory files and removes authentication-related coverage, so the sensitive-area criteria require human review.
Notes:
- All code in this push has already been reviewed. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).