GitHubivarvong
ply
main
1// The probe runner: executes src/probe-scenarios.ts plans against a target and records what stock git, the judge,
2// sees afterwards. Impure on purpose (processes, sockets, temp dirs); every decision about what a result means is in
3// src/probe-evaluate.ts (stock git's answers: git-outcome.ts).
4//
5// A target is a smart-HTTP base URL behind a recording proxy this process runs. The proxy forwards each request to the
6// upstream, records method, path, status, duration, sizes and the upstream's cf-ray, applies the step's fault on the
7// first receive-pack POST of the `main` channel, and, for the reference, enforces the filter policy (any upload-pack
8// filter but blob:none is a 400). Channels: `main` (the client under test), `side` (seeding and the racing writer),
9// `judge` (stock git reading the result). A credential, when the upstream needs one, is added by the proxy: neither
10// ply nor git is handed it, so it is in no argv, environment or config of a child process.
11import http from 'node:http';
12import { spawn } from 'node:child_process';
13import { createHash } from 'node:crypto';
14import { gunzipSync, deflateSync } from 'node:zlib';
15import { mkdirSync, mkdtempSync, rmSync } from 'node:fs';
16import { tmpdir } from 'node:os';
17import { join } from 'node:path';
18import { performance } from 'node:perf_hooks';
19import { startGitServer, fsckProblems, NO_MAINTENANCE } from '../server.js';
20import { GitHttp } from '../../src/client.js';
21import { TYPE_ID } from '../../src/objects.js';
22import { Tracer, arrayExporter, flattenLine } from '../../src/otel.js';
23import { gitOutcome, gitFetchOutcome } from './git-outcome.ts';
24import { plyOutcome } from '../../src/probe-evaluate.ts';
26const ZERO = '0'.repeat(40);
27// Artifacts' known policy, applied to every reference repository (lab notes 2026-10-23..25, matrix runs): wants of
28// reachable objects only, blob:none the only filter (the proxy refuses others), objects fsck'd on receive, 64 MiB cap.
29export const REFERENCE_POLICY = [
30 ['http.receivepack', 'true'], ['receive.fsckObjects', 'true'], ['transfer.fsckObjects', 'true'],
31 ['uploadpack.allowFilter', 'true'], ['uploadpack.allowReachableSHA1InWant', 'true'], ['uploadpack.allowAnySHA1InWant', 'false'],
32 ['receive.maxInputSize', String(64 * 1024 * 1024)], ['receive.advertiseAtomic', 'true'], ...NO_MAINTENANCE,
33];
34const FILTER_REFUSAL = 'Unsupported Git fetch filter; only blob:none is supported.';
36// ---- git, with no user or system config, deterministic identities, nothing interactive ----
37const IDENT = { GIT_AUTHOR_NAME: 'ply probe', GIT_AUTHOR_EMAIL: 'probe@ply.invalid', GIT_COMMITTER_NAME: 'ply probe', GIT_COMMITTER_EMAIL: 'probe@ply.invalid', GIT_AUTHOR_DATE: '1700000000 +0000', GIT_COMMITTER_DATE: '1700000000 +0000' };
38export function gitEnv(home, extra = {}) {
39 const cfg = [['credential.helper', ''], ['protocol.version', '2'], ['advice.pushUpdateRejected', 'false'], ...NO_MAINTENANCE];
40 return {
41 PATH: process.env.PATH, HOME: home, GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null', GIT_TERMINAL_PROMPT: '0', LANG: 'C', LC_ALL: 'C',
42 GIT_CONFIG_COUNT: String(cfg.length), ...Object.fromEntries(cfg.flatMap(([k, v], i) => [[`GIT_CONFIG_KEY_${i}`, k], [`GIT_CONFIG_VALUE_${i}`, v]])),
43 ...IDENT, ...extra,
44 };
45}
46export function run(cmd, args, { cwd, env, input, timeoutMs = 300_000 } = {}) {
47 return new Promise(resolve => {
48 const t0 = performance.now();
49 const c = spawn(cmd, args, { cwd, env, stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'] });
50 const out = [], err = [];
51 const timer = setTimeout(() => c.kill('SIGKILL'), timeoutMs);
52 c.stdout.on('data', d => out.push(d)); c.stderr.on('data', d => err.push(d));
53 if (input !== undefined) { c.stdin.on('error', () => {}); c.stdin.end(input); }
54 c.on('close', status => { clearTimeout(timer); const buf = Buffer.concat(out); resolve({ status, out: buf, stdout: buf.toString('utf8'), stderr: Buffer.concat(err).toString('utf8'), ms: +(performance.now() - t0).toFixed(1) }); });
55 });
56}
57const must = async (p, what) => { const r = await p; if (r.status !== 0) throw new Error(`${what}: exit ${r.status}: ${r.stderr.trim().slice(0, 400)}`); return r; };
59// ---- seed objects: plumbing only, so every target gets the same object ids ----
60export function noiseBytes(seed, n) {
61 const out = Buffer.alloc(n);
62 for (let o = 0, i = 0; o < n; i++) { const h = createHash('sha256').update(`${seed}:${i}`).digest(); h.copy(out, o, 0, Math.min(32, n - o)); o += 32; }
63 return out;
64}
65function contentOf(c) {
66 switch (c.tag) {
67 case 'text': return Buffer.from(c.text, 'utf8');
68 case 'noise': return noiseBytes(c.seed, c.bytes);
69 case 'repeat': return Buffer.alloc(c.bytes, c.byte);
70 }
71 throw new Error(`unknown content ${c.tag}`);
72}
73// A raw tree's bytes: `<mode> <name>\0<20-byte id>` per entry, in the plan's order (types.ts RawTreeSpec).
74async function rawTreeBytes(seedSoFar, entries) {
75 const parts = [];
76 for (const e of entries) parts.push(Buffer.from(`${e.mode} ${e.name}\0`, 'utf8'), Buffer.from(await resolveRef(seedSoFar, e.blob), 'hex'));
77 return Buffer.concat(parts);
78}
79const writeLiteral = async (dir, env, type, input, what) => (await must(run('git', ['hash-object', '--literally', '-t', type, '-w', '--stdin'], { cwd: dir, env, input }), what)).stdout.trim();
81// A bare object store holding the scenario's objects: { dir, names (name -> oid), byOid (oid -> name) }.
82export async function buildSeed(root, seed) {
83 const dir = join(root, 'objects.git');
84 const env = gitEnv(root);
85 await must(run('git', ['init', '-q', '--bare', '-b', 'main', dir], { env }), 'init seed store');
86 const names = {}, trees = {};
87 for (const o of seed.objects) {
88 if (o.tag === 'raw-tree') {
89 names[o.name] = await writeLiteral(dir, env, 'tree', await rawTreeBytes({ dir, env, names }, o.entries), `raw tree ${o.name}`);
90 continue;
91 }
92 if (o.tag === 'raw-commit') {
93 const tree = trees[o.tree] ?? names[o.tree];
94 const body = [`tree ${tree}`, ...o.parents.map(p => `parent ${names[p]}`), `author ${o.author}`, 'committer ply probe <probe@ply.invalid> 1700000000 +0000', '', o.message, ''].join('\n');
95 names[o.name] = await writeLiteral(dir, env, 'commit', Buffer.from(body, 'utf8'), `raw commit ${o.name}`);
96 continue;
97 }
98 if (o.tag === 'raw-tag') {
99 const body = `object ${names[o.object]}\ntype ${o.type}\ntag ${o.tagName}\ntagger ply probe <probe@ply.invalid> 1700000000 +0000\n\n${o.message}\n`;
100 names[o.name] = await writeLiteral(dir, env, 'tag', Buffer.from(body, 'utf8'), `raw tag ${o.name}`);
101 continue;
102 }
103 if (o.tag === 'phantom') {
104 // an id nothing holds: never written to the seed store
105 names[o.name] = createHash('sha1').update(`probe phantom ${o.seed}`).digest('hex');
106 continue;
107 }
108 if (o.tag === 'commit') {
109 const ienv = { ...env, GIT_INDEX_FILE: join(root, `index-${o.name}`) };
110 const first = o.parents[0];
111 await must(run('git', first === undefined ? ['read-tree', '--empty'] : ['read-tree', trees[first]], { cwd: dir, env: ienv }), `read-tree ${o.name}`);
112 for (const f of o.files) {
113 const blob = (await must(run('git', ['hash-object', '-w', '--stdin'], { cwd: dir, env, input: contentOf(f.content) }), `blob ${f.path}`)).stdout.trim();
114 await must(run('git', ['update-index', '--add', '--cacheinfo', `100644,${blob},${f.path}`], { cwd: dir, env: ienv }), `index ${f.path}`);
115 }
116 trees[o.name] = (await must(run('git', ['write-tree'], { cwd: dir, env: ienv }), 'write-tree')).stdout.trim();
117 const parents = o.parents.flatMap(p => ['-p', names[p]]);
118 names[o.name] = (await must(run('git', ['commit-tree', trees[o.name], ...parents, '-m', o.message], { cwd: dir, env }), `commit ${o.name}`)).stdout.trim();
119 } else {
120 const body = `object ${names[o.target]}\ntype commit\ntag ${o.tagName}\ntagger ply probe <probe@ply.invalid> 1700000000 +0000\n\n${o.message}\n`;
121 names[o.name] = (await must(run('git', ['mktag'], { cwd: dir, env, input: body }), `mktag ${o.name}`)).stdout.trim();
122 }
123 }
124 const byOid = Object.fromEntries(Object.entries(names).map(([n, oid]) => [oid, n]));
125 return { dir, env, names, byOid, trees };
126}
127const oidOf = (seed, e) => (e.tag === 'zero' ? ZERO : seed.names[e.name]);
129// A seed object by reference (types.ts ObjRef).
130async function resolveRef(seed, r) {
131 if (r.tag === 'commit') return seed.names[r.name];
132 return (await must(run('git', ['rev-parse', `${seed.names[r.of]}:${r.path}`], { cwd: seed.dir, env: seed.env }), `rev-parse ${r.of}:${r.path}`)).stdout.trim();
133}
134async function catFile(seed, oids) {
135 const batch = (await must(run('git', ['cat-file', '--batch'], { cwd: seed.dir, env: seed.env, input: `${oids.join('\n')}\n` }), 'cat-file')).out;
136 const objs = [];
137 for (let o = 0; o < batch.length;) {
138 const nl = batch.indexOf(10, o);
139 const [oid, type, size] = batch.subarray(o, nl).toString('latin1').split(' ');
140 const n = Number(size);
141 objs.push({ oid, type: TYPE_ID[type], data: new Uint8Array(batch.subarray(nl + 1, nl + 1 + n)) });
142 o = nl + 1 + n + 1;
143 }
144 return objs;
145}
146// The objects a push carries: reachable from its new ids, not from what the target was seeded with (the race's moves
147// may add objects the server has; sending them again is harmless), minus the plan's `omit`.
148async function objectsFor(seed, scenario, push) {
149 if (push.pack.tag === 'defect' && push.pack.defect.tag === 'no-objects') return [];
150 if (push.pack.tag === 'listed') return catFile(seed, push.pack.objects.map(n => seed.names[n]));
151 const news = push.updates.map(u => oidOf(seed, u.new)).filter(o => o !== ZERO);
152 if (news.length === 0) return [];
153 const have = scenario.seed.refs.map(r => seed.names[r.at]);
154 const omit = new Set(await Promise.all(push.omit.map(r => resolveRef(seed, r))));
155 const list = (await must(run('git', ['rev-list', '--objects', '--no-object-names', ...news, ...(have.length ? ['--not', ...have] : [])], { cwd: seed.dir, env: seed.env }), 'rev-list')).stdout.trim().split('\n').filter(Boolean).filter(x => !omit.has(x));
156 return catFile(seed, list);
157}
159// ---- packs the harness writes (PackForm 'hand'): plain entries, an optional REF_DELTA, then damage ----
160const u32 = n => { const b = Buffer.alloc(4); b.writeUInt32BE(n); return b; };
161const varint = n => { const out = []; do { let b = n & 0x7f; n = Math.floor(n / 128); if (n > 0) b |= 0x80; out.push(b); } while (n > 0); return Buffer.from(out); };
162function entryHeader(type, size) {
163 const out = []; let b = (type << 4) | (size & 15); let rest = Math.floor(size / 16);
164 while (rest > 0) { out.push(b | 0x80); b = rest & 0x7f; rest = Math.floor(rest / 128); }
165 out.push(b);
166 return Buffer.from(out);
167}
168const sha1 = b => createHash('sha1').update(b).digest();
169// entries: { type, data } or { refDelta: <base oid>, delta }. Returns the pack and where each zlib stream ends.
170export function writePack(entries) {
171 const parts = [Buffer.from('PACK'), u32(2), u32(entries.length)];
172 let at = 12; const zlibEnds = [];
173 for (const e of entries) {
174 const head = e.refDelta ? Buffer.concat([entryHeader(7, e.delta.length), Buffer.from(e.refDelta, 'hex')]) : entryHeader(e.type, e.data.length);
175 const z = deflateSync(e.refDelta ? e.delta : e.data);
176 parts.push(head, z); at += head.length + z.length; zlibEnds.push(at);
177 }
178 const body = Buffer.concat(parts);
179 return { pack: Buffer.concat([body, sha1(body)]), zlibEnds };
180}
181// A delta from a base of `srcSize` bytes: literal inserts only (valid; needs the base present to resolve), or one copy
182// that reads 16 bytes from past the end of the base (never valid).
183export function deltaFor(srcSize, target, kind) {
184 if (kind === 'copy-past-end') {
185 const off = srcSize + 1000; let op = 0x80; const args = [];
186 for (let i = 0; i < 4; i++) { const b = Math.floor(off / 256 ** i) & 0xff; if (b !== 0) { op |= 1 << i; args.push(b); } }
187 op |= 0x10; args.push(16);
188 return Buffer.concat([varint(srcSize), varint(16), Buffer.from([op, ...args])]);
189 }
190 const chunks = [];
191 for (let o = 0; o < target.length; o += 127) { const c = target.subarray(o, o + 127); chunks.push(Buffer.from([c.length]), c); }
192 return Buffer.concat([varint(srcSize), varint(target.length), ...chunks]);
193}
194export function damagePack({ pack, zlibEnds }, damage) {
195 const b = Buffer.from(pack);
196 switch (damage) {
197 case 'none': return b;
198 case 'bad-trailer': b[b.length - 1] ^= 0xff; return b;
199 case 'truncated': return b.subarray(0, Math.floor(b.length / 2));
200 case 'bad-zlib': {
201 b[zlibEnds[0] - 1] ^= 0xff; // the last byte of the first object's Adler-32
202 const body = b.subarray(0, b.length - 20);
203 return Buffer.concat([body, sha1(body)]);
204 }
205 }
206 throw new Error(`unknown damage ${damage}`);
207}
208// git's OFS_DELTA base offset: big-endian 7-bit groups, each continuation adding one (pack-format.txt).
209function ofsEncode(n) {
210 const out = [n & 0x7f];
211 for (n = Math.floor(n / 128); n > 0; n = Math.floor(n / 128)) { n -= 1; out.unshift(0x80 | (n & 0x7f)); }
212 return Buffer.from(out);
213}
214const withTrailer = body => Buffer.concat([body, sha1(body)]);
215const bodyOf = pack => pack.subarray(0, pack.length - 20);
216// The first blob's index in `objects`, for a defect that rewrites it.
217const firstBlob = objects => { const i = objects.findIndex(o => o.type === TYPE_ID.blob); if (i < 0) throw new Error('defect pack: no blob'); return i; };
218// A pack with one structural defect (types.ts PackDefect), its trailer recomputed over the damaged bytes.
219export async function defectPack(seed, objects, defect) {
220 const plain = objects.map(o => ({ type: o.type, data: Buffer.from(o.data) }));
221 switch (defect.tag) {
222 case 'signature': { const b = Buffer.from(bodyOf(writePack(plain).pack)); b.write('PACX', 0, 'latin1'); return withTrailer(b); }
223 case 'version': { const b = Buffer.from(bodyOf(writePack(plain).pack)); b.writeUInt32BE(defect.version, 4); return withTrailer(b); }
224 case 'count': { const b = Buffer.from(bodyOf(writePack(plain).pack)); b.writeUInt32BE(plain.length + defect.by, 8); return withTrailer(b); }
225 case 'duplicate': return writePack([...plain, ...plain]).pack;
226 case 'no-objects': return writePack([]).pack;
227 case 'size-header': case 'bad-type': {
228 const i = firstBlob(objects);
229 const parts = [Buffer.from('PACK'), u32(2), u32(plain.length)];
230 plain.forEach((e, k) => {
231 const head = k !== i ? entryHeader(e.type, e.data.length) : defect.tag === 'bad-type' ? entryHeader(defect.type, e.data.length) : entryHeader(e.type, e.data.length + defect.by);
232 parts.push(head, deflateSync(e.data));
233 });
234 return withTrailer(Buffer.concat(parts));
235 }
236 case 'ofs-delta-before-start': {
237 const i = firstBlob(objects);
238 const parts = [Buffer.from('PACK'), u32(2), u32(plain.length)];
239 let at = 12;
240 plain.forEach((e, k) => {
241 let entry;
242 if (k === i) {
243 const delta = deltaFor(e.data.length, e.data, 'literal');
244 // a base `at + 4096` bytes back: before the pack's first byte
245 entry = Buffer.concat([entryHeader(6, delta.length), ofsEncode(at + 4096), deflateSync(delta)]);
246 } else entry = Buffer.concat([entryHeader(e.type, e.data.length), deflateSync(e.data)]);
247 parts.push(entry); at += entry.length;
248 });
249 return withTrailer(Buffer.concat(parts));
250 }
251 case 'delta-size-mismatch': {
252 const i = firstBlob(objects);
253 const base = await resolveRef(seed, defect.base);
254 const size = Number((await must(run('git', ['cat-file', '-s', base], { cwd: seed.dir, env: seed.env }), 'cat-file -s')).stdout.trim());
255 const target = plain[i].data;
256 const chunks = [];
257 for (let o = 0; o < target.length; o += 127) { const c = target.subarray(o, o + 127); chunks.push(Buffer.from([c.length]), c); }
258 // the header states one byte more than the inserts write
259 const delta = Buffer.concat([varint(size), varint(target.length + 1), ...chunks]);
260 return writePack(plain.map((e, k) => (k === i ? { refDelta: base, delta } : e))).pack;
261 }
262 }
263 throw new Error(`unknown pack defect ${defect.tag}`);
264}
265async function handPack(seed, objects, form) {
266 let entries = objects.map(o => ({ type: o.type, data: Buffer.from(o.data) }));
267 if (form.deltaBase !== null) {
268 const i = objects.findIndex(o => o.type === TYPE_ID.blob);
269 if (i < 0) throw new Error('hand pack: no blob to send as a delta');
270 const base = await resolveRef(seed, form.deltaBase);
271 const size = Number((await must(run('git', ['cat-file', '-s', base], { cwd: seed.dir, env: seed.env }), 'cat-file -s')).stdout.trim());
272 entries = entries.map((e, k) => (k === i ? { refDelta: base, delta: deltaFor(size, e.data, form.delta) } : e));
273 }
274 return damagePack(writePack(entries), form.damage);
275}
277// ---- the recording proxy ----
278const HOP = new Set(['host', 'connection', 'keep-alive', 'content-length', 'transfer-encoding', 'accept-encoding', 'authorization', 'expect', 'te', 'upgrade', 'proxy-connection']);
279// The leading pkt-lines of a body up to the first flush (or the pack signature), as text: the commands of a receive-pack
280// request ("<old> <new> <ref>", capabilities cut), or the refs of an advertisement ("<oid> <ref>"). Object ids and ref
281// names only; no credential is ever in either.
282export function pktLines(buf, limit = 200) {
283 const out = [];
284 for (let o = 0; o + 4 <= buf.length && out.length < limit;) {
285 const h = buf.subarray(o, o + 4).toString('latin1');
286 if (!/^[0-9a-f]{4}$/.test(h)) break;
287 const n = parseInt(h, 16);
288 if (n === 0) { if (out.length > 0 && !out[out.length - 1].startsWith('# service=')) break; o += 4; continue; }
289 if (n < 4 || o + n > buf.length) break;
290 out.push(buf.subarray(o + 4, o + n).toString('latin1').split('\0')[0].replace(/\n$/, ''));
291 o += n;
292 }
293 return out;
294}
295const OID_LINE = /^[0-9a-f]{40} /;
296// The filter argument of a v2 fetch request, read pkt-line by pkt-line (a line may or may not end in LF).
297function filterOf(body) {
298 for (let o = 0; o + 4 <= body.length;) {
299 const h = body.subarray(o, o + 4).toString('latin1');
300 if (!/^[0-9a-f]{4}$/.test(h)) return null;
301 const n = parseInt(h, 16);
302 if (n < 4) { o += 4; continue; }
303 const line = body.subarray(o + 4, o + n).toString('latin1').replace(/\n$/, '');
304 if (line.startsWith('filter ')) return line.slice(7);
305 o += n;
306 }
307 return null;
308}
309// The per-command report a receive-pack answer carries (report-status, inside side-band 1 when the push asked for it):
310// its `unpack …`, `ok <ref>` and `ng <ref> <reason>` lines, as sent.
311function pkts(buf) {
312 const out = [];
313 let o = 0;
314 while (o + 4 <= buf.length) {
315 const h = buf.subarray(o, o + 4).toString('latin1');
316 if (!/^[0-9a-f]{4}$/.test(h)) break;
317 const n = parseInt(h, 16);
318 if (n < 4) { o += 4; continue; }
319 if (o + n > buf.length) break;
320 out.push(buf.subarray(o + 4, o + n));
321 o += n;
322 }
323 return out;
324}
325export function reportOf(buf) {
326 const lines = pkts(buf);
327 const banded = lines.length > 0 && lines.every(l => l.length > 0 && l[0] >= 1 && l[0] <= 3);
328 const inner = banded ? pkts(Buffer.concat(lines.filter(l => l[0] === 1).map(l => l.subarray(1)))) : lines;
329 return inner.map(l => l.toString('latin1').replace(/\n$/, '')).filter(l => /^(unpack |ok |ng )/.test(l));
330}
331export function startRecordingProxy({ upstream, authorization = null, filterPolicy = false }) {
332 const base = new URL(upstream);
333 const exchanges = [];
334 let armed = null; // a types.ts Fault plus `on` ('receive' | 'upload') and, for a race, `run`; for the next matching POST on `main`
335 let n = 0;
336 const server = http.createServer((req, res) => {
337 const chunks = [];
338 req.on('data', d => chunks.push(d));
339 req.on('end', async () => {
340 const t0 = performance.now();
341 const body = Buffer.concat(chunks);
342 const m = /^\/(main|side|judge)(\/.*)$/.exec(req.url);
343 const rec = { i: n++, channel: m?.[1] ?? '?', method: req.method, path: m?.[2] ?? req.url, status: 0, ms: 0, reqBytes: body.length, resBytes: 0, cfRay: null, fault: null };
344 exchanges.push(rec);
345 if (!m) { rec.status = 404; res.writeHead(404); res.end(); return; }
346 const isReceive = req.method === 'POST' && rec.path.split('?')[0].endsWith('/git-receive-pack');
347 const isUpload = req.method === 'POST' && rec.path.split('?')[0].endsWith('/git-upload-pack');
348 const plainUpload = isUpload ? (req.headers['content-encoding'] === 'gzip' ? gunzipSync(body) : body) : null;
349 if (filterPolicy && plainUpload !== null) {
350 const f = filterOf(plainUpload);
351 if (f !== null && f !== 'blob:none') { rec.status = 400; rec.fault = 'policy:filter'; rec.ms = +(performance.now() - t0).toFixed(1); res.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' }); res.end(FILTER_REFUSAL); return; }
352 }
353 let fault = null;
354 const isFetchCommand = plainUpload !== null && plainUpload.includes('command=fetch');
355 // stock git first sends a 4-byte probe ("0000") before a body larger than http.postBuffer: not the push
356 if (armed !== null && rec.channel === 'main' && (armed.on === 'receive' ? isReceive && body.length > 4 : isFetchCommand)) { fault = armed; armed = null; rec.fault = fault.tag; }
357 try {
358 if (fault?.tag === 'race') await fault.run();
359 const headers = {};
360 for (const [k, v] of Object.entries(req.headers)) if (!HOP.has(k) && typeof v === 'string') headers[k] = v;
361 if (authorization !== null) headers.authorization = authorization;
362 const target = new URL(base.pathname.replace(/\/$/, '') + rec.path, base.origin);
363 if (fault?.tag === 'cut-request') {
364 // the upstream reads part of the body, then the request is aborted; the client hears nothing
365 const cutAt = Math.max(1, Math.floor(body.length * fault.fraction));
366 const ctl = new AbortController();
367 const part = new ReadableStream({ start(c) { c.enqueue(new Uint8Array(body.subarray(0, cutAt))); setTimeout(() => { c.error(new Error('probe: request body cut')); ctl.abort(); }, 500); } });
368 rec.cutAt = cutAt;
369 try {
370 const up = await fetch(target, { method: req.method, headers, body: part, duplex: 'half', redirect: 'manual', signal: ctl.signal });
371 rec.status = up.status; rec.cfRay = up.headers.get('cf-ray'); await up.body?.cancel();
372 } catch (e) { rec.error = String(e?.message ?? e).slice(0, 200); }
373 rec.ms = +(performance.now() - t0).toFixed(1);
374 req.socket.destroy();
375 return;
376 }
377 let reqBody = req.method === 'GET' || req.method === 'HEAD' ? undefined : body;
378 if (fault?.tag === 'stall-request') {
379 const at = Math.max(1, Math.floor(body.length * fault.fraction));
380 rec.stallAt = at;
381 reqBody = new ReadableStream({ async start(c) { c.enqueue(new Uint8Array(body.subarray(0, at))); await new Promise(r => setTimeout(r, fault.ms)); c.enqueue(new Uint8Array(body.subarray(at))); c.close(); } });
382 }
383 const up = await fetch(target, { method: req.method, headers, body: reqBody, ...(reqBody instanceof ReadableStream ? { duplex: 'half' } : {}), redirect: 'manual' });
384 const buf = Buffer.from(await up.arrayBuffer());
385 rec.status = up.status; rec.resBytes = buf.length; rec.cfRay = up.headers.get('cf-ray');
386 if (isReceive) { const plain = req.headers['content-encoding'] === 'gzip' ? gunzipSync(body) : body; rec.commands = pktLines(plain, 400).filter(l => OID_LINE.test(l)); rec.report = reportOf(buf); }
387 if (req.method === 'GET' && /service=git-receive-pack/.test(rec.path) && up.status === 200) rec.advertised = pktLines(buf, 400).filter(l => OID_LINE.test(l)).map(l => l.replace(/^([0-9a-f]{40}) (\S+).*$/, '$1 $2'));
388 rec.ms = +(performance.now() - t0).toFixed(1);
389 if (fault?.tag === 'cut-response') { req.socket.destroy(); return; }
390 if (fault?.tag === 'stall-response') await new Promise(r => setTimeout(r, fault.ms));
391 const out = { 'content-length': String(buf.length) };
392 for (const k of ['content-type', 'cache-control', 'cf-ray', 'www-authenticate', 'location']) { const v = up.headers.get(k); if (v !== null) out[k] = v; }
393 res.on('error', () => {});
394 if (req.socket.destroyed) { rec.clientGone = true; return; }
395 res.writeHead(up.status, out);
396 if (fault?.tag === 'drop-response') { res.write(buf.subarray(0, Math.floor(buf.length * fault.fraction)), () => req.socket.destroy()); return; }
397 res.end(buf);
398 } catch (e) {
399 rec.status = 502; rec.error = `${String(e?.message ?? e)}${e?.cause ? `: ${e.cause.code ?? ''} ${e.cause.message ?? ''}` : ''}`.slice(0, 300); rec.ms = +(performance.now() - t0).toFixed(1);
400 if (!res.headersSent) { res.writeHead(502); res.end(); }
401 }
402 });
403 });
404 server.keepAliveTimeout = 120_000; server.headersTimeout = 121_000; server.requestTimeout = 0;
405 return new Promise(resolve => server.listen(0, '127.0.0.1', () => resolve({
406 url: `http://127.0.0.1:${server.address().port}`, exchanges,
407 arm: f => { armed = f; }, armedLeft: () => armed !== null, disarm: () => { armed = null; },
408 close: () => new Promise(r => { server.closeAllConnections?.(); server.close(r); }),
409 })));
410}
412// ---- clients ----
413// A create is a plain push (no lease, no force): git 2.47 does not protect a create with --force-with-lease=<ref>: or
414// <ref>:<zero id> (it force-updates a ref that exists), so a lease there would turn a lost create race into a silent
415// overwrite. Without force, git refuses client side when its advertisement already has the ref ("fetch first") and
416// otherwise sends the zero old id for the server to check. An update or delete carries a lease on the plan's old id,
417// and its refspec has no `+`: git lets a `+` (forced) refspec override a stale lease (remote.c set_ref_status_for_push
418// drops REJECT_STALE when the ref is forced), so with a `+` a git client that read a moved ref sent that ref as the old
419// id and overwrote it (run 20261114t2158-165d, same-ref contention). A matching lease alone already permits a
420// non-fast-forward update.
421const gitArgs = (seed, push) => [
422 ...(push.atomic ? ['--atomic'] : []),
423 ...push.updates.filter(u => u.old.tag !== 'zero').map(u => `--force-with-lease=${u.ref}:${oidOf(seed, u.old)}`),
424];
425const gitSpecs = (seed, push) => push.updates.map(u => (u.new.tag === 'zero' ? `:${u.ref}` : `${oidOf(seed, u.new)}:${u.ref}`));
427const plyErr = (r, prefix = '') => plyOutcome({ ok: false, code: r.error.code, message: `${prefix}${String(r.error.message)}` });
428const plyLimits = timeouts => (timeouts === null ? {} : { limits: { firstByteTimeoutMs: timeouts.ms, idleTimeoutMs: timeouts.ms } });
429const gitTimeouts = timeouts => (timeouts === null ? [] : ['-c', 'http.lowSpeedLimit=1', '-c', `http.lowSpeedTime=${Math.ceil(timeouts.ms / 1000)}`]);
430async function plyFetch(url, seed, st, tracer, parent) {
431 const client = GitHttp.create(url, { tracer, parent, recordResponseHeaders: ['cf-ray'], quirks: {}, ...plyLimits(st.timeouts) });
432 if (!client.ok) return plyErr(client);
433 const want = seed.names[st.want];
434 const f = await client.value.fetchPack({ wants: [want] });
435 if (!f.ok) return plyErr(f);
436 return f.value.objects?.has(want) ? { outcome: 'landed', error: null, detail: `fetched ${f.value.objects.size} objects` } : { outcome: 'rejected', error: 'harness', detail: 'the wanted object did not arrive' };
437}
438async function gitFetch(url, seed, st, root) {
439 const dir = join(root, `fetch-${fromN++}.git`);
440 await must(run('git', ['init', '-q', '--bare', dir], { env: seed.env }), 'init fetch');
441 const r = await run('git', [...gitTimeouts(st.timeouts), 'fetch', '-q', url, st.ref], { cwd: dir, env: seed.env });
442 return gitFetchOutcome(r.status, r.stderr);
443}
444async function plyPush(url, seed, scenario, push, tracer, parent, from = { tag: 'full' }, timeouts = null) {
445 const client = GitHttp.create(url, { tracer, parent, recordResponseHeaders: ['cf-ray'], quirks: {}, ...plyLimits(timeouts) });
446 if (!client.ok) return plyErr(client);
447 if (from.tag === 'partial') {
448 // ply's partial clone: main's commits and trees, no blob
449 const tip = seed.names[scenario.seed.refs.find(r => r.ref === 'refs/heads/main')?.at ?? ''];
450 const f = await client.value.fetchPack({ wants: [tip], filter: 'blob:none' });
451 if (!f.ok) return plyErr(f, 'partial fetch: ');
452 const blobs = [...(f.value.objects?.values() ?? [])].filter(o => o.type === TYPE_ID.blob).length;
453 if (blobs > 0) return { outcome: 'rejected', error: 'harness', detail: `partial fetch carried ${blobs} blobs` };
454 }
455 const objects = await objectsFor(seed, scenario, push);
456 const commands = push.updates.map(u => ({ ref: u.ref, oldOid: oidOf(seed, u.old), newOid: oidOf(seed, u.new) }));
457 const atomic = push.atomic ? { atomic: true } : {};
458 let r;
459 if (push.pack.tag === 'hand' || push.pack.tag === 'defect') {
460 const bytes = new Uint8Array(push.pack.tag === 'hand' ? await handPack(seed, objects, push.pack) : await defectPack(seed, objects, push.pack.defect));
461 const pack = new ReadableStream({ start(c) { c.enqueue(bytes); c.close(); } });
462 r = await client.value.pushPack({ commands, pack, length: bytes.length, ...atomic });
463 } else r = await client.value.push({ commands, objects, ...atomic });
464 return r.ok ? plyOutcome({ ok: true }) : plyErr(r);
465}
466// The repository stock git pushes from (types.ts From): the seed store, a shallow fetch out of it, or a blob:none
467// clone of the target with the push's new objects added.
468let fromN = 0;
469async function gitFrom(seed, scenario, push, from, root, cloneUrl) {
470 if (from.tag === 'full') return seed.dir;
471 const dir = join(root, `${from.tag}-${fromN++}.git`);
472 if (from.tag === 'shallow') {
473 await must(run('git', ['update-ref', 'refs/probe/tip', seed.names[from.tip]], { cwd: seed.dir, env: seed.env }), 'tip ref');
474 await must(run('git', ['init', '-q', '--bare', dir], { env: seed.env }), 'init shallow');
475 await must(run('git', ['fetch', '-q', `--depth=${from.depth}`, `file://${seed.dir}`, 'refs/probe/tip:refs/heads/tip'], { cwd: dir, env: seed.env }), 'shallow fetch');
476 return dir;
477 }
478 await must(run('git', ['clone', '-q', '--bare', '--filter=blob:none', cloneUrl, dir], { env: seed.env }), 'partial clone');
479 const news = push.updates.map(u => oidOf(seed, u.new)).filter(o => o !== ZERO);
480 const have = scenario.seed.refs.map(r => seed.names[r.at]);
481 const pack = (await must(run('git', ['pack-objects', '--stdout', '--revs', '-q'], { cwd: seed.dir, env: seed.env, input: `${news.join('\n')}\n${have.map(h => `^${h}`).join('\n')}\n` }), 'pack-objects')).out;
482 await must(run('git', ['index-pack', '--stdin'], { cwd: dir, env: seed.env, input: pack }), 'index-pack into the partial clone');
483 return dir;
484}
485async function gitPush(url, seed, push, cwd = seed.dir, timeouts = null) {
486 const r = await run('git', [...gitTimeouts(timeouts), 'push', '--porcelain', ...gitArgs(seed, push), url, ...gitSpecs(seed, push)], { cwd, env: seed.env });
487 return { ...gitOutcome(r.status, r.stdout, r.stderr, new Set(push.updates.filter(u => u.old.tag === 'zero').map(u => u.ref))), exit: r.status };
488}
489async function forcePush(url, seed, moves) {
490 const specs = moves.map(mv => (mv.to.tag === 'zero' ? `:${mv.ref}` : `+${oidOf(seed, mv.to)}:${mv.ref}`));
491 return must(run('git', ['push', '--porcelain', '--force', url, ...specs], { cwd: seed.dir, env: seed.env }), 'side push');
492}
494// ---- the judge: stock git reads the target back ----
495export async function observeEnd(url, root, env) {
496 const ls = await must(run('git', ['ls-remote', '--symref', url], { cwd: root, env }), 'ls-remote');
497 let head = null; const refs = {};
498 for (const line of ls.stdout.split('\n').filter(Boolean)) {
499 const sym = /^ref: (\S+)\tHEAD$/.exec(line);
500 if (sym) { head = sym[1]; continue; }
501 const [oid, name] = line.split('\t');
502 if (name === 'HEAD' || name.endsWith('^{}')) continue;
503 refs[name] = oid;
504 }
505 if (Object.keys(refs).length === 0) return { head, refs, objects: [], trees: {}, ancestry: [], mergeBases: {}, fsck: [] };
506 const dir = join(root, `judge-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.git`);
507 // a repository stock git cannot mirror (refs it will not hold side by side, say) is judged as such: its refs as listed, and
508 // the clone's refusal as its one fsck problem
509 const cl = await run('git', ['clone', '-q', '--mirror', url, dir], { cwd: root, env });
510 if (cl.status !== 0) { rmSync(dir, { recursive: true, force: true }); return { head, refs, objects: [], trees: {}, ancestry: [], mergeBases: {}, fsck: [`clone --mirror failed: ${cl.stderr.trim().split('\n').pop()?.slice(0, 200) ?? ''}`] }; }
511 const g = async args => (await must(run('git', args, { cwd: dir, env }), args[0])).stdout;
512 const objects = (await g(['rev-list', '--objects', '--no-object-names', '--all'])).trim().split('\n').filter(Boolean).sort();
513 const trees = {};
514 for (const r of Object.keys(refs)) { const t = await run('git', ['rev-parse', '--verify', '-q', `${r}^{tree}`], { cwd: dir, env }); if (t.status === 0) trees[r] = t.stdout.trim(); }
515 const ancestry = (await g(['rev-list', '--parents', '--all'])).trim().split('\n').filter(Boolean).sort();
516 const heads = Object.keys(refs).filter(r => r.startsWith('refs/heads/')).sort();
517 const mergeBases = {};
518 if (heads.length <= 8) for (let i = 0; i < heads.length; i++) for (let j = i + 1; j < heads.length; j++) {
519 const mb = await run('git', ['merge-base', '--all', heads[i], heads[j]], { cwd: dir, env });
520 mergeBases[`${heads[i]}..${heads[j]}`] = mb.stdout.trim().split('\n').filter(Boolean).sort().join(',');
521 }
522 const fsck = fsckProblems(dir);
523 rmSync(dir, { recursive: true, force: true });
524 return { head, refs, objects, trees, ancestry, mergeBases, fsck };
525}
527// ---- one scenario on one target ----
528// target: { name: Target, client: 'ply' | 'git', proxy, repoPath } where repoPath is the path under the proxy's
529// upstream (e.g. `/s3.git` or `/git/<namespace>/<repo>.git`).
530export async function runScenario(scenario, target, { tracer, root }) {
531 const seed = await buildSeed(root, scenario.seed);
532 const url = ch => `${target.proxy.url}/${ch}${target.repoPath}`;
533 const rootSpan = tracer.start('probe.run', { attrs: { 'probe.scenario': scenario.id, 'probe.target': target.name } });
534 const steps = [], stepExchanges = [];
535 try {
536 if (scenario.seed.refs.length > 0) {
537 const s = tracer.start('probe.seed', { parent: rootSpan });
538 const r = await run('git', ['push', '--porcelain', url('side'), ...scenario.seed.refs.map(x => `${seed.names[x.at]}:${x.ref}`)], { cwd: seed.dir, env: seed.env });
539 s.set({ 'process.exit.code': r.status }).end();
540 if (r.status !== 0) throw new Error(`seed push failed: ${r.stderr.trim().slice(0, 400)}`);
541 }
542 for (const [i, st] of scenario.steps.entries()) {
543 const span = tracer.start('probe.step', { parent: rootSpan, attrs: { 'probe.step': i, 'probe.step.kind': st.tag, 'probe.client': target.client } });
544 const before = target.proxy.exchanges.length;
545 let outcomes;
546 if (target.client === 'git' && st.git.tag === 'none') outcomes = [{ outcome: 'landed', error: 'skipped', detail: st.git.why }];
547 else if (target.client === 'ply' && st.tag === 'push' && st.ply.tag === 'none') outcomes = [{ outcome: 'landed', error: 'skipped', detail: st.ply.why }];
548 else if (st.tag === 'push' || st.tag === 'fetch') {
549 const cwd = st.tag === 'push' && target.client === 'git' ? await gitFrom(seed, scenario, st.push, st.from, root, url('main')) : null;
550 const f = st.fault;
551 if (f.tag !== 'none') target.proxy.arm({ ...f, on: st.tag === 'push' ? 'receive' : 'upload', ...(f.tag === 'race' ? { run: () => forcePush(url('side'), seed, f.moves) } : {}) });
552 const r = st.tag === 'fetch'
553 ? (target.client === 'ply' ? await plyFetch(url('main'), seed, st, tracer, span) : await gitFetch(url('main'), seed, st, root))
554 : (target.client === 'ply' ? await plyPush(url('main'), seed, scenario, st.push, tracer, span, st.from, st.timeouts) : await gitPush(url('main'), seed, st.push, cwd, st.timeouts));
555 const unfired = target.proxy.armedLeft();
556 target.proxy.disarm();
557 outcomes = [{ outcome: r.outcome, error: r.error, detail: unfired ? `fault ${st.fault.tag} never fired; ${r.detail}` : r.detail }];
558 } else if (st.tag === 'retry-unlanded') {
559 const prev = scenario.steps[st.of], seen = steps[st.of];
560 const pushes = prev?.tag === 'concurrent' ? prev.pushes : prev?.tag === 'push' ? [prev.push] : [];
561 outcomes = [];
562 for (const [k, p] of pushes.entries()) {
563 const first = seen?.outcomes[k];
564 if (first?.outcome === 'landed') { outcomes.push({ outcome: 'landed', error: null, detail: 'landed the first time' }); continue; }
565 const r = target.client === 'ply' ? await plyPush(url('main'), seed, scenario, p, tracer, span) : await gitPush(url('main'), seed, p);
566 outcomes.push({ outcome: r.outcome, error: r.error, detail: `retry after ${first?.outcome ?? '?'}: ${r.detail}` });
567 }
568 } else {
569 const rs = await Promise.all(st.pushes.map(p => (target.client === 'ply' ? plyPush(url('main'), seed, scenario, p, tracer, span) : gitPush(url('main'), seed, p))));
570 outcomes = rs.map(r => ({ outcome: r.outcome, error: r.error, detail: r.detail }));
571 }
572 const ex = target.proxy.exchanges.slice(before);
573 span.set({ 'probe.outcomes': outcomes.map(o => o.outcome).join(','), 'probe.errors': outcomes.map(o => String(o.error)).join(','), 'probe.exchanges': ex.length, 'probe.cf_rays': ex.map(e => e.cfRay).filter(Boolean).join(',') }).end();
574 steps.push({ outcomes });
575 stepExchanges.push(ex);
576 }
577 const js = tracer.start('probe.judge', { parent: rootSpan });
578 const end = await observeEnd(url('judge'), root, seed.env);
579 js.set({ 'probe.refs': Object.keys(end.refs).length, 'probe.objects': end.objects.length, 'probe.fsck_problems': end.fsck.length }).end();
580 rootSpan.ok().end();
581 return { observation: { steps, end }, byOid: seed.byOid, stepExchanges };
582 } catch (e) {
583 rootSpan.error(e).end();
584 throw e;
585 }
586}
588// ---- the reference target: git http-backend with Artifacts' policy, behind the recording proxy ----
589export async function startReference() {
590 const root = mkdtempSync(join(tmpdir(), 'ply-probes-ref-'));
591 const repos = join(root, 'repos'); mkdirSync(repos);
592 const srv = await startGitServer(repos);
593 const proxy = await startRecordingProxy({ upstream: srv.url, filterPolicy: true });
594 let n = 0;
595 return {
596 root, proxy,
597 async repo(scenario) {
598 const name = `r${n++}`;
599 const dir = join(repos, `${name}.git`);
600 const env = gitEnv(root);
601 await must(run('git', ['init', '-q', '--bare', '-b', 'main', dir], { env }), 'init reference repo');
602 for (const [k, v] of [...REFERENCE_POLICY, ...scenario.referenceConfig]) await must(run('git', ['config', k, v], { cwd: dir, env }), `config ${k}`);
603 return { repoPath: `/${name}.git`, dir };
604 },
605 close: async () => { await proxy.close(); await srv.close(); rmSync(root, { recursive: true, force: true }); },
606 };
607}
609export function newTracer() {
610 const exporter = arrayExporter();
611 return { tracer: new Tracer({ exporter, resource: { 'service.name': 'ply-probes' } }), spans: () => exporter.lines.flatMap(flattenLine) };
612}
Diagnostics9 git calls · 200 ms
CallStatusSizeTime0200 ms
discover200191 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=191 git.server.agent=git/github-9922ec520325-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=191 git.pkt.payload.max=36
ls-refs20012 KiB3 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=11990 git.response.cache=UPDATING git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=152 git.pkt.data=151 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=11990 git.pkt.payload.max=122 git.ls_refs.count=151 git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 1200347 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=4 git.response.bytes=347 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=347 git.pkt.payload.max=247 git.sideband.band1.bytes=247 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=247 git.pack.trailer=4b72f39b5ea57c5ae3009f90b53e3a6a155093e7Open pack map
fetchtree:0 · deepen 102004.2 KiB · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=80 git.response.bytes=4347 git.response.cache=HIT git.response.duration_ms=4 git.fetch.filter=tree:0 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=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=4347 git.pkt.payload.max=4247 git.sideband.band1.bytes=4247 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=4247 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=a6caf8e129bea82c9bae4cbc7c130c9205add400 git.pack.full=10Open pack map
fetchcombine:blob:none+tree:2 · deepen 1200—80 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.cache=BYPASS git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 error.type=remote_error error=remote: filter 'combine' not supported
fetchtree:0200919 B · 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=919 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=800d30ba8923860bfc460ca884b7f9ba22083588 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=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=919 git.pkt.payload.max=892 git.sideband.band1.bytes=892 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=892 git.pack.trailer=5323b9266eea5ded637285d1c5320699f12be76eOpen pack map
fetchtree:02005.6 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=5724 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=58fabb6768b3f737ee9cd8bac647bdc27405fb4d 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=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=5724 git.pkt.payload.max=5697 git.sideband.band1.bytes=5697 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=5697 git.pack.trailer=be7e0453974a5fe832f9065a33bb7e3434c10e9bOpen pack map
fetchtree:0200305 B · 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=305 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=facf357dda5424ce8c1bda8ebca6cacc9b5bfc3a 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=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=305 git.pkt.payload.max=278 git.sideband.band1.bytes=278 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=278 git.pack.trailer=36c263093b3db739addfdbaa3928c1028217ea9eOpen pack map
fetch20013 KiB109 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=107 git.response.bytes=12839 git.response.cache=MISS git.response.duration_ms=109 git.fetch.wants=abd286277e992fa5c6b9f011e4e5f9ba09a20417 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=5 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=12839 git.pkt.payload.max=8192 git.sideband.band1.bytes=12807 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://github.com/ivarvong/ply
- Ref
- refs/heads/main
- Commit
- 19912563f540228593df0c489082e5e2508e21e4
- cf-ray
- a5e1a3e62efc5e44
- Request
- 7256e016…
- Protocol
- v2 · sha1
- Agent
- git/github-9922ec520325-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format