Deflake the surface bridge progress and zmx watcher tests - #723
Merged
Conversation
Two tests still asserted the trailing flush after a single TestClock advance; under parallel-bundle load the freshly spawned flush task can register its sleep after the advance, so the tick no-ops and the value sticks at the leading edge. Fold the bounded advance-until loop from the earlier coalescing deflake into a shared helper and use it at every trailing-flush assertion. - progressDriverRestartsAfterStaleRemoval: coarsen the idle interval and widen the stale window so teardown converges within the loop bound even when a starved tick lands a single wake, while the re-arm ticks can never accrue a second stale REMOVE. - removeRacingRescheduleKeepsFlushHealthy: assert the pre-tick applied sequence so a cancelled task clobbering the live flush handle fails deterministically instead of converging to the same destination. - determinateValuePaintsPromptlyAfterIdlePeriod: drain the in-flight flush (new test seam on the bridge) before asserting the leading-edge paint, keeping the drain budget below the stale window so a stale REMOVE can never stand in for a real drain.
The real-socket delivery test timed out its 3s semaphore budget on a saturated CI runner. Raise the positive waits to a shared 30s budget: a passing run still signals in milliseconds, only a failing run ever waits this long. The negative start-after-stop wait keeps its short budget by design.
sbertix
enabled auto-merge (squash)
July 22, 2026 21:48
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.
Summary
CI went red three times on main today without a related code change. Two classes of flake:
GhosttySurfaceBridgeTests.removeRacingRescheduleKeepsFlushHealthyandprogressDriverRestartsAfterStaleRemovalasserted the trailing flush after asingle
TestClockadvance. Under parallel-bundle load the freshly spawnedflush task can register its sleep after the advance, so the tick no-ops and
the value sticks at the leading edge (
(progressValue -> 30) == 90). Sameclass as the coalescing flake fixed in Fix coalescesBurstOfProgressReports flake by advancing until the flush lands #638; these two were left on single
advances.
ZmxSessionWatcherRegistryDeliveryTests.deliversSequenceThroughOnOSCSequenceOnMainActortimed out its 3s real-time semaphore budget on a saturated runner.
Changes, test-only except a read-only seam:
settleThenAdvance(_:by:until:)helper and use it at every trailing-flushassertion.
progressDriverRestartsAfterStaleRemoval: coarsen the idle interval andwiden the stale window so teardown converges within the loop bound even when
a starved tick lands a single wake, while the re-arm ticks can never accrue
a second stale REMOVE.
removeRacingRescheduleKeepsFlushHealthy: assert the pre-tick appliedsequence, so a cancelled flush task clobbering the live handle now fails
deterministically (previously both healthy and clobbered runs converged to
the same final state).
determinateValuePaintsPromptlyAfterIdlePeriod: drain the in-flight flush(new
isProgressFlushIdleForTestingseam mirroring the leading-edge gate)before asserting the leading-edge paint, with the drain budget kept below
the stale window so a stale REMOVE can never stand in for a real drain.
budget; a passing run still signals in milliseconds, only a failing run ever
waits this long. The negative start-after-stop wait keeps its short budget
by design.
Type of change
ready)How was this tested?
Full suite run four times while iterating; final tree fully green, including
all previously flaking tests.
make checkpasses (format + lint)make testpassesChecklist
Closes #above.ready.