Skip to content

[dead-code] chore: remove dead functions — 6 functions removed#24476

Merged
pelikhan merged 1 commit intomainfrom
dead-code-removal-2026-04-04-8a8fcf5643657d6a
Apr 4, 2026
Merged

[dead-code] chore: remove dead functions — 6 functions removed#24476
pelikhan merged 1 commit intomainfrom
dead-code-removal-2026-04-04-8a8fcf5643657d6a

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 4, 2026

Dead Code Removal

This PR removes unreachable Go functions identified by the deadcode static analyzer.

Functions Removed

Function File
Coordinator.Stages pkg/agentdrain/coordinator.go
Coordinator.MinerForStage pkg/agentdrain/coordinator.go
Miner.PreTrainTemplate pkg/agentdrain/pretrain.go
Miner.PreTrainTemplates pkg/agentdrain/pretrain.go
Miner.PreTrainTemplateCounts pkg/agentdrain/pretrain.go
sortPinsByVersion pkg/workflow/action_pins.go

pkg/agentdrain/pretrain.go was deleted entirely since all its functions were dead.

Tests Removed / Updated

  • TestPreTrainTemplate (pkg/agentdrain/miner_test.go) — deleted; exclusively tested the removed pretrain functions
  • TestSortPinsByVersion (pkg/workflow/action_pins_test.go) — deleted; exclusively tested sortPinsByVersion
  • TestStageRouting (pkg/agentdrain/miner_test.go) — updated to remove MinerForStage call section

Verification

  • go build ./... — passes
  • go vet ./... — passes
  • go vet -tags=integration ./... — passes
  • make fmt — no changes needed
  • go test ./pkg/agentdrain/... ./pkg/workflow/... — passes

Dead Function Count

  • Before this batch: ~20 functions
  • Removed in this PR: 6 functions
  • Remaining: ~14 functions

Automated by Dead Code Removal workflow — https://github.com/github/gh-aw/actions/runs/23978319418

Generated by Dead Code Removal Agent · ● 2.7M ·

  • expires on Apr 7, 2026, 12:04 PM UTC


✨ PR Review Safe Output Test - Run 23978813659

💥 [THE END] — Illustrated by Smoke Claude · ● 182.6K ·

Remove unreachable Go functions identified by the deadcode static analyzer:
- Coordinator.Stages (pkg/agentdrain/coordinator.go)
- Coordinator.MinerForStage (pkg/agentdrain/coordinator.go)
- Miner.PreTrainTemplate (pkg/agentdrain/pretrain.go)
- Miner.PreTrainTemplates (pkg/agentdrain/pretrain.go)
- Miner.PreTrainTemplateCounts (pkg/agentdrain/pretrain.go)
- sortPinsByVersion (pkg/workflow/action_pins.go)

Also remove exclusive test functions and update TestStageRouting to
remove the MinerForStage section.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude · ● 182.6K

@@ -52,25 +52,6 @@ func (c *Coordinator) AnalyzeEvent(evt AgentEvent) (*MatchResult, *AnomalyReport
return m.AnalyzeEvent(evt)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of Stages() and MinerForStage() looks correct per the dead-code analysis. Consider adding a comment to AllClusters() clarifying it is now the primary iteration point for consumers that previously used Stages().

@@ -144,25 +144,6 @@ func getActionPinsByRepo(repo string) []ActionPin {
return cachedActionPinsByRepo[repo]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean removal of sortPinsByVersion. Confirm that GetActionPin (the only caller of the sort logic) still handles multi-version repos correctly after this change — the inline sort logic should cover the same cases.

@pelikhan pelikhan marked this pull request as ready for review April 4, 2026 13:09
Copilot AI review requested due to automatic review settings April 4, 2026 13:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes unreachable Go code identified by a dead-code analyzer, including deleting an entire file (pretrain.go) whose exported methods were unused, and trimming now-obsolete tests.

Changes:

  • Removed sortPinsByVersion and its dedicated unit test.
  • Removed Coordinator.Stages, Coordinator.MinerForStage, and pretrain-related Miner methods; deleted pkg/agentdrain/pretrain.go.
  • Updated TestStageRouting to stop relying on the removed coordinator API.
Show a summary per file
File Description
pkg/workflow/action_pins.go Removes unused sortPinsByVersion helper.
pkg/workflow/action_pins_test.go Removes test that exclusively covered the deleted helper.
pkg/agentdrain/pretrain.go Deletes file containing only dead pretrain helpers.
pkg/agentdrain/miner_test.go Removes/updates tests that depended on removed dead methods.
pkg/agentdrain/coordinator.go Removes unused coordinator methods (Stages, MinerForStage).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 0

@pelikhan pelikhan merged commit 8e0d7a0 into main Apr 4, 2026
67 checks passed
@pelikhan pelikhan deleted the dead-code-removal-2026-04-04-8a8fcf5643657d6a branch April 4, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants