[dead-code] chore: remove dead functions — 4 functions removed#30167
[dead-code] chore: remove dead functions — 4 functions removed#30167
Conversation
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>
There was a problem hiding this comment.
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
| maps.Copy(merged, frontmatterModels) | ||
|
|
||
| modelAliasesLog.Printf("Final alias map has %d entries", len(merged)) | ||
| return merged | ||
| } |
🧪 Test Quality Sentinel ReportTest Quality Score: N/Ai️ No new tests to analyze — this PR only removes tests.
SummaryThis PR removes dead code — 4 production functions and their corresponding test functions were deleted:
The 2 lines added in Verdict
References: §25332856533
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Dead Code Removal
This PR removes unreachable Go functions identified by the
deadcodestatic analyzer.Functions Removed
fastParseTitlepkg/cli/workflows.goMergeModelAliasespkg/workflow/model_aliases.goextractOTLPConfigFromRawpkg/workflow/observability_otlp.goIsBarepkg/workflow/model_identifier.goTests Removed
TestFastParseTitlepkg/cli/commands_utils_test.gofastParseTitleTestMergeModelAliasespkg/workflow/model_aliases_test.goMergeModelAliasesTestExtractOTLPConfigFromRawpkg/workflow/observability_otlp_test.goextractOTLPConfigFromRawTestExtractOTLPConfigFromRaw_MapHeaderspkg/workflow/observability_otlp_test.goextractOTLPConfigFromRawCallers in
TestBuildAWFConfigJSON_ModelsSectionwere updated to useMergeImportedModelAliases(nil, ...)directly (the functionMergeModelAliaseswas a thin wrapper around it).Verification
go build ./...— passesgo vet ./...— passesgo vet -tags=integration ./...— passesmake fmt— no changes neededDead Function Count
validatePiEngineRequirementswhich is live)Automated by Dead Code Removal workflow — https://github.com/github/gh-aw/actions/runs/25326109980