Skip to content

test: harden Waiter timeouts and reentrancy scheduling to fix flaky iOS CI - #6

Merged
MaximBazarov merged 2 commits into
mainfrom
maxim/fix-ios-timeouts
Sep 14, 2026
Merged

MaximBazarov merged 2 commits into
mainfrom
maxim/fix-ios-timeouts

Conversation

@MaximBazarov

Copy link
Copy Markdown
Owner

Intent

Fix the failing StateManagement iOS CI tests. On PR #4, Test (iOS) failed with Timeout() in ComputedTests.keyedComputedRead() and DictionaryReadEntryPointTests.serviceReadsTheDictionary() (also named "A Service reads the whole dictionary, does not kick, and serves again on an entry write"). macOS Test passed on the same runs. That PR only changes docs/CI scripts/snippets, so treat this as an iOS reliability/correctness problem that is blocking green CI, not as a README change.

What Changed

  • Tests/Utils/Waiter.swift now takes a configurable timeout parameter with a generous 10-second default (up from a hardcoded 1 second), so scheduler backlog on parallel CI simulator runs is no longer misread as a test failure.
  • Negative-assertion tests in ComputedTests and RemoveValueTests (which always wait out the full deadline because a serve must not arrive) pass an explicit short 1-second timeout to keep runtime bounded.
  • ReentrancyFirstWinsTests replaces the racy async let duplicate operation with a @MainActor Task plus yields, guaranteeing the duplicate joins the live first execution instead of occasionally starting its own and deadlocking on the gate.

Risk Assessment

✅ Low: Test-only change that directly addresses the diagnosed iOS CI timeout cause at the shared Waiter boundary, preserves short deadlines for absence tests, fixes a source-verified test hang race, and touches no product code.

Testing

Reproduced the failing Test (iOS) CI job live by running its exact xcodebuild command against a local iPhone 17 simulator (Xcode 26.6): the full test target passed (267 tests), including both previously-failing tests. Stressed the two named flaky tests for 10 iterations and the restructured firstWins reentrancy test for 25 iterations on the iOS simulator with -run-tests-until-failure, all clean, and confirmed the shortened 1-second must-not-serve deadlines still trip Timeout correctly (those tests complete at ~1.22s only because Timeout throws). A targeted macOS swift test run of the affected suites also passed, showing the shared Waiter change does not regress the macOS job. The only thing not driven was reproducing the original failure at the base commit, since the flake is CI-load dependent and does not trigger deterministically on this fast local machine.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
The iOS CI job command (xcodebuild test on iPhone 17 simulator) runs the full test target and goes green ✅ pass live ios-xcodebuild-test.log — 267 tests in 51 suites passed, ** TEST SUCCEEDED **
Previously-failing ComputedTests.keyedComputedRead passes repeatedly on the iOS simulator under the new 10s Waiter deadline ✅ pass live ios-stress-computed-dictionary.log — keyedComputedRead() passed 10/10 iterations with -run-tests-until-failure
Previously-failing 'A Service reads the whole dictionary, does not kick, and serves again on an entry write' passes repeatedly on the iOS simulator ✅ pass live ios-stress-computed-dictionary.log — passed 10/10 iterations with -run-tests-until-failure
The restructured firstWins duplicate-join test completes deterministically (no permanent hang from the duplicate missing the live Execution) across repeated iOS runs ✅ pass live ios-stress-25-iterations.log — ReentrancyFirstWinsTests passed 100/100 test executions over 25 iterations
Adversarial: must-not-serve guard tests keep their teeth — the explicit short 1s deadline still throws Timeout so an unexpected serve or missing guard is still caught quickly ✅ pass live ios-xcodebuild-test.log — computedUnrelatedMutations, keyedComputedUnrelatedChanges, and removingUnreadKeyDoesNotRecompute complete at ~1.22s, which only happens when the 1s Timeout fires as designed
The macOS test job (which was already green) is not regressed by the shared Waiter change ✅ pass live macos-targeted-suites.log — swift test on ComputedTests, ReentrancyFirstWinsTests, RemoveValueTests, DictionaryReadEntryPointTests: 20 tests passed
Reproduce the original Timeout() failure at the base commit to show the fix flips it from fail to pass ⏸️ untested no The original failure is a load-dependent scheduling flake specific to busy GitHub macos-26 CI simulators; on this fast local machine the old 1s deadline does not trip deterministically, so a base-comm…
Evidence: Full iOS CI command run (xcodebuild test, iPhone 17 simulator) — TEST SUCCEEDED
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test -scheme StateManagement-Package -destination "platform=iOS Simulator,name=iPhone 17"

