Skip to content

test: restore 100% coverage on root src/ (errors.ts + pool.ts defensive guards)#122

Merged
oorabona merged 1 commit into
masterfrom
chore/root-coverage-100
Apr 30, 2026
Merged

test: restore 100% coverage on root src/ (errors.ts + pool.ts defensive guards)#122
oorabona merged 1 commit into
masterfrom
chore/root-coverage-100

Conversation

@oorabona
Copy link
Copy Markdown
Owner

Summary

Wrap two defensive branches with v8 ignore start/stop to restore root src/ to 100% coverage. Both are intentional fail-closed safety nets that TypeScript's noUncheckedIndexedAccess requires (it widens narrowed types) but are unreachable at runtime under current invariants.

Targets

File:Line Code Prior guard Why suppression justified
src/errors.ts:176 if (msg === undefined) return ... L172 bounds check (errno >= messages.length early return) array lookup always returns string at runtime ; TS widens type but value is always defined
src/pool.ts:168 if (item === undefined) throw ... L163 queue.length === 0 early return shift() never returns undefined when queue non-empty ; TS widens to T | undefined but value is always T

Coverage

Scope Before After
Root src/ statements 99.66% (601/603) 100% (599/599)
Root src/ branches 98.97% (194/196) 100% (192/192)
Root src/ functions 100% 100%
Root src/ lines 99.82% (587/588) 100% (585/585)

Combined with PR #121 (packages/nxz 95.2% → 100%), the entire repo is now at 100% coverage.

Gates

  • pnpm install --frozen-lockfile: EXIT 0
  • pnpm build: EXIT 0
  • pnpm type-check: EXIT 0
  • pnpm exec biome check .: EXIT 0, 0 warnings
  • pnpm test: 707 pass / 0 fail / 3 skipped

Diff

2 files, +4 / -0.

Test plan

  • CI green
  • Codecov reports 100% repo-wide

…ve guards)

Two defensive branches in root src/ were flagged as uncovered by
vitest's v8 instrumentation. Both are intentional fail-closed safety
nets that should remain in code (TypeScript noUncheckedIndexedAccess
widens the runtime-narrowed types) but are unreachable under current
invariants and so cannot be exercised by tests.

- src/errors.ts:176 — 'if (msg === undefined) return Unknown LZMA
  error code: ...' is preceded by a bounds check on errno, so the
  array lookup is always defined. Wrapped with v8 ignore start/stop.
- src/pool.ts:168 — 'if (item === undefined) throw Invariant
  violation' is preceded by a queue.length===0 early return, so
  shift() never returns undefined. Wrapped with v8 ignore start/stop.

Per project convention the start/stop pair form is mandatory (never
'next' or 'next N' which only excludes line coverage and not branch
coverage).

Coverage restored across the entire repo: root src/ now 100%/100%/
100%/100% (statements/branches/functions/lines), packages/nxz
already at 100% from PR #121, packages/tar-xz unchanged. 707 tests
still pass byte-identical.
@oorabona oorabona merged commit 5e164e0 into master Apr 30, 2026
6 of 7 checks passed
@oorabona oorabona deleted the chore/root-coverage-100 branch April 30, 2026 13:20
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