main
1// The HTTP-level probes (test/probes/wire-plans.ts) against the reference: git http-backend with Artifacts' known
2// policy behind Node's HTTP server (test/server.js), asked directly (no proxy, so framing reaches it as written). Every
3// plan the reference can answer must meet its stated answer with every sender, the main branch unmoved and the
4// repository fsck-clean; each plan names a matrix behaviour; senders that cannot send a plan say why.
5import { test, beforeAll as before, afterAll as after } from 'vitest';
6import assert from 'node:assert/strict';
7import { join } from 'node:path';
8import { mkdirSync, rmSync } from 'node:fs';
9import { startGitServer } from '../server.js';
10import { BEHAVIOURS } from '../behaviours/matrix.ts';
11import { WIRE, WIRE_ALLOW, cornersOf, onReference } from './wire-plans.ts';
12import { REFERENCE_POLICY, gitEnv, newTracer, run } from './runner.mjs';
13import { WIRE_REFERENCE_CONFIG, referenceAuth, runWirePlan, seedOf, tempRoot, v2Caps, wireSeed } from './wire.mjs';
15let root, srv, ws, n = 0;
16before(async () => {
17 root = tempRoot();
18 mkdirSync(join(root, 'repos'));
19 srv = await startGitServer(join(root, 'repos'));
20 ws = await wireSeed(root);
21});
22after(async () => { await srv.close(); rmSync(root, { recursive: true, force: true }); });
24async function referenceRepo(plan) {
25 const name = `w${n++}`;
26 const dir = join(root, 'repos', `${name}.git`);
27 const env = gitEnv(root);
28 await run('git', ['init', '-q', '--bare', '-b', 'main', dir], { env });
29 for (const [k, v] of [...REFERENCE_POLICY, ...WIRE_REFERENCE_CONFIG]) await run('git', ['config', k, v], { cwd: dir, env });
30 const url = `${srv.url}/${name}.git`;
31 const p = await run('git', ['push', '-q', url, ...(await seedOf(plan, ws)).specs], { cwd: ws.dir, env: ws.env });
32 assert.equal(p.status, 0, p.stderr);
33 return url;
34}
36test('every allow entry names a plan, a sender it runs with, and a reason', () => {
37 for (const a of WIRE_ALLOW) {
38 const p = WIRE.find(x => x.id === a.plan);
39 assert.ok(p !== undefined && cornersOf(p).includes(a.corner), `${a.plan} ${a.corner}`);
40 assert.ok(a.reason.length > 40);
41 }
42});
44test('every wire plan names a matrix behaviour, ids are unique, a sender that cannot send says why', () => {
45 const ids = WIRE.map(p => p.id);
46 assert.equal(new Set(ids).size, ids.length);
47 const known = new Set(BEHAVIOURS.map(b => b.id));
48 for (const p of WIRE) {
49 assert.ok(known.has(p.id.split('#')[0]), `${p.id} names no behaviour`);
50 if (p.git.tag === 'none') assert.ok(p.git.why.length > 10, p.id);
51 if (p.ply.tag === 'none') assert.ok(p.ply.why.length > 10, p.id);
52 }
53});
55for (const plan of WIRE.filter(onReference)) {
56 test(`reference: ${plan.id} meets its answer with every sender`, async () => {
57 const url = await referenceRepo(plan);
58 const { tracer } = newTracer();
59 const caps = (await v2Caps(url, referenceAuth(url))).caps;
60 const r = await runWirePlan(plan, cornersOf(plan), { name: 'ref', url, judgeUrl: url, auth: referenceAuth(url) }, ws, { root, tracer, caps });
61 for (const x of r.results) {
62 const allow = WIRE_ALLOW.find(a => a.plan === plan.id && a.target === 'ref' && a.corner === x.corner);
63 if (allow === undefined) assert.ok(x.meets, `${x.corner}: ${x.cls} (${x.detail}) end ${JSON.stringify(r.end)}`);
64 else assert.ok(!x.meets && x.cls === allow.cls, `allow entry unused: ${plan.id} ref ${x.corner} gave ${x.cls}, meets ${x.meets}`);
65 }
66 }, 60_000);
67}
Diagnostics4 git calls · 514 ms
CallStatusSizeTime0514 ms
discover200152 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=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 · hit3 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=145 git.response.cache=HIT git.response.duration_ms=3 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=3 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
fetch2001.5 KiB508 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=508 git.response.bytes=1574 git.response.cache=MISS git.response.duration_ms=508 git.fetch.wants=c0bb6e5e79183e783ab96374b51008b7fed03620 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=1574 git.pkt.payload.max=1553 git.sideband.band1.bytes=1552 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
- a5e2f41eed3f7089
- Request
- 98942761…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format