Remove dead code surfaced by a whole-app audit#511
Merged
Conversation
Whole-app audit (single module) for declared-but-unreferenced symbols. Each was verified to have zero references across the app and tests before removal; clean build-for-testing and SwiftLint both pass. - Views: StatusPill (MenuBarSections) and the whole TagsInputView.swift. - Methods: SuggestionInteractionState.clearContext (resetAll already clears the context), ModelDownloadManager.cancelAllDownloads, SuggestionSettingsModel.setDebounceMilliseconds / setFocusPollIntervalMilliseconds (no caller; the published values are still read and persisted elsewhere), FileLogWriter.wipeForTesting (a test hook no test calls), ExtendedContextPlaygroundModel.cancelGeneration. - Getters: MirrorPreference.helpDescription, FocusTrackingModel .menuBarStatusText / .menuBarSymbolName, FocusInspectionSnapshot's three role/capability summaries, FocusedInputSnapshot.textPreview, and GeneralPaneView.emojiSkinToneBinding (the skin-tone UI writes the setting directly). - OverlayController's never-called setCurrentBundleIdentifier and the always-nil currentBundleIdentifier it fed; the render policy now receives nil directly (behavior unchanged) until per-app overrides ship.
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
A whole-app audit (single module, so any unreferenced internal symbol is dead) for declared-but-unreferenced code. The recent base-model engine migration left no dead code in the engine/prompt/OCR paths — those were already cleaned. What remained was incidental, unrelated cruft. This removes everything with zero references across the app and tests:
StatusPill(inMenuBarSections) and the entireTagsInputView.swift(and its privateTagBubble/FlowLayout).SuggestionInteractionState.clearContext(resetAllalready clears),ModelDownloadManager.cancelAllDownloads,SuggestionSettingsModel.setDebounceMilliseconds/setFocusPollIntervalMilliseconds(no caller; the published values are still read and persisted elsewhere),FileLogWriter.wipeForTesting(a test hook no test calls),ExtendedContextPlaygroundModel.cancelGeneration.MirrorPreference.helpDescription,FocusTrackingModel.menuBarStatusText/.menuBarSymbolName,FocusInspectionSnapshot's three role/capability summaries,FocusedInputSnapshot.textPreview,GeneralPaneView.emojiSkinToneBinding.OverlayController.setCurrentBundleIdentifierwas never called, so thecurrentBundleIdentifierit fed was always nil; the render policy now receivesnildirectly (behavior unchanged) until per-app overrides ship.Validation
Each symbol was verified with
rg -w '<name>' -t swift Cotabby CotabbyTeststo have only its own declaration before removal. Cascade checks confirmed no helper was orphaned (e.g.setPreferredEmojiSkinTonekeeps a live caller, the debounce/poll DefaultsKeys are still used by load/persist).Linked issues
None.
Risk / rollout notes
OverlayControllerpassingnilwhere it already passed an always-nil value.SettingsAttentionEvaluator.calloutMessage,FocusCapabilityResolution.bestDiagnosticCandidate, andCotabbyPermissionKind.guidanceHint(each superseded by a live path), plusSuggestionTextColorCodec.hexString(from:)andActiveSuggestionSession.acceptedText(cohesive value-type API kept for symmetry/completeness). Removing them means deleting test coverage too, so I left them; happy to remove in a follow-up if you'd prefer.Greptile Summary
This PR removes dead code surfaced by a whole-app audit, deleting unreferenced symbols across views, models, services, and support files. The only live-code behavioural touch is in
OverlayController, where an always-nilcurrentBundleIdentifier(because its setter was never called) is replaced with a literalnil.TagsInputView.swiftin full,StatusPillinMenuBarSections,ExtendedContextPlaygroundModel.cancelGeneration(),ModelDownloadManager.cancelAllDownloads(),SuggestionInteractionState.clearContext(), several computed properties inFocusModels,FocusTrackingModel, andCompletionRenderModePolicy, and theemojiSkinToneBinding/wipeForTestinghelpers.OverlayController.showSuggestionnow passesbundleIdentifier: nildirectly (identical runtime result) with a code comment pointing future per-app override authors to the right thread point.Confidence Score: 5/5
Pure dead-code removal with one cosmetic live-code simplification in OverlayController that does not change observable behavior; safe to merge.
Every removed symbol was confirmed to have zero call sites across the app and tests. The only live-code change — passing nil directly where a field that was always nil was previously read — is a no-op refactor backed by a clean full build and SwiftLint run. No logic paths are modified, no data flows are altered, and no tests are deleted.
No files require special attention. The Xcode project file changes are bookkeeping-only and match the Swift file deletions precisely.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Coord as SuggestionCoordinator participant OC as OverlayController participant Policy as CompletionRenderModePolicy participant Panel as OverlayPanel Note over Coord,Panel: Before PR — setCurrentBundleIdentifier (dead hook, never called) Coord--xOC: setCurrentBundleIdentifier(_:) ❌ never called Note over OC: currentBundleIdentifier = nil (always) Note over Coord,Panel: After PR — nil passed directly Coord->>OC: showSuggestion(_:geometry:) OC->>Policy: mode(for: geometry, bundleIdentifier: nil) Policy-->>OC: .inline / .mirror(reason:) OC->>Panel: setFrame + orderFrontRegardless()Reviews (1): Last reviewed commit: "Remove dead code: unused views, methods,..." | Re-trigger Greptile