refactor: move UI-test harnesses out of AppDelegate into extension files - #60
Merged
Merged
Conversation
~3,200 lines of XCUITest-only instrumentation (cmd-click diagnostics, stress-workspace loaders, jump-unread/goto-split/bonsplit-drag/ multi-window-notification harnesses) move to same-type extension files. Zero call-site change; visibility widened only where the move split a same-file reference. Nuclear-review N3/AS2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
AppDelegate.swifthad grown to 14,818 lines, and roughly a fifth of that was code that only exists to support XCUITest automation (cmd-click diagnostics, stress-workspace loaders, jump-to-unread/goto-split/bonsplit-drag/multi-window-notification test harnesses). None of it runs in production builds. This moves that instrumentation into three same-type extension files soAppDelegate.swiftitself is smaller and easier to navigate, with zero behavior change.Summary
Sources/AppDelegate+UITestCmdClick.swift(726 lines): cmd-click terminal UI test setup, socket sanity check, display-resolution diagnostics. Moved as a single#if DEBUGblock (lines 3103–3815 of the original file).Sources/AppDelegate+UITestStressWorkspaces.swift(547 lines): debug-stress-workspace loaders (openDebugStressWorkspacesWithLoadedSurfacesand its helpers). Functions only — the stored properties they depend on stay in theAppDelegateclass body (Swift doesn't allow stored properties in extensions), re-wrapped in their own#if DEBUG.Sources/AppDelegate+UITestHarnesses.swift(1,803 lines): jump-unread, goto-split, bonsplit tab-drag, and multi-window-notification test harnesses. Moved as a single#if DEBUGblock.Sources/AppDelegate.swift: 14,818 → 11,783 lines. All moved code deleted; no call sites changed.GhosttyTabs.xcodeproj/project.pbxproj: registered the 3 new files (fileRef + buildFile entries, group membership, Sources build phase) mirroringAppDelegate.swift's existing entries.Visibility widened (private/fileprivate → internal only — no other change) because the split moved code across file boundaries within the same type:
MainWindowContext(private final class) → internalwriteUITestDiagnosticsIfNeeded,socketListenerConfigurationIfEnabled,restartSocketListenerIfEnabled,debugManagerToken,sendTextWhenReady, plus stored properties the compiler flagged during the build pass:mainWindowContexts,didSetupJumpUnreadUITest,jumpUnreadFocusExpectation,jumpUnreadFocusObserver,didSetupTerminalCmdClickUITest,didSetupGotoSplitUITest,didSetupBonsplitTabDragUITest,terminalCmdClickUITestPoller,bonsplitTabDragUITestRecorder,gotoSplitUITestRecorder,gotoSplitUITestObservers,didSetupMultiWindowNotificationsUITest,didSetupDisplayResolutionUITestDiagnostics,displayResolutionUITestObservers,ghosttyGotoSplitLeftShortcut/RightShortcut/UpShortcut/DownShortcut,debugStressWorkspaceCreationInProgress,debugStressLagProbeEnabled,debugStressWorkspaceCount,debugStressPaneCount,debugStressTabsPerPane,debugStressYieldInterval,debugStressSurfaceLoadTimeoutSeconds,debugPerfWorkspaceTitlePrefix.AppDelegate.swift: the sixsetup...UITestIfNeededentry points (setupJumpUnreadUITestIfNeeded,setupTerminalCmdClickUITestIfNeeded,setupGotoSplitUITestIfNeeded,setupBonsplitTabDragUITestIfNeeded,setupMultiWindowNotificationsUITestIfNeeded,setupDisplayResolutionUITestDiagnosticsIfNeeded), pluslogSlowShortcutMonitorLatencyIfNeeded,recordGotoSplitMoveIfNeeded,recordGotoSplitSplitIfNeeded,recordGotoSplitZoomIfNeeded,recordMultiWindowNotificationFocusIfNeeded,scheduleUITestSocketSanityCheckIfNeeded,writeJumpUnreadTestData,writeMultiWindowNotificationTestData.Nuclear-review N3/AS2.
Test Plan
PROGRAMA_SKIP_ZIG_BUILD=1 xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug -destination 'platform=macOS' build→** BUILD SUCCEEDED **ui-regressionsand the UITest-driven jobs (jump-unread, goto-split, bonsplit-drag, multi-window-notification, cmd-click) passing unchanged.