Skip to content

Slow-test ratchet: convert real-time waits to injected budgets #1098

Description

@thymikee

Tracking issue for the pinned entries in scripts/vitest-slow-test-reporter.ts (the slow-test gate). Every pin is a unit test that waits REAL time — production timeout constants, 1Hz poll loops, real retry backoff. Measured 2026-07-04: the unit suite's 48s wall clock was bounded by these files (worst single test: 10.8s proving "times out" by waiting out the full production budget).

Conversion patterns, in preference order:

  1. Budget-derived cadence (production-legit, no seams): poll intervals scale with the caller's timeout — waitForAndroidEmulatorByAvdName conversion took devices.test.ts from 25.6s to 2.8s (9x) while making short-budget production calls more responsive.
  2. Budget-wiring assertion (for "times out" tests): don't re-prove the exec layer's timeout end-to-end per call site — mock the tool-command layer and assert the right timeoutMs constant is passed. The exec layer's timeout semantics are proven once in its own tests. Requires the call site's test file to mock cleanly, which for the platform monolith test files rides the topology split (see AGENTS.md test-mirror rule).
  3. Fake clocks (createFakeClock pattern) where the code takes an injected clock.

Rules: the pin list only shrinks, or grows in the same PR with a justification; no test-only DI seams (the CI gate enforces this) — prefer pattern 1 and 2, which are production improvements and test restructurings respectively.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions