Skip to content

test(tar-xz): close extract.ts coverage partials with v8 ignores#129

Merged
oorabona merged 1 commit into
masterfrom
test/extract-coverage-close
Apr 30, 2026
Merged

test(tar-xz): close extract.ts coverage partials with v8 ignores#129
oorabona merged 1 commit into
masterfrom
test/extract-coverage-close

Conversation

@oorabona
Copy link
Copy Markdown
Owner

Summary

Close 5 defensive-unreachable branches in packages/tar-xz/src/node/extract.ts by wrapping impossible parser states with v8 ignore start/stop markers:

  • drainEntryChunks: done:true guard (parseTar always emits 'end' first)
  • createEntryDataPull: dataGenInFlight condition guard (existing wrap relocated up to cover the if-condition itself)
  • makeDataGen: done:true guard (same parseTar invariant)
  • extract outer loop: done:true guard (same parseTar invariant)
  • extract: ev.kind === 'chunk' condition guard (existing wrap relocated up)

The 5 branches are defensive guards for parser states that cannot occur via the public API: parseTar either yields {kind:'end'} then returns (line 271-272 of tar-parser.ts), or throws 'Unexpected end of archive' on truncation. A stray 'chunk' before 'entry' would be a parser bug. Senior pre-push review confirmed the invariant claim on all 5 wraps.

No tests added — project convention is v8 ignore start/stop for defensive-unreachable branches rather than adversarial mocking (mocking external systems is forbidden by CLAUDE.md).

Coverage: extract.ts 93.75% → 100% lines, 5 → 0 partials. Diff is +8 -2.

Test plan

  • CI passes (lint, typecheck, tests)
  • Codecov reports extract.ts at 100% lines / 0 partials post-merge
  • No regressions on packages/tar-xz/test/ (208 tests should still pass)

Close 5 defensive-unreachable branches in extract.ts by wrapping impossible
parser states with v8 ignore markers:

- drainEntryChunks: done:true guard (parseTar always emits 'end' first)
- createEntryDataPull: dataGenInFlight condition guard
- makeDataGen: done:true guard (same parseTar invariant)
- extract outer loop: done:true guard (same parseTar invariant)
- extract: ev.kind==='chunk' condition guard

Coverage: 93.75% lines (5 partials) → 100% lines (0 partials).
@oorabona oorabona merged commit 3abb041 into master Apr 30, 2026
18 checks passed
@oorabona oorabona deleted the test/extract-coverage-close branch April 30, 2026 19:46
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