Repository navigation
Check the main queue, not the main thread, in main-actor turn tests - #105
Merged
Merged
Conversation
The six `endsItsTurnOnMainActor` tests recorded `Thread.isMainThread` each time a turn ended. On Linux, threads other than the main thread run the main dispatch queue's work, so code on the main actor can run off of the main thread, and all six tests failed in a debug build. CI missed it because both Linux jobs build in release, which compiles these tests out. Record whether each turn ended on the main dispatch queue instead, with the main-queue key that `ManualTaskExecutor` already used, now shared as `isOnMainQueue`. On Linux the tests pass 10 of 10 debug runs, and still fail 10 of 10 runs when `FIFOQueue` ends a main-actor task's turn off of the main actor, or when `CancellableQueue` doesn't isolate its wrapper to the main actor. Add a debug `swift test` step to the pinned Linux job so that tests under `#if DEBUG` run on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLuVQNGMJwKLhXGryHUn5X
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #105 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 3605 3607 +2
=========================================
+ Hits 3605 3607 +2
🚀 New features to boost your workflow:
|
dfed
enabled auto-merge (squash)
November 17, 2026 05:16
dfed
disabled auto-merge
November 17, 2026 05:17
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.
Requested by Dan · project thread
Problem
The six
…endsItsTurnOnMainActortests from #101 recordThread.isMainThreadeach time a turn ends. On Linux, threads other than the main thread run the main dispatch queue's work, so code on the main actor can run off of the main thread. All six tests fail in a debugswift teston Linux (reproduced inswift:6.4onmain). CI missed it because both Linux jobs build with-c release, which compiles these#if DEBUGtests out.Changes
DispatchSpecificKeythatManualTaskExecutoralready used. The key moves toTestHelpers.swiftas a sharedisOnMainQueue.Test Debug Buildstep that runsswift test, so tests under#if DEBUGrun on Linux. No job names change, so the required checks are unaffected.Nothing in
Sourceschanges, so no release is needed.Verification (Linux,
swift:6.4, debug)@MainActorfromFIFOQueue's twoexecuteOnMainActorfunctions, so turns end off of the main actor: all six tests fail.@MainActor infromCancellableQueue's main-actor wrappers: bothCancellableQueuetests fail.[false, true]tests confirm the check reportsfalseoff of the main queue.swiftformat --lintis clean.Generated by Claude Code