main
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});
Diagnostics4 git calls · 324 ms
CallStatusSizeTime0324 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 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 · 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=145 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=145 git.pkt.payload.max=76 git.ls_refs.count=2 git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=38434 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=6 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=38434 git.pkt.payload.max=38339 git.sideband.band1.bytes=38338 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=63 git.pack.bytes=38338 git.pack.ofs_delta=0 git.pack.ref_delta=8 git.pack.chain.max=8 git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77 git.pack.full=55Open pack map
fetch2002.2 KiB319 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=319 git.response.bytes=2218 git.response.cache=MISS git.response.duration_ms=319 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=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2218 git.pkt.payload.max=2197 git.sideband.band1.bytes=2196 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
- a5e315a67f77cf5b
- Request
- a846da18…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format