Skip to content

tests: tighten coverage by retiring unreachable defensive code#2

Merged
TeoSlayer merged 1 commit into
mainfrom
coverage-housekeeping
May 28, 2026
Merged

tests: tighten coverage by retiring unreachable defensive code#2
TeoSlayer merged 1 commit into
mainfrom
coverage-housekeeping

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

Two unreachable branches dropped:

  • ParseResponse (wire.go): the len(lines) == 0 guard cannot fire because strings.Split always returns >= 1 element. The empty case is still caught by the len(fields) < 1 check.
  • save (records.go): json.MarshalIndent cannot fail on recordSnapshot — string/uint16/time.Time only.

Left in place: 60-second reapLoop ticker body, the SetStorePath("") guard, and the MkdirAll/AtomicWrite error branches (real filesystem failure modes worth keeping).

Coverage

  • Before: 98.2%
  • After: 99.0%

Test plan

  • go test -race -count=1 -timeout 120s ./... passes

Two unreachable branches dropped:

1. ParseResponse (wire.go): the len(lines) == 0 guard cannot fire
   because strings.Split always returns at least one element. The real
   empty case is caught by the subsequent len(fields) < 1 check.

2. save (records.go): the json.MarshalIndent error branch cannot fire
   on recordSnapshot — every field is a string, uint16, or time.Time,
   no exotic types.

Left in place: the 60-second reapLoop ticker, the no-op
SetStorePath("") guard, and the MkdirAll/AtomicWrite error branches
(real filesystem failure modes worth keeping). Coverage 98.2% -> 99.0%.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit 9a61bf9 into main May 28, 2026
2 checks passed
@TeoSlayer TeoSlayer deleted the coverage-housekeeping branch May 28, 2026 02:22
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.

2 participants