Artifactspublic-v0

ply

main
ply4 git calls212 ms40 KiB2 cachedprotocol v2
78 lines4.6 KiBRaw
1// The tree-entry name checks (src/validate.ts isDotGitName, isDotFileName, and isHfsDot through checkoutPathRefusal)
2// answer exactly what they answered before #207 made them allocation-free (test/oracle/dotnames-ref.ts, the c91c9cf
3// code): every byte string up to two bytes, short strings over the bytes the checks branch on, every spelling × prefix ×
4// tail with its truncations, one-byte substitutions, deletions, doublings and ignorables inserted, and random names.
5// Under the mutation run (MUTATION=1) the same generators at smaller sizes. The large campaign (every 3-byte string,
6// 4 bytes over the branch bytes, every head and tail, 10^7 random names) is test/fuzz/dotnames.mjs. Both sides are
7// held to git by test/space/fsck-tree.test.js.
8import { test } from 'vitest';
9import assert from 'node:assert/strict';
10import { ALPHABET, ALL_BYTES, BRANCH_BYTES, BYTE_TAILS, exhaustive, targeted, rng, randomName, judge, hfsGitmodules } from './dotnames-corpus.js';
11import { checkoutPathRefusal } from '../src/validate.js';
12import { unwrap } from './unwrap.js';
14const QUICK = process.env.MUTATION === '1';
15const agree = (names, label, minHits = 0) => {
16 const stats = { n: 0, hits: 0 };
17 const bad = judge(names, stats);
18 assert.equal(bad, null, `${label}: ${JSON.stringify(bad)}`);
19 assert.ok(stats.hits >= minHits, `${label}: only ${stats.hits} of ${stats.n} names spell anything (expected ≥ ${minHits}): the corpus is vacuous`);
20 return stats;
21};
23test('every byte string up to 2 bytes (1 under mutation)', () => {
24 agree(exhaustive(ALL_BYTES, QUICK ? 1 : 2), 'all bytes');
25});
27test('every string up to 3 bytes over the bytes the checks branch on', () => {
28 // no spelling is that short: this holds the first-byte exit and the tail and NUL branches on near misses
29 agree(exhaustive(QUICK ? BRANCH_BYTES : ALPHABET.subarray(0, 40), 3), 'branch bytes ≤ 3');
30});
32test('every spelling, truncated, substituted, shortened, doubled and with ignorables inserted', () => {
33 if (QUICK) {
34 // every spelling with the short tails, substituted by the branch bytes; the UTF-8 byte tails after one of each kind
35 const s = agree(targeted([''], ['', ':x', '\\x'], BRANCH_BYTES, []), 'targeted', 1_000);
36 const u = agree(targeted([''], [], BRANCH_BYTES.subarray(0, 0), BYTE_TAILS, ['.git', 'git~1', '.gitmodules', 'gitmod~1', 'gi7eba~1', '~1234567']), 'targeted utf-8 tails', 100);
37 assert.ok(s.n + u.n > 50_000, `targeted corpus is ${s.n + u.n} names`);
38 return;
39 }
40 const s = agree(targeted(['', 'a\\'], ['', '. .', ':x', '\\x', '\0', 'x']), 'targeted', 10_000);
41 assert.ok(s.n > 500_000, `targeted corpus is ${s.n} names`);
42});
44test('random names from spelling fragments (seeded)', () => {
45 const r = rng(Number(process.env.DOTNAMES_SEED ?? 207));
46 const n = QUICK ? 5_000 : 30_000;
47 agree((function* () { for (let i = 0; i < n; i++) yield randomName(r); })(), 'random', QUICK ? 10 : 100);
48});
50test('checkoutPathRefusal reads isHfsDot(.gitmodules) as before, on every targeted name it can be asked about', () => {
51 let asked = 0, hits = 0;
52 for (const b of targeted([''], QUICK ? ['', 'x'] : ['', '. .', ':x', '\\x', 'x'], BRANCH_BYTES, QUICK ? [] : BYTE_TAILS)) {
53 const v = hfsGitmodules(b);
54 if (v === null) continue;
55 asked++; if (v.want) hits++;
56 assert.equal(v.got, v.want, [...b].map(x => x.toString(16)).join(' '));
57 }
58 assert.ok(asked > 10_000 && hits > 20, `asked ${asked}, ${hits} spell .gitmodules on HFS+`);
59});
61test('checkoutPathRefusal: a symlink at a spelling of .gitmodules, by platform and position', () => {
62 const why = (path, mode, platform) => { const r = unwrap(checkoutPathRefusal(path, mode, platform)); return r.tag === 'some' ? r.value : null; };
63 const LINK = 'a symlink at a spelling of .gitmodules';
64 // exactly .gitmodules (any case), anywhere, any platform
65 assert.equal(why('a/.GITMODULES', '120000', 'linux'), LINK);
66 assert.equal(why('.gitmodules/x', '120000', 'linux'), LINK);
67 // not a symlink: no refusal
68 assert.equal(why('.gitmodules', '100644', 'darwin'), null);
69 assert.equal(why('.g‌itmodules', '100644', 'darwin'), null);
70 // the HFS+ spelling: on macOS only, at any component
71 assert.equal(why('.g‌itmodules/x', '120000', 'darwin'), LINK);
72 assert.equal(why('.g‌itmodules/x', '120000', 'linux'), null);
73 // the NTFS spellings: at the last component only (and the HFS+ one there, on every platform)
74 assert.equal(why('a/gitmod~1', '120000', 'linux'), LINK);
75 assert.equal(why('gitmod~1/x', '120000', 'linux'), null);
76 assert.equal(why('a/.g‌itmodules', '120000', 'linux'), LINK);
77 assert.equal(why('x/.gitmodulesx', '120000', 'darwin'), null);
78});
Diagnostics4 git calls · 212 ms
CallStatusSizeTime0212 ms
discover200152 B3 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 · 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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=206
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.9 KiB206 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1979
git.response.cache=MISS
git.response.duration_ms=206
git.fetch.wants=638fcb8af9ab6ece478b826038af489dc4dfe2f9
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=1979
git.pkt.payload.max=1958
git.sideband.band1.bytes=1957
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
a5e2c8619c3f4b67
Request
b014b135…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format