Drive RepositoriesFeature timers with an injected clock#674
Merged
Conversation
The GitHub-availability recovery loop, the success-toast auto-dismiss and the
delayed pull-request refresh each slept on a freshly constructed
ContinuousClock, so TestStore had to race real wall time. On a saturated CI
runner that made
worktreeInfoEventRepositoryPullRequestRefreshQueuesWhileAvailabilityUnknown
flaky: a `receive` could blow past TCA's 1s timeout, or the 15s recovery timer
could fire an action the test never asserted.
Inject `\.continuousClock` and route all three sleeps through it, and drive the
affected tests with a TestClock, with new deterministic coverage for the
recovery re-check across intervals, the toast auto-dismiss and re-arm, and the
delayed refresh.
While here, the sleeps now use `try await` instead of `try?` so cancellation
ends the effect directly rather than falling through to a send that TCA's own
`Send` guard would drop anyway; this lets the recovery loop shed its redundant
post-sleep cancellation check.
Two related fixes:
- PullRequestMergeQueueStatusTests pinned the abbreviated minute unit to an OS
version ("min" below macOS 26.5, "mins" above), which is wrong on 26.5. Take
the spelling from the formatter and assert the magnitude instead.
- `make test` now writes a result bundle and prints each failure's assertion
text on exit, so a red build no longer shows a bare "Test case X failed".
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
The
buildjob was failingmake teston a timing-sensitive test:RepositoriesFeatureslept on freshly constructedContinuousClock()s insideeffects that
TestStorehas to drive, so on a saturated CI runner areceivecould blow past TCA's 1s timeout or the 15s recovery timer could fire an action
the test never asserted.
\.continuousClockintoRepositoriesFeatureand route all threesleeps through it (15s GitHub-availability recovery loop, 2.5s success-toast
auto-dismiss, 2s delayed pull-request refresh); drive the affected tests with
a
TestClock.toast auto-dismiss and re-arm, the
.inProgresscancel path, and thedelayed-refresh coalescing.
PullRequestMergeQueueStatusTests, which pinned the abbreviated minuteunit to an OS version ("min" below macOS 26.5, "mins" above) and so failed on
26.5. Take the spelling from the formatter and assert the magnitude instead.
make testnow writes a result bundle and prints each failure's assertiontext on exit, since xcodebuild's streamed log reduces a parallel-bundle
failure to a bare "Test case X failed" with no message.
Type of change
How was this tested?
make checkpasses (format + lint)make testpassesNot applicable: this is a test-infrastructure and reducer-clock change with no
runtime UI surface; it is exercised entirely through the test suite.
Checklist