Skip to content

Run the simulator's timed faults on a clock the tests step - #396

Merged
alexkroman merged 1 commit into
mainfrom
test/sim-fault-clock
Nov 25, 2026
Merged

alexkroman merged 1 commit into
mainfrom
test/sim-fault-clock

Conversation

@alexkroman

@alexkroman alexkroman commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What

SimulatorAudioSource's timed faults (interruptAfter, runtimeErrorAfter, routeChangeAfter) now sleep on an injected any Clock<Duration>, ContinuousClock() by default. The three "Simulator faults" tests pass a TestClock and step it with waitUntilSleeping + advance.

Why

interruptAfter: taken, refused, given back — in that order failed on #383's ios-build (run), which doesn't touch this code. The runner stalled: the next suite, Command router, took 4.08 s against its usual 0.105 s. That pushed the fault's second 50 ms wall-clock sleep past the test's 3 s wait for interruptionEnded.

On the test clock, the fault fires when the test steps it, so a stall can't reorder anything. routeChangeAfter also stops depending on the watchdog event winning a 50 ms race. The suite runs in 0.013 s instead of 0.249 s, and gets a one-minute .timeLimit because waitUntilSleeping has no timeout of its own.

Verification

  • scripts/ios-check.sh: 374 passed, BlurtiOSCore coverage 96.14%, swiftlint analyze clean, periphery clean
  • scripts/check.sh --lint-only: ok

🤖 Generated with Claude Code

`interruptAfter` failed on a stalled runner: the fault's two 50 ms
`Task.sleep`s ran on the wall clock, and the suite after it took 40x its
usual time, so `interruptionEnded` missed the test's 3 s wait.
`SimulatorAudioSource` now sleeps on an injected clock (the wall clock
by default); the three timed-fault tests pass a `TestClock` and step it
once each sleep has parked. The suite gets a one-minute limit, since
`waitUntilSleeping` waits on it rather than on a timeout of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman enabled auto-merge November 25, 2026 05:19
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 2494607 Nov 25, 2026
15 checks passed
@alexkroman
alexkroman deleted the test/sim-fault-clock branch November 25, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants