main
1// The large differential campaign of the tree-entry name checks (#207): src/validate.ts against the version before it
2// (test/oracle/dotnames-ref.ts), on isDotGitName, isDotFileName × 4 and checkoutPathRefusal's isHfsDot(.gitmodules).
3// node --import ./test/ts-resolve.mjs test/fuzz/dotnames.mjs [--n 10000000] [--seed 207] [--stage all|exhaustive|targeted|random]
4// Stages: every byte string up to 3 bytes (16.8 M); every string up to 4 bytes over 38 bytes (FOUR); every spelling × head ×
5// tail with its truncations, substitutions by the alphabet, deletions, doublings and ignorables inserted; random names
6// from spelling fragments. Prints each stage's count, how many names spell something (so a green run is known not to be
7// vacuous), and the first disagreement as hex bytes.
8// Stage `git` is the one whose oracle is not ply: every --git-stride-th targeted name and the first --git-n random
9// names of the seed, each a one-entry symlink tree judged by `git fsck --strict` (test/fuzz/git-names.mjs), against
10// src/validate.ts. The other stages compare src with the pre-#207 ply and prove only that the rewrite changed nothing.
11// node --import ./test/ts-resolve.mjs test/fuzz/dotnames.mjs --stage git [--git-n 20000] [--git-stride 997] [--seed 207]
12import { ALPHABET, ALL_BYTES, exhaustive, targeted, rng, randomName, judge, hfsGitmodules, verdicts } from '../dotnames-corpus.js';
13import { gitNameVerdicts, MSG_IDS } from './git-names.mjs';
15const args = Object.fromEntries(process.argv.slice(2).map((a, i, arr) => (a.startsWith('--') ? [a.slice(2), arr[i + 1] ?? true] : [])).filter(x => x.length));
16const N = Number(args.n ?? 10_000_000), SEED = Number(args.seed ?? 207), STAGE = args.stage ?? 'all';
17const GIT_N = Number(args['git-n'] ?? 20_000), GIT_STRIDE = Number(args['git-stride'] ?? 997);
18console.log(`dotnames: seed=${SEED} n=${N} stage=${STAGE} git-n=${GIT_N} git-stride=${GIT_STRIDE}`);
19let failed = false;
20const stage = (name, names) => {
21 if (STAGE !== 'all' && !name.startsWith(STAGE)) return;
22 const t0 = Date.now();
23 const stats = { n: 0, hits: 0 };
24 const bad = judge(names, stats);
25 console.log(`${name.padEnd(26)} ${String(stats.n).padStart(11)} names ${String(stats.hits).padStart(9)} spell something ${((Date.now() - t0) / 1000).toFixed(1)} s${bad ? ` DISAGREE ${JSON.stringify(bad)}` : ''}`);
26 if (bad) failed = true;
27};
28stage('exhaustive all bytes ≤ 3', exhaustive(ALL_BYTES, 3));
29// 4 bytes reach `.git`, `~1`+tail and an ignorable + `.`: the separators, `~`, digits at the range edges, the letters of
30// git and of the short names, and the UTF-8 bytes of the ignorables and their neighbours
31const FOUR = Uint8Array.from([0x00, 0x20, 0x2e, 0x2f, 0x3a, 0x5c, 0x7e, 0x30, 0x31, 0x34, 0x35, 0x39, 0x67, 0x69, 0x74, 0x47, 0x49, 0x54, 0x6d, 0x4d, 0x37, 0x65, 0x62, 0x61, 0x78, 0x80, 0x81, 0x8c, 0x8f, 0xae, 0xbb, 0xbf, 0xc2, 0xe2, 0xed, 0xef, 0xf0, 0xff]);
32stage(`exhaustive alphabet(${FOUR.length}) ≤ 4`, exhaustive(FOUR, 4));
33stage('targeted', targeted());
34const r = rng(SEED);
35stage(`random seed ${SEED}`, (function* () { for (let i = 0; i < N; i++) yield randomName(r); })());
36if (STAGE === 'all' || STAGE === 'hfs') {
37 let asked = 0, hits = 0, bad = null;
38 for (const b of targeted(undefined, undefined, ALPHABET.subarray(0, 24))) {
39 const v = hfsGitmodules(b);
40 if (v === null) continue;
41 asked++; if (v.want) hits++;
42 if (v.got !== v.want) { bad = [...b].map(x => x.toString(16)).join(' '); break; }
43 }
44 console.log(`hfs .gitmodules (checkout) ${String(asked).padStart(11)} names ${String(hits).padStart(9)} spell something${bad ? ` DISAGREE ${bad}` : ''}`);
45 if (bad) failed = true;
46}
47if (STAGE === 'all' || STAGE === 'git') {
48 const t0 = Date.now();
49 const names = [];
50 let k = 0;
51 // 997 is prime, so the sample is not the same position of every base's run of variants
52 for (const b of targeted()) if (k++ % GIT_STRIDE === 0) names.push(b);
53 const rg = rng(SEED);
54 for (let i = 0; i < GIT_N; i++) names.push(randomName(rg));
55 const git = gitNameVerdicts(names);
56 let judged = 0, hits = 0, bad = null;
57 for (let i = 0; i < names.length; i++) {
58 const want = git[i];
59 if (want === null) continue;
60 judged++; if (want !== '00000') hits++;
61 const got = verdicts(names[i], 'src');
62 if (got !== want && !bad) bad = { bytes: [...names[i]].map(x => x.toString(16).padStart(2, '0')).join(' '), git: want, ply: got, order: MSG_IDS.join(',') };
63 }
64 console.log(`${'git fsck --strict'.padEnd(26)} ${String(judged).padStart(11)} names ${String(hits).padStart(9)} spell something ${((Date.now() - t0) / 1000).toFixed(1)} s${bad ? ` DISAGREE ${JSON.stringify(bad)}` : ''}`);
65 // a green run with nothing judged, or nothing git objects to, proves nothing
66 if (judged === 0 || hits === 0) { console.log('git stage is vacuous: no name judged, or none that git flags'); failed = true; }
67 if (bad) failed = true;
68}
69if (failed) {
70 console.log(`FAIL dotnames seed=${SEED} replay: node --import ./test/ts-resolve.mjs test/fuzz/dotnames.mjs --seed ${SEED} --n ${N} --stage ${STAGE} --git-n ${GIT_N} --git-stride ${GIT_STRIDE}`);
71 process.exit(1);
72}
Diagnostics4 git calls · 301 ms
CallStatusSizeTime0301 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
fetch2002.2 KiB296 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=296 git.response.bytes=2251 git.response.cache=MISS git.response.duration_ms=296 git.fetch.wants=c0668673b8d78460aafc4cc0337e72db39ea7d0e 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=2251 git.pkt.payload.max=2230 git.sideband.band1.bytes=2229 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
- a5e2d9889aac14c2
- Request
- 74cb3065…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format