Repository navigation
Take the engine and iPhone tests off the wall clock - #380
Merged
Merged
Conversation
Timing a real 300 ms timer against a 5 s poll failed on a loaded CI runner whose main actor stalled for seconds (CancellationError from waitUntil). The TestClock proves the same thing deterministically: the timer waits the hold delay exactly, nothing starts before it fires, the read starts after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…them Timers the tests waited on behind a bounded poll, and elapsed-time assertions, could fail spuriously on a loaded CI runner, as heldReadStartsAfterTheDelay did. They now step a TestClock or wait for the event itself: - StreamingPCMPlayer takes a clock (default ContinuousClock, so production is unchanged); its tests bound the drain in virtual time instead of timing it, by the new drainPollCeiling rather than seconds of margin. - The rewrite, compose and command suites became holds only when the real 300 ms hold timer fired. speakHeldPress now steps the router's TestClock, and so does styleReachesTheAnswer, for its hold and the answer's cue gap. Stepping exposed a race the delay hid: a press whose mic opened before the phase stream's replayed idle took that idle for its own end. wirePhases waits for the replay before pressing. - pacesByPlayback waits for the room check that holds the next piece back, the meter test's sink plays until the meter has heard it, the writer cancellation test waits for bytes in the pipe, and the URLSession cancellation waits for the first audio rather than 50 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…real time BlurtiOSTests waited real seconds for production timers and asserted on elapsed wall time, so a loaded runner whose main actor stalled could fail them spuriously. Two production seams, both defaulting to real time: - KeyboardRelayInjector takes a `clock:` (ContinuousClock by default); the delivery poll, re-signal and timeout run on it. The relay tests drive it with TestClock: the timeout test steps every poll and checks the result is still waiting before the last, instead of asserting >= 2.5 s elapsed; the delivered tests take the result once written rather than after 300 ms. - KeyboardModel.clock: the handshake ticks, notice dwell and clock, term check, leave grace and heartbeat sleep on it. The press-timer, notice dwell, held error, term dwell and leave-grace tests advance it instead of sleeping or polling against the real timer. Elsewhere: the coordinator's watchdog and hop-return cap tests wait for the sleeper to park before advancing (the race #353 fixed for the cap), and prove a stood-down timer by its sleeper leaving the clock; the resume poll steps on its sleeper instead of 10 ms sleeps; two "nothing happened" window checks use the inbox's FIFO order and the record sequence instead of a sleep; the lexicon stamp is bracketed rather than compared to "< 5 s ago". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexkroman
enabled auto-merge
November 24, 2026 23:27
alexkroman
disabled auto-merge
November 25, 2026 00:06
…eld-read test #375 gave the relay a ResultAddress presser; the injected clock now sits beside it, and the delivered test steps the clock while asserting the controller. #370 independently moved the held-read test onto a TestClock with its own press helper; its version is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hold Every KeyboardRig model read the wall clock, so on an ASan or loaded CI runner more than the 350 ms hold threshold could pass between a tap's micDown and micUp, and the tap's lift sent a release (the × test saw [press, release, cancel]). The rig now holds time still unless a test moves it. The one fuzz test that ages records by Date() opts back into the wall clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…edes #357's widened wall-clock one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With main, the suite's struct body reached 253 lines (type_body_length 250). The suite already splits by topic (+Latch, +Undo); the stepped retry and deadline get their own file, which keeps this PR clear of the gate tests #378 also moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # App/BlurtiOS/BlurtiOSCore/KeyboardRelayInjector.swift
# Conflicts: # App/BlurtiOS/BlurtiOSTests/ProtocolTests.swift
alexkroman
enabled auto-merge
November 25, 2026 02:54
-warn-long-function-bodies / -warn-long-expression-type-checking measure how long the compiler took, which varies with a CI runner's load; with every warning an error they made the build nondeterministic. They failed #384's merge-queue compile on a test that took 729 ms against the 500 ms limit, while the run beside it passed. Every remaining strict setting gives the same answer on every machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexkroman
enabled auto-merge
November 25, 2026 03:57
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Takes the engine and iPhone unit tests off the wall clock wherever a slow CI runner could fail them spuriously.
What prompted this
SelectionSpeechRouterLifecycleTests.heldReadStartsAfterTheDelayfailed on #376's CI run withCancellationError: it polledwaitUntil(a real 5 s timeout) for a read driven by a real 300 ms hold timer, and the runner's main actor stalled for seconds. The same pattern was elsewhere: real production timers awaited with bounded polls, elapsed-time assertions, and fixed sleeps standing in for an event.Production seams (all default to real time, so behavior is unchanged)
StreamingPCMPlayer(clock:):drain()'s deadline and polls run on it. NewdrainPollCeilingnames the existing 100 ms cap.KeyboardRelayInjector(clock:): the delivery poll, re-signal and 3 s timeout run on it. The deadline is now measured on a monotonic clock rather thanDate().KeyboardModel.clock: handshake ticks, notice dwell/clock, term check, leave grace and heartbeat sleep on it.Engine tests
TestClock. That covers the held read itself andspeakHeldPress, which all 34 Rewrite/Compose/Command tests go through (they only became holds when the real 300 ms timer fired).styleReachesTheAnsweralso steps its 400 ms cue gap.idlereached the router, which then took it for its own request's end. The newwirePhases(of:to:)waits for that replay before pressing.StreamingPCMPlayerTestsbound the drain in virtual time instead of timing it.LongReadTests,SelectionSpeakerTests(meter),ChunkedRequestBodyTestsandSpeechTransportTestswait for the event itself instead of a fixed sleep..timeLimit(.minutes(1))is added to suites whose new waits are unbounded, so a stuck wait fails instead of hanging.iPhone tests
>= 2.5 selapsed. The delivered tests take the result once written instead of after 300 ms.Left on purpose
DictationCoordinatorTests. These can't fail spuriously; a slow runner only weakens them.DictationPerformanceTestsbudget, and the hardware/live harnesses (BLURT_LIVE_AUDIO_TESTS,.drivesThisMac,BLURT_PLANNER_EVAL, all gated off by default).Verification
swift build --build-tests -Xswiftc -warnings-as-errors: clean.swift test: 1304 tests in 192 suites pass. Every touched suite passed 5 runs in a row.scripts/ios-test.sh, 3 runs: 365 tests pass,BlurtiOSCorecoverage 96.12%. The two-process contract suite dropped from ~3.5 s to 0.12 s.check-invariants.shpasses.🤖 Generated with Claude Code