fix(mac): replace .inspector() to stop the default UIProbe sweep crash - #458
Merged
Conversation
NavigationSplitView + .inspector() triggers a busy loop inside SwiftUI's private pane-negotiation machinery on the macOS 27 beta SDK, saturating the main thread until AppKit's runaway-layout guard hard-crashes the app. Confirmed content-independent, config-independent, and reproducible on a clean main checkout (predates the AppKit port). The trailing inspector panel is now a plain HStack sibling of the sidebar/detail NavigationSplitView instead of an .inspector() pane, with a hand-rolled drag-resize over the same 300-480pt range. InspectorPanel's content is unchanged. Verified via 3 consecutive clean default-sweep runs plus a 90s soak with a new method-swizzle layout-loop diagnostic (Support/LayoutLoopDiagnostics.swift, DEBUG-only, opt-in via SERGECODE_LAYOUT_LOOP_DEBUG=1) after 15+ runs of the old path crashed every time. Also drops a dead subview-measurement call in WindowContentSizeClamp (unrelated cleanup; explicitly not the crash fix, per its updated doc comment). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
SERGECODE_UI_PROBEsweep crashed within seconds of presenting the trailing inspector, every run, via AppKit's "Update Constraints in Window" runaway-layout exception.NavigationSplitView+.inspector()pane-width negotiation — confirmed content-independent, config-independent, and reproducible on a cleanmaincheckout (predates the AppKit port, not caused by it). A method-swizzle diagnostic showed ~12,000 invalidations/second entirely inside SwiftUI-privateNavigationPaneModifier/_ViewList_Viewtypes once the inspector opens; no app symbol appears anywhere in the churn.RootView.splitShellno longer presentsInspectorPanelvia.inspector(isPresented:). The trailing panel is now a plainHStacksibling of the sidebar/detailNavigationSplitView, sized via ordinary.frame(width:)with a hand-rolled drag-resize over the same 300–480pt range.inspectorColumnWidthused to enforce.InspectorPanel's content is unchanged (it has zero@Environmentreads and no dependency on.inspector()itself).WindowContentSizeClamp(unrelated cleanup — explicitly documented as not the crash fix, since removing it alone did not stop the crash when tested in isolation).SERGECODE_LAYOUT_LOOP_DEBUG=1) layout-loop diagnostic (Support/LayoutLoopDiagnostics.swift) that named the churn during root-causing and is kept for future layout-loop bugs.docs/audits/appkit-migration-parity-matrix.md.Test plan
swift test— 1439 tests pass (1107 SurgeCodeMacTests + 296 T3Kit + 36 SidecarKit)SERGECODE_UI_PROBEsweep: 3 consecutive clean runs (previously crashed every run)sidebar-outlineandsidebar-menusprobe scenarios: both passpnpm run verify --all: clean (one unrelated server-test flake reproduced the documented "workers starve into 401s" pattern fromAGENTS.md, passed on rerun in isolation and on a full clean re-run)🤖 Generated with Claude Code