Skip to content

[dead-code] chore: remove dead functions — 2 functions removed#22175

Merged
pelikhan merged 1 commit intomainfrom
dead-code-2026-03-21-c8e8b66d0a5c563f
Mar 21, 2026
Merged

[dead-code] chore: remove dead functions — 2 functions removed#22175
pelikhan merged 1 commit intomainfrom
dead-code-2026-03-21-c8e8b66d0a5c563f

Conversation

@github-actions
Copy link
Contributor

Dead Code Removal

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

Functions Removed

Function File
Compiler.generateUnifiedPromptStep pkg/workflow/unified_prompt_step.go
Compiler.GetSharedActionResolverForTest pkg/workflow/compiler_types.go

Tests Removed

The following test functions exclusively tested the removed functions and were deleted:

  • TestGenerateUnifiedPromptStep_AllSections (unified_prompt_step_test.go)
  • TestGenerateUnifiedPromptStep_MinimalSections (unified_prompt_step_test.go)
  • TestGenerateUnifiedPromptStep_TrialMode (unified_prompt_step_test.go)
  • TestGenerateUnifiedPromptStep_PRContext (unified_prompt_step_test.go)
  • TestGenerateUnifiedPromptStep_NoSections (unified_prompt_step_test.go)
  • TestGenerateUnifiedPromptStep_EnvVarsSorted (unified_prompt_step_test.go)
  • TestAutoInjectedCreateIssuePrompt (safe_outputs_default_create_issue_test.go)
  • TestGenerateSafeOutputsPromptStep_IncludesWhenEnabled (prompts_test.go)
  • TestGenerateSafeOutputsPromptStep_SkippedWhenDisabled (prompts_test.go)
  • TestSafeOutputsPrompt_IncludesPerToolInstructions (prompts_test.go)
  • TestSafeOutputsPrompt_AlwaysIncludesNoop (prompts_test.go)
  • TestForceRefreshActionPins_ClearCache (compile_force_refresh_action_pins_test.go)

Note: collectPromptSections, normalizeLeadingWhitespace, and removeConsecutiveEmptyLines (also in unified_prompt_step.go) were not removed — they are still called from production code (compiler_yaml.go).

Verification

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

Dead Function Count

  • Before this batch: ~21 functions
  • Removed in this PR: 2 functions
  • Remaining: ~19 functions

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

Generated by Dead Code Removal Agent ·

  • expires on Mar 24, 2026, 6:11 PM UTC

- Remove Compiler.generateUnifiedPromptStep (pkg/workflow/unified_prompt_step.go)
- Remove Compiler.GetSharedActionResolverForTest (pkg/workflow/compiler_types.go)
- Delete exclusive test functions that tested the removed functions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 21, 2026 18:17
Copilot AI review requested due to automatic review settings March 21, 2026 18:17
Copy link
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

Removes dead/unreachable workflow compiler functions identified by deadcode, along with the tests that only exercised those removed paths.

Changes:

  • Removed Compiler.generateUnifiedPromptStep and its direct unit tests.
  • Removed Compiler.GetSharedActionResolverForTest and a CLI test that depended on it.
  • Cleaned up affected test files/imports accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/workflow/unified_prompt_step.go Deletes the dead generateUnifiedPromptStep implementation.
pkg/workflow/unified_prompt_step_test.go Removes tests that exclusively covered the deleted method; keeps tests for remaining helpers/section collection.
pkg/workflow/safe_outputs_default_create_issue_test.go Removes a test that depended on the deleted unified prompt generator; drops now-unused import.
pkg/workflow/prompts_test.go Removes safe-outputs prompt tests that called the deleted unified prompt generator.
pkg/workflow/compiler_types.go Removes exported test-only helper GetSharedActionResolverForTest.
pkg/cli/compile_force_refresh_action_pins_test.go Removes a test that depended on the exported test-only helper and cleans up imports.

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

@pelikhan pelikhan merged commit 8e7aa45 into main Mar 21, 2026
61 checks passed
@pelikhan pelikhan deleted the dead-code-2026-03-21-c8e8b66d0a5c563f branch March 21, 2026 18:30
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