openclaw - 💡(How to fix) Fix Dead Code Audit: 358 isolated production functions (static call graph analysis) [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56207Fetched 2026-04-08 01:43:34
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
closed ×1commented ×1locked ×1

Fix Action

Fix / Workaround

src/cron/isolated-agent/delivery-dispatch.ts (1): getCompletedDirectCronDeliveriesCountForTests

src/infra/net/undici-global-dispatcher.ts (1): resetGlobalUndiciStreamTimeoutsForTests

ui/src/ui/chat-model.test-helpers.ts (1): createResolvedModelPatch

Code Example

For each file in the list above, read the file and classify each flagged function:

1. If it's a framework callback (Android lifecycle, macOS NSView delegate, 
   event handler interface method) — add a brief comment above it:
   `// Framework callback — called by OS/runtime, not by application code`

2. If it's a test injection setter (setXxxForTest, xxxMock, resetXxxForTests)   check if any .test. file actually imports and calls it. If yes, keep it.
   If no test imports it, delete it.

3. If it's a Solid.js signal accessor (getter/setter pair with same name in 
   tui.ts or ui/ files) — these are reactive state. Keep them but skip future 
   dead code audits on signal accessors.

4. If it's none of the above and nothing imports it — delete it. Run the test 
   suite after each file to verify nothing breaks.

Work file by file. Commit after each file with message: 
"chore: remove dead code in <filename> (N functions)"

Start with the files that have the most isolated functions — they're most 
likely to contain genuinely dead code rather than framework callbacks.
RAW_BUFFERClick to expand / collapse

Dead Code Audit: 358 Isolated Production Functions

