Disown AppKit window restoration — launches present welcome again instead of a windowless shell
macOS keeps Saved Application State per app, and on macOS 26 its mere existence — even describing zero windows, which repeated dev kills guarantee — counts as "a restored session": SwiftUI then treats every scene's defaultLaunchBehavior as moot and presents nothing. The app launched as a windowless shell with no way back, since windowOpener is captured by the first scene that appears — so Open Recent, the re-grant Grant click, and Dock reopen all silently buffered or no-opped. Proven by -ApplePersistenceIgnoreState YES presenting correctly on the same state; with the fix, welcome presented 3/3 consecutive plain launches. Three changes: - App.init registers ApplePersistenceIgnoreState — restoration is the registry's job (02 § Launch and window lifecycle), every scene already declares restorationBehavior(.disabled), and AppKit's layer was pure liability. Registered before NSApplicationMain runs, which is what makes a registration-domain default early enough. - The restore bootstrap presents at every launch as the app's one reliable presenter; welcome is never system-presented (.suppressed) — the pass opens it when nothing else lands on screen. LaunchPlan.presentsBootstrap retired. - captureWindowActions returns the replayed Finder-open count so the pass counts those as opens — a cold document launch doesn't get welcome stacked beside its board. Both suites green, verify-editions 30/30. Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
@@ -48,14 +48,6 @@ struct LaunchPlanTests {
|
||||
)
|
||||
}
|
||||
|
||||
/// Which plans need the throwaway bootstrap window: both the ones that open something, neither
|
||||
/// more. Welcome is a scene the app presents directly and needs no view to run a pass for it.
|
||||
@Test("Only the two opening plans present the bootstrap window")
|
||||
func bootstrapPresentation() {
|
||||
#expect(LaunchPlan.welcome.presentsBootstrap == false)
|
||||
#expect(LaunchPlan.restoreBoards.presentsBootstrap)
|
||||
#expect(LaunchPlan.uiTestFixture.presentsBootstrap)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - The flag
|
||||
|
||||
Reference in New Issue
Block a user