Resolve Package Graph
2026-09-14 11:21:55.434 xcodebuild[1448:8683698] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.


Resolved source packages:
  StateManagement: ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N

ComputePackagePrebuildTargetDependencyGraph

Prepare packages

CreateBuildRequest

SendProjectDescription

CreateBuildOperation

ComputeTargetDependencyGraph
note: Building targets in dependency order
note: Target dependency graph (5 targets)
    Target 'StateManagementTestingSupport' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagementTestingSupport' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagement' in project 'StateManagement'
    Target 'StateManagement' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagement' in project 'StateManagement'
    Target 'StateManagement_Tests' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagement' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagementTestingSupport' in project 'StateManagement'
    Target 'StateManagementTestingSupport' in project 'StateManagement'
        ➜ Explicit dependency on target 'StateManagement' in project 'StateManagement'
    Target 'StateManagement' in project 'StateManagement' (no dependencies)

GatherProvisioningInputs

CreateBuildDescription

ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --version

ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk -x c -c /dev/null

ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -version_details

ReadFileContents /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/docc/features.json

Build description signature: 41a2bfbe8cc0fcc9903a80e8e091b6ea
Build description path: ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/XCBuildData/41a2bfbe8cc0fcc9903a80e8e091b6ea.xcbuilddata
ClangStatCache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk ~/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator26.5-23F81a-688ef53f1462e2c8f657fdc38a81448f6cfe768891a92b912361537c460fe42b.sdkstatcache
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.5.sdk -o ~/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator26.5-23F81a-688ef53f1462e2c8f657fdc38a81448f6cfe768891a92b912361537c460fe42b.sdkstatcache

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products/Debug-iphonesimulator
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products/Debug-iphonesimulator

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/SwiftExplicitPrecompiledModules
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/SwiftExplicitPrecompiledModules

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/ExplicitPrecompiledModules
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/ExplicitPrecompiledModules

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator

CreateBuildDirectory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products/Debug-iphonesimulator/PackageFrameworks
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N/.swiftpm/xcode
    builtin-create-build-directory ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Products/Debug-iphonesimulator/PackageFrameworks

WriteAuxiliaryFile ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/StateManagement.build/Debug-iphonesimulator/StateManagement_Tests.build/empty-StateManagement_Tests.plist (in target 'StateManagement_Tests' from project 'StateManagement')
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N
    write-file ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/StateManagement.build/Debug-iphonesimulator/StateManagement_Tests.build/empty-StateManagement_Tests.plist

WriteAuxiliaryFile ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/StateManagement.build/Debug-iphonesimulator/StateManagement_Tests.build/StateManagement_Tests.DependencyStaticMetadataFileList (in target 'StateManagement_Tests' from project 'StateManagement')
    cd ~/.no-mistakes/worktrees/bb64960314cc/01M2FK885BXWRZFCJ0XNXWBQ7N
    write-file ~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Build/Intermediates.noindex/StateManagement.build/Debug-iphonesimulator/StateManagement_Tests.build/StateManagement_Tests.DependencyStaticMetadataFileList

WriteAuxiliaryFile ~/Library/Developer/Xcode/Deri

... [212476 bytes truncated] ...

