deadcode -test ./... still reports a handful of genuinely-unreachable functions. This tracks removing them.
Remaining after #706: five dead wrapper functions and unused test seams (plus five //go:build !linux stubs that are live on Linux and should stay).
Activity
7Ran make deadcode on main at 99721c7 while triaging. The count has grown well past "five dead wrapper functions", and more usefully, most of what it reports is not abandoned code.
Twenty-five now, in three clusters plus four singletons:
internal/tui/plan_step_detail.go:107:16: unreachable func: model.sidebarPlanSelectables
internal/tui/plan_step_detail.go:153:16: unreachable func: model.openPlanStepDetail
internal/tui/plan_step_detail.go:341:16: unreachable func: model.requestPlanStepExplanation
internal/tui/plan_step_detail.go:370:6: unreachable func: planStepExplanationPrompt
internal/tui/plan_step_detail.go:434:6: unreachable func: planStepDigestItems
internal/tui/sidebar.go:30:6: unreachable func: sidebarWidth
internal/tui/sidebar.go:40:16: unreachable func: model.sidebarActive
internal/tui/sidebar.go:50:16: unreachable func: model.sidebarAvailable
internal/tui/sidebar.go:448:16: unreachable func: model.sidebarAgentSelectables
internal/tui/sidebar.go:554:16: unreachable func: model.renderContextSidebar
internal/tui/sidebar.go:644:16: unreachable func: model.hoveredSidebarLineOffset
internal/tui/sidebar.go:690:6: unreachable func: sidebarPlaceholder
internal/tui/sidebar.go:845:16: unreachable func: model.sidebarTokenLine
internal/tui/sidebar.go:882:6: unreachable func: joinColumns
internal/tui/syntax_highlight.go:212:6: unreachable func: highlightShellCommand
internal/tui/syntax_highlight.go:239:6: unreachable func: highlightShellText
internal/tui/syntax_highlight.go:280:6: unreachable func: isShellControlOperator
internal/tui/syntax_highlight.go:289:6: unreachable func: isShellCommandWrapper
internal/tui/syntax_highlight.go:298:6: unreachable func: isShellNumber
internal/tui/syntax_highlight.go:310:6: unreachable func: looksLikeShellPath
internal/tui/syntax_highlight.go:323:6: unreachable func: highlightCodeForPathWithSpans
internal/tui/theme.go:351:6: unreachable func: buildSystemTheme
internal/update/replace_windows.go:260:6: unreachable func: clearOldBinaryPreserved
internal/zerogit/zerogit.go:1116:6: unreachable func: HasUpstream
internal/zeroruntime/helpers.go:45:6: unreachable func: SeedMessages```
**None of these are unwritten or untested.** Sampling call sites, counting production references and test references separately:
renderContextSidebar prod=0 test=2 sidebarWidth prod=1 test=22 openPlanStepDetail prod=0 test=11 highlightShellCommand prod=0 test=1 buildSystemTheme prod=0 test=2 HasUpstream prod=0 test=3 clearOldBinaryPreserved prod=0 test=3
`openPlanStepDetail` has eleven test references and no production caller at all. `sidebarWidth` has twenty-two.
**The TUI cluster is one chain, not three piles.** `renderContextSidebar` is never called outside comments, so the context sidebar does not render. `hover.go` defines `hoverPlanStep` as "a plan step row in the sidebar's PLAN section", and `model.stepExplanation` is documented as "cached so re-clicking is instant", so the plan-step detail card was meant to be reached by clicking a row in that sidebar. No sidebar means no rows, which means `openPlanStepDetail` and the four functions around it cannot be reached either. That is a built and tested feature with no entry point rather than leftovers.
So the tui part of this is a decision, wire it or drop it, and not a good first issue any more. `internal/tui/syntax_highlight.go` is the one genuinely leftover-looking group: `highlightCodeForPathWithSpans` sits next to `highlightCodeForPath` and `highlightCodeForPathWithLineBackgrounds`, both of which are used, so it reads as a superseded variant.
The four singletons outside `internal/tui` (`theme.go`'s `buildSystemTheme`, `zerogit.HasUpstream`, `zeroruntime.SeedMessages`, `clearOldBinaryPreserved`) are still the straightforward part and still fit the original framing.
Not picking this up, partly because it is labelled good first issue and partly because deleting a tested feature is not mine to decide. Flagging the measurement so whoever takes it is not surprised by what is behind the label.Correcting myself on one line above. I wrote that the sidebar cluster is "a built and tested feature with no entry point rather than leftovers", and the evidence leans the other way.
sidebar.go:37 says sidebarActive is "retained for the compact data helpers and legacy file-detail", and files_panel.go describes itself as the FILES section of that same right context sidebar whose "compact rows feed the run-details overlay" and the file drill-in. Read together, that is a two-column layout that was deliberately retired, with its data helpers kept because other surfaces still use them. What deadcode is reporting is the rendering half nobody calls any more.
So the original framing of this issue was closer to right than mine. What still stands from the measurement: it is twenty-five functions rather than five, they all carry tests, and the sidebar and plan-step-detail files go together, since the plan card was reached by clicking a row in the sidebar that no longer renders. Whoever takes this should confirm the retirement was intended before deleting, but they should expect to be deleting rather than wiring.
Hi @Vasanthdev2004 , I'd like to work on this issue. I’ve gone through the latest discussion and understand that the scope has expanded beyond the original five functions, with the TUI/sidebar code being retired rather than something that should be wired back up. I’ll confirm the retirement intent and then work on removing the genuinely unreachable code, leaving the //go:build !linux stubs as-is. Please let me know if anyone is currently working on this.
@ShubhamB74 nobody else is on it, so it's yours, and I'm assigning it to you. Two PRs will go faster than one:
- The part nobody needs to confirm: the four functions outside
internal/tui(buildSystemTheme,zerogit.HasUpstream,zeroruntime.SeedMessages,clearOldBinaryPreserved) and the shell-highlight group insyntax_highlight.go, plus the tests that exist only to cover them. - The sidebar and plan-step-detail files, together, once a maintainer confirms the two-column layout was retired on purpose. The comments in
sidebar.goandfiles_panel.gosay it was, but that one isn't mine to call.
For each function, check that make deadcode no longer lists it, and keep anything a live caller still uses even when its neighbours go: the sidebar's data helpers still feed the run-details overlay. Leaving the build-tagged stubs alone is right.
@Vasanthdev2004 Got it, thanks! I’ll split this into two PRs then.
@kevincodex1 one yes or no unblocks the second half of this. Was the two-column context sidebar retired on purpose? The comments in sidebar.go and files_panel.go say it was.
On main at 8c4e7597, deadcode still lists 14 unreachable functions in those two files: 9 in sidebar.go (including renderContextSidebar) and 5 in plan_step_detail.go (the plan card, reached from a sidebar row that no longer renders). #953 doesn't add a caller to any of them. If the answer is yes, ShubhamB74 can delete that rendering half and keep the data helpers the run-details overlay still uses.
Approved and marked as a good first issue.
deadcode -test ./...names the functions, so the work is mechanical. Per the issue itself, the five//go:build !linuxstubs are live on Linux and stay; a PR that removes them will be sent back.