Remove dead code proven unreachable even from tests
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
Research direction
Start with CONTRIBUTING.md and the make targets make deadcode-check / make deadcode-baseline, which run the repository-pinned deadcode tool against .deadcode-baseline.txt. Then work through the candidate clusters in the issue table (internal/cloud/dashboard, internal/cloud/cloudserver, cmd/engram/main.go, internal/tui/styles.go, internal/store) verifying each symbol's references within its package on Linux, Windows and Darwin before deleting. Done means the candidates are removed, affected tests still pass, and the baseline file is refreshed without changing the pinned tool version or relaxing the ratchet.
Written by the indexing model from the issue text.
Description
📋 Pre-flight Checks
- I have searched existing issues and this is not a duplicate
- I understand this issue needs
status:approvedbefore a PR can be opened
📦 Affected Area
Mechanical dead-code cleanup across CLI, cloud dashboard/server, store, TUI, and orphan test helpers.
🔍 Problem Description
The proposed cleanup remains relevant, but the original symbol counts and deletion list were measured on an older revision. Current source and static analysis on main at a43183c2 report 17 unreachable functions with tests included as analysis roots and 19 U1000 findings. These are overlapping sets, not 36 distinct deletion candidates.
Current candidate groups:
| Cluster | Candidates to revalidate before deletion |
|---|---|
internal/cloud/dashboard |
Handler, staticSyncStatusProvider and its Status method, totalStatObservations, totalStatPrompts, totalStatSessions, paginationURL, parsePagination |
internal/cloud/cloudserver |
withAuthHandler, validateLegacyPayload, validateMutationEntry |
cmd/engram/main.go |
stdinScanner, userHomeDir globals |
internal/tui/styles.go |
colorSurface, searchHighlightStyle. Keep colorBase: it is referenced by a live style. |
internal/store |
pairResult, unused fakeSemanticRunner / routingRunner test scaffolding, and the unused sessionID field in migration test scaffolding |
| Orphan test helpers | httpPushMutations, countElementsWithClass, assertClaudeCodeWritesUnderRoot, runHookInDir, writeMigratingEngramStub |
Handler, staticSyncStatusProvider, and Status remain a single reachability/deletion unit. Review references within each package rather than treating every reported name as an independent unused symbol.
💡 Proposed Solution
Prepare a focused type:refactor cleanup of candidates proven dead on the implementation base. Delete rather than introduce replacement abstractions. Refresh the existing dead-code baseline in the same change when debt is removed.
Acceptance:
- Revalidate the candidate set on the exact implementation revision and exclude any symbol that is now live, including
colorBase. - Check Linux, Windows, and Darwin, tagged tests, documentation references, and current open PR diffs before deletion. The present revalidation is Windows-only; older cross-platform/open-PR checks do not establish today's coverage.
- Preserve behavior and run the affected tests and repository ratchets. Use the repository-pinned deadcode tool for baseline refresh; do not change the tool version or relax the ratchet as part of cleanup.
- Keep tests and the reviewed baseline tightening with the deletion work, splitting into coherent cleanup units if needed.
🔄 Alternatives Considered
Leave the existing debt in place, with the current ratchets preventing new debt. Cleanup still reduces misleading reading surface, but does not require a new CI policy or framework.
📎 Additional Context
The deadcode CI ratchet is already implemented. CONTRIBUTING.md documents make deadcode-check, make deadcode-baseline, and the pinned golang.org/x/tools/cmd/[email protected] comparison against .deadcode-baseline.txt. The original claim that CI has no guard is no longer current.
Current analysis was executed on Windows/amd64 with Go 1.26.4 against an isolated archive of a43183c2:
go run golang.org/x/tools/cmd/[email protected] -test ./... # 17 unreachable functions
go run honnef.co/go/tools/cmd/[email protected] -checks=U1000 ./... # 19 findings
Staticcheck exited nonzero because it reported the listed unused-code findings. These exploratory tool versions are recorded for reproducibility, not proposed replacements for repository-pinned CI tools. No deletions or functional tests were performed for this update, and no refreshed Linux/Darwin, tagged-test, or open-PR reachability proof is claimed.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 9h 11m
- Merged PRs (30d)
- 359
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 ·
Maintainers usually reply within 1 day
-
priority:medium status:needs-review type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Gentleman-Programming/engram#863 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review type:feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
Gentleman-Programming/engram#2122 ·
Maintainers usually reply within 1 day
-
status:needs-review type:feature
Difficulty 5/5 Over a week Newbie friendliness 35/100
Gentleman-Programming/engram#2121 ·
Maintainers usually reply within 1 day
-
feat(governance): allow self-contained PRs and retire universal issue and label merge gatesPossibly taken @dnlrsls claimed this 1 day ago. Openstatus:approved type:feature
Gentleman-Programming/engram#2120 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
fix(handlers): explicitly set Content-Type header in static Index handlerPossibly taken @kage-zero claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eugenioenko/ttt#1206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
open-policy-agent/opa#9426 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rorkai/App-Store-Connect-CLI#3192 ·
Maintainers usually reply within 1 day
-
t:urlDecodeUni does not map U+3002 and U+FF61 to a dot, unlike ModSecurityPossibly taken @fzipi claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day