cution" passed after 0.001 seconds.
◇ Test "a committed Sync child of a cancelled Execution stays committed" started.
✔ Test "First HostedView Watch of apply-inside-onRead shows the applied Value and does not re-evaluate after" passed after 0.405 seconds.
✔ Suite AsyncStateFirstReadTests passed after 0.421 seconds.
✔ Test testWatchCoordinates() passed after 0.003 seconds.
✔ Test "Leftover $ follows an Operation on SharedEnvironment.shared" passed after 0.003 seconds.
◇ Test testOSLogTelemetryLogger() started.
◇ Test "Leftover $ and leftover set send objectWillChange" started.
✔ Test testOSLogTelemetryLogger() passed after 0.001 seconds.
◇ Test testStateUpdatePerformTracing() started.
✔ Test "Leftover $ and leftover set send objectWillChange" passed after 0.001 seconds.
✔ Test "A change arriving while a run is in flight still drives a follow-up that reads it" passed after 0.005 seconds.
◇ Test "Leftover whole-dict write diffs and invalidates changed keys" started.
✔ Test testStateUpdatePerformTracing() passed after 0.001 seconds.
✔ Test "a committed Sync child of a cancelled Execution stays committed" passed after 0.004 seconds.
◇ Test "A run completes its work even when a newer change arrives mid-run, never cancelled" started.
◇ Test testOSLogTelemetryLoggerTreeFormatting() started.
✔ Test "Leftover whole-dict write diffs and invalidates changed keys" passed after 0.054 seconds.
✔ Test "firstWins joins the live Execution; a second awaited perform does not start another" passed after 0.472 seconds.
◇ Test "incoming reentrancy decides when two instances disagree for one Identity" started.
✔ Test "Async operation fire-and-forget lands eventually" passed after 0.059 seconds.
◇ Test "Awaiting async overload suspends until the effect is visible" started.
◇ Test "Keyed Operation invalidates the atomic dictionary Address so leftover $items emits" started.
◇ Test "firstWins fire-and-forget duplicate starts nothing and waits for nothing" started.
✔ Test testOSLogTelemetryLoggerTreeFormatting() passed after 0.008 seconds.
✔ Test "A run completes its work even when a newer change arrives mid-run, never cancelled" passed after 0.062 seconds.
✔ Test "Keyed Operation invalidates the atomic dictionary Address so leftover $items emits" passed after 0.007 seconds.
◇ Test "Plain var on the same class stays per-instance" started.
◇ Test "A service writing a value it reads settles under single-flight, no loop" started.
✔ Test "incoming reentrancy decides when two instances disagree for one Identity" passed after 0.008 seconds.
◇ Test "a cancelled Execution can still start a nested async perform" started.
✔ Test "firstWins fire-and-forget duplicate starts nothing and waits for nothing" passed after 0.007 seconds.
◇ Test testSpanEmpty() started.
◇ Test "firstWins groups by Identity; different keys both run" started.
✔ Test "Plain var on the same class stays per-instance" passed after 0.001 seconds.
✔ Test testSpanEmpty() passed after 0.001 seconds.
◇ Test "read(_:) still snapshots SharedEnvironment.shared without leftover $ emitting" started.
◇ Test testNotificationReceiverID() started.
✔ Test "firstWins groups by Identity; different keys both run" passed after 0.002 seconds.
✔ Test "a cancelled Execution can still start a nested async perform" passed after 0.002 seconds.
◇ Test "firstWins groups by Operation type plus Identity; two types do not Join" started.
✔ Suite ReentrancyNewestWinsTests passed after 0.488 seconds.
✔ Test "read(_:) still snapshots SharedEnvironment.shared without leftover $ emitting" passed after 0.002 seconds.
✔ Test testNotificationReceiverID() passed after 0.002 seconds.
✔ Suite SMPublishedTests passed after 0.488 seconds.
◇ Test testOSLogTelemetryLoggerNestedChildSpans() started.
✔ Test "firstWins groups by Operation type plus Identity; two types do not Join" passed after 0.001 seconds.
✔ Suite ReentrancyFirstWinsTests passed after 0.507 seconds.
✔ Test testOSLogTelemetryLoggerNestedChildSpans() passed after 0.001 seconds.
◇ Test testOSLogTelemetryLoggerRemovePrettify() started.
✔ Test testOSLogTelemetryLoggerRemovePrettify() passed after 0.001 seconds.
◇ Test testDurationFormattingAllBranches() started.
✔ Test testDurationFormattingAllBranches() passed after 0.001 seconds.
◇ Test testOSLogTelemetryLoggerEviction() started.
✔ Test testOSLogTelemetryLoggerEviction() passed after 0.001 seconds.
◇ Test testWithSpanRunsBodyAndStripsWhenOff() started.
✔ Test "Awaiting async overload suspends until the effect is visible" passed after 0.012 seconds.
◇ Test "isInProgress is true while the Execution this wrapper started is in flight" started.
✔ Test testWithSpanRunsBodyAndStripsWhenOff() passed after 0.008 seconds.
✔ Test syncOpPerformsAsyncOp() passed after 0.103 seconds.
◇ Test testLogInsideSpanEmitsNote() started.
◇ Test fireAndForgetPerformAsync() started.
✔ Test testLogInsideSpanEmitsNote() passed after 0.001 seconds.
◇ Test testLogOutsideSpanDoesNothing() started.
✔ Test "isInProgress is true while the Execution this wrapper started is in flight" passed after 0.014 seconds.
◇ Test "A fire-and-forget firstWins duplicate does not set isInProgress" started.
✔ Test testLogOutsideSpanDoesNothing() passed after 0.005 seconds.
◇ Test testOSLogRendersLogAsLeaf() started.
✔ Test testOSLogRendersLogAsLeaf() passed after 0.001 seconds.
◇ Test testSetSpanCarriesNoValue() started.
✔ Test testSetSpanCarriesNoValue() passed after 0.001 seconds.
✔ Suite TelemetryTests passed after 0.510 seconds.
✔ Test "A fire-and-forget firstWins duplicate does not set isInProgress" passed after 0.013 seconds.
◇ Test "Sync perform does not set isInProgress" started.
✔ Test "Sync perform does not set isInProgress" passed after 0.005 seconds.
◇ Test "isInProgress is true while this wrapper awaits a Join or its own Execution" started.
✔ Test "A parent starts a non-throwing child without await and continues before the child writes" passed after 0.107 seconds.
✔ Suite NestedAsyncOperationAwaitTests passed after 0.524 seconds.
✔ Test "isInProgress is true while this wrapper awaits a Join or its own Execution" passed after 0.023 seconds.
◇ Test "isInProgress stays true after Cancel until the body exits" started.
✔ Test "isInProgress stays true after Cancel until the body exits" passed after 0.011 seconds.
✔ Suite PerformTests passed after 0.559 seconds.
✔ Test fireAndForgetPerformAsync() passed after 0.110 seconds.
◇ Test "Async op getService returns the same spawned EnvironmentService" started.
✔ Test "Async op getService returns the same spawned EnvironmentService" passed after 0.001 seconds.
✔ Suite OperationsTests passed after 0.627 seconds.
✔ Test "A service writing a value it observes settles instead of looping forever" passed after 0.214 seconds.
✔ Suite "EnvironmentService lifecycle" passed after 0.633 seconds.
✔ Test "A service writing a value it reads settles under single-flight, no loop" passed after 0.209 seconds.
✔ Suite "EnvironmentService single-flight reactor" passed after 0.694 seconds.
✔ Test computedUnrelatedMutations() passed after 1.224 seconds.
✔ Test keyedComputedUnrelatedChanges() passed after 1.224 seconds.
✔ Test removingUnreadKeyDoesNotRecompute() passed after 1.223 seconds.
✔ Suite RemoveValueTests passed after 1.228 seconds.
✔ Suite ComputedTests passed after 1.246 seconds.
✔ Test run with 267 tests in 51 suites passed after 1.247 seconds.
2026-09-14 11:22:12.413 xcodebuild[1448:8683698] [MT] IDETestOperationsObserverDebug: 3.152 elapsed -- Testing started completed.
2026-09-14 11:22:12.413 xcodebuild[1448:8683698] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2026-09-14 11:22:12.413 xcodebuild[1448:8683698] [MT] IDETestOperationsObserverDebug: 3.152 sec, +3.152 sec -- end

