Artifactspublic-v0

ply

main
ply4 git calls254 ms40 KiB2 cachedprotocol v2
65 lines5.3 KiBRaw
1// Exhaustive protocol matrix against real git. Not sampled: the full product of
2// want kind × have kind × deepen × filter × server mode (thin, ofs-delta, done and client-shallow cycle deterministically)
3// Every cell checks: required ⊆ got ⊆ required ∪ had (model bound), got == pack-objects (git oracle), object
4// types/sizes, shallow/unshallow lines, thin bases derivable from haves, no OFS when not requested, chain ≤ pack.depth.
5import { test } from 'vitest';
6import assert from 'node:assert/strict';
7import { Worker } from 'node:worker_threads';
8import { packObjectsArgs } from './fuzz/packobjects.js';
9import { plan, WANT_KEYS, HAVE_KEYS, DEEPEN_KEYS, FILTER } from './protocol-matrix.js';
11// The matrix enumerates four dimensions and cycles three flags with the cell number. A cycle whose period divides a
12// dimension's stride makes the flag a function of that dimension: `i % 3` under a 9-value innermost filter loop asked
13// for thin-pack with three filters only and never with no filter. The rule is stated here, not read off the plan:
14// every value of every enumerated dimension, every (deepen, filter) pair and every (want, have) pair meets thin-pack
15// on and off, ofs-delta on and off, done and negotiate, and all four (thin-pack, ofs-delta) combinations.
16test('matrix plan: no cycled flag is a function of an enumerated dimension', () => {
17 const groups = new Map();
18 let cells = 0;
19 for (const c of plan()) {
20 cells++;
21 const f = c.filter ?? '-';
22 for (const g of [`want=${c.wk}`, `have=${c.hk}`, `deepen=${c.dk}`, `filter=${f}`, `deepen=${c.dk} filter=${f}`, `want=${c.wk} have=${c.hk}`]) {
23 const seen = groups.get(g) ?? new Set();
24 for (const k of [`thin=${c.thinPack}`, `ofs=${c.ofsDelta}`, `done=${c.done}`, `thin=${c.thinPack} ofs=${c.ofsDelta}`]) seen.add(k);
25 groups.set(g, seen);
26 }
27 }
28 // 8 wants x 11 haves x 6 deepens x 9 filters, counted by hand from SAFETY.md's dimension list
29 assert.deepEqual([WANT_KEYS.length, HAVE_KEYS.length, DEEPEN_KEYS.length, FILTER.length, cells], [8, 11, 6, 9, 4752]);
30 assert.equal(groups.size, 8 + 11 + 6 + 9 + 6 * 9 + 8 * 11);
31 const want = ['thin=true', 'thin=false', 'ofs=true', 'ofs=false', 'done=true', 'done=false', 'thin=true ofs=true', 'thin=true ofs=false', 'thin=false ofs=true', 'thin=false ofs=false'];
32 const missing = [];
33 for (const [g, seen] of groups) for (const k of want) if (!seen.has(k)) missing.push(`${g}: never ${k}`);
34 assert.deepEqual(missing.slice(0, 12), [], `${missing.length} (group, flag) combinations never run`);
35});
37test('pack-objects argv: git 2.55 create_pack_file, git 2.56 odb_source_files_generate_pack', () => {
38 const full = { thinPack: true, shallows: ['aa'], ofsDelta: true, filter: 'blob:none' };
39 assert.equal(packObjectsArgs({ ...full, version: [2, 55, 0] }).join(' '), '--revs --thin --stdout --shallow --delta-base-offset --filter=blob:none');
40 assert.equal(packObjectsArgs({ ...full, version: [2, 56, 0] }).join(' '), '--revs --stdout --thin --shallow --delta-base-offset --quiet --filter=blob:none');
41 assert.equal(packObjectsArgs({ thinPack: false, shallows: [], ofsDelta: false, version: [2, 43, 0] }).join(' '), '--revs --stdout');
42 assert.equal(packObjectsArgs({ thinPack: false, shallows: [], ofsDelta: false, version: [2, 56, 0] }).join(' '), '--revs --stdout --quiet');
43});
45test('exhaustive fetch matrix: wants × haves × deepen × filter × server', async () => {
46 // One worker thread per server mode (test/protocol-matrix.js): the same cells and checks, the modes side by side.
47 const runs = await Promise.all(['loose', 'packed', 'bitmap'].map(mode => new Promise((resolve, reject) => {
48 const w = new Worker(new URL('./protocol-matrix.js', import.meta.url), { workerData: { mode } });
49 w.once('message', resolve); w.once('error', reject);
50 w.once('exit', code => reject(new Error(`${mode} worker exited ${code} without a result`)));
51 })));
52 for (const r of runs) if (!r.ok) assert.fail(r.error);
53 const stats = { cells: 0, modelExact: 0, oracleExact: 0, invocationExact: 0, degenerate: 0, crash: 0 };
54 for (const r of runs) for (const k of Object.keys(stats)) stats[k] += r.stats[k];
55 const seen = new Map(runs.flatMap(r => r.seen));
56 console.log(` cells=${stats.cells} oracleExact=${stats.oracleExact} invocationExact=${stats.invocationExact} modelExact=${stats.modelExact} degenerate=${stats.degenerate} serverCrash=${stats.crash}`);
57 // No cell is excused for a refusal: a remote_error fails its cell in the worker (the server refuses no request of the plan).
58 assert.equal(stats.cells, 3 * 4752, 'three server modes, every cell of the plan');
59 assert.equal(stats.oracleExact, stats.cells - stats.degenerate - stats.crash, 'every non-degenerate cell is pack-objects-exact');
60 assert.ok(stats.crash + stats.degenerate < stats.cells * 0.25, 'degenerate deepen-since/not combos stay a minority (each one is only accepted when the degeneracy predicate holds)');
61 // the three server modes must agree wherever bitmaps cannot be used (deepen present or unsupported filter)
62 let disagree = 0, compared = 0;
63 for (const [k, v] of seen) if (k.startsWith('loose|')) { const kp = k.replace('loose|', 'packed|'); if (seen.has(kp)) { compared++; if (seen.get(kp) !== v) disagree++; } }
64 assert.equal(disagree, 0, `loose vs packed(no bitmap) must be identical: ${disagree}/${compared} differ`);
65});
Diagnostics4 git calls · 254 ms
CallStatusSizeTime0254 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 · hit4 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=4
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=4
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
fetch2002.3 KiB248 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=248
git.response.bytes=2309
git.response.cache=MISS
git.response.duration_ms=248
git.fetch.wants=d51f23b3e3b8133fb0a84fa732363d832c134256
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=2309
git.pkt.payload.max=2288
git.sideband.band1.bytes=2287
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
a5e1acd1e9a02c38
Request
b388032f…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format