Skip to content

[dead-code] chore: remove dead functions — 4 functions removed#30167

Merged
pelikhan merged 1 commit intomainfrom
chore/remove-dead-code-batch-1-202c7ad0f961eabf
May 4, 2026
Merged

[dead-code] chore: remove dead functions — 4 functions removed#30167
pelikhan merged 1 commit intomainfrom
chore/remove-dead-code-batch-1-202c7ad0f961eabf

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 4, 2026

Dead Code Removal

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

Functions Removed

Function File
fastParseTitle pkg/cli/workflows.go
MergeModelAliases pkg/workflow/model_aliases.go
extractOTLPConfigFromRaw pkg/workflow/observability_otlp.go
IsBare pkg/workflow/model_identifier.go

Tests Removed

Test File Reason
TestFastParseTitle pkg/cli/commands_utils_test.go Exclusively tested fastParseTitle
TestMergeModelAliases pkg/workflow/model_aliases_test.go Exclusively tested MergeModelAliases
TestExtractOTLPConfigFromRaw pkg/workflow/observability_otlp_test.go Exclusively tested extractOTLPConfigFromRaw
TestExtractOTLPConfigFromRaw_MapHeaders pkg/workflow/observability_otlp_test.go Exclusively tested extractOTLPConfigFromRaw

Callers in TestBuildAWFConfigJSON_ModelsSection were updated to use MergeImportedModelAliases(nil, ...) directly (the function MergeModelAliases was a thin wrapper around it).

Verification

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

Dead Function Count

  • Before this batch: ~11 functions
  • Removed in this PR: 4 functions
  • Remaining: ~7 functions (includes false positives like validatePiEngineRequirements which is live)

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

Generated by Dead Code Removal Agent · ● 4.8M ·

  • expires on May 7, 2026, 3:24 PM UTC

Remove unreachable functions identified by the deadcode static analyzer.

- fastParseTitle (pkg/cli/workflows.go): superseded by fastParseTitleFromReader
- MergeModelAliases (pkg/workflow/model_aliases.go): thin wrapper around MergeImportedModelAliases
- extractOTLPConfigFromRaw (pkg/workflow/observability_otlp.go): superseded by collectAllOTLPEndpoints
- IsBare (pkg/workflow/model_identifier.go): no callers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review May 4, 2026 17:20
Copilot AI review requested due to automatic review settings May 4, 2026 17:20
@pelikhan pelikhan merged commit e8553d1 into main May 4, 2026
19 of 20 checks passed
@pelikhan pelikhan deleted the chore/remove-dead-code-batch-1-202c7ad0f961eabf branch May 4, 2026 17:20
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

Removes Go functions reported as unreachable by the deadcode analyzer, along with their now-obsolete unit tests, to reduce maintenance surface area.

Changes:

  • Removed dead helpers in CLI/workflow packages (fastParseTitle, MergeModelAliases, extractOTLPConfigFromRaw, (*ParsedModelIdentifier).IsBare).
  • Removed tests that exclusively covered the deleted functions.
  • Updated remaining tests to call MergeImportedModelAliases(nil, ...) directly.
Show a summary per file
File Description
pkg/workflow/observability_otlp.go Removes the dead raw-frontmatter OTLP extraction helper.
pkg/workflow/observability_otlp_test.go Removes tests that only exercised the deleted OTLP extraction helper.
pkg/workflow/model_identifier.go Removes unused exported IsBare method on ParsedModelIdentifier.
pkg/workflow/model_aliases.go Removes dead exported wrapper MergeModelAliases.
pkg/workflow/model_aliases_test.go Removes wrapper-specific tests; updates callers to use MergeImportedModelAliases.
pkg/cli/workflows.go Removes dead fastParseTitle helper (string-based parsing).
pkg/cli/commands_utils_test.go Removes tests that only exercised the deleted fastParseTitle helper.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (1)

pkg/cli/workflows.go:332

  • The doc comment still references fastParseTitle, but that helper was removed in this PR. Please update the wording to avoid pointing to a non-existent function (e.g., compare against reading/parsing the whole file into memory).
// fastParseTitleFromReader scans lines from r for the first H1 header, skipping
// an optional frontmatter block, without reading the entire file into memory.
// This is more efficient than fastParseTitle for file-based callers because it
// stops reading as soon as the title is found.
//
  • Files reviewed: 7/7 changed files
  • Comments generated: 1

Comment on lines 168 to 172
maps.Copy(merged, frontmatterModels)

modelAliasesLog.Printf("Final alias map has %d entries", len(merged))
return merged
}
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 4, 2026

🧪 Test Quality Sentinel Report

Test Quality Score: N/A

i️ No new tests to analyze — this PR only removes tests.

Metric Value
New/modified tests analyzed 0
Test functions removed 3
Production functions removed 4

Summary

This PR removes dead code — 4 production functions and their corresponding test functions were deleted:

  • TestFastParseTitle (pkg/cli/commands_utils_test.go) — removed along with fastParseTitle()
  • TestMergeModelAliases (pkg/workflow/model_aliases_test.go) — removed along with MergeModelAliases()
  • TestExtractOTLPConfigFromRaw (pkg/workflow/observability_otlp_test.go) — removed along with extractOTLPConfigFromRaw()
  • TestExtractOTLPConfigFromRaw_MapHeaders (pkg/workflow/observability_otlp_test.go) — removed along with the dead helper

The 2 lines added in model_aliases_test.go are call-site updates (MergeModelAliasesMergeImportedModelAliases) in existing tests — not new test functions.

Verdict

Check passed. No new tests were introduced. Removing tests for deleted dead code is correct hygiene — no behavioral coverage was lost.

References: §25332856533

🧪 Test quality analysis by Test Quality Sentinel · ● 505.7K ·

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.

✅ Test Quality Sentinel: N/A. No new tests introduced — this PR removes tests for deleted dead code. Correct hygiene, no behavioral coverage lost.

Copilot AI pushed a commit that referenced this pull request May 4, 2026
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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