Test session results, code coverage, and logs:
	~/Library/Developer/Xcode/DerivedData/01M2FK885BXWRZFCJ0XNXWBQ7N-elrtmilgiacayifrvjmpdnzwyvcp/Logs/Test/Test-StateManagement-Package-2026.09.14_11-21-55-+0200.xcresult

** TEST SUCCEEDED **

Testing started
  • Evidence: iOS stress: ComputedTests + DictionaryReadEntryPointTests, 10 iterations until failure — all passed (local file: ~/.no-mistakes/evidence/01M2FK885BXWRZFCJ0XNXWBQ7N/ios-stress-computed-dictionary.log)
  • Evidence: iOS stress: ReentrancyFirstWinsTests, 25 iterations until failure — all passed (local file: ~/.no-mistakes/evidence/01M2FK885BXWRZFCJ0XNXWBQ7N/ios-stress-25-iterations.log)
  • Evidence: macOS targeted run of affected suites via swift test — all passed (local file: ~/.no-mistakes/evidence/01M2FK885BXWRZFCJ0XNXWBQ7N/macos-targeted-suites.log)
Evidence: Previously-failing tests passing on iOS simulator
✔ Test keyedComputedRead() passed after 0.243 seconds.
✔ Test "A Service reads the whole dictionary, does not kick, and serves again on an entry write" passed after 0.250 seconds.
✔ Test run with 267 tests in 51 suites passed after 1.247 seconds.
** TEST SUCCEEDED **

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ Tests/Operations/ReentrancyPolicyTests.swift:90 - The firstWinsJoinsLiveExecution rework fixes a test not among the two failures named in the intent. The race is real and source-verified: the old async let duplicate is nonisolated and can reach the firstWins join after the first Execution finished, so it starts its own Execution and blocks forever on a gate that was already released, hanging the CI job. This fits the intent's broader framing of an iOS CI reliability problem blocking green CI, so it is noted for transparency rather than flagged as scope creep.
  • ℹ️ Tests/Utils/Waiter.swift:33 - The three must-NOT-serve tests keep a 1s deadline, so on the same lagging CI simulator this change diagnoses, a spurious serve arriving after 1s would go undetected (false pass). This window is unchanged from before the change (it was always 1s), is an inherent limitation of absence-assertions, and is explicitly documented in the new Waiter doc comment, so no action is needed.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
