GitHubivarvong

ply

main
ply6 git calls95 ms29 KiB4 cachedprotocol v2
318 lines21 KiBRaw
1// The telemetry contract (#35). Span names and attribute keys are public API: consumers build dashboards and alerts on
2// them. Every public operation and the wire spans run against real git (http-backend), and the span tree each produces is reduced to its shape: names, kinds, parent/child structure, links, and
3// attribute KEYS with their value types (never values). The shape must equal test/span-contract.json.
4//
5// a span or key removed or renamed → this test fails, naming it: a breaking change (README "Telemetry contract")
6// a span or key added → this test fails too, until the snapshot is regenerated and reviewed:
7// UPDATE_SPAN_CONTRACT=1 npx vitest run test/span-contract.test.js
8//
9// Shape rules. Siblings with the same name merge into one node (a fetch made three times is one `git.upload-pack fetch`
10// node with the union of their keys), so a round-trip count is not part of the contract; their order in the file is by
11// name. OTLP intValue and doubleValue are both `number` (a duration that happens to be whole encodes as an int). A span
12// that follows another (README "Span lifetimes") is listed under that span's `followers`, not its `children`.
13//
14// Also here: the lifetime rule. In every trace above, no span starts before or ends after its parent; a span with no
15// parent is either an operation root (it carries ply.isolate.invocation) or follows an exported span via a
16// follows_from link.
17import { test, beforeAll as before, afterAll as after } from 'vitest';
18import assert from 'node:assert/strict';
19import { join } from 'node:path';
20import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
21import { git, tmpRoot, makeBareRepo, startGitServer, initRepo } from './server.js';
22import { Tracer, arrayExporter, KIND } from '../src/otel.js';
23import { createTransport as createTransportR } from '../src/http.js';
24import { editFile } from '../src/edit.js';
25import { commitChanges } from '../src/changes.js';
26import { pushTree } from '../src/tree.js';
27import { checkoutTree } from '../src/checkout.js';
28import { readFile, listTree, readCommit } from '../src/read.js';
29import { mergeBranch } from '../src/merge.js';
30import { rebaseBranch, cherryPick, revertCommit } from '../src/rebase.js';
31import { createBranch, deleteBranch, createTag } from '../src/refops.js';
32import { pushRepo } from '../src/repo-node.js';
33import { lsRefs as lsRefsR } from '../src/lsrefs.js';
34import { fetchPack as fetchPackR } from '../src/fetchpack.js';
35import { discover as discoverR } from '../src/discover.js';
36import { receiveCaps as receiveCapsR } from '../src/receivecaps.js';
38import { unwrap, unwrapAsync } from './unwrap.js';
39// Throwing adapters over the Result API (0.2.0): the assertions below are about the throw.
40const createTransport = (...a) => unwrap(createTransportR(...a));
41const lsRefs = (...a) => unwrapAsync(lsRefsR(...a));
42const fetchPack = (...a) => unwrapAsync(fetchPackR(...a));
43const discover = (...a) => unwrapAsync(discoverR(...a));
44const receiveCaps = (...a) => unwrapAsync(receiveCapsR(...a));
45const SNAPSHOT = new URL('./span-contract.json', import.meta.url);
46const UPDATE = process.env.UPDATE_SPAN_CONTRACT === '1';
47const author = { name: 'contract', email: 'contract@x' };
48const KIND_NAME = Object.fromEntries(Object.entries(KIND).map(([k, v]) => [v, k]));
50// ---- shape (pure) ----
51const TYPE_OF = { stringValue: 'string', intValue: 'number', doubleValue: 'number', boolValue: 'boolean', arrayValue: 'array', bytesValue: 'bytes' };
52const valueType = v => TYPE_OF[Object.keys(v)[0]] ?? 'unknown';
53const spansOf = lines => lines.flatMap(l => l.resourceSpans.flatMap(rs => rs.scopeSpans.flatMap(ss => ss.spans)));
54const linkKind = l => (l.attributes ?? []).find(a => a.key === 'ply.link')?.value.stringValue ?? '';
56// raw OTLP spans → [root node]: { name, kind, attrs: {key: type}, links: [kind], children: [node], followers: [node] }
57export function shape(spans, { skipRoot = null } = {}) {
58 const byId = new Map(spans.map(s => [s.spanId, { s, children: [], followers: [] }]));
59 const roots = [];
60 for (const n of byId.values()) {
61 const follows = n.s.links?.find(l => linkKind(l) === 'follows_from');
62 const up = n.s.parentSpanId ? byId.get(n.s.parentSpanId) : follows ? byId.get(follows.spanId) : null;
63 if (n.s.parentSpanId && !up) throw new Error(`span ${n.s.name} has a parent that was never exported`);
64 if (up) (n.s.parentSpanId ? up.children : up.followers).push(n); else roots.push(n);
65 }
66 const merge = group => {
67 const attrs = {}, links = new Set();
68 for (const { s } of group) {
69 for (const { key, value } of s.attributes) { const t = valueType(value); attrs[key] = attrs[key] && attrs[key] !== t ? [...new Set([...attrs[key].split('|'), t])].sort().join('|') : t; }
70 for (const l of s.links ?? []) links.add(linkKind(l));
71 }
72 const node = { name: group[0].s.name, kind: [...new Set(group.map(({ s }) => KIND_NAME[s.kind]))].join('|'), attrs: Object.fromEntries(Object.entries(attrs).sort(([a], [b]) => (a < b ? -1 : 1))) };
73 if (links.size) node.links = [...links].sort();
74 const children = collapse(group.flatMap(g => g.children)), followers = collapse(group.flatMap(g => g.followers));
75 if (children.length) node.children = children;
76 if (followers.length) node.followers = followers;
77 return node;
78 };
79 const collapse = nodes => {
80 const by = new Map();
81 for (const n of nodes) { const l = by.get(n.s.name); if (l) l.push(n); else by.set(n.s.name, [n]); }
82 return [...by.keys()].sort().map(k => merge(by.get(k)));
83 };
84 const top = skipRoot ? roots.filter(r => r.s.name === skipRoot).flatMap(r => r.children) : roots;
85 return collapse(top);
88// a shape → sorted lines, one per span and one per key: what the failure diff is made of
89export function flatten(nodes, prefix = '') {
90 const out = [];
91 for (const n of nodes) {
92 const p = `${prefix}${n.name}`;
93 out.push(`${p} [${n.kind}]${n.links ? ` links=${n.links.join(',')}` : ''}`);
94 for (const [k, t] of Object.entries(n.attrs)) out.push(`${p} · ${k}: ${t}`);
95 out.push(...flatten(n.children ?? [], `${p} > `), ...flatten(n.followers ?? [], `${p} ~> `));
96 }
97 return out;
100export function contractDiff(want, got) {
101 const lines = [];
102 for (const op of [...new Set([...Object.keys(want), ...Object.keys(got)])].sort()) {
103 const w = new Set(flatten(want[op] ?? [])), g = new Set(flatten(got[op] ?? []));
104 const removed = [...w].filter(x => !g.has(x)), added = [...g].filter(x => !w.has(x));
105 if (!removed.length && !added.length) continue;
106 lines.push(`${op}:`);
107 for (const x of removed) lines.push(` - ${x}`);
108 for (const x of added) lines.push(` + ${x}`);
109 }
110 return lines;
113// no child outside its parent's [start, end]; every parentless span is an invocation root or follows an exported span
114export function lifetimeViolations(spans) {
115 const byId = new Map(spans.map(s => [s.spanId, s]));
116 const bad = [];
117 for (const s of spans) {
118 const [start, end] = [BigInt(s.startTimeUnixNano), BigInt(s.endTimeUnixNano)];
119 if (s.parentSpanId) {
120 const p = byId.get(s.parentSpanId);
121 if (!p) { bad.push(`${s.name}: parent never exported`); continue; }
122 if (p.traceId !== s.traceId) bad.push(`${s.name}: parent in another trace`);
123 if (start < BigInt(p.startTimeUnixNano)) bad.push(`${s.name} starts before its parent ${p.name}`);
124 if (end > BigInt(p.endTimeUnixNano)) bad.push(`${s.name} ends ${Number(end - BigInt(p.endTimeUnixNano)) / 1e6} ms after its parent ${p.name}`);
125 continue;
126 }
127 if (s.attributes.some(a => a.key === 'ply.isolate.invocation')) continue;
128 const f = s.links?.find(l => linkKind(l) === 'follows_from');
129 if (!f) bad.push(`${s.name}: parentless, not an operation root, and follows nothing`);
130 else if (!byId.has(f.spanId)) bad.push(`${s.name}: follows a span that was never exported`);
131 else if (byId.get(f.spanId).traceId === s.traceId) bad.push(`${s.name}: follows a span in its own trace (it should be a child)`);
132 }
133 return bad;
136// ---- fixtures: real git behind http-backend ----
137let root, cleanup, srv, n = 0;
138before(async () => { ({ root, cleanup } = tmpRoot()); srv = await startGitServer(root); });
139after(async () => { await srv?.close(); cleanup?.(); });
141const repo = () => {
142 const name = `c${n++}`; const bare = makeBareRepo(root, name); const work = join(root, `w${name}`);
143 mkdirSync(work); initRepo(work);
144 return { bare, work, url: `${srv.url}/${name}.git` };
145};
146const G = ['-c', 'user.name=seed', '-c', 'user.email=seed@x', '-c', 'commit.gpgsign=false'];
147// commit `files` on `branch` (created from `from`) and push it; null deletes a path. Returns the commit oid.
148const commitOn = (r, branch, files, msg, from = branch) => {
149 const exists = b => { try { git(r.work, ['rev-parse', '-q', '--verify', `refs/heads/${b}`]); return true; } catch { return false; } };
150 if (exists(from)) git(r.work, ['checkout', '-q', '-B', branch, from]); else git(r.work, ['checkout', '-q', '-B', branch]);
151 for (const [p, v] of Object.entries(files)) {
152 if (v === null) { git(r.work, ['rm', '-q', p]); continue; }
153 mkdirSync(join(r.work, p, '..'), { recursive: true }); writeFileSync(join(r.work, p), v);
154 }
155 git(r.work, ['add', '-A']); git(r.work, [...G, 'commit', '-q', '--allow-empty', '-m', msg]);
156 git(r.work, ['push', '-q', '-f', r.bare, `HEAD:refs/heads/${branch}`]);
157 return git(r.work, ['rev-parse', 'HEAD']).trim();
158};
159const seeded = () => { const r = repo(); r.base = commitOn(r, 'main', { 'a/b.txt': 'MARK\n', 'a/c.txt': 'c\n', 'big.bin': Buffer.alloc(200_000, 7), 'README.md': '# r\n' }, 'seed'); return r; };
160const drain = async stream => { const rd = stream.getReader(); let bytes = 0; for (;;) { const { value, done } = await rd.read(); if (done) return bytes; bytes += value.length; } };
161const traced = () => { const ex = arrayExporter(); return { tracer: new Tracer({ exporter: ex }), spans: () => spansOf(ex.lines) }; };
163// one entry per public operation (and the wire layer): name → async ({ tracer }) => void, every stream drained
164const SCENARIOS = {
165 editFile: async ({ tracer }) => { const r = seeded(); await unwrapAsync(editFile(r.url, { path: 'a/b.txt', find: 'MARK', replace: 'DONE', author, message: 'edit' }, { tracer, verify: true })); },
166 commitChanges: async ({ tracer }) => {
167 const r = seeded();
168 await unwrapAsync(commitChanges(r.url, { ref: 'refs/heads/main', changes: [{ kind: 'create', path: 'n.txt', content: 'n\n' }], author, message: 'add', time: 1700000000 }, { tracer, verify: true }));
169 await unwrapAsync(commitChanges(r.url, { ref: 'refs/heads/main', changes: [{ kind: 'edit', path: 'a/b.txt', find: 'MARK', replace: 'DONE' }], author, message: 'edit', time: 1700000000 }, { tracer, verify: true }));
170 },
171 pushTree: async ({ tracer }) => { const r = seeded(); await unwrapAsync(pushTree(r.url, { files: { 'a/b.txt': 'NEW\n', 'a/c.txt': 'c\n', 'x/y.txt': 'y\n' }, author, message: 'deploy' }, { tracer, verify: true })); },
172 checkoutTree: async ({ tracer }) => { const r = seeded(); const res = await unwrapAsync(checkoutTree(r.url, {}, { tracer })); for await (const f of res.files) if (f.stream) await drain(f.stream); },
173 'checkoutTree(batch=1)': async ({ tracer }) => { const r = seeded(); const res = await unwrapAsync(checkoutTree(r.url, { path: 'a' }, { tracer, batch: 1 })); for await (const f of res.files) if (f.stream) await drain(f.stream); },
174 readFile: async ({ tracer }) => { const r = seeded(); const res = await unwrapAsync(readFile(r.url, { path: 'a/b.txt' }, { tracer })); await drain(res.stream); },
175 listTree: async ({ tracer }) => { const r = seeded(); await unwrapAsync(listTree(r.url, { path: 'a' }, { tracer })); },
176 readCommit: async ({ tracer }) => { const r = seeded(); await unwrapAsync(readCommit(r.url, {}, { tracer })); },
177 mergeBranch: async ({ tracer }) => {
178 const r = seeded(); commitOn(r, 'feat', { 'f.txt': 'f\n' }, 'feat', 'main'); commitOn(r, 'main', { 'a/c.txt': 'c2\n' }, 'main moves');
179 await unwrapAsync(mergeBranch(r.url, { ref: 'refs/heads/main', from: 'refs/heads/feat', author, message: 'merge feat' }, { tracer, verify: true }));
180 },
181 rebaseBranch: async ({ tracer }) => {
182 const r = seeded(); commitOn(r, 'feat', { 'f.txt': 'f\n' }, 'feat 1', 'main'); commitOn(r, 'feat', { 'g.txt': 'g\n' }, 'feat 2'); commitOn(r, 'main', { 'a/c.txt': 'c2\n' }, 'main moves');
183 await unwrapAsync(rebaseBranch(r.url, { ref: 'refs/heads/feat', onto: 'refs/heads/main', committer: author }, { tracer }));
184 },
185 cherryPick: async ({ tracer }) => {
186 const r = seeded(); const pick = commitOn(r, 'feat', { 'f.txt': 'f\n' }, 'feat', 'main'); commitOn(r, 'main', { 'a/c.txt': 'c2\n' }, 'main moves');
187 await unwrapAsync(cherryPick(r.url, { ref: 'refs/heads/main', commit: pick, committer: author }, { tracer }));
188 },
189 revertCommit: async ({ tracer }) => {
190 const r = seeded(); const bad = commitOn(r, 'main', { 'a/c.txt': 'c2\n' }, 'oops'); commitOn(r, 'main', { 'f.txt': 'f\n' }, 'later');
191 await unwrapAsync(revertCommit(r.url, { ref: 'refs/heads/main', commit: bad, committer: author }, { tracer }));
192 },
193 createBranch: async ({ tracer }) => { const r = seeded(); await unwrapAsync(createBranch(r.url, { ref: 'refs/heads/b', from: 'main' }, { tracer, verify: true })); },
194 deleteBranch: async ({ tracer }) => { const r = seeded(); commitOn(r, 'gone', { 'g.txt': 'g\n' }, 'gone', 'main'); await unwrapAsync(deleteBranch(r.url, { ref: 'refs/heads/gone' }, { tracer })); },
195 createTag: async ({ tracer }) => { const r = seeded(); await unwrapAsync(createTag(r.url, { name: 'v1', target: r.base, message: 'v1', tagger: author }, { tracer, verify: true })); },
196 pushRepo: async ({ tracer }) => {
197 const r = seeded(); writeFileSync(join(r.work, 'a/c.txt'), 'c2\n'); git(r.work, ['add', '-A']); git(r.work, [...G, 'commit', '-q', '-m', 'local']);
198 await unwrapAsync(pushRepo(r.work, r.url, { refspecs: ['main'] }, { tracer }));
199 },
200 // the wire spans on their own, under a harness span that is not part of the contract
201 wire: async ({ tracer }) => {
202 const r = seeded(); const holder = tracer.start('contract.harness');
203 const t = createTransport(r.url, { tracer, parent: holder });
204 await discover(t); await receiveCaps(t);
205 const { refs } = await lsRefs(t, ['refs/heads/main']);
206 await fetchPack(t, { wants: [refs.get('refs/heads/main').oid], filter: 'blob:none', deepen: 1 });
207 holder.end();
208 },
209};
212async function record(scenarios) {
213 const out = {}, all = [];
214 for (const [name, run] of Object.entries(scenarios)) {
215 const { tracer, spans } = traced();
216 await run({ tracer });
217 const s = spans(); all.push(...s);
218 out[name] = shape(s, { skipRoot: name === 'wire' ? 'contract.harness' : null });
219 }
220 return { shapes: out, spans: all };
223let recorded = null;
224const recordAll = async () => (recorded ??= (async () => {
225 return record(SCENARIOS);
226})());
228test('span contract: every operation\'s span tree (names, kinds, structure, links, attribute keys and types) equals test/span-contract.json', async () => {
229 const { shapes } = await recordAll();
230 if (UPDATE) { writeFileSync(SNAPSHOT, `${JSON.stringify(shapes, null, 2)}\n`); return; }
231 assert.ok(existsSync(SNAPSHOT), 'no snapshot: run UPDATE_SPAN_CONTRACT=1 npx vitest run test/span-contract.test.js');
232 const want = JSON.parse(readFileSync(SNAPSHOT, 'utf8'));
233 const diff = contractDiff(want, shapes);
234 assert.deepEqual(diff, [], [
235 'the span contract changed (- is in test/span-contract.json but no longer emitted: removing or renaming it is a breaking change; + is new: review it, then regenerate with UPDATE_SPAN_CONTRACT=1 npx vitest run test/span-contract.test.js):',
236 ...diff,
237 ].join('\n'));
238 // the diff is set-based; the file must also be exactly what the generator writes (no hand edits, nothing reordered)
239 assert.equal(readFileSync(SNAPSHOT, 'utf8'), `${JSON.stringify(shapes, null, 2)}\n`);
240});
242test('span contract: the snapshot covers every public operation, and the wire spans', async () => {
243 const want = JSON.parse(readFileSync(SNAPSHOT, 'utf8'));
244 const names = new Set(flatten(Object.values(want).flat()).map(l => l.split(' [')[0].split(' · ')[0].split(/ (?:>|~>) /).at(-1)));
245 for (const s of ['git.edit', 'git.commit', 'git.commit.apply', 'git.push_tree', 'git.checkout', 'git.checkout.blobs', 'git.read', 'git.read.blob', 'git.blob.inflate', 'git.ls_tree', 'git.read_commit', 'git.merge', 'git.rebase', 'git.cherry_pick', 'git.revert', 'git.branch_create', 'git.branch_delete', 'git.tag_create',
246 'git.upload-pack ls-refs', 'git.upload-pack fetch', 'git.upload-pack discover', 'git.receive-pack', 'git.receive-pack advertise']) assert.ok(names.has(s), `${s} is not in the contract`);
247});
249test('span lifetimes: no span outlives its parent; a parentless span is an operation root or follows an exported one', async () => {
250 const { spans } = await recordAll();
251 assert.ok(spans.length > 50);
252 assert.deepEqual(lifetimeViolations(spans), []);
253});
255test('span naming: the rules test/pure.test.js checks on one edit hold on every span above', async () => {
256 const { spans } = await recordAll();
257 const NAME = /^(git\.(upload-pack|receive-pack)( [a-z-]+)?|git\.[a-z_]+(\.[a-z_]+)?)$/;
258 const KEY = /^(git|http|url|server|mem|error|ply|exception)\.[a-z0-9_.-]+$/;
259 for (const s of spans.filter(x => x.name !== 'contract.harness')) {
260 assert.match(s.name, NAME);
261 for (const { key } of s.attributes) assert.match(key, KEY, `attr ${key} on ${s.name}`);
262 if (!s.parentSpanId) assert.ok(s.attributes.some(a => a.key === `${s.name}.outcome`), `trace root ${s.name} has no ${s.name}.outcome`);
263 }
264});
266test('span lifetimes: a blob read long after readFile returns is its own trace, linked both ways, and ends with the stream', async () => {
267 const r = seeded(); const { tracer, spans } = traced();
268 const res = await unwrapAsync(readFile(r.url, { path: 'big.bin' }, { tracer }));
269 const rootSpan = spans().find(s => s.name === 'git.read');
270 assert.ok(rootSpan, 'the root is exported when readFile returns, before the stream is read');
271 assert.equal(spans().find(s => s.name === 'git.read.blob'), undefined, 'the blob span is still open');
272 await new Promise(ok => setTimeout(ok, 30));
273 assert.equal(await drain(res.stream), 200_000);
274 const blob = spans().find(s => s.name === 'git.read.blob');
275 assert.equal(blob.parentSpanId, undefined); assert.notEqual(blob.traceId, rootSpan.traceId);
276 assert.deepEqual(blob.links.map(l => [l.traceId, l.spanId, linkKind(l)]), [[rootSpan.traceId, rootSpan.spanId, 'follows_from']]);
277 assert.deepEqual(rootSpan.links.map(l => [l.traceId, l.spanId, linkKind(l)]), [[blob.traceId, blob.spanId, 'followed_by']]);
278 assert.ok(BigInt(blob.startTimeUnixNano) < BigInt(rootSpan.endTimeUnixNano), 'the stream is opened inside the operation');
279 assert.ok(BigInt(blob.endTimeUnixNano) - BigInt(rootSpan.endTimeUnixNano) >= 30_000_000n, 'and ends with the read, after the root');
280 assert.equal(blob.attributes.some(a => a.key === 'ply.isolate.invocation'), false, 'a follower is not an invocation');
281 assert.deepEqual(lifetimeViolations(spans()), []);
282});
284test('span lifetimes: a cancelled blob stream ends its spans with outcome cancelled (before or after the bytes arrive)', async () => {
285 const r = seeded();
286 for (const [path, how] of [['a/b.txt', 'before-read'], ['big.bin', 'mid-read']]) {
287 const { tracer, spans } = traced();
288 const res = await unwrapAsync(readFile(r.url, { path }, { tracer }));
289 if (how === 'before-read') { await new Promise(ok => setTimeout(ok, 50)); await res.stream.cancel('done'); }
290 else { const rd = res.stream.getReader(); await rd.read(); await rd.cancel('done'); }
291 const blob = spans().find(s => s.name === 'git.read.blob');
292 assert.ok(blob, `${how}: the blob span ended`);
293 const attrs = Object.fromEntries(blob.attributes.map(a => [a.key, a.value]));
294 assert.deepEqual([attrs['git.read.blob.outcome'], blob.status.code], [{ stringValue: 'cancelled' }, 1], how);
295 await new Promise(ok => setTimeout(ok, 20)); // the aborted pump settles; it must not re-end or re-export anything
296 assert.equal(spans().filter(s => s.name === 'git.read.blob').length, 1);
297 assert.deepEqual(lifetimeViolations(spans()), [], how);
298 }
299});
301test('span contract: opt-in response-header attributes are absent unless recordResponseHeaders is set', async () => {
302 const { spans } = await recordAll();
303 for (const s of spans) for (const { key } of s.attributes) {
304 assert.ok(key === 'http.response.header.content-type' || !key.startsWith('http.response.header.'), `${s.name} emitted ${key} with no recordResponseHeaders`);
305 assert.notEqual(key, 'http.response.headers.from_cache', s.name);
306 }
307});
309test('span contract: the differ names removed, renamed and added keys and spans', () => {
310 const base = { op: [{ name: 'git.x', kind: 'INTERNAL', attrs: { 'git.x.a': 'number', 'git.x.outcome': 'string' }, children: [{ name: 'git.x.y', kind: 'INTERNAL', attrs: {} }] }] };
311 const renamed = structuredClone(base); delete renamed.op[0].attrs['git.x.a']; renamed.op[0].attrs['git.x.b'] = 'number';
312 assert.deepEqual(contractDiff(base, renamed), ['op:', ' - git.x · git.x.a: number', ' + git.x · git.x.b: number']);
313 const retyped = structuredClone(base); retyped.op[0].attrs['git.x.a'] = 'string';
314 assert.deepEqual(contractDiff(base, retyped), ['op:', ' - git.x · git.x.a: number', ' + git.x · git.x.a: string']);
315 const dropped = structuredClone(base); delete dropped.op[0].children;
316 assert.deepEqual(contractDiff(base, dropped), ['op:', ' - git.x > git.x.y [INTERNAL]']);
317 assert.deepEqual(contractDiff(base, structuredClone(base)), []);
318});
Diagnostics6 git calls · 95 ms
CallStatusSizeTime095 ms
discover200191 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
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 KiB · 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=11990
git.response.cache=HIT
git.response.duration_ms=2
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 102004.2 KiB · 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=4347
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=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=10
Open pack map
fetchtree:0200919 B · hit4 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=919
git.response.cache=HIT
git.response.duration_ms=4
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=5323b9266eea5ded637285d1c5320699f12be76e
Open 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=84
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=be7e0453974a5fe832f9065a33bb7e3434c10e9b
Open pack map
fetch2006.7 KiB84 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=6819
git.response.cache=MISS
git.response.duration_ms=84
git.fetch.wants=f7a2da1b4d8cd6fb61fde7a6c2afa0982aca0f44
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=6819
git.pkt.payload.max=6792
git.sideband.band1.bytes=6792
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
a5e0fc7a080b332c
Request
545d0756…
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