fix(v8): catch boundary lines#25
Merged
Merged
Conversation
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.
This step completes @pokujs/coverage against Node.js ✨
Steps
🐢 Node.js(easy)TypeScript(medium)Poku codebase vs. @pokujs/coverage, @pokujs/c8, and @pokujs/monocart.
Headline counts
Each reporter consumed the same Poku run via plugin teardown. Differences in entry counts and verdicts are entirely about how each reporter post-processes V8 dumps.
The headline numbers above conflate two distinct entry kinds. The breakdown below tells the actual story:
Suspect findings: @pokujs/c8
Esbuild-wrapper functions (18 entries)
c8 emits tsx-injected CJS wrappers as named functions at line 1 of every
.tssource:__name,__copyProps,__toCommonJS,__toESM,get. These positions don't exist in source. Worse, c8 frequently emits duplicate FN/FNDA pairs for the same wrapper in the same file, one with the real count and one stale withFNDA:0. Examples:src/parsers/get-runtime.ts: emitsFNDA:0,getRuntimeANDFNDA:1,getRuntime(duplicate, while coverage and monocart emit only one entry).src/builders/assert.ts: emitsFN:107,doesNotThrow(count 0) ANDFN:107,doesNotThrow(count 28).These are pipeline artifacts, not code that needs tests.
Real line/function suspects (310 entries, top files)
src/builders/assert.tssrc/modules/helpers/describe.tssrc/bin/index.tssrc/services/reporters/poku.tssrc/modules/helpers/modifiers.tssrc/modules/helpers/it/core.tssrc/services/format.tssrc/services/run-test-file.tssrc/modules/essentials/poku.tsPattern: c8 reports whole blocks of executed code as
DA:N,0when the surrounding V8 ranges show clear hits. Spot-check onsrc/builders/assert.ts:107–139: V8 reportscount > 0on every line, coverage and monocart agree, and c8 reportsDA:107,0...DA:139,0. This is c8 attributing source-mapped offsets to the wrong V8 range, losing entire function bodies in the report.c8 also produces the structurally most divergent reports: e.g.
bin/index.tsshowsFNH:0(no functions hit) despite all five real functions clearly executing.c8 verdict: not faithful to V8. 310 real-line-or-function suspects + 18 wrapper ghosts on the Poku codebase. Recommend not relying on c8 for measuring Poku's Node.js coverage.
Suspect findings: @pokujs/monocart
src/parsers/get-runtime.tsDA:N,0, but V8 says hit=1 on all three (single-process branches).src/parsers/get-runner.tsDA:N,0, but V8 says hit=114 / hit=212.src/services/watch.tssrc/services/pid.tssrc/modules/plugins.ts} catch {reported as 0, but V8 says hit=37.src/modules/helpers/kill.tssrc/services/run-test-file.tssrc/modules/helpers/create-service.tsPattern: monocart drops hits on lines that V8 marks executed in every loaded process (e.g.
pid.ts:26: V8 reports hit=206/206, monocart reportsDA:26,0). This is a hard pipeline bug: monocart's V8-to-source-map remap is producing zero-counts on positions where V8 unambiguously says > 0.Notable:
parsers/get-runtime.ts:5–7is the canonical case, with three single-process conditionals, eachhit=1in V8, all reported0by monocart. Coverage reports them correctly.monocart verdict: not faithful to V8 on Poku. 14 real-line + 11 branch-line suspects on a 40-entry sample. The reporter under-counts execution on every file with conditional flow control.
Findings: @pokujs/coverage
0 suspects. All 315 uncovered entries are confirmed faithful to V8: 184 lines, 7 functions, 124 branches.
Edge case retained as faithful:
src/modules/helpers/kill.ts:13(isWindows)V8 emits no sub-range that isolates L13 from L14/L15. The only enveloping range is the outer arrow callback. Per the SKILL caveat ("treat as uncovered legitimately when the surrounding context also lacks hits in the same code block"), L13 is faithful: Istanbul attributes the ternary condition to the bodies that follow, all of which are correctly zero.
Branches (124) and functions (7)
FNDA:0functions are declarations whose body never executed (callbacks stored but not invoked, SIGINT handlers not triggered,killarrow defined but unused). Istanbul convention treatsFNDA:0as the correct label for these.count = 0, or to lines where the entire line hashit = 0. Spot-checks onbin/index.ts:14(--versionflag never passed),parsers/get-runtime.ts:5–7(single-process conditional arms),polyfills/jsonc.ts:49–50(line-comment path unused) all confirm V8 agreement at the arm level.coverage verdict: faithful to V8.
Structural divergences (not bugs)
These are reporting-shape differences, not faithfulness issues:
LF(lines found) accounting:bin/index.tsreportsLF:196against a 260-line source (executable lines only).bin/help.tsreportsLF:9against a 99-line source.LF:260matching the source line count, but treats blank lines and comments as executable (over-counts).FN(functions) accounting:bin/help.ts→FNF:4.bin/help.ts→FNF:9.__name,__copyProps, etc.) often duplicated.bin/help.ts→FNF:6with five wrappers.Anonymous-function naming:
(anonymous_N)numbered relative to the source.(anonymous_N)plus mangled paths likeObject.assign.ok.ok,import_each.each.before.cb.These differences explain why aggregate percentages diverge across reporters even when all three agree on what was executed.
Final verdict
get-runtime.ts:5–7,pid.ts:26,pid.ts:61).builders/assert.ts:107–139). Structurally divergent (FNH:0forbin/index.ts).Bottom line: @pokujs/coverage is the only one of the three Node.js reporters that produces an LCOV faithful to the raw V8 evidence on the Poku codebase.