Artifactspublic-v0

ply

main
ply4 git calls28 ms41 KiB3 cachedprotocol v2
138 lines8.5 KiBRaw
1// Names for the differential test of the tree-entry name checks (#207): src/validate.ts against the version before it
2// (test/oracle/dotnames-ref.ts). Shared by test/dotnames.test.js (sizes a mutation run can afford) and
3// test/fuzz/dotnames.mjs (the large campaign). Every generator yields Uint8Arrays; the judge compares every predicate.
4import { isDotGitName, isDotFileName, checkoutPathRefusal } from '../src/validate.js';
5import { isDotGitNameRef, isDotFileNameRef, isHfsDotRef } from './oracle/dotnames-ref.ts';
7export const FILES = ['gitmodules', 'gitignore', 'gitattributes', 'mailmap'];
8const enc = s => new TextEncoder().encode(s);
10// The bytes every check branches on: the end (NUL), the separators and NTFS tail bytes, `~` and the digits around the
11// short-name ranges, the letters of every needle in both cases (and a neighbour of each range), UTF-8 leads of every
12// length, continuation bytes at the range edges, the ignorables' bytes (E2 80 8C, E2 81 AF, EF BB BF), and bytes no
13// UTF-8 has.
14export const ALPHABET = Uint8Array.from(new Set([
15 0x00, 0x01, 0x20, 0x2e, 0x2f, 0x3a, 0x5c, 0x7e, 0x2d,
16 0x30, 0x31, 0x32, 0x34, 0x35, 0x37, 0x39, 0x3a,
17 ...enc('gitmodulesbaignorttrmlp7GITMODULESBAIGNORTTRMLP'), 0x40, 0x5b, 0x60, 0x7b, 0x41, 0x5a,
18 0x7f, 0x80, 0x81, 0x8c, 0x8f, 0x90, 0x9f, 0xa0, 0xaa, 0xaf, 0xbb, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xdf,
19 0xe0, 0xe2, 0xed, 0xee, 0xef, 0xf0, 0xf4, 0xf5, 0xf8, 0xfe, 0xff,
20]));
22// The spellings the checks look for, and near misses: every `.git` form, every dotfile's dot name, 6-character short
23// names ~1..~4 (and ~0, ~5), fallback short names (`<prefix>~N…`, `~1234567`), in both cases.
24const IGNORABLES = [[0xe2, 0x80, 0x8c], [0xe2, 0x80, 0x8d], [0xe2, 0x80, 0x8e], [0xe2, 0x80, 0x8f], [0xe2, 0x80, 0xaa], [0xe2, 0x80, 0xae], [0xe2, 0x80, 0xaf], [0xe2, 0x81, 0xaa], [0xe2, 0x81, 0xaf], [0xe2, 0x81, 0xb0], [0xe2, 0x80, 0x8b], [0xef, 0xbb, 0xbf], [0xef, 0xbb, 0xbe], [0xef, 0xbf, 0xbe], [0xed, 0xa0, 0x80], [0xc0, 0xae], [0xe0, 0x80, 0xae], [0xf0, 0x80, 0x80, 0xae]];
25export const SPELLINGS = [
26 '.git', 'git~1', 'git~2', 'GIT~1', '.GIT', '.gIt', 'gIT~1', 'gi~1', '.gi', 'git', '.g', '.', '~1', '~',
27 '.gitmodules', 'gitmod~1', 'gitmod~4', 'gitmod~5', 'gitmod~0', 'GITMOD~2', 'gi7eba~1', 'gi7eba~9', 'gi7eb~12', 'gi7e~123', 'gi~12345', 'g~123456', '~1234567', '~0234567', '~123456a', 'gi7eba~10',
28 '.gitignore', 'gitign~1', 'gi250a~1', 'gi250~12', '.gitattributes', 'gitatt~1', 'gi7d29~1', 'gi7d2~12', '.mailmap', 'mailma~1', 'maba30~1', 'maba3~12', 'MAILMA~3',
29 '.gitmodulesx', '.gitmodule', 'gitmodules', '.gitmodules~1', 'gitmodules~1',
30];
31export const TAILS = ['', '.', ' ', '. .', ' . ', ':', ':x', ':$DATA', '/', '/x', '\\', '\\x', 'x', '.x', ' x', '\0', '\0x', '~', '1', 'é', '€', '\u{1f600}', '‌'];
32// UTF-8 after a spelling, byte by byte: each length's first and last code point, and what git calls invalid (a stray
33// continuation, a cut sequence, C0/C1 leads, overlong 3- and 4-byte forms, a surrogate, U+FFFE/U+FFFF, above U+10FFFF,
34// a lead past F4)
35export const BYTE_TAILS = [
36 [0x7f], [0xc2, 0x80], [0xdf, 0xbf], [0xe0, 0xa0, 0x80], [0xef, 0xbf, 0xbd], [0xf0, 0x90, 0x80, 0x80], [0xf4, 0x8f, 0xbf, 0xbf],
37 [0x80], [0xbf], [0xc3], [0xe2, 0x80], [0xf0, 0x9f, 0x98], [0xc0, 0x80], [0xc1, 0xbf], [0xe0, 0x9f, 0xbf], [0xf0, 0x8f, 0xbf, 0xbf],
38 [0xed, 0xa0, 0x80], [0xed, 0x9f, 0xbf], [0xef, 0xbf, 0xbe], [0xef, 0xbf, 0xbf], [0xef, 0xbe, 0xbf], [0xf4, 0x90, 0x80, 0x80], [0xf5, 0x80, 0x80, 0x80],
39 [0xc3, 0x41], [0xe2, 0x41, 0x80], [0xe2, 0x80, 0x41], [0xf0, 0x41, 0x80, 0x80], [0xf0, 0x90, 0x41, 0x80], [0xf0, 0x90, 0x80, 0x41], [0xf8, 0x80, 0x80, 0x80, 0x80],
40];
41// The bytes the checks branch on, few enough for 4-byte strings and the mutation run's substitutions: the separators,
42// `~`, digits at the range edges, the letters of git and of the short names, and UTF-8 leads and continuations
43export const BRANCH_BYTES = 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]);
44export const HEADS = ['', 'a\\', '\\', 'a\\b\\', '\\\\', '.git\\', 'x', ' ', '‌'];
46// Every predicate the two sides answer, as one string: isDotGitName and isDotFileName × 4.
47export function verdicts(b, side) {
48 if (side === 'ref') return `${+isDotGitNameRef(b)}${FILES.map(f => +isDotFileNameRef(b, f)).join('')}`;
49 return `${+isDotGitName(b)}${FILES.map(f => +isDotFileName(b, f)).join('')}`;
51// isHfsDot(b, 'gitmodules') as checkoutPathRefusal asks it: a symlink on macOS at `<name>/x` (a component before the
52// last, where the NTFS spellings are not asked) is refused for the name exactly when it is .gitmodules (ASCII case
53// folded) or isHfsDot says so. Asked only of a name that can be such a component: no `/` or NUL, well-formed UTF-8 (the
54// path is a string), not `.`/`..`, no .git spelling (refused for that first). Null for any other name.
55const utf8 = new TextDecoder('utf-8', { ignoreBOM: true });
56export function hfsGitmodules(b) {
57 if (b.length === 0 || b.includes(0x2f) || b.includes(0) || isDotGitNameRef(b)) return null;
58 const s = utf8.decode(b);
59 const back = enc(s);
60 if (back.length !== b.length || !back.every((x, i) => x === b[i])) return null;
61 if (s === '.' || s === '..' || /^\.gitmodules$/i.test(s)) return null;
62 const r = checkoutPathRefusal(`${s}/x`, '120000', 'darwin');
63 if (!r.ok) return null;
64 return { got: r.value.tag === 'some', want: isHfsDotRef(b, 'gitmodules') };
67// ---- generators ----
68export function* exhaustive(alphabet, maxLen) {
69 yield new Uint8Array(0);
70 const a = alphabet.length;
71 for (let len = 1; len <= maxLen; len++) {
72 const idx = Array.from({ length: len }, () => 0);
73 for (;;) {
74 const b = new Uint8Array(len);
75 for (let k = 0; k < len; k++) b[k] = alphabet[idx[k]];
76 yield b;
77 let k = len - 1;
78 while (k >= 0 && ++idx[k] === a) idx[k--] = 0;
79 if (k < 0) break;
80 }
81 }
83export const ALL_BYTES = Uint8Array.from({ length: 256 }, (_, i) => i);
85// Each spelling × head × (tail, and byte tail); then of each: every truncation, every one-byte substitution by the
86// alphabet, every ignorable inserted at every position, each byte deleted, and each byte doubled.
87export function* targeted(heads = HEADS, tails = TAILS, alphabet = ALPHABET, byteTails = BYTE_TAILS, spellings = SPELLINGS) {
88 const bases = [];
89 for (const s of spellings) for (const h of heads) {
90 for (const t of tails) bases.push(enc(h + s + t));
91 for (const t of byteTails) bases.push(Uint8Array.of(...enc(h + s), ...t));
92 }
93 for (const b of bases) {
94 yield b;
95 for (let n = 0; n < b.length; n++) yield b.subarray(0, n);
96 for (let i = 0; i < b.length; i++) {
97 for (const x of alphabet) { if (x === b[i]) continue; const c = b.slice(); c[i] = x; yield c; }
98 yield Uint8Array.of(...b.subarray(0, i), ...b.subarray(i + 1));
99 yield Uint8Array.of(...b.subarray(0, i + 1), ...b.subarray(i));
100 }
101 for (let i = 0; i <= b.length; i++) for (const ig of IGNORABLES) yield Uint8Array.of(...b.subarray(0, i), ...ig, ...b.subarray(i));
102 }
105// xorshift32, seeded: the same names for the same seed
106export function rng(seed) {
107 let s = seed >>> 0 || 1;
108 const next = () => { s ^= s << 13; s >>>= 0; s ^= s >>> 17; s ^= s << 5; s >>>= 0; return s; };
109 return { int: n => next() % n, pick: xs => xs[next() % xs.length] };
111// A random name from fragments: spellings (either case per letter), ignorables, tails, backslashes and random bytes
112export function randomName(r) {
113 const parts = [];
114 const k = 1 + r.int(5);
115 for (let j = 0; j < k; j++) {
116 switch (r.int(6)) {
117 case 0: { const s = r.pick(SPELLINGS); parts.push(...[...enc(s)].map(c => (c >= 0x61 && c <= 0x7a && r.int(3) === 0 ? c - 0x20 : c))); break; }
118 case 1: parts.push(...r.pick(IGNORABLES)); break;
119 case 2: parts.push(...enc(r.pick(TAILS))); break;
120 case 3: parts.push(0x5c); break;
121 case 4: parts.push(r.pick(ALPHABET)); break;
122 default: parts.push(r.int(256)); break;
123 }
124 }
125 return Uint8Array.from(parts);
128// Judge names: the first disagreement (a repro), or null; counts what was checked and how many each side accepted.
129export function judge(names, stats = { n: 0, hits: 0 }) {
130 for (const b of names) {
131 const want = verdicts(b, 'ref');
132 const got = verdicts(b, 'src');
133 stats.n++;
134 if (want !== '00000') stats.hits++;
135 if (want !== got) return { bytes: [...b].map(x => x.toString(16).padStart(2, '0')).join(' '), want, got };
136 }
137 return null;
Diagnostics4 git calls · 28 ms
CallStatusSizeTime028 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=3
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 · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=38434
git.response.cache=HIT
git.response.duration_ms=2
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
fetch2003.4 KiB · hit23 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=23
git.response.bytes=3515
git.response.cache=HIT
git.response.duration_ms=23
git.fetch.wants=ffb55029c317be64091c868804398849db7f89aa
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=3515
git.pkt.payload.max=3494
git.sideband.band1.bytes=3493
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
a5e1e27c7ea6d96e
Request
63f65dc2…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format