refactor: remove dead main process exports (Phase 01D)#812
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR reduces the public API surface by converting many previously exported helpers/constants/functions into module-local (non-exported) entities and removes the associated tests that covered those APIs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR conservatively removes 28 dead exports from main process modules across 32 files, either deleting them outright (15 symbols) or demoting them to module-private (13 symbols). All removals were verified against the live codebase — no remaining references exist for the deleted symbols, and all demoted functions are still called only within their own modules. Test files were updated in lockstep to import only the remaining public API. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[startSessionCleanup\nDELETED] -->|set| B[cleanupIntervalId\nNow always null]
B -->|clear| C[stopSessionCleanup\nStill exported - no-op]
C --> D[index.ts shutdown\nline 658]
C --> E[quit-handler.ts\nline 216]
subgraph "Deleted Exports (15)"
F[getAutoRunWatcherCount]
G[getDocumentGraphWatcherCount]
H[registerAllHandlers + HandlerDependencies]
I[getGhPath / clearGhCache]
J[getSshPath / clearSshCache]
K[stopMemoryMonitoring]
L[startSessionCleanup + STALE_SESSION_THRESHOLD_MS]
M[getPendingParticipants]
N[findSshRemoteById]
O[ensureParsersInitialized / findSshConfigHost / debugLogLazy]
end
subgraph "Demoted to Private (13)"
P[DEBUG_GROUP_CHAT]
Q[sanitizeText / sanitizeDisplayName]
R[getCustomShellPath / getGroupChatsDir]
S[setGroupChatReadOnlyState]
T[isValidToolType / getMigrations]
U[needsWindowsShell / shellEscapeArgs]
V[getStatsCachePath / getGlobalStatsCachePath]
W[isWindowsMountPath]
end
|
Remove 28 dead main-process exports across src/main/, reducing 710 lines net. Per Phase 01D methodology: grep-verified zero external production references (tests not considered prod). Kept exports used internally with many test refs to avoid cascading test rewrites. Fully deleted (no internal use, no/trivial test refs): - src/main/ipc/handlers/autorun.ts: getAutoRunWatcherCount - src/main/ipc/handlers/documentGraph.ts: getDocumentGraphWatcherCount - src/main/ipc/handlers/index.ts: registerAllHandlers, HandlerDependencies interface, AgentConfigsData, ClaudeSessionOriginsData, 6 unused imports - src/main/utils/cliDetection.ts: getGhPath, clearGhCache, getSshPath, clearSshCache - src/main/utils/sentry.ts: stopMemoryMonitoring - src/main/utils/wslDetector.ts: getWslWarningMessage - src/main/group-chat/group-chat-moderator.ts: startSessionCleanup, STALE_SESSION_THRESHOLD_MS const (stopSessionCleanup kept, production used) - src/main/group-chat/group-chat-router.ts: getPendingParticipants - src/main/stores/utils.ts: findSshRemoteById + unused SshRemoteConfig import - src/main/parsers/index.ts: ensureParsersInitialized + _initialized - src/main/utils/ssh-config-parser.ts: findSshConfigHost - src/main/constants.ts: debugLogLazy Exports dropped to private (still used internally, test blocks removed): - src/main/constants.ts: DEBUG_GROUP_CHAT - src/main/debug-package/collectors/sanitize.ts: sanitizeText - src/main/group-chat/group-chat-config.ts: getCustomShellPath - src/main/group-chat/group-chat-router.ts: setGroupChatReadOnlyState - src/main/group-chat/group-chat-storage.ts: getGroupChatsDir - src/main/ipc/handlers/director-notes.ts: sanitizeDisplayName - src/main/parsers/agent-output-parser.ts: isValidToolType - src/main/stats/migrations.ts: getMigrations - src/main/utils/execFile.ts: needsWindowsShell - src/main/utils/shell-escape.ts: shellEscapeArgs - src/main/utils/statsCache.ts: getStatsCachePath, getGlobalStatsCachePath - src/main/utils/wslDetector.ts: isWindowsMountPath Test files updated (import cleanup + dead test block removal): - src/__tests__/main/constants.test.ts - src/__tests__/main/debug-package/collectors.test.ts - src/__tests__/main/group-chat/group-chat-config.test.ts - src/__tests__/main/group-chat/group-chat-storage.test.ts - src/__tests__/main/ipc/handlers/director-notes.test.ts - src/__tests__/main/parsers/agent-output-parser.test.ts - src/__tests__/main/parsers/index.test.ts - src/__tests__/main/stores/utils.test.ts - src/__tests__/main/utils/shell-escape.test.ts - src/__tests__/main/utils/ssh-config-parser.test.ts - src/__tests__/main/utils/needsWindowsShell.test.ts (deleted; file exclusively tested a now-private function) Skipped (removal would cascade into heavy test rewrites or has test infrastructure dependencies): clearCloudflaredCache and 5 notifications.ts test helpers, 4 ipcHandler.ts factory helpers, extractMentions, extractAllMentions, extractTextGeneric, extractTextFromAgentOutput, getShellCommand, isCommandEcho, extractCommand, escapeContent, unescapeContent, detectLanguageFromPath, WRITE_TOOL_NAMES, detectSessionNotFoundError, buildRemoteCommand, parseConfigContent, parseNotificationCommand, and 5 group-chat-agent participant helpers. Also did not touch src/main/cue/ per playbook risk boundary. Kept as production-used (playbook flagged but verified active): stopSessionCleanup, setupProcessListeners, initializeSessionStorages, initializeOutputParsers.
9353f50 to
2461de0
Compare
Auto-resolver merged both old standalone managers (now removed in rc) with new shared spec-command-manager wrapper, creating duplicate types and undefined references. Take rc's clean version. Also remove startSessionCleanup from group-chat-moderator - it was removed in PR RunMaestro#812 as dead code (never called in production).
Summary
Removes 28 dead exports from main process modules. Conservatively excludes exports whose only references are in test files with extensive setup logic, and excludes
src/main/cue/entirely per risk boundaries (active development).Net: -710 lines across 32 files
Fully deleted (15):
getAutoRunWatcherCount,getDocumentGraphWatcherCount,registerAllHandlers+HandlerDependencies+ helpers,getGhPath,clearGhCache,getSshPath,clearSshCache,stopMemoryMonitoring,getWslWarningMessage,startSessionCleanup+STALE_SESSION_THRESHOLD_MS,getPendingParticipants,findSshRemoteById,ensureParsersInitialized,findSshConfigHost,debugLogLazy.Demoted to private (13):
DEBUG_GROUP_CHAT,sanitizeText,getCustomShellPath,setGroupChatReadOnlyState,getGroupChatsDir,sanitizeDisplayName,isValidToolType,getMigrations,needsWindowsShell,shellEscapeArgs,getStatsCachePath,getGlobalStatsCachePath,isWindowsMountPath.The playbook originally targeted ~75 symbols; the remaining 47 were kept exported to preserve complex test setups without rewriting test isolation logic. Follow-up work can revisit.
Test plan
npm run lintpasses clean (all 3 tsconfigs)Risk
Low - conservative removal, nothing in
src/main/cue/touched.Summary by CodeRabbit
Refactor
Tests