The iOS CI job command (xcodebuild test on iPhone 17 simulator) runs the full test target and goes green ✅ pass live ios-xcodebuild-test.log — 267 tests in 51 suites passed, ** TEST SUCCEEDED **
Previously-failing ComputedTests.keyedComputedRead passes repeatedly on the iOS simulator under the new 10s Waiter deadline ✅ pass live ios-stress-computed-dictionary.log — keyedComputedRead() passed 10/10 iterations with -run-tests-until-failure
Previously-failing 'A Service reads the whole dictionary, does not kick, and serves again on an entry write' passes repeatedly on the iOS simulator ✅ pass live ios-stress-computed-dictionary.log — passed 10/10 iterations with -run-tests-until-failure
The restructured firstWins duplicate-join test completes deterministically (no permanent hang from the duplicate missing the live Execution) across repeated iOS runs ✅ pass live ios-stress-25-iterations.log — ReentrancyFirstWinsTests passed 100/100 test executions over 25 iterations
Adversarial: must-not-serve guard tests keep their teeth — the explicit short 1s deadline still throws Timeout so an unexpected serve or missing guard is still caught quickly ✅ pass live ios-xcodebuild-test.log — computedUnrelatedMutations, keyedComputedUnrelatedChanges, and removingUnreadKeyDoesNotRecompute complete at ~1.22s, which only happens when the 1s Timeout fires as designed
The macOS test job (which was already green) is not regressed by the shared Waiter change ✅ pass live macos-targeted-suites.log — swift test on ComputedTests, ReentrancyFirstWinsTests, RemoveValueTests, DictionaryReadEntryPointTests: 20 tests passed
Reproduce the original Timeout() failure at the base commit to show the fix flips it from fail to pass ⏸️ untested no The original failure is a load-dependent scheduling flake specific to busy GitHub macos-26 CI simulators; on this fast local machine the old 1s deadline does not trip deterministically, so a base-comm…
  • xcodebuild test -scheme StateManagement-Package -destination 'platform=iOS Simulator,name=iPhone 17' (the exact failing CI command; 267 tests in 51 suites, TEST SUCCEEDED)
  • xcodebuild test-without-building ... -only-testing:StateManagement_Tests/ComputedTests -only-testing:StateManagement_Tests/DictionaryReadEntryPointTests -test-iterations 10 -run-tests-until-failure (keyedComputedRead and 'A Service reads the whole dictionary...' passed 10/10 iterations)
  • xcodebuild test-without-building ... -only-testing:StateManagement_Tests/ReentrancyFirstWinsTests -test-iterations 25 -run-tests-until-failure (100/100 test executions passed, no hang)
  • swift test --filter "ComputedTests|ReentrancyFirstWinsTests|RemoveValueTests|DictionaryReadEntryPointTests" (macOS regression check on affected suites, 20 tests passed)
  • Verified in the iOS run log that computedUnrelatedMutations, keyedComputedUnrelatedChanges, and removingUnreadKeyDoesNotRecompute complete at ~1.22s, proving the shortened 1s must-not-serve deadline still fires Timeout as designed
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

