Artifactspublic-v0

ply

main
ply4 git calls339 ms39 KiB2 cachedprotocol v2
58 lines3.6 KiBRaw
1// A ratchet baseline may move the unsafe way only in a commit that says so. Each baseline's own script compares the
2// tree with the baseline, so a change that edits both passes it; this compares the baseline with the base commit's.
3// node scripts/ratchet-guard.mjs [<base>] base: the argument, else $RATCHET_BASE, else origin/main
4// A loosened baseline fails unless a commit in <merge-base>..HEAD carries, on a line of its own,
5// Ratchet-Change: <file>: <reason>
6// Loosened means: throw-baseline's count rose; an absence-baseline count rose or its boundary changed; a category of
7// test/space/ratchet.json gained a hole id or was removed; test/durations.json lost the entry of a test file that
8// still exists (it would be planned as the heaviest file). A baseline the base does not have is new, not loosened.
9import { execFileSync } from 'node:child_process';
10import { existsSync, readFileSync } from 'node:fs';
11import { pathToFileURL } from 'node:url';
13const rose = (base, head) => Object.keys(base).filter(k => typeof base[k] === 'number')
14 .flatMap(k => (typeof head[k] !== 'number' ? [`${k} removed`] : head[k] > base[k] ? [`${k} rose ${base[k]} -> ${head[k]}`] : []));
16export const BASELINES = {
17 'scripts/throw-baseline.json': rose,
18 'scripts/absence-baseline.json': (base, head) => [...(head.boundary === base.boundary ? [] : [`boundary ${base.boundary} -> ${head.boundary}`]), ...rose(base, head)],
19 'test/space/ratchet.json': (base, head) => Object.entries(base.categories ?? {}).flatMap(([c, { ids }]) => {
20 const now = head.categories?.[c];
21 if (!now) return [`category ${c} removed`];
22 const had = new Set(ids);
23 return now.ids.filter(id => !had.has(id)).map(id => `${c} gained hole ${id}`);
24 }),
25 'test/durations.json': (base, head, exists) => Object.keys(base).filter(f => !(f in head) && exists(f)).map(f => `${f} lost its weight`),
26};
28// The ways `file` moved the unsafe way between two versions of its text; [] when it did not.
29export function loosened(file, baseText, headText, exists = existsSync) {
30 if (baseText === null) return [];
31 if (headText === null) return ['baseline deleted'];
32 return BASELINES[file](JSON.parse(baseText), JSON.parse(headText), exists);
35function main() {
36 const git = (...args) => execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
37 const ref = process.argv[2] ?? (process.env.RATCHET_BASE || 'origin/main');
38 let base;
39 try { base = git('merge-base', ref, 'HEAD').trim(); } catch {
40 console.error(`ratchet-guard: cannot resolve base '${ref}' (fetch it; CI needs fetch-depth: 0)`);
41 process.exit(1);
42 }
43 const marked = new Set([...git('log', '--format=%B', `${base}..HEAD`).matchAll(/^Ratchet-Change: (\S+): \S.*$/gmu)].map(m => m[1]));
44 let failed = false;
45 for (const file of Object.keys(BASELINES)) {
46 let baseText = null;
47 try { baseText = git('show', `${base}:${file}`); } catch { /* not in the base: a new baseline */ }
48 const why = loosened(file, baseText, existsSync(file) ? readFileSync(file, 'utf8') : null);
49 if (why.length === 0) continue;
50 if (marked.has(file)) { console.log(`ratchet-guard: ${file} loosened (${why.length}), declared by Ratchet-Change`); continue; }
51 failed = true;
52 console.error(`ratchet-guard: ${file} moved the unsafe way against ${base.slice(0, 7)}:\n${why.slice(0, 20).map(w => ` ${w}`).join('\n')}${why.length > 20 ? `\n ... ${why.length - 20} more` : ''}\n a commit must carry the line 'Ratchet-Change: ${file}: <reason>'`);
53 }
54 if (failed) process.exit(1);
55 console.log(`ratchet-guard: no undeclared loosening against ${base.slice(0, 7)}`);
58if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();
Diagnostics4 git calls · 339 ms
CallStatusSizeTime0339 ms
discover200152 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=4
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200145 B · hit4 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=4
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=4
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=145
git.pkt.payload.max=76
git.ls_refs.count=2
git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=38434
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=6
git.pkt.data=4
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=38434
git.pkt.payload.max=38339
git.sideband.band1.bytes=38338
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=63
git.pack.bytes=38338
git.pack.ofs_delta=0
git.pack.ref_delta=8
git.pack.chain.max=8
git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77
git.pack.full=55
Open pack map
fetch2001.7 KiB333 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=333
git.response.bytes=1711
git.response.cache=MISS
git.response.duration_ms=333
git.fetch.wants=eca27b7811f4c0584616d9c7bf8711954b4d1f37
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=1711
git.pkt.payload.max=1690
git.sideband.band1.bytes=1689
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
a5e13fae5cbb1293
Request
a9106045…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format