Skip to content

test: close targeted coverage gaps (85.1% → 90.9%) - #5

Merged
tanem merged 6 commits into
mainfrom
test/targeted-coverage-gaps
Jun 14, 2026
Merged

test: close targeted coverage gaps (85.1% → 90.9%)#5
tanem merged 6 commits into
mainfrom
test/targeted-coverage-gaps

Conversation

@tanem

@tanem tanem commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Adds characterization tests for genuine, user-facing behaviour that wasn't exercised, lifting total statement coverage from 85.1% to 90.9% without touching any production code. Coverage here is the diagnostic, not the goal — each test pins a behaviour a user can actually trigger, and the deliberately-untestable seams are left alone on purpose.

New coverage:

  • CLI behaviours (cli_test.go): accounts --json, flag-parse errors for pnl/accounts, invalid pnl --from, the set-passphrase non-interactive-terminal guard, and --help.
  • Range/path helpers (args_test.go): expandTilde (~ / ~/ expansion) and resolveRange's invalid --to branch.
  • Snapshot decoding (internal/snapshot/snapshot_test.go): malformed schema versions (non-numeric major/minor) and Read's gzip-decompress and JSON-parse error branches. The latter two needed fixtures that are valid age wrapping a bad payload, so internal/snaptest gained two helpers (WriteAge, WriteGzip) via a behaviour-preserving refactor of Write.

Package deltas: root main 76.8% → 85.1%, internal/snapshot 85.3% → 97.1%.

Out of scope by design (and left untested): main()'s os.Exit wiring, the set-passphrase happy path (real TTY + keychain write — per CLAUDE.md), os.UserHomeDir failure, and tabwriter flush errors. Chasing those would mean either coverage theatre or contorting code that's deliberately structured to keep them out of the testable path.

Spec and implementation plan are included under docs/superpowers/.

Test plan

  • go test ./... -race green on the dev machine
  • CI green across ubuntu/macos/windows (the expandTilde and set-passphrase tests derive home dir from os.UserHomeDir() and rely on non-TTY stdin respectively — both chosen for cross-platform safety)

🤖 Generated with Claude Code

tanem and others added 6 commits June 14, 2026 19:12
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tanem
tanem merged commit 94cd381 into main Jun 14, 2026
4 checks passed
@tanem
tanem deleted the test/targeted-coverage-gaps branch June 15, 2026 01:29
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