MaximBazarov and others added 2 commits September 14, 2026 11:14
…s short.

The 1-second deadline read CI simulator scheduler backlog as a product
failure: on iOS runners keyedComputedRead() and serviceReadsTheDictionary()
timed out while the same code passed on macOS. A successful wait resumes
the moment the last resume() lands, so the deadline only bounds how long
a genuinely broken run takes to fail; 10 seconds keeps every assertion
intact. Tests that assert a serve must NOT arrive always wait out the
full deadline, so they pass an explicit short timeout instead.

Co-authored-by: Cursor <[email protected]>
…held.

An async-let child is nonisolated and hops to the MainActor at an
arbitrary later point, so releasing the gate right away raced: the first
Execution could finish before the duplicate reached the Join, and the
duplicate then legitimately started its own Execution and held the gate
forever, hanging the suite. A MainActor Task enqueues its first slice
immediately and the Join runs synchronously inside it, so yielding the
actor before the release makes the Join certain. Reproduced hanging one
run in four when looped; ten looped runs pass with the fix.

Co-authored-by: Cursor <[email protected]>
@MaximBazarov
MaximBazarov merged commit f2bec57 into main Sep 14, 2026
3 checks passed
@MaximBazarov
MaximBazarov deleted the maxim/fix-ios-timeouts branch September 14, 2026 09:33
MaximBazarov added a commit that referenced this pull request Sep 14, 2026
…OS CI (#6)

* Give Waiter a generous default deadline, and keep must-not-serve waits short.

The 1-second deadline read CI simulator scheduler backlog as a product
failure: on iOS runners keyedComputedRead() and serviceReadsTheDictionary()
timed out while the same code passed on macOS. A successful wait resumes
the moment the last resume() lands, so the deadline only bounds how long
a genuinely broken run takes to fail; 10 seconds keeps every assertion
intact. Tests that assert a serve must NOT arrive always wait out the
full deadline, so they pass an explicit short timeout instead.

* Guarantee the firstWins duplicate joins while the first Execution is held.

An async-let child is nonisolated and hops to the MainActor at an
arbitrary later point, so releasing the gate right away raced: the first
Execution could finish before the duplicate reached the Join, and the
duplicate then legitimately started its own Execution and held the gate
forever, hanging the suite. A MainActor Task enqueues its first slice
immediately and the Join runs synchronously inside it, so yielding the
actor before the release makes the Join certain. Reproduced hanging one
run in four when looped; ten looped runs pass with the fix.
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.

1 participant