[dead-code] chore: remove dead functions — 1 function removed#38858
Conversation
Remove ResolveDefaultMaxAICredits and its exclusive test. Flagged as unreachable by deadcode (no callers outside test files). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
🧪 Test Quality Sentinel completed test quality analysis. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #38858 does not have the implementation label (has_implementation_label=false) and has 0 new lines of code in business logic directories, well below the 100-line threshold (requires_adr_by_default_volume=false). |
There was a problem hiding this comment.
Pull request overview
This PR removes a dead codepath for resolving the default max AI credits from the compiler process environment, along with its unit test, leaving the runtime variable-expression based configuration as the remaining mechanism.
Changes:
- Removed
ResolveDefaultMaxAICreditsfrompkg/workflow/compilerenv/manager.go. - Dropped the now-unused
typeutilimport frommanager.go. - Removed
TestResolveDefaultMaxAICreditsfrompkg/workflow/compilerenv/manager_test.go.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compilerenv/manager.go | Removes the dead ResolveDefaultMaxAICredits helper and its related import. |
| pkg/workflow/compilerenv/manager_test.go | Removes the unit test that only covered the deleted helper. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /zoom-out — clean, well-scoped dead-code removal. ✅
📋 Analysis Summary
Verification
ResolveDefaultMaxAICreditshas zero callers in the codebase (confirmed by search)- The
DefaultMaxAICreditsconstant is correctly retained — still used byBuildDefaultMaxAICreditsExpression,engine.go, and test code - The
typeutilimport removal is correct — it was the sole consumer in this file - Architecture decision explicitly captured in
awf_config_test.go: env var is NOT used at compile time, resolved at action runtime go build ./...andgo vet ./...pass per PR checklist
Positive Highlights
- ✅ Tests for the removed function removed alongside the function — no orphaned test stubs
- ✅
DefaultMaxAICreditsconstant preserved for future runtime use - ✅ PR description is clear and accurate
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 193.7 AIC · ⌖ 13.3 AIC · ⊞ 27.8K
🧪 Test Quality Sentinel Report✅ Test Quality Score: N/A — No new tests to analyze
📊 Metrics & Test Classification (0 tests analyzed)
Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.
|
[dead-code] chore: remove dead functions — 1 function removed
Summary
Removes
ResolveDefaultMaxAICreditsfrom the compiler-env manager package. The function was flagged as unreachable by thedeadcodeanalyser: it had no callers outside its own test file. The companion testTestResolveDefaultMaxAICreditsis removed in the same commit.What changed
pkg/workflow/compilerenv/manager.go— breaking removalResolveDefaultMaxAICredits(fallback int64) int64.This function read the enterprise env-var
GH_AW_DEFAULT_MAX_AI_CREDITS, applied optional K/M suffix normalisation viatypeutil.NormalizeInt64KMSuffix, and fell back to the supplied default when the var was absent or invalid. The special sentinel value-1(disable budget enforcement) was preserved."github.com/github/gh-aw/pkg/typeutil"import, which was only needed by the deleted function.pkg/workflow/compilerenv/manager_test.go— test clean-upTestResolveDefaultMaxAICreditsand all its subtests (env-var unset, plain integer, K/M suffix,-1sentinel, invalid values).Impact
ResolveDefaultMaxAICreditsis a public symbol. Any caller outside this repo that imported and called this function will fail to compile.deadcodeconfirmed zero callers exist in the repo tree; the env-varGH_AW_DEFAULT_MAX_AI_CREDITSis no longer read at runtime.pkg/typeutilimport dropped frommanager.go; no other consumers oftypeutilin this file.Why this is safe
deadcodestatic analyser flaggedResolveDefaultMaxAICreditsas unreachable — confirmed by the commit message: "no callers outside test files".ResolveDefaultMaxTurns(same file, same pattern) is not removed and remains intact.Checklist
deadcode)