Repository navigation
test: stop scene and script event tests timing out on a busy runner - #656
Conversation
Swift Testing runs about 900 tests at once on CI, nearly all on the main actor, so a test can wait seconds for its next turn. Three tests bounded such a wait with the clock: - Scenes gave their views 60 seconds to get ready. The package scene's views need many main-actor turns; it took 46 to 70 seconds in passing runs and failed three runs since #619. The wait now counts 600 checks a tenth of a second apart, still about a minute when nothing else runs. - The event burst test timed out its startup command after 4 seconds, before the test released it. A later command cleared the error and left a log without end:startup. - The widget actions test's first action had 60 seconds, which a 61-second hold also beat. Both held commands now get 120 seconds, like the cancellation test's command.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Before and after
156 unchanged screens
Visual review: 156 screens, none changed. |
|
🎉 This PR is included in version 0.16.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
) completedActionCannotRestartAReplacedWidget holds a widget action until the test has reloaded the configuration and seen the replacement widget's output. The widget set no timeout, so the action got the default 10 seconds, and on CI the main-actor turns in between took longer: the command was killed and store.actionErrors kept the timeout (PR #789's run took 75 seconds). The widget now sets a 120-second timeout, as #656 gave the other held commands in this file. A probe that held the main actor for 11 seconds after the action started failed the test the same way before this change and passed after it. Fixes #790
Problem
Since #619 fixed the hangs, 3 of 49 CI Test runs failed on tests that bound a main-actor wait with the clock. Swift Testing runs about 900 tests at once, nearly all on the main actor, so on the macOS runner a test can wait seconds for its next turn:
settingsSceneDrawsTheSettingsOfAPackageItInstallsfailed with "the views weren't ready after a minute" in runs 43300511730, 43444323935 and 43574762026.OffscreenSnapshot.writegave the views 60 seconds of wall-clock time, and the package scene needs many main-actor turns to load its package: the test took 46 to 70 seconds even in passing runs (1.2 s alone).eventBurstsFinishCurrentCommandThenRunLatestPayloadWithoutOverlapfailed atScriptEventTests.swift:69(run 43436005366). Its startup command waits for the test to release it but timed out after 4 seconds first; the later command succeeded and cleared the error, leaving a log withoutend:startup:initial. It also failed once in a local full run on current main.widgetActionsRunInOrderAndStoppingCancelsQueuedWork(stop: false)failed atScriptEventTests.swift:298(run 43192081269) the same way, with a 60-second action timeout.Changes
OffscreenSnapshot.writecounts its readiness checks instead of watching the clock: at most 600 checks a tenth of a second apart, so still about a minute when nothing else runs, as AGENTS.md asks for main-actor waits.--render-scenesand the docs images use it too.cancellingAWidgetStopsItsRunningCommand.Testing
taskpolicy -b swift test --skip-build --disable-xctest, about 4× slower): before, four scene tests failed with CI's exact "weren't ready after a minute"; after, those three settings scenes and the event burst test pass.stop: falsewidget actions case before and passed after.LIBDISPATCH_COOPERATIVE_POOL_STRICT=1;scripts/check.sh --quickpasses.Not covered: on macOS 27.2 locally,
setupSceneDrawsTheSameStepHoweverLongItSettlesfails 20–30% of runs with or without this change (its two drawings differ slightly around the selected card's glow); it has not failed on CI (macOS 26) since #528 closed.aListThatScrollsFollowsItsEndAndShowsANewEntryfailed three runs on November 11 and not since; it couldn't be reproduced, so it's unchanged.Merging
One
test:commit, so any merge method works; it starts no release.Claude Opus 5.5 via Claude Code, cross-checked by GPT-6.1-sol via Codex