Skip to content

test(zbugs-swift): open a new window on each macOS screenshot-test launch - #236

Merged
tmm merged 1 commit into
mainfrom
fix/zbugs-swift-mac-new-window
Nov 18, 2026
Merged

tmm merged 1 commit into
mainfrom
fix/zbugs-swift-mac-new-window

Conversation

@tmm

@tmm tmm commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

On #230, the macOS testScreens waited two minutes for a window that never opened, online and again in the offline run 12 minutes later (job 134391266294). The app launched, connected, and answered accessibility queries, but it had only a menu bar, and its Window menu was empty.

Cause. A Mac launch of zbugs restores the windows its last run left. When that saved state holds no window, the app opens none, and every later launch does the same until the state changes. That explains both CI symptoms:

  • No window views. zero-cache's log shows the windowless app's client asking only for its four preloads. It never asked for a list, issue, or filter query, so SwiftUI never built the window's views. A healthy relaunch in the next attempt had already asked for all of them when it connected.
  • Stuck across launches. The offline launch was a new process, 12 minutes later, with no app left to terminate, and it was still windowless.

How CI's paging test came to leave saved state with no window isn't established. On a Mac, its app always left its window in the saved state, across kills at different moments and torn or damaged state files. The repeat runs below record what CI actually saves.

Fix. The tests launch the macOS app with -ApplePersistenceIgnoreState YES, so each launch opens a new window instead of restoring what the last test left. As a side effect, testScreens no longer starts from the paging test's restored selection.

Checks. On a Mac (macos-26, Xcode 26.3), each run started testScreens from saved state with no window:

Window and list came up
Current tests 0 of 3. Each run failed with CI's error at ScreenshotTests.swift:224, and the UI tree held only the menu bar.
This change 5 of 5, in about 4 s each

The tests then stop at a "New Issue" button that Xcode 26.3 matches twice. CI's Xcode 26.6 passes that step.

CI repeat runs. I ran the macOS sequence 20 times on each branch, from fresh state each round: the paging test, then testScreens, in one xcodebuild run. Runs 44245082890 (current tests) and 44245087183 (this change).

Both tests passed Windowless
Current tests 20 of 20 0
This change 20 of 20 0

These runs didn't reproduce the failure. In all 40 rounds, neither launch had saved state to restore (hasPersistentStateToRestore=0), and the paging test left no saved window behind. So the failure needs a saved state that CI rarely produces: 1 of 18 screenshot jobs since #204. The runs show that this change passes CI's macOS sequence. The Mac checks above show that it fixes the windowless case.

The iPhone timeout in job 134463464281 is unrelated and not fixed here.

…unch

A Mac launch of zbugs restores the windows its last run left. When that
saved state holds no window, the app opens none, and keeps opening none
on every launch until the state changes. That is how CI's macOS
testScreens, and the offline run 12 minutes later, each waited two
minutes with only a menu bar: zero-cache saw the windowless app ask for
its preloads and never for a list, issue, or filter query, so SwiftUI
never built the window's views.

The tests now launch with -ApplePersistenceIgnoreState YES, so each
launch opens a new window instead of restoring the last test's.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1ecca-7f5f-74f3-af23-3f0aaa149aa1
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm merged commit 8d8e2aa into main Nov 18, 2026
25 checks passed
@tmm
tmm deleted the fix/zbugs-swift-mac-new-window branch November 18, 2026 07:51
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.

2 participants