[GH-ISSUE #3488] [Issue]: Code sweep: dead code catalogue (unreferenced components, exports, unreachable branches) #1886

Closed
opened 2026-10-21 05:43:31 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jul 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3488

Originally assigned to: @kolacheee on GitHub.

Summary

A verified catalogue of dead code: whole components with zero importers, exported functions nothing calls, and branches that can never run.

Why this is a problem: dead code is where agents go wrong quietly. They edit files that never run (a concrete example below), copy superseded patterns, and in two cases here the dead name collides with a live one, inviting the wrong import.
What it negatively affects: agent and contributor productivity, code search quality, and refactor safety. No user-facing behavior — that is the point.

Verification method: every entry was checked with repo-wide reference searches including barrel re-exports, lazy/dynamic imports, codegen registries, and string-keyed dispatch. Visual-Novel-related dead code (including shared/src/types/vn.ts, fully dead) is deliberately excluded here — it is catalogued under #3456.

Expected behavior

Code in the repo is reachable, or it is deleted.

Actual behavior

Dead files (zero importers; delete candidates)

  • client/.../components/game/GameSessionBanner.tsx — superseded by GameSurface.handleConcludeSession/useConcludeSession
  • client/.../components/game/GameStateIndicator.tsx — its STATE_CONFIG is a byte-duplicate of the live one in GameMap.tsx
  • client/.../components/chat/ExpressionPanel.tsx (and its ExpressionSprite)
  • client/.../components/chat/SpriteSidebar.tsx — live path is SpriteOverlay.tsx
  • client/.../components/modals/BotBrowserModal.tsx — Chub-only modal superseded by BotBrowserPanel (wired in RightPanel.tsx:26,50)
  • client/.../components/game/GamePartySidebar.tsx — GameSurface.tsx:11386 says "REMOVED: Old sidebar replaced by compact GamePartyBar"
  • client/.../components/game/GameCheckpoints.tsx — checkpoint browse/restore UI; server checkpoints have no UI entry point
  • client/.../components/game/GameDialogueOverlay.tsx
  • client/.../components/game/GameNpcTracker.tsx
  • client/.../features/chat-settings/sections/ManualRepliesSection.tsx — ChatSettingsDrawer imports every sibling section except this one
  • client/.../hooks/use-party-turn.ts — party turns flow through the main SSE /generate pipeline
  • server/src/types/better-sqlite3.d.ts and sql-js.d.ts — ambient decls for packages createDB() refuses to load (libsql-only since v1.5.7)
  • scripts/import-genshin-music.sh — personal one-off with hardcoded /Users/marysia/... paths, wired to nothing

Dead exports / branches

  • shared/.../utils/xml-wrapper.ts:25 — wrapInXml/stripXmlTags: zero call sites (real wrapping is format-engine.ts). Note: packages/client/.instructions.md:314 advertises wrapInXml() as THE XML util, actively steering agents to dead code (doc fix tracked in the meta-file issue).
  • server/.../routes/chats.routes.ts:301 — local resolveLorebookGenerationTriggers(mode): zero in-file callers, and the name collides with the live 2-arg resolver in lorebook-generation-runtime.ts used by generate.routes.ts. High hazard: wrong-import magnet.
  • client/.../lib/app-dialogs.ts:84 — showConfirmWithCheckbox and the whole checkbox-dialog feature behind it (store field + UI) is unreachable end-to-end.
  • server/.../services/professor-mari/workspace-skills.service.ts:258 — loadPiSkills: zero callers; live path is list() → buildSkillsPrompt.
  • server/.../services/game/journal.service.ts:384 — buildDeterministicSummary: zero callers; comment implies it can replace the LLM conclude path. Delete or wire up (maintainer decision).
  • server/.../routes/generate/generate-route-utils.ts:343 — resolveProviderTopK google branch returns the identical expression as the default; implies provider-specific top-K that does not exist.
  • server/.../services/game/asset-manifest.service.ts:276 — buildAssetTagList: zero callers.
  • client/.../hooks/use-touch-folder-drag.ts:27 — moveCancelThresholdPx: back-compat alias of the renamed moveActivateThresholdPx, zero callers, name now lies.
  • client/.../components/panels/LorebooksPanel.tsx:624 — LorebookRow.personaName prop/branch: the only caller hardcodes undefined.
  • client/.../components/bot-browser/BotBrowserView.tsx:112 — provider interface methods getAvatarUrl/getExternalUrl/importCard: implemented by all 6 providers, called by nothing.
  • client/.../components/modals/EditAgentModal.tsx + ModalRenderer.tsx:100 edit-agent case — nothing calls openModal("edit-agent"); live editor is AgentEditor (maintainer decision).
  • client/.../components/onboarding/OnboardingTutorial.tsx:236 — _buildClipPath: zero callers.

Dead locals / unreachable branches (smaller, batched)

  • client/.../components/chat/ConversationCallSurface.tsx:633 — the kind==="command" formatting switch in messageContent is unreachable: visibleCallMessages (:1347) filters command messages out before the only call site (:2743). High hazard: an agent editing call-message formatting edits dead code.
  • client/.../components/game/GameSurface.tsx:3523 — _rollEncounter/_journalEntry mutations never called; journal writes instead go through 6 ad-hoc api.post('/game/journal/entry') calls that skip the mutation's cache invalidation.
  • Underscore-flagged unused locals: ChatInput.tsx:1374 _isRP; AgentEditor.tsx:931 _displayPrompt; ChatArea.tsx:736 _messageOrderIndexById (O(n) map rebuilt every render, unused) and :3112 TypingIndicator; ChatMessage.tsx:1349 _modelName.
  • No-op branches: gm-prompts.ts:414 normalizedLanguage unused; world-state-display.ts:331/:403 keyword branches return the same value as their fallback; generate.routes.ts:2859 empty if-body; GameSurface.tsx:9070-9071 duplicate new Set() reset; use-generate.ts:3206 dead !result.success branch.

Steps to reproduce

For any entry: repo-wide search for the symbol/file name; the only hits are the definition and (where noted) a misleading doc reference.

Environment

  • Marinara Engine version: 2.2.0 (staging @ 45b650de9)
  • Install type: source
  • OS + version: N/A — verified by reading the code
  • Browser or app shell: N/A

Logs, screenshots, or video

N/A.

Additional context

Found by a repo-wide read-only sweep; every entry survived adversarial verification specifically hunting for dynamic/lazy/registry references before being listed. No deletions started. Part of a coordinated set of sweep catalogue issues filed together.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Jul 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3488 Originally assigned to: @kolacheee on GitHub. ## Summary A verified catalogue of dead code: whole components with zero importers, exported functions nothing calls, and branches that can never run. **Why this is a problem:** dead code is where agents go wrong quietly. They edit files that never run (a concrete example below), copy superseded patterns, and in two cases here the dead name collides with a live one, inviting the wrong import. **What it negatively affects:** agent and contributor productivity, code search quality, and refactor safety. No user-facing behavior — that is the point. Verification method: every entry was checked with repo-wide reference searches including barrel re-exports, lazy/dynamic imports, codegen registries, and string-keyed dispatch. Visual-Novel-related dead code (including `shared/src/types/vn.ts`, fully dead) is deliberately excluded here — it is catalogued under #3456. ## Expected behavior Code in the repo is reachable, or it is deleted. ## Actual behavior ### Dead files (zero importers; delete candidates) - [ ] `client/.../components/game/GameSessionBanner.tsx` — superseded by `GameSurface.handleConcludeSession`/`useConcludeSession` - [ ] `client/.../components/game/GameStateIndicator.tsx` — its `STATE_CONFIG` is a byte-duplicate of the live one in `GameMap.tsx` - [ ] `client/.../components/chat/ExpressionPanel.tsx` (and its `ExpressionSprite`) - [ ] `client/.../components/chat/SpriteSidebar.tsx` — live path is `SpriteOverlay.tsx` - [ ] `client/.../components/modals/BotBrowserModal.tsx` — Chub-only modal superseded by `BotBrowserPanel` (wired in `RightPanel.tsx:26,50`) - [ ] `client/.../components/game/GamePartySidebar.tsx` — `GameSurface.tsx:11386` says "REMOVED: Old sidebar replaced by compact GamePartyBar" - [ ] `client/.../components/game/GameCheckpoints.tsx` — checkpoint browse/restore UI; server checkpoints have no UI entry point - [ ] `client/.../components/game/GameDialogueOverlay.tsx` - [ ] `client/.../components/game/GameNpcTracker.tsx` - [ ] `client/.../features/chat-settings/sections/ManualRepliesSection.tsx` — `ChatSettingsDrawer` imports every sibling section except this one - [ ] `client/.../hooks/use-party-turn.ts` — party turns flow through the main SSE `/generate` pipeline - [ ] `server/src/types/better-sqlite3.d.ts` and `sql-js.d.ts` — ambient decls for packages `createDB()` refuses to load (libsql-only since v1.5.7) - [ ] `scripts/import-genshin-music.sh` — personal one-off with hardcoded `/Users/marysia/...` paths, wired to nothing ### Dead exports / branches - [ ] `shared/.../utils/xml-wrapper.ts:25` — `wrapInXml`/`stripXmlTags`: zero call sites (real wrapping is `format-engine.ts`). Note: `packages/client/.instructions.md:314` advertises `wrapInXml()` as THE XML util, actively steering agents to dead code (doc fix tracked in the meta-file issue). - [ ] `server/.../routes/chats.routes.ts:301` — local `resolveLorebookGenerationTriggers(mode)`: zero in-file callers, and the name collides with the live 2-arg resolver in `lorebook-generation-runtime.ts` used by `generate.routes.ts`. High hazard: wrong-import magnet. - [ ] `client/.../lib/app-dialogs.ts:84` — `showConfirmWithCheckbox` and the whole checkbox-dialog feature behind it (store field + UI) is unreachable end-to-end. - [ ] `server/.../services/professor-mari/workspace-skills.service.ts:258` — `loadPiSkills`: zero callers; live path is `list()` → `buildSkillsPrompt`. - [ ] `server/.../services/game/journal.service.ts:384` — `buildDeterministicSummary`: zero callers; comment implies it can replace the LLM conclude path. Delete or wire up (maintainer decision). - [ ] `server/.../routes/generate/generate-route-utils.ts:343` — `resolveProviderTopK` google branch returns the identical expression as the default; implies provider-specific top-K that does not exist. - [ ] `server/.../services/game/asset-manifest.service.ts:276` — `buildAssetTagList`: zero callers. - [ ] `client/.../hooks/use-touch-folder-drag.ts:27` — `moveCancelThresholdPx`: back-compat alias of the renamed `moveActivateThresholdPx`, zero callers, name now lies. - [ ] `client/.../components/panels/LorebooksPanel.tsx:624` — `LorebookRow.personaName` prop/branch: the only caller hardcodes `undefined`. - [ ] `client/.../components/bot-browser/BotBrowserView.tsx:112` — provider interface methods `getAvatarUrl`/`getExternalUrl`/`importCard`: implemented by all 6 providers, called by nothing. - [ ] `client/.../components/modals/EditAgentModal.tsx` + `ModalRenderer.tsx:100` `edit-agent` case — nothing calls `openModal("edit-agent")`; live editor is `AgentEditor` (maintainer decision). - [ ] `client/.../components/onboarding/OnboardingTutorial.tsx:236` — `_buildClipPath`: zero callers. ### Dead locals / unreachable branches (smaller, batched) - [ ] **`client/.../components/chat/ConversationCallSurface.tsx:633`** — the `kind==="command"` formatting switch in `messageContent` is unreachable: `visibleCallMessages` (:1347) filters command messages out before the only call site (:2743). High hazard: an agent editing call-message formatting edits dead code. - [ ] `client/.../components/game/GameSurface.tsx:3523` — `_rollEncounter`/`_journalEntry` mutations never called; journal writes instead go through 6 ad-hoc `api.post('/game/journal/entry')` calls that skip the mutation's cache invalidation. - [ ] Underscore-flagged unused locals: `ChatInput.tsx:1374` `_isRP`; `AgentEditor.tsx:931` `_displayPrompt`; `ChatArea.tsx:736` `_messageOrderIndexById` (O(n) map rebuilt every render, unused) and `:3112` `TypingIndicator`; `ChatMessage.tsx:1349` `_modelName`. - [ ] No-op branches: `gm-prompts.ts:414` `normalizedLanguage` unused; `world-state-display.ts:331`/`:403` keyword branches return the same value as their fallback; `generate.routes.ts:2859` empty if-body; `GameSurface.tsx:9070-9071` duplicate `new Set()` reset; `use-generate.ts:3206` dead `!result.success` branch. ## Steps to reproduce For any entry: repo-wide search for the symbol/file name; the only hits are the definition and (where noted) a misleading doc reference. ## Environment - Marinara Engine version: 2.2.0 (staging @ 45b650de9) - Install type: source - OS + version: N/A — verified by reading the code - Browser or app shell: N/A ## Logs, screenshots, or video N/A. ## Additional context Found by a repo-wide read-only sweep; every entry survived adversarial verification specifically hunting for dynamic/lazy/registry references before being listed. No deletions started. Part of a coordinated set of sweep catalogue issues filed together. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@kolacheee commented on GitHub (Jul 11, 2026):

Taking the remaining sections (dead exports/branches and dead locals). The dead-files section is already covered by open PR #3500. Each entry is being re-verified against current staging before deletion; judgment-call items (EditAgentModal, buildDeterministicSummary, etc.) will have the wire-up-vs-remove reasoning documented in the PR for review. — @kolacheee

<!-- gh-comment-id:4949070465 --> @kolacheee commented on GitHub (Jul 11, 2026): Taking the remaining sections (dead exports/branches and dead locals). The dead-files section is already covered by open PR #3500. Each entry is being re-verified against current staging before deletion; judgment-call items (EditAgentModal, buildDeterministicSummary, etc.) will have the wire-up-vs-remove reasoning documented in the PR for review. — @kolacheee
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1886
No description provided.