test(tar-xz): close extract.ts coverage partials with v8 ignores#129
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Close 5 defensive-unreachable branches in
packages/tar-xz/src/node/extract.tsby wrapping impossible parser states withv8 ignore start/stopmarkers:drainEntryChunks:done:trueguard (parseTar always emits'end'first)createEntryDataPull:dataGenInFlightcondition guard (existing wrap relocated up to cover the if-condition itself)makeDataGen:done:trueguard (same parseTar invariant)extractouter loop:done:trueguard (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:
parseTareither yields{kind:'end'}then returns (line 271-272 oftar-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/stopfor defensive-unreachable branches rather than adversarial mocking (mocking external systems is forbidden byCLAUDE.md).Coverage: extract.ts 93.75% → 100% lines, 5 → 0 partials. Diff is +8 -2.
Test plan
extract.tsat 100% lines / 0 partials post-mergepackages/tar-xz/test/(208 tests should still pass)