Artifactspublic-v0

ply

main
ply4 git calls520 ms39 KiB2 cachedprotocol v2
56 lines3.5 KiBRaw
1// Runs one rendered cell through the real push path: `push()` over a fake transport that frames the response bytes
2// exactly as http.js does (pktStep over the body, pktFinish at the end), no network. Returns the outcome as a tagged union.
3// PUSH_SPACE_SRC=<dir>: run the space against another copy of src/ (e.g. `git archive main src`) to see where it disagrees
4const SRC = process.env.PUSH_SPACE_SRC ?? '../../src';
5const { push } = await import(`${SRC}/push.js`);
6// atomic and push options reach push() only as capabilities checked against an advertisement that has them (the cells
7// are about the response, not the advertisement: test/space/advertisement.test.js is). An older src/ without
8// checkPushCaps took them raw.
9const { checkPushCaps } = await import(`${SRC}/receivecaps.js`);
10import { pktInit, pktStep, pktFinish } from '../../src/pktline.js';
11import { withLimits } from '../../src/limits.js';
12import { plyError as fail } from '../../src/errors.js';
13import { unwrap } from '../unwrap.js';
15const spanStub = { set() {}, event() {}, error() {} };
16const tracer = { span: async (_name, _opts, fn) => fn(spanStub) };
18export function fakeTransport(response, limits) {
19 const t = {
20 limits: withLimits(limits), tracer, parent: null, sent: 0,
21 async *frames(service, body) {
22 t.sent++;
23 if (service !== 'git-receive-pack' || !(body instanceof Uint8Array)) throw new Error('harness: bad request');
24 if (response.drop) throw fail('network', `connection reset ${response.drop}`);
25 const r = unwrap(pktStep(pktInit(), response.bytes));
26 yield* r.frames;
27 if (response.end === 'throw') throw fail('network', 'connection reset after the response');
28 unwrap(pktFinish(r.state));
29 },
30 };
31 return t;
34// rendered: { commands, opts, limits, response } (space.js render). Outcome:
35// landed | rejected | partial | ambiguous | preSend (a typed error with nothing sent) | other (anything else: a bug)
36export async function runPush(rendered, response = rendered.response) {
37 const t = fakeTransport(response ?? { drop: 'never' }, rendered.limits);
38 try {
39 const { atomic = false, pushOptions = [], ...opts } = rendered.opts ?? {};
40 const checked = checkPushCaps && (atomic || pushOptions.length > 0) ? checkPushCaps(new Set(['atomic', 'push-options']), { atomic, pushOptions }).value : undefined;
41 // push returns a Result (an older src/ threw): an Err is read below as the throw was
42 const r = await push(t, { commands: rendered.commands, objects: [], ...(checkPushCaps ? { ...opts, ...(checked ? { checked } : {}) } : rendered.opts) });
43 if (r?.ok === false) throw r.error;
44 return { tag: 'landed', refs: rendered.commands.map(c => c.ref) };
45 } catch (e) {
46 if (t.sent === 0 && (e.code === 'bad_request' || e.code === 'limit_exceeded')) return { tag: 'preSend', code: e.code, what: e.what };
47 if (t.sent === 0) return { tag: 'other', code: e.code, message: `nothing sent: ${e.message}` };
48 if (e.code === 'ambiguous') return { tag: 'ambiguous' };
49 if (e.code === 'cas_conflict' || e.code === 'push_rejected' || e.code === 'not_fast_forward') return { tag: 'rejected', code: e.code };
50 if (e.code === 'push_partial') return { tag: 'partial', landed: e.landed, rejected: e.rejected.map(r => r.ref) };
51 return { tag: 'other', code: e.code, message: e.message };
52 }
55export const sameOutcome = (a, b) => JSON.stringify(a) === JSON.stringify(b);
56export const label = o => (o.tag === 'rejected' || o.tag === 'preSend' || o.tag === 'other' ? `${o.tag}(${o.code})` : o.tag);
Diagnostics4 git calls · 520 ms
CallStatusSizeTime0520 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 · 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=38434
git.response.cache=HIT
git.response.duration_ms=4
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.5 KiB513 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=513
git.response.bytes=1579
git.response.cache=MISS
git.response.duration_ms=513
git.fetch.wants=700270d76bd06ce054363278e60bb6b5efd0f345
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=1579
git.pkt.payload.max=1558
git.sideband.band1.bytes=1557
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
a5e1e143dc9fd96e
Request
a3dd0376…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format