Artifactspublic-v0

ply

main
ply4 git calls40 ms39 KiB3 cachedprotocol v2
52 lines3.7 KiBRaw
1// Merge NODE_V8_COVERAGE output from many processes into per-file line coverage for src/, listing uncovered lines.
2// NODE_V8_COVERAGE=/tmp/cov node --test ... && node test/fuzz/*.mjs ...; node test/coverage.mjs /tmp/cov [--lines]
3import { readdirSync, readFileSync } from 'node:fs';
4import { join, relative } from 'node:path';
5import { fileURLToPath } from 'node:url';
7const dir = process.argv[2] ?? '/tmp/cov';
8const showLines = process.argv.includes('--lines');
9const srcRoot = fileURLToPath(new URL('../src/', import.meta.url));
11// per file: max count seen per byte offset (union across processes = max over all ranges that cover the byte)
12const files = new Map(); // url → { source, counts: Int32Array }
13for (const f of readdirSync(dir)) {
14 if (!f.endsWith('.json')) continue;
15 const j = JSON.parse(readFileSync(join(dir, f), 'utf8'));
16 for (const s of j.result) {
17 if (!s.url.startsWith('file://') || !fileURLToPath(s.url).startsWith(srcRoot)) continue;
18 const path = fileURLToPath(s.url);
19 if (!files.has(s.url)) { const source = readFileSync(path, 'utf8'); files.set(s.url, { path, source, counts: new Int32Array(source.length).fill(-1) }); }
20 const { counts } = files.get(s.url);
21 // V8 block coverage: ranges are nested; apply outer first then inner so inner overrides. Sort by start asc, end desc.
22 const ranges = s.functions.flatMap(fn => fn.ranges.map(r => ({ ...r, block: fn.isBlockCoverage })));
23 ranges.sort((a, b) => a.startOffset - b.startOffset || b.endOffset - a.endOffset);
24 const local = new Int32Array(counts.length).fill(-1);
25 for (const r of ranges) local.fill(r.count, r.startOffset, r.endOffset);
26 for (let i = 0; i < counts.length; i++) if (local[i] > counts[i]) counts[i] = local[i];
27 }
30const rows = [];
31let totLines = 0, totCovered = 0;
32for (const [, { path, source, counts }] of [...files].sort()) {
33 const lines = source.split('\n');
34 let off = 0, covered = 0, executable = 0; const uncovered = [];
35 for (let i = 0; i < lines.length; i++) {
36 const line = lines[i], start = off, end = off + line.length; off = end + 1;
37 const code = line.trim();
38 if (!code || code.startsWith('//') || code === '}' || code === '};' || code === ');' || code.startsWith('import ') || code.startsWith('export {') || /^(export )?(const|let) [A-Z_]+ = /.test(code) && !code.includes('=>') && !code.includes('(')) continue;
39 // a line is covered if any non-whitespace byte in it has count > 0; uncovered if all its bytes are 0; unknown (-1) is skipped
40 let any = false, zero = false, known = false;
41 for (let p = start; p < end; p++) { if (/\s/.test(source[p])) continue; const c = counts[p]; if (c < 0) continue; known = true; if (c > 0) { any = true; break; } else zero = true; }
42 if (!known) continue;
43 executable++;
44 if (any) covered++; else uncovered.push(i + 1);
45 }
46 totLines += executable; totCovered += covered;
47 rows.push({ file: relative(srcRoot, path), executable, covered, pct: executable ? (100 * covered / executable) : 100, uncovered });
49const ranges = u => { const out = []; for (let i = 0; i < u.length; i++) { let j = i; while (j + 1 < u.length && u[j + 1] === u[j] + 1) j++; out.push(i === j ? `${u[i]}` : `${u[i]}-${u[j]}`); i = j; } return out.join(','); };
50console.log('file'.padEnd(14), 'lines'.padStart(6), 'cov'.padStart(6), 'pct'.padStart(7));
51for (const r of rows) console.log(r.file.padEnd(14), String(r.executable).padStart(6), String(r.covered).padStart(6), (r.pct.toFixed(1) + '%').padStart(7), showLines && r.uncovered.length ? ' uncovered: ' + ranges(r.uncovered) : '');
52console.log('TOTAL'.padEnd(14), String(totLines).padStart(6), String(totCovered).padStart(6), ((100 * totCovered / totLines).toFixed(1) + '%').padStart(7));
Diagnostics4 git calls · 40 ms
CallStatusSizeTime040 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200145 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=145
git.pkt.payload.max=76
git.ls_refs.count=2
git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=35
git.response.bytes=38434
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=6
git.pkt.data=4
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=38434
git.pkt.payload.max=38339
git.sideband.band1.bytes=38338
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=63
git.pack.bytes=38338
git.pack.ofs_delta=0
git.pack.ref_delta=8
git.pack.chain.max=8
git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77
git.pack.full=55
Open pack map
fetch2001.6 KiB · hit35 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1631
git.response.cache=HIT
git.response.duration_ms=35
git.fetch.wants=6e6ff95121b6e640b1b21cd2d9ae0db95cfefe61
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1631
git.pkt.payload.max=1610
git.sideband.band1.bytes=1609
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
Ref
refs/heads/main
Commit
19912563f540228593df0c489082e5e2508e21e4
cf-ray
a5e19001dcf65b65
Request
4af10ebc…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format