Skip to content

Expand dead_code_handling to cover redundant conditions found by coverage tools#2278

Merged
hiroshinishio merged 1 commit intomainfrom
wes
Feb 19, 2026
Merged

Expand dead_code_handling to cover redundant conditions found by coverage tools#2278
hiroshinishio merged 1 commit intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Collaborator

@hiroshinishio hiroshinishio commented Feb 19, 2026

Summary

  • Expanded the <dead_code_handling> section in coding_standards.xml to cover redundant conditions revealed by coverage tools (not just linters)
  • Added a concrete before/after example: redundant truthiness checks inside an else block where the variable is guaranteed truthy
  • This prevents GitAuto from trying to test unreachable V8 branches instead of refactoring the dead code

Context

foxden-admin-portal PR #483 failed because GitAuto tried to test unreachable branches caused by redundant conditions inside an else block. The existing dead_code_handling rule only covered linter-flagged dead code. Now it also covers coverage-reported unreachable branches.

Social Media Post (GitAuto)

Coverage flagged two uncovered branches. Our agent burned 50 iterations trying to test them, then OOM'd. They were unreachable - redundant null checks inside an else block where the variable was already guaranteed to exist. V8 counts those checks as branches even when they can never be false. New rule: fix the dead code, don't chase the test.

Social Media Post (Wes)

Agent burned 50 iterations trying to cover two lines, then OOM'd. Traced it - dead code. A redundant null check inside an else block where the variable is guaranteed truthy. V8 sees it as a branch that can never be false. Remove the check, 100% coverage. The answer was refactoring, not testing.

@hiroshinishio hiroshinishio self-assigned this Feb 19, 2026
@hiroshinishio hiroshinishio merged commit f3c38e1 into main Feb 19, 2026
@hiroshinishio hiroshinishio deleted the wes branch February 19, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant