Skip to content

test(tar-xz): close 7 coverage partials with surgical v8 ignores#130

Merged
oorabona merged 1 commit into
masterfrom
test/coverage-wraps-sweep
Apr 30, 2026
Merged

test(tar-xz): close 7 coverage partials with surgical v8 ignores#130
oorabona merged 1 commit into
masterfrom
test/coverage-wraps-sweep

Conversation

@oorabona
Copy link
Copy Markdown
Owner

Summary

Close 7 coverage partials in packages/tar-xz/ via surgical v8 ignore start/stop wraps. Each wrap discloses its category in the rationale comment per the project convention authorized 2026-04-30: WRAP is acceptable for branches that are EITHER physically unreachable via the public API OR reachable-but-negative-ROI (fixture cost > catch value).

Wraps applied (7)

File Lines Category Branch
file.ts ~402 negative-ROI writeFileEntryWin32 mtime=0 false branch (Windows-only, fixture cost > value)
file.ts ~543 negative-ROI extractFile uncommon entry types (CHARDEV/BLOCKDEV/FIFO/CONTIGUOUS — no public API produces them)
format.ts ~98 unreachable writeString TS noUncheckedIndexedAccess guard (bytes[i] always defined within bound)
format.ts ~170 unreachable parseHeader header[156] guard (after 512-byte validation)
format.ts ~180 unreachable parseHeader empty-string predicate via extracted isEmptyChar const (String.fromCharCode always returns 1-char)
checksum.ts ~32 unreachable calculateChecksum header[i] guard (after 512-byte validation)
tar-parser.ts ~348, ~376 unreachable parseTar state-machine invariant (phase === 'PADDING' always true here) — surgical 2-pragma split

Senior pre-push review

Two-pass senior Opus review: first pass flagged 3 over-suppressed wraps that masked EXECUTED code (if-true bodies, ternary's tested arm). Implementer applied 3 fixes per verbatim recipe — narrowed to surgical scope, extracted const for ternary case, split wide wrap into two 1-line pragmas. Re-pass senior: SAFE-TO-PUSH, all wraps verified minimal-scope and correctly classified.

Honest disclosure

One NEW partial is now exposed at format.ts:186 — the ternary's === '\0' arm (legacy null typeflag, header[156] === 0). No existing test exercises this case. The previous wide wrap suppressed it silently; this PR narrows the wrap so the partial becomes visible. A 1-test follow-up could close it cleanly via a hand-crafted 512-byte header buffer with header[156] = 0. Tracked for PR-θ2.

Net coverage delta

  • Branch partials in scope: 7 → 1 (the new format.ts:186 exposure).
  • Total packages/tar-xz/ partials: ~13 → ~7 (6 remaining TEST candidates from prior analysis + the new exposure).
  • No behavior change. Diff is +29 -4.

Test plan

  • CI passes (lint, typecheck, tests, smoke matrix)
  • Codecov reports checksum.ts, tar-parser.ts at 100% lines/branches; format.ts shows the :186 partial honestly; file.ts partial count unchanged for the 2 wrap targets
  • No regressions on packages/tar-xz/test/ (208 tests still pass)

Add v8 ignore start/stop wraps for unreachable code paths across
checksum, format, file, and tar-parser modules. Each wrap targets a
specific invariant (state-machine phases, validated input bounds,
TS index guards) or negative-ROI Windows-only branch. Closes 7
partials; 1 new partial honestly exposed (legacy typeflag null arm).
@oorabona oorabona merged commit de86c0c into master Apr 30, 2026
18 checks passed
@oorabona oorabona deleted the test/coverage-wraps-sweep branch April 30, 2026 22:04
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