You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✘ "start forwards layout changes and player attachment to the window"
(window.attachedPlayers.count → 0) == 1
(window.appliedWallpaperScales → [1.0]).contains(1.4)
✘ "config reload that removes the wallpaper detaches the player from the window"
(window.attachedPlayers.count → 0) == 1
@Test("start forwards layout changes and player attachment to the window")func startForwardsLayout()async{awaitwithMainSerialExecutor{
// …router.start() の後、ポーリングではなく yield で駆動
}}
本番コードに触らないのが最大の。Presenter に専用の継ぎ目を足す案(loadTask を await 可能にする)と比べ、production の API 面が増えない
AppRouterTestsの 2 本が手元では 0.34 秒で通る。
では 3 秒のポーリング期限を使い切って
countが 0 のまま。10 倍の余裕があって落ちているので「わずかに遅い」ではない。原因 —
化されているのは「時間」であって「実行順序」ではない
AppLaunchEnvironmentTestsはImmediateClock()を注入しており、待機経路にDate()もTask.sleepも無い。それでも落ちるのは、待っているrouter.start()→ プレイヤー添付までの実際の経路(Sources/Presenters/Wallpaper/WallpaperPresenter.swift:69-94):ImmediateClockが早送りできるのはclock.sleepだけで、上の 3 つ(非Taskのディスパッチ /AsyncStreamの要素配送 /DispatchQueue.mainホップ)はすべて協調スレッドプールと GCD の管轄にあり、注入可能な継ぎ目が無い。waitUntil(AppLaunchEnvironmentTests.swift:14-22)は、意味論的な問い(「その仕事はもう起きたか」)をマシンのスループットへの賭け(「3 秒以内にディスパッチされるか」)に変換している。負荷の高い
runner では賭けが負ける。
withMainSerialExecutorswift-concurrency-extrasのwithMainSerialExecutorでTaskの割り込み順を決定的にする。ポーリングはawait Task.yield()にloadTaskを await 可能にする)と比べ、production の API 面が増えないswift-concurrency-extrasは swift-dependencies 経由で既に推移的に入っている(ビルドPackage.swiftへの明示的なwithMainSerialExecutorは一度も使われていない該当箇所
Tests/AppRouterTests/AppLaunchEnvironmentTests.swift:14-22—waitUntilヘルパー:553,:603— 落ちた 2 本のアサーションSources/Presenters/Wallpaper/WallpaperPresenter.swift:69-94— 待機waitUntilの期限延長 — 賭けの掛けTask+AsyncStream+ Combine の設計自体は妥当。withMainSerialExecutor配下でwaitUntil)がこの 2 本の経路から消えている同種の
負荷由来 flake は前歴がある(
は別だが性質は同一なので、
mainの9f7907f、ScopedAPISessionの timing とサブプロセスの timing)。withMainSerialExecutorの適用範囲を検討する際の参考になる。