GitHubivarvong

ply

main
ply7 git calls90 ms25 KiB4 cachedprotocol v2
107 lines5.9 KiBRaw
1import { test } from 'vitest';
2import assert from 'node:assert/strict';
3import { readFileSync } from 'node:fs';
4import { dirname, join } from 'node:path';
5import { fileURLToPath } from 'node:url';
6import { DEFAULT_LIMITS } from '../../src/limits.js';
7import { boundaryValues } from './boundary.mjs';
8import { PARAMS } from './params.mjs';
9import { CI_BYTES, CI_ENTRIES, allCells, isCi } from './matrix.mjs';
11const here = dirname(fileURLToPath(import.meta.url));
12const ratchet = JSON.parse(readFileSync(join(here, 'ratchet.json'), 'utf8'));
14test('boundary values are 0, 1, the limit, both neighbours, and powers of two through the first power past it', () => {
15 assert.deepEqual(boundaryValues(0), [0, 1]);
16 assert.deepEqual(boundaryValues(1), [0, 1, 2]);
17 assert.deepEqual(boundaryValues(8), [0, 1, 2, 4, 7, 8, 9, 16]);
18 const tree = boundaryValues(DEFAULT_LIMITS.maxTreeEntries);
19 for (const n of [0, 1, 199_999, 200_000, 200_001, 262_144]) assert.ok(tree.includes(n), String(n));
20 assert.equal(tree.includes(524_288), false);
21 assert.equal(boundaryValues(DEFAULT_LIMITS.maxDeltaChain).includes(65), true);
22});
24test('every Limits key is in the param registry', () => {
25 assert.deepEqual(PARAMS.map(p => p.key).sort(), Object.keys(DEFAULT_LIMITS).sort());
26 for (const row of PARAMS) {
27 assert.equal(row.limit, DEFAULT_LIMITS[row.key]);
28 assert.equal(row.later, row.probe === null);
29 }
30});
32test('every Limits key has cells, and each limit is crossed in CI: a cell at or under the boundary and one past it', () => {
33 const cells = allCells();
34 assert.deepEqual(PARAMS.filter(p => p.later).map(p => p.key), []);
35 for (const { key } of PARAMS) {
36 const mine = cells.filter(c => c.param === key);
37 assert.ok(mine.length >= 3, `${key}: ${mine.length} cells`);
38 assert.ok(mine.some(c => isCi(c)), `${key}: no CI cell`);
39 }
40});
42test('second-pass cells (#144) exist: thin packs, protocol v0/v1, pkt-line lengths, caps, timeout, workerd', () => {
43 const ids = new Set(allCells().map(c => c.id));
44 for (const id of [
45 'objects.pack.tiny-99898', 'objects.pack.tiny-99899', 'section.acks.h999', 'section.acks.h1000', 'section.shallow.k1000', 'section.shallow.k1001',
46 'thin.push.thin', 'thin.fetch.external', 'proto.v0.lsRefs', 'proto.v1.readFile', 'pktline.frame-4.readFile.1024', 'pktline.frame-65520.readFile',
47 'pktline.frame-65521.readFile', 'caps.nofilter.readFile', 'timeout.cap1000.lsRefs.stall-2500', 'timeout.lsRefs.delay-65000', 'workerd.readFile.16777216',
48 'delta.ofs.d65', 'parents.octo-10001', 'report.n10000', 'rebase.cap8.k9',
49 ]) assert.equal(ids.has(id), true, id);
50 const wd = allCells().filter(c => c.runtime === 'workerd');
51 assert.ok(wd.length >= 8 && wd.filter(c => isCi(c)).length >= 6, `workerd cells ${wd.length}`);
52 // the slow-server cells at the default 60 s timers are nightly; CI crosses a 1 s cap (#255: one per timer)
53 const timers = ['requestTimeoutMs', 'firstByteTimeoutMs', 'idleTimeoutMs', 'heldTimeoutMs'];
54 for (const c of allCells().filter(c => timers.includes(c.param) && !c.id.startsWith('parse.') && !c.limits?.[c.param])) assert.equal(isCi(c), false, c.id);
55 for (const key of timers) assert.ok(allCells().some(c => c.param === key && isCi(c) && c.limits?.[key] === 1000), `a CI cell crosses a 1 s ${key}`);
56});
58test('every Limits key is parsed where it enters (#156): a CI cell per key refuses a value that bounds nothing at an operation that never reads it', () => {
59 const cells = allCells();
60 for (const { key } of PARAMS) {
61 const mine = cells.filter(c => c.id.startsWith(`parse.${key}.`));
62 assert.equal(mine.length, 2, key);
63 for (const c of mine) {
64 assert.ok(isCi(c), c.id);
65 assert.equal(c.op, 'lsRefs', c.id);
66 assert.deepEqual(Object.keys(c.limits), [key], c.id);
67 // null is a value on every key, refused like -1 (#271)
68 assert.deepEqual(c.expect, { status: 'refused', code: 'bad_request', what: key }, c.id);
69 }
70 }
71 const work = cells.filter(c => c.id.startsWith('parse.maxResolveWork.'));
72 assert.deepEqual(work.map(c => [c.id, c.limits.maxResolveWork, c.expect.status]), [['parse.maxResolveWork.negative', -1, 'refused'], ['parse.maxResolveWork.null', null, 'refused']]);
73 assert.deepEqual(cells.find(c => c.id === 'parse.none').expect, { status: 'ok' });
74});
76test('CI keeps cells up to 16 MiB and 65536 entries; the known large boundaries are nightly', () => {
77 const cells = allCells();
78 const ids = new Set(cells.map(c => c.id));
79 for (const id of ['refs.lsRefs.10000', 'refs.lsRefs.10001', 'depth.mergebase.k1024', 'depth.mergebase.k1025', 'depth.mergebase.k2048', 'tree.listTree.65536']) {
80 assert.equal(ids.has(id), true, id);
81 assert.equal(isCi(cells.find(c => c.id === id)), true, id);
82 }
83 for (const id of ['tree.listTree.199999', 'tree.listTree.200000', 'tree.listTree.200001', 'tree.listTree.262144', 'push.total.3x50331648', 'delta.ofs.d299']) {
84 assert.equal(ids.has(id), true, id);
85 assert.equal(isCi(cells.find(c => c.id === id)), false, id);
86 }
87 for (const cell of cells) {
88 if (!isCi(cell)) continue;
89 assert.ok((cell.bytes ?? 0) <= CI_BYTES, `${cell.id} bytes ${cell.bytes}`);
90 assert.ok((cell.entries ?? 0) <= CI_ENTRIES, `${cell.id} entries ${cell.entries}`);
91 }
92 assert.ok(cells.length > 80, `matrix has ${cells.length} cells`);
93});
95test('the ratchet names cells the matrix builds, and only goes down by deleting a line', () => {
96 const ids = new Set(allCells().map(c => c.id));
97 assert.ok(Array.isArray(ratchet.entries));
98 for (const entry of ratchet.entries) {
99 assert.equal(ids.has(entry.id), true, entry.id);
100 const cell = allCells().find(c => c.id === entry.id);
101 assert.ok(cell?.runtime === 'workerd' ? entry.heap === 'workerd' : entry.heap === 'default' || entry.heap === '128', `${entry.id} heap ${entry.heap}`);
102 assert.equal(typeof entry.why, 'string');
103 assert.ok(entry.why.length > 12, entry.id);
104 assert.match(entry.why, /#\d+/, `${entry.id}: the reason cites an issue`);
105 assert.equal(typeof entry.actual?.status, 'string');
106 }
107});
Diagnostics7 git calls · 90 ms
CallStatusSizeTime090 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 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 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=3
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 · 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=5724
git.response.cache=HIT
git.response.duration_ms=3
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
fetchtree:0200381 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=75
git.response.bytes=381
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=294ee88709910bdf98d58eeb6898cd838de94a3a
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=381
git.pkt.payload.max=354
git.sideband.band1.bytes=354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=354
git.pack.trailer=2c7127c2c53a7ca2957296d420246ab2358e3775
Open pack map
fetch2002.2 KiB75 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2224
git.response.cache=MISS
git.response.duration_ms=75
git.fetch.wants=b994219c4b85070d070caedc2d556e4f76c6236e
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=2224
git.pkt.payload.max=2197
git.sideband.band1.bytes=2197
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
a5e2ef2a89ec77be
Request
4abba67d…
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