Conversation
…hind their manager facades
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
Audit finding 3.3 — Manager-on-Storage facade duplication. Two singleton pairs (Manager + Storage) had a public Storage
static let sharedthat callers could (and did) bypass the Manager with. After this PR, the public surface for each domain is just the Manager.Changes
QueryHistoryStorageandSQLFavoriteStoragelose theirstatic let shared. They are constructed by their owning Manager and not reachable directly from elsewhere in the codebase.QueryHistoryManager.init(storage:)defaults toQueryHistoryStorage(). Same forSQLFavoriteManager.init(storage:)->SQLFavoriteStorage().QueryHistoryManagergains a smalladdHistory(_:)method that wrapsstorage.addHistory(entry)and postsqueryHistoryDidUpdate(entry.connectionId).recordQuery(...)(which builds an entry from raw arguments) now delegates toaddHistory(_:)so the event-posting logic lives in one place.QueryHistoryStorage.shared.Xdirectly are migrated toQueryHistoryManager.shared.X:AppDelegate(background warm-up access)MCPAuthPolicy.recordAuditQuery(addHistory)MCPConnectionBridge.queryHistory(fetchHistory)SearchQueryHistoryTool(fetchHistory)HistoryDataProvider.deleteEntryandclearAll(deleteHistory,clearAllHistory)AppServices.queryHistoryStoragefield is removed; consumers threadservices.queryHistoryManagerinstead. (No callers in main today readservices.queryHistoryStorage; it was a vestigial leak from the early DI rollout.)Side benefit (latent bug fix)
HistoryDataProvider.deleteEntryandclearAllwere callingQueryHistoryStorage.shareddirectly, bypassing the Manager'squeryHistoryDidUpdateevent post. So deleting a history entry from the panel UI didn't refresh other windows' history panels. After this PR, all writes go through the Manager and post the event.ValueDisplayFormatService(also flagged by 3.3) is intentionally not folded: it carries its own per-process state (autoDetectedFormats,overridesVersion) and isn't a thin wrapper. The audit's framing of it as a Manager/Storage duplication is loose; folding it would be a different refactor.Test plan
recordQuery -> addHistory).search_query_historytool returns recent entries (coversfetchHistorymigration).SQLFavoriteStorageshared removal — the only construction path now is viaSQLFavoriteManager).