main
1// Nightly deep fuzz, one fuzzer per call: node scripts/nightly-fuzz.mjs <seed> <fuzzer.mjs> [args...]
2// Runs test/fuzz/<fuzzer.mjs> --seed <seed> [args...], streams its output, and on failure prints the seed, the failing
3// cases and one `reproduce:` command per case (the lines the nightly issue quotes), plus a step summary on Actions.
4import { spawn } from 'node:child_process';
5import { appendFileSync } from 'node:fs';
6import { fileURLToPath } from 'node:url';
8const [seedArg, fuzzer, ...rest] = process.argv.slice(2);
9if (!/^\d+$/.test(seedArg ?? '') || !/^[a-z-]+\.mjs$/.test(fuzzer ?? '')) {
10 console.error('usage: node scripts/nightly-fuzz.mjs <seed> <fuzzer.mjs> [args...]');
11 process.exit(2);
12}
13const seed = seedArg;
14const argv = [`test/fuzz/${fuzzer}`, '--seed', seed, ...rest];
15const base = `node ${argv.join(' ')}`;
16const q = s => `'${String(s).replace(/'/g, `'\\''`)}'`;
17const n = (() => { const i = rest.indexOf('--n'); return i < 0 ? null : rest[i + 1]; })();
18const flags = rest.filter((a, i) => a !== '--n' && rest[i - 1] !== '--n');
19const withN = k => `node test/fuzz/${fuzzer} --seed ${seed} --n ${k} ${flags.join(' ')}`.trim();
21// one reproduce command per failing case, from the line the fuzzer prints for it
22const RULES = [
23 [/repro: (node test\/fuzz\/\S+ --case \d+)/, m => m[1]], // run, hostile, liar, protocol: the case seed alone
24 [/^FAIL #\s*(\d+)/, m => withN(+m[1] + 1)], // packs, packgen, codec: one stream from --seed, case i is the (i+1)th
25 // below-hash, git-semantic: a random case `kind#<seed>` is picked by its seed, a fixed case by its name
26 [/^(?:FAIL|DIVERGE)\s+(\S+?):?\s/, m => `${withN(n ?? 20)} --case ${/#(\d+)$/.test(m[1]) ? m[1].match(/#(\d+)$/)[1] : q(m[1])}`],
27 [/^WRONG case (\d+)/, m => `${withN(n ?? 2000)} --case ${m[1]}`], // linemerge
28 [/^case (\d+) \(seed/, m => `${withN(n ?? 200)} --case ${m[1]}`], // attributes
29 [/^case (\d+): n=/, m => withN(+m[1] + 1)], // diffscript: no --case; the (c+1)th diff of this seed
30];
32const out = [];
33// src/ keeps .js specifiers for .ts files; the hook resolves them under plain node (test/ts-resolve.mjs).
34const hook = fileURLToPath(new URL('../test/ts-resolve.mjs', import.meta.url));
35const child = spawn(process.execPath, ['--import', hook, ...argv], { stdio: ['ignore', 'pipe', 'pipe'] });
36let buf = '';
37const onData = (stream, d) => { stream.write(d); buf += d; let i; while ((i = buf.indexOf('\n')) >= 0) { out.push(buf.slice(0, i)); buf = buf.slice(i + 1); } };
38child.stdout.on('data', d => onData(process.stdout, d));
39child.stderr.on('data', d => onData(process.stderr, d));
40const code = await new Promise(r => child.on('close', (c, sig) => r(c ?? (sig ? 128 : 1))));
41if (buf) out.push(buf);
42if (code === 0) process.exit(0);
44const repro = [];
45for (const line of out) {
46 for (const [re, f] of RULES) { const m = line.trim().match(re); if (m) { repro.push(f(m)); break; } }
47}
48const uniq = [...new Set(repro)];
49if (!uniq.length) uniq.push(base); // a crash, or no per-case line: the whole run is deterministic from the seed
50const lines = [`NIGHTLY-FAIL ${fuzzer} seed=${seed} exit=${code} command: ${base}`, ...uniq.slice(0, 10).map(c => `NIGHTLY-FAIL ${fuzzer} seed=${seed} reproduce: ${c}`)];
51if (uniq.length > 10) lines.push(`NIGHTLY-FAIL ${fuzzer} seed=${seed} ... ${uniq.length - 10} more failing cases`);
52console.log('\n' + lines.join('\n'));
53for (const l of lines) console.log(`::error title=${fuzzer} seed ${seed}::${l}`);
54if (process.env.GITHUB_STEP_SUMMARY) appendFileSync(process.env.GITHUB_STEP_SUMMARY, `### ${fuzzer} failed (seed ${seed})\n\n\`\`\`\n${lines.join('\n')}\n\`\`\`\n`);
55process.exit(code);
Diagnostics4 git calls · 27 ms
CallStatusSizeTime027 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 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=3 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=55Open pack map
fetch2001.7 KiB · hit22 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=21 git.response.bytes=1753 git.response.cache=HIT git.response.duration_ms=22 git.fetch.wants=743149c0e04dfa97388a5f13c9b96b66356267c5 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=1753 git.pkt.payload.max=1732 git.sideband.band1.bytes=1731 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
- a5e13ed38f341293
- Request
- 58d4e08d…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format