refactor(events): drop four 1-to-1 PassthroughSubject buses for direct ownership#1150
Merged
Conversation
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
Four publishers on
AppCommandshad a single sender and a single receiver where direct ownership was already available. They are removed:saveAsFavoriteRequested—MainContentCoordinator+Favoritessent it,MainEditorContentViewreceived it inside the same coordinator graph. Replaced with an@ObservablefavoriteDialogQuery: FavoriteDialogQuery?on the coordinator. The view binds the sheet'sitem:to it viaBinding(get:set:).focusConnectionFormWindowRequested— sent inWelcomeViewModel.focusConnectionFormWindow(), received inAppDelegate.handleFocusConnectionForm(). The lookup (NSApp.windows.first(where: AppLaunchCoordinator.isConnectionFormWindow) → makeKeyAndOrderFront) is now inlined directly inWelcomeViewModel.openSampleDatabaseRequested— sent from the File menu, received inAppDelegatewhich just calledSampleDatabaseLauncher.open(). Now the menu callsSampleDatabaseLauncher.open()directly.resetSampleDatabaseRequested— same shape, now callsSampleDatabaseLauncher.reset()directly.Side effects:
AppDelegate.handleFocusConnectionFormand thecommandCancellablesset are removed (no remaining subscribers).AppCommands.swiftshrinks by four publisher declarations.exportConnections,importConnections,importConnectionsFromApp(also flagged by the audit) are left in place: the menu fires regardless of whether the welcome view is loaded, so the publisher is genuinely 1-to-N (1-or-0 receivers depending on welcome window state) and benefits from the bus's auto-no-op-when-no-subscriber semantics.Why this matters
This is audit finding 4.1, partial. Direct ownership is the stronger pattern when the receiver is reachable: it removes hidden subscribers, makes the call graph traceable in Xcode (jump-to-definition lands on the implementation, not on the publisher), and keeps
AppCommandsreserved for genuine fan-out.Test plan