Static analysis of the codebase (via cqs call graph extraction) found 358 functions in production code that have:

  • Zero callers (no other indexed function calls them)
  • Zero callees (they don't call any other indexed function)

These are across 245 files. Test files, constructors, render methods, and main/entry points were excluded.

Categories

Many of these are likely:

  1. Framework callbacks (Android lifecycle, macOS delegates) — called by the OS, not by code
  2. Dependency injection setters (setXxxForTest) — called in test setup, not production
  3. Exported utilities — called by consumers, not within this repo
  4. Genuinely dead code — can be safely deleted

Prompt for cleanup

For each file listed below, check whether the flagged functions are:

  • Framework callbacks: Keep, but add a comment like // Called by Android OS so future audits skip them
  • Test injection points: Keep if tests use them; consider making them test-only exports
  • Dead code: Delete and verify tests still pass

Files with isolated functions

<details> <summary>Full list (245 files, 358 functions)</summary>

src/tui/tui.ts (32): agentDefaultId, agentDefaultId, sessionMainKey, sessionMainKey, sessionScope, sessionScope, currentAgentId, currentAgentId, currentSessionId, currentSessionId, activeChatRunId, activeChatRunId, historyLoaded, historyLoaded, sessionInfo, sessionInfo, initialSessionApplied, initialSessionApplied, autoMessageSent, autoMessageSent, toolsExpanded, toolsExpanded, showThinking, showThinking, connectionStatus, connectionStatus, activityStatus, activityStatus, statusTimeout, statusTimeout, lastCtrlCAt, lastCtrlCAt

extensions/discord/src/monitor/provider.ts (16): setFetchDiscordApplicationId, setCreateDiscordNativeCommand, setRunDiscordGatewayLifecycle, setCreateDiscordGatewayPlugin, setCreateDiscordGatewaySupervisor, setLoadDiscordVoiceRuntime, setLoadDiscordProviderSessionRuntime, setCreateClient, setGetPluginCommandSpecs, setResolveDiscordAccount, setResolveNativeCommandsEnabled, setResolveNativeSkillsEnabled, setListNativeCommandSpecsForConfig, setListSkillCommandsForAgents, setIsVerbose, setShouldLogVerbose

extensions/browser/src/browser/client-actions-state.ts (11): browserCookiesSet, browserCookiesClear, browserStorageSet, browserStorageClear, browserSetOffline, browserSetHeaders, browserSetMedia, browserSetTimezone, browserSetLocale, browserSetDevice, browserClearPermissions

extensions/browser/src/browser/server.control-server.test-harness.ts (6): setBrowserControlServerCreateTargetId, setBrowserControlServerAttachOnly, setBrowserControlServerEvaluateEnabled, setBrowserControlServerReachable, getChromeMcpMocks, getLaunchCalls

src/auto-reply/reply.triggers.trigger-handling.test-harness.ts (5): getAbortEmbeddedPiRunMock, getQueueEmbeddedPiMessageMock, getModelCatalogMocks, getModelFallbackMocks, getWebSessionMocks

test/helpers/memory-tool-manager-mock.ts (5): setMemoryBackend, setMemorySearchImpl, setMemoryReadFileImpl, getMemorySearchManagerMockCalls, getReadAgentMemoryFileMockCalls

apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt (4): onStartDiscoveryFailed, onStopDiscoveryFailed, onDiscoveryStarted, onDiscoveryStopped

apps/android/app/src/main/java/ai/openclaw/app/voice/VoiceWakeManager.kt (4): setTriggerWords, onReadyForSpeech, onBeginningOfSpeech, onBufferReceived

extensions/whatsapp/src/test-helpers.ts (4): makeWASocketImpl, useMultiFileAuthStateImpl, fetchLatestBaileysVersionImpl, makeCacheableSignalKeyStoreImpl

apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt (3): onReadyForSpeech, onBeginningOfSpeech, onBufferReceived

apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt (3): onReadyForSpeech, onBeginningOfSpeech, onBufferReceived

apps/macos/Sources/OpenClaw/GatewayProcessManager.swift (3): setTestingConnection, setTestingDesiredActive, setTestingLastFailureReason

extensions/discord/src/monitor/native-command.ts (3): setMatchPluginCommand, setExecutePluginCommand, setResolveDiscordNativeInteractionRouteState

src/agents/tools/web-search-provider-config.ts (3): getTopLevelCredentialValue, setTopLevelCredentialValue, resolveSearchEnabled

src/gateway/call.ts (3): defaultCreateGatewayClient, setCreateGatewayClientForTests, resetDepsForTests

apps/ios/Sources/Services/WatchMessagingService.swift (2): sessionDidBecomeInactive, sessionReachabilityDidChange

apps/macos/Sources/OpenClaw/CanvasChromeContainerView.swift (2): acceptsFirstMouse, acceptsFirstMouse

apps/macos/Sources/OpenClaw/TalkOverlay.swift (2): currentWindowOrigin, acceptsFirstMouse

extensions/feishu/src/mention.ts (2): formatMentionAllForText, formatMentionAllForCard

extensions/matrix/src/matrix/client/file-sync-store.ts (2): hasSavedSync, wantsSave

extensions/msteams/src/streaming-message.ts (2): isFinalized, isFallback

extensions/nostr/src/test-fixtures.ts (2): createConfiguredNostrCfg, buildResolvedNostrAccount

src/acp/control-plane/manager.ts (2): resetAcpSessionManagerForTests, setAcpSessionManagerForTests

src/agents/openclaw-tools.subagents.test-harness.ts (2): setSubagentsConfigOverride, resetSubagentsConfigOverride

src/agents/pi-embedded-runner/extra-params.ts (2): setProviderRuntimeDepsForTest, resetProviderRuntimeDepsForTest

src/agents/pi-embedded-subscribe.e2e-harness.ts (2): createReasoningFinalAnswerMessage, findLifecycleErrorAgentEvent

src/agents/provider-capabilities.ts (2): setResolveProviderCapabilitiesWithPluginForTest, resetDepsForTests

src/agents/test-helpers/agent-message-fixtures.ts (2): makeAgentUserMessage, makeAgentToolResultMessage

src/channel-web.ts (2): toString, valueOf

src/channels/plugins/directory-adapters.ts (2): emptyChannelDirectoryList, nullChannelDirectorySelf

src/cli/program.test-mocks.ts (2): installBaseProgramMocks, installSmokeProgramMocks

src/infra/restart-stale-pids.ts (2): setSleepSyncOverride, setDateNowOverride

src/infra/state-migrations.ts (2): buildFileCopyPreview, resetAutoMigrateLegacyStateDirForTest

src/logging/test-helpers/console-snapshot.ts (2): captureConsoleSnapshot, restoreConsoleSnapshot

src/plugin-sdk/allowlist-config-edit.ts (2): resolveDmGroupAllowlistConfigPaths, resolveLegacyDmAllowlistConfigPaths

src/plugins/status.test-helpers.ts (2): createTypedHook, createCustomHook

test/helpers/extensions/directory.ts (2): createDirectoryTestRuntime, expectDirectorySurface

test/helpers/extensions/onboard-config.ts (2): createLegacyProviderConfig, createConfigWithFallbacks

apps/android/app/src/main/java/ai/openclaw/app/NodeForegroundService.kt (1): onBind

apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewaySession.kt (1): currentMainSessionKey

apps/android/app/src/main/java/ai/openclaw/app/node/CanvasController.kt (1): isDefaultCanvas

apps/android/app/src/main/java/ai/openclaw/app/ui/OpenClawTheme.kt (1): overlayIconColor

apps/ios/Sources/Onboarding/QRScannerView.swift (1): updateUIViewController

apps/macos/Sources/OpenClaw/AgentWorkspace.swift (1): blocked

apps/macos/Sources/OpenClaw/AppState.swift (1): setWorking

apps/macos/Sources/OpenClaw/DeepLinks.swift (1): currentCanvasKey

apps/macos/Sources/OpenClaw/HealthStore.swift (1): __setSnapshotForTest

apps/macos/Sources/OpenClaw/MenuBar.swift (1): userDidCancelDownload

apps/macos/Sources/OpenClaw/MenuContextCardInjector.swift (1): _testSetCache

apps/macos/Sources/OpenClaw/SessionMenuPreviewView.swift (1): _testReset

apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift (1): setTestingService

apps/macos/Sources/OpenClaw/TalkOverlayView.swift (1): acceptsFirstMouse

apps/macos/Sources/OpenClaw/VoiceWakeOverlayTextViews.swift (1): textDidChange

apps/macos/Sources/OpenClawDiscovery/GatewayDiscoveryModel.swift (1): buildSSHTarget

apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer.swift (1): textDidChange

apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMessageViews.swift (1): inset

docs/automation/hooks.md (1): myHandler

docs/plugins/architecture.md (1): generateVideo

docs/zh-CN/automation/hooks.md (1): myHandler

extensions/acpx/src/service.ts (1): createDefaultRuntime

extensions/browser/src/browser/chrome-mcp.ts (1): setChromeMcpSessionFactoryForTest

extensions/browser/src/browser/config.ts (1): shouldStartLocalBrowserServer

extensions/browser/src/browser/pw-ai-state.ts (1): markPwAiLoaded

extensions/browser/src/browser/pw-tools-core.test-harness.ts (1): setPwToolsCoreCurrentRefLocator

extensions/browser/src/cli/browser-cli-manage.test-helpers.ts (1): getBrowserManageCallBrowserRequestMock

extensions/browser/src/cli/browser-cli.test-support.ts (1): createBrowserCliUtilsMockModule

extensions/browser/src/control-service.ts (1): getBrowserControlState

extensions/chutes/models.ts (1): buildChutesModelDefinition

extensions/deepseek/models.ts (1): buildDeepSeekModelDefinition

extensions/diffs/src/config.ts (1): toPresentationDefaults

extensions/discord/src/draft-stream.ts (1): isValidStreamMessageId

extensions/discord/src/monitor/allow-list.ts (1): resolveDiscordChannelConfigEntry

extensions/discord/src/monitor/provider.lifecycle.reconnect.ts (1): ignoreSocketError

extensions/discord/src/monitor/thread-bindings.state.ts (1): resolveDefaultThreadBindingDurations

extensions/discord/src/send.types.ts (1): toString

extensions/discord/src/voice/manager.ts (1): setBotUserId

extensions/fal/image-generation-provider.ts (1): _setFalFetchGuardForTesting

extensions/feishu/src/accounts.ts (1): isFeishuSecretRefUnavailableError

extensions/feishu/src/client.ts (1): setFeishuClientRuntimeForTest

extensions/feishu/src/lifecycle.test-support.ts (1): getFeishuLifecycleTestMocks

extensions/feishu/src/monitor.test-mocks.ts (1): createFeishuRuntimeMockModule

extensions/github-copilot/models-defaults.ts (1): getDefaultCopilotModelIds

extensions/google/google-shared.test-helpers.ts (1): makeGeminiCliModel

extensions/google/oauth.credentials.ts (1): clearCredentialsCache

extensions/googlechat/src/monitor.ts (1): computeGoogleChatMediaMaxMb

extensions/irc/src/client.ts (1): nick

extensions/kilocode/provider-models.ts (1): buildKilocodeModelDefinition

extensions/line/src/template-messages.ts (1): createImageCarouselColumn

extensions/matrix/src/cli.ts (1): toCliDirectRoomCandidate

extensions/matrix/src/matrix/client/logging.ts (1): matrixSdkSilentMethodFactory

extensions/matrix/src/matrix/sdk.ts (1): onDecrypted

extensions/matrix/src/matrix/sdk/logger.ts (1): noop

extensions/matrix/src/test-runtime.ts (1): defaultStateDirResolver

extensions/mattermost/src/mattermost/monitor-websocket.ts (1): defaultMattermostWebSocketFactory

extensions/mattermost/src/mattermost/slash-state.ts (1): getAllSlashCommandStates

extensions/memory-core/src/memory/embedding.test-mocks.ts (1): getEmbedQueryMock

extensions/msteams/src/monitor.ts (1): noop

extensions/msteams/src/pending-uploads.ts (1): getPendingUploadCount

extensions/msteams/src/user-agent.ts (1): resetUserAgentCache

extensions/nextcloud-talk/src/format.ts (1): formatNextcloudTalkCodeBlock

extensions/nostr/src/channel.ts (1): getActiveNostrBuses

extensions/nvidia/provider-catalog.ts (1): buildNvidiaProvider

extensions/openshell/src/cli.ts (1): setBundledOpenShellCommandResolverForTest

extensions/signal/src/monitor.tool-result.test-harness.ts (1): getSignalToolResultTestMocks

extensions/slack/src/blocks.test-helpers.ts (1): installSlackBlockTestMocks

extensions/slack/src/monitor/auth.ts (1): clearSlackAllowFromCacheForTest

extensions/slack/src/monitor/message-handler/prepare.test-helpers.ts (1): createSlackTestAccount

extensions/slack/src/monitor/slash.test-harness.ts (1): getSlackSlashMocks

extensions/synology-chat/src/channel.test-mocks.ts (1): makeSecurityAccount

extensions/synology-chat/src/webhook-handler.ts (1): getSynologyWebhookRateLimiterCountForTest

extensions/synthetic/models.ts (1): buildSyntheticModelDefinition

extensions/telegram/src/accounts.ts (1): resetMissingDefaultWarnFlag

extensions/telegram/src/bot-native-commands.test-helpers.ts (1): createTelegramGroupCommandContext

extensions/telegram/src/bot.media.e2e-harness.ts (1): defaultSaveMediaBuffer

extensions/telegram/src/bot/reply-threading.ts (1): createDeliveryProgress

extensions/telegram/src/network-config.ts (1): resetTelegramNetworkConfigStateForTests

extensions/telegram/src/polling-session.ts (1): activeRunner

extensions/telegram/src/send.test-harness.ts (1): getTelegramSendTestMocks

extensions/tlon/src/settings.ts (1): loaded

extensions/tlon/src/urbit/story.ts (1): textToStory

extensions/together/models.ts (1): buildTogetherModelDefinition

extensions/twitch/src/client-manager-registry.ts (1): getRegisteredClientManagerCount

extensions/twitch/src/test-fixtures.ts (1): makeTwitchTestConfig

extensions/voice-call/src/providers/tts-openai.ts (1): mulawToLinear

extensions/voice-call/src/providers/twilio.ts (1): getPublicUrl

extensions/whatsapp/src/auto-reply/monitor.ts (1): handleSigint

extensions/whatsapp/src/monitor-inbox.test-harness.ts (1): buildNotifyMessageUpsert

extensions/zai/detect.ts (1): setDetectZaiEndpointForTesting

extensions/zalo/src/api.ts (1): isPollingTimeout

extensions/zalouser/src/test-helpers.ts (1): createDefaultResolvedZalouserAccount

packages/memory-host-sdk/src/host/status-format.ts (1): resolveMemoryCacheState

scripts/docker/setup.sh (1): is_valid_timezone

scripts/label-open-issues.ts (1): mapNodeToLabelItem

scripts/lib/arg-utils.mjs (1): booleanFlag

src/agents/chutes-models.ts (1): buildChutesModelDefinition

src/agents/cli-session.ts (1): clearAllCliSessions

src/agents/deepseek-models.ts (1): buildDeepSeekModelDefinition

src/agents/model-catalog.ts (1): defaultImportPiSdk

src/agents/opencode-zen-models.ts (1): clearOpencodeZenModelCache

src/agents/pi-embedded-block-chunker.ts (1): bufferedText

src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts (1): makeSimpleUserMessages

src/agents/pi-embedded-runner/model.test-harness.ts (1): buildOpenAICodexForwardCompatExpectation

src/agents/pi-embedded-runner/run/attempt.spawn-workspace.test-support.ts (1): createSubscriptionMock

src/agents/pi-extensions/compaction-safeguard.ts (1): setSummarizeInStagesForTest

src/agents/subagent-lifecycle-events.ts (1): resolveSubagentSessionEndedOutcome

src/agents/subagent-registry.mocks.shared.ts (1): noop

src/agents/subagent-spawn.test-helpers.ts (1): identityDeliveryContext

src/agents/synthetic-models.ts (1): buildSyntheticModelDefinition

src/agents/test-helpers/model-fallback-config-fixture.ts (1): makeModelFallbackCfg

src/agents/test-helpers/sandbox-agent-config-fixtures.ts (1): createRestrictedAgentSandboxConfig

src/agents/together-models.ts (1): buildTogetherModelDefinition

src/agents/workspace-templates.ts (1): resetWorkspaceTemplateDirCache

src/auto-reply/media-understanding.test-fixtures.ts (1): createSuccessfulImageMediaDecision

src/auto-reply/reply/abort-primitives.ts (1): getAbortMemorySizeForTest

src/auto-reply/reply/abort.ts (1): resetDepsForTests

src/auto-reply/reply/auto-topic-label.ts (1): isTextContentBlock

src/auto-reply/reply/bash-command.ts (1): resetBashChatCommandForTests

src/auto-reply/reply/commands-subagents.test-mocks.ts (1): installSubagentsCommandCoreMocks

src/auto-reply/reply/queue/cleanup.ts (1): resetDepsForTests

src/auto-reply/thinking.shared.ts (1): resolveElevatedMode

src/channels/plugins/whatsapp-shared.ts (1): resolveWhatsAppGroupIntroHint

src/cli/channel-options.ts (1): resetPrecomputedChannelOptionsForTests

src/cli/program/config-guard.ts (1): resetConfigGuardStateForTests

src/cli/program/helpers.ts (1): collectOption

src/cli/test-runtime-capture.ts (1): firstWrittenJsonArg

src/commands/auth-choice.apply.api-providers.ts (1): applyAuthChoiceApiProviders

src/commands/auth-choice.apply.oauth.ts (1): applyAuthChoiceOAuth

src/config/defaults.ts (1): resetSessionDefaultsWarningForTests

src/config/sessions/store.ts (1): getSessionStoreLockQueueSizeForTest

src/config/talk-defaults.ts (1): describeTalkSilenceTimeoutDefaults

src/config/test-helpers.ts (1): buildWebSearchProviderConfig

src/cron/isolated-agent/delivery-dispatch.ts (1): getCompletedDirectCronDeliveriesCountForTests

src/cron/run-log.ts (1): getPendingCronRunLogWriteCountForTests

src/cron/schedule.ts (1): getCronScheduleCacheSizeForTest

src/daemon/schtasks.ts (1): hasListenerPid

src/flows/model-picker.ts (1): loadModelPickerRuntime

src/gateway/client.ts (1): describeGatewayCloseCode

src/gateway/model-pricing-cache.ts (1): getGatewayModelPricingCacheMeta

src/gateway/node-pending-work.ts (1): getNodePendingWorkStateCountForTests

src/gateway/server-methods/agents.ts (1): resetDepsForTests

src/gateway/server.impl.ts (1): stopGatewayUpdateCheck

src/gateway/test-helpers.openai-mock.ts (1): extractToolOutput

src/global-state.ts (1): setYes

src/hooks/bundled/README.md (1): myHandler

src/hooks/gmail-setup-utils.ts (1): resetGmailSetupUtilsCachesForTest

src/hooks/gmail-watcher.ts (1): isGmailWatcherRunning

src/infra/exec-approvals-test-helpers.ts (1): makeMockExecutableResolution

src/infra/gaxios-fetch-compat.ts (1): resetGaxiosFetchCompatForTests

src/infra/heartbeat-wake.ts (1): hasHeartbeatWakeHandler

src/infra/net/undici-global-dispatcher.ts (1): resetGlobalUndiciStreamTimeoutsForTests

src/infra/openclaw-exec-env.ts (1): ensureOpenClawExecMarkerOnProcess

src/infra/outbound/bound-delivery-router.ts (1): isActiveBinding

src/infra/outbound/format.ts (1): buildOutboundDeliveryJson

src/infra/system-events.ts (1): cloneSystemEvent

src/infra/update-startup.ts (1): resetUpdateAvailableStateForTest

src/infra/windows-install-roots.ts (1): _resetWindowsInstallRootsForTests

src/infra/wsl.ts (1): resetWSLStateForTests

src/media-understanding/attachments.select.ts (1): isAttachmentRecord

src/media-understanding/resolve.ts (1): resolveCapabilityConfig

src/media/store.ts (1): setMediaStoreNetworkDepsForTest

src/plugin-sdk/core.ts (1): defineSetupPluginEntry

src/plugin-sdk/provider-web-search.ts (1): createPluginBackedWebSearchProvider

src/plugins/hooks.ts (1): mergeSubagentDeliveryTargetResult

src/plugins/loader.ts (1): maxPluginRegistryCacheEntries

src/plugins/runtime.ts (1): getActivePluginHttpRouteRegistryVersion

src/plugins/runtime/index.ts (1): unavailable

src/plugins/runtime/runtime-imessage.ts (1): createRuntimeIMessage

src/plugins/runtime/runtime-matrix.ts (1): createRuntimeMatrix

src/plugins/runtime/runtime-signal.ts (1): createRuntimeSignal

src/plugins/runtime/runtime-slack.ts (1): createRuntimeSlack

src/plugins/runtime/runtime-whatsapp.ts (1): createRuntimeWhatsApp

src/plugins/update.ts (1): changed

src/plugins/web-search-providers.runtime.ts (1): resetWebSearchProviderSnapshotCacheForTests

src/test-helpers/whatsapp-outbound.ts (1): createWhatsAppPollFixture

src/test-utils/internal-hook-event-payload.ts (1): createInternalHookEventPayload

src/test-utils/typed-cases.ts (1): typedCases

src/tts/tts-core.ts (1): isTextContentBlock

src/tui/components/filterable-select-list.ts (1): getFilterText

src/tui/components/selectors.ts (1): createSelectList

src/tui/gateway-chat.ts (1): waitForReady

src/tui/osc8-hyperlinks.ts (1): wrapOsc8

src/utils.ts (1): assertWebChannel

src/utils/usage-format.ts (1): __resetUsageFormatCachesForTest

test/helpers/auth-wizard.ts (1): noop

test/helpers/extensions/discord-provider.test-support.ts (1): getProviderMonitorTestMocks

test/helpers/extensions/feishu-lifecycle.ts (1): restoreFeishuLifecycleStateDir

test/helpers/extensions/plugin-api.ts (1): registerInteractiveHandler

test/helpers/extensions/plugin-sdk-stub.cjs (1): construct

test/helpers/extensions/send-config.ts (1): createSendCfgThreadingRuntime

test/helpers/extensions/setup-wizard.ts (1): selectFirstWizardOption

test/helpers/extensions/zalo-lifecycle.ts (1): createImageUpdate

test/helpers/import-fresh.ts (1): importFreshModule

test/setup.ts (1): installDefaultPluginRegistry

tsdown.config.ts (1): nodeBuildConfig

ui/src/i18n/lib/translate.ts (1): registerTranslation

ui/src/ui/app.ts (1): createRenderRoot

ui/src/ui/chat-model.test-helpers.ts (1): createResolvedModelPatch

ui/src/ui/chat/pinned-messages.ts (1): indices

ui/src/ui/chat/slash-commands.ts (1): choiceToValue

ui/src/ui/chat/speech.ts (1): isSttActive

ui/src/ui/components/dashboard-header.ts (1): createRenderRoot

ui/src/ui/controllers/agents.ts (1): resetToolsEffectiveState

ui/src/ui/icons.ts (1): setEmojiIcon

ui/src/ui/views/command-palette.ts (1): getPaletteItems

ui/src/ui/views/config-form.node.ts (1): extractLiteral

</details>

Methodology

Analysis performed with cqs v1.9.0 using BGE-large-en-v1.5 embeddings and tree-sitter call graph extraction across 51 supported languages. The call graph captures static function calls from tree-sitter AST analysis. Dynamic dispatch, framework callbacks, and cross-repo consumers are not captured — hence the false positive categories above.

Agent-ready prompt

For each file in the list above, read the file and classify each flagged function:

1. If it's a framework callback (Android lifecycle, macOS NSView delegate, 
   event handler interface method) — add a brief comment above it:
   `// Framework callback — called by OS/runtime, not by application code`

2. If it's a test injection setter (setXxxForTest, xxxMock, resetXxxForTests) — 
   check if any .test. file actually imports and calls it. If yes, keep it.
   If no test imports it, delete it.

3. If it's a Solid.js signal accessor (getter/setter pair with same name in 
   tui.ts or ui/ files) — these are reactive state. Keep them but skip future 
   dead code audits on signal accessors.

4. If it's none of the above and nothing imports it — delete it. Run the test 
   suite after each file to verify nothing breaks.

Work file by file. Commit after each file with message: 
"chore: remove dead code in <filename> (N functions)"

Start with the files that have the most isolated functions — they're most 
likely to contain genuinely dead code rather than framework callbacks.

extent analysis

Fix Plan

To address the issue of dead code in the production environment, we will follow a step-by-step approach:

  1. Identify Framework Callbacks: For each file listed, identify functions that are framework callbacks (e.g., Android lifecycle methods, macOS delegates). Add a comment above these functions: // Framework callback — called by OS/runtime, not by application code.
  2. Review Test Injection Setters: Check if any test file imports and calls the flagged functions. If a test uses it, keep the function. Otherwise, delete it.
  3. Handle Solid.js Signal Accessors: Identify and keep signal accessors (getter/setter pairs with the same name in tui.ts or ui/ files) as they are part of reactive state.
  4. Delete Unused Functions: For functions that do not fit into the above categories and are not imported or used anywhere, delete them.

Example Code Changes

For a function identified as a framework callback, add a comment:

// Framework callback — called by OS/runtime, not by application code
function onStartDiscoveryFailed() {
    // Implementation
}

For a test injection setter that is used by a test, keep it and ensure it's properly documented:

// Used by tests to set up mock dependencies
function setFetchDiscordApplicationId(id: string) {
    // Implementation
}

For a function that is not used and can be deleted, simply remove its definition:

- function unusedFunction() {
-     // Unused implementation
- }

Verification

After making changes to each file, run the test suite to verify that nothing breaks. Commit changes file by file with a message like "chore: remove dead code in <filename> (N functions)".

Extra Tips

  • Start with files that have the most isolated functions, as they are more likely to contain genuinely dead code.
  • Use tools like cqs for static analysis to identify dead code and framework callbacks.
  • Keep the codebase clean by regularly removing unused functions and commenting on framework callbacks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING