GitHubivarvong
ply
main
1// HTTP-level probes: requests written byte for byte (framing, encoding, malformed bodies, the v0 advertisement,
2// object-info, a refused filter, the status of a request with a bad credential), each stating the answer a git server
3// with Artifacts' known policy should give. ply has no form of most of them (the matrix calls those behaviours
4// unsupported); they are here for the server's coverage, triangulated by independent clients: a raw socket (exact
5// bytes), curl, and stock git or ply where either can send the request. test/probes/wire.mjs runs them;
6// test/probes/wire.test.js holds the reference (git http-backend behind Node's HTTP server) to every expectation.
7import type { Area, BehaviourId } from '../../src/probe-types.ts';
9export type WireId = `${BehaviourId<Area>}#${string}`;
10// Who sends the request: `raw` writes the bytes on a socket; `curl` is curl 8 given the same body and headers; `git`
11// and `ply` send their own request for the same thing (GitForm, PlyForm).
12export type Corner = 'raw' | 'curl' | 'git' | 'ply';
13export type Encoding = { readonly tag: 'identity' } | { readonly tag: 'gzip' } | { readonly tag: 'gzip-corrupt' };
14// length Content-Length equal to the body
15// length-off Content-Length the body's length plus `by` (more: the client half-closes after the body)
16// chunked Transfer-Encoding: chunked, 8 KiB chunks
17// expect-continue Content-Length and Expect: 100-continue; the body follows the interim 100 or 1.5 s of silence
18export type Framing = { readonly tag: 'length' } | { readonly tag: 'length-off'; readonly by: number } | { readonly tag: 'chunked' } | { readonly tag: 'expect-continue' };
19// The request body, built from the target's seed (base: main; next: its child, with a 64 KiB incompressible file):
20// ls-refs v2 ls-refs for refs/heads/
21// object-info v2 object-info: the size of base's a.txt
22// fetch-filter v2 fetch of base with `filter <filter>` (the blob named is base's a.txt)
23// unknown-command v2 command=frobnicate
24// push-create v0 receive-pack: create refs/heads/wire-<corner> at next, with next's objects as a pack
25// bytes the latin-1 text given, sent as is
26// ls-refs-no-flush v2 ls-refs whose arguments end without the flush packet
27// push-ref v0 receive-pack: one command `<old> <new> <ref>` with `caps` after the NUL (report-status and an
28// agent are always there), and next's objects as a pack when new is next (an empty pack otherwise);
29// `<c>` in the ref is the sender's name, so senders of one plan write different refs
30// v2 a v2 request: `command=<command>`, the capability lines, a delimiter, the argument lines (`<base>`
31// in a line is base's id), a flush
32// ls-refs-all v2 ls-refs of every ref (no prefix), with peel and symrefs
33export type OldNew = 'zero' | 'base' | 'next';
34export type WireBody =
35 | { readonly tag: 'ls-refs' }
36 | { readonly tag: 'object-info' }
37 | { readonly tag: 'fetch-filter'; readonly filter: string }
38 | { readonly tag: 'unknown-command' }
39 | { readonly tag: 'push-create' }
40 | { readonly tag: 'bytes'; readonly latin1: string }
41 | { readonly tag: 'ls-refs-no-flush' }
42 | { readonly tag: 'push-ref'; readonly ref: string; readonly old: OldNew; readonly new: OldNew; readonly caps: string }
43 | { readonly tag: 'v2'; readonly command: 'fetch' | 'ls-refs'; readonly capLines: readonly string[]; readonly argLines: readonly string[] }
44 | { readonly tag: 'ls-refs-all' };
45export type Service = 'git-upload-pack' | 'git-receive-pack';
46export type ContentType = { readonly tag: 'service' } | { readonly tag: 'other'; readonly value: string };
47// A credential a status probe presents (Artifacts only: git http-backend has no authentication):
48// none no Authorization header
49// bogus a well-formed bearer token that was never minted
50// revoked the token `repos create` minted, after its revocation
51// missing-repo the repository's own (repository-scoped) write token, on a path where no repository is
52export type Credential = 'none' | 'bogus' | 'revoked' | 'missing-repo';
53export type RpcRequest = { readonly tag: 'rpc'; readonly service: Service; readonly protocol: 'v0' | 'v2'; readonly contentType: ContentType; readonly encoding: Encoding; readonly framing: Framing; readonly body: WireBody };
54export type WireRequest =
55 | { readonly tag: 'advertise'; readonly service: string; readonly protocol: 'v0' | 'v2' }
56 | RpcRequest
57 | { readonly tag: 'credential'; readonly credential: Credential }
58 // a plain GET of a path under the repository (the dumb HTTP protocol's files), no Git-Protocol header
59 | { readonly tag: 'get'; readonly path: DumbPath };
60export type DumbPath = '/info/refs' | '/HEAD' | '/objects/info/packs';
61// What the target holds before the plan: main at base, or main plus `heads` branches under refs/heads/many/ (alternately
62// at base and next) and `tags` lightweight tags under refs/tags/many/ at base.
63export type WireSeedForm = { readonly tag: 'base' } | { readonly tag: 'many-refs'; readonly heads: number; readonly tags: number };
64// The answer each sender should get:
65// v0-advertisement 200 with `# service=git-upload-pack`, then main at base and the capabilities
66// ls-refs-main 200, main at base in the ls-refs answer
67// landed a report `unpack ok` and `ok` for the ref; the ref then at next
68// refused the request does not succeed: status 400 or more, an ERR packet, a report naming an unpack error or
69// `ng`, or no answer body at all; the sender's ref absent afterwards
70// object-info if the v2 advertisement lists object-info: the size of base's a.txt; otherwise refused
71// status one of these HTTP statuses on the info/refs GET (or, for ply and git, their class of it)
72// ref-landed the sender's ref (`<c>` filled) created at next: a report `ok` for it (git, ply: landed), main at base,
73// fsck clean
74// ref-refused refused (as `refused`, or refused by the sending client before any request), and the repository
75// exactly as seeded: no ref added, main at base, fsck clean
76// ref-either one of the two, consistently (the server's choice: a length only a filesystem bounds)
77// dumb a dumb-HTTP file: refused with a 4xx (a smart-only server), or served with the right content (info/refs:
78// main at base; HEAD: `ref: refs/heads/main`; objects/info/packs: `P pack-<id>.pack` lines)
79// listing every seeded ref with its id, nothing else (HEAD and peeled lines aside)
80export type Answer =
81 | { readonly tag: 'v0-advertisement' }
82 | { readonly tag: 'ls-refs-main' }
83 | { readonly tag: 'landed' }
84 | { readonly tag: 'refused' }
85 | { readonly tag: 'object-info' }
86 | { readonly tag: 'status'; readonly statuses: readonly [HttpRefusal, ...HttpRefusal[]] }
87 | { readonly tag: 'ref-landed'; readonly ref: string }
88 | { readonly tag: 'ref-refused'; readonly ref: string }
89 | { readonly tag: 'ref-either'; readonly ref: string }
90 | { readonly tag: 'dumb'; readonly path: DumbPath }
91 | { readonly tag: 'listing' };
92export type HttpRefusal = 401 | 403 | 404;
93// Stock git's own request for the same thing, and ply's:
94export type GitForm =
95 | { readonly tag: 'none'; readonly why: string }
96 | { readonly tag: 'ls-remote-v0' } // git -c protocol.version=0 ls-remote
97 | { readonly tag: 'push-chunked' } // git -c http.postBuffer=4096 push next:refs/heads/wire-git (chunked body)
98 | { readonly tag: 'fetch-filter' } // git fetch --filter=<filter> of main into an empty repository
99 | { readonly tag: 'ls-remote' } // git ls-remote, with the plan's credential
100 | { readonly tag: 'push-ref' } // git push next:<the answer's ref>
101 | { readonly tag: 'ls-remote-dumb' } // GIT_SMART_HTTP=0 git ls-remote: the dumb protocol's info/refs
102 | { readonly tag: 'ls-remote-all'; readonly protocol: 'v0' | 'v2' }; // git ls-remote of every ref
103export type PlyForm =
104 | { readonly tag: 'none'; readonly why: string }
105 | { readonly tag: 'fetch-filter' } // fetchPack({ wants: [base], filter })
106 | { readonly tag: 'ls-refs' } // lsRefs, with the plan's credential
107 | { readonly tag: 'push-ref' } // push({ commands: [create <the answer's ref> at next], objects: next's })
108 | { readonly tag: 'ls-refs-all' }; // lsRefs() of every ref
109export type WirePlan = {
110 readonly id: WireId;
111 readonly description: string;
112 readonly request: WireRequest;
113 readonly seed: WireSeedForm;
114 readonly curl: boolean; // curl can send this request as written
115 readonly git: GitForm;
116 readonly ply: PlyForm;
117 readonly expect: Answer;
118};
120const BASE: WireSeedForm = { tag: 'base' };
121const GZIP: Encoding = { tag: 'gzip' };
122const IDENTITY: Encoding = { tag: 'identity' };
123const LENGTH: Framing = { tag: 'length' };
124const SERVICE: ContentType = { tag: 'service' };
125const NO_GIT = (why: string): GitForm => ({ tag: 'none', why });
126const NO_PLY = (why: string): PlyForm => ({ tag: 'none', why });
127const PLY_NEVER = NO_PLY('ply writes only well-formed, identity-encoded, Content-Length requests');
128// upload-pack speaks v2, receive-pack v0 (git's own choice for each)
129const rpc = (service: Service, body: WireBody): RpcRequest => ({ tag: 'rpc', service, protocol: service === 'git-upload-pack' ? 'v2' : 'v0', contentType: SERVICE, encoding: IDENTITY, framing: LENGTH, body });
131// ---- ref and object semantics (phase 4) ----
132// A create of `ref` at next with the given capabilities, raw only (curl would send the same bytes).
133const RS = 'report-status';
134const createRef = (ref: string, caps: string = RS): RpcRequest => rpc('git-receive-pack', { tag: 'push-ref', ref, old: 'zero', new: 'next', caps });
135// A name receive-pack refuses ("funny refname"): stock git and ply refuse it before sending (a client-side refusal meets
136// the answer: the server is asked by the raw sender alone).
137const badName = (variant: string, ref: string, what: string): WirePlan => ({
138 id: `push.ref-name-rules#${variant}`, description: `A create of ${what} is refused (check-ref-format); nothing is added.`,
139 request: createRef(ref), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-refused', ref },
140});
141const ONE_FORM = 'the name has one form, so a second sender would meet the first one\'s ref; ply\'s own check of it is test/space/refname.test.js';
142const LONG = (n: number, c: string): string => c.repeat(n);
143const PATH_OF = (components: number, width: number): string => Array.from({ length: components }, (_, i) => `${String(i).padStart(2, '0')}${LONG(width - 2, 'd')}`).join('/');
144const MANY_REFS: WireSeedForm = { tag: 'many-refs', heads: 1500, tags: 500 };
145const PHASE4: readonly WirePlan[] = [
146 badName('dot-dot', 'refs/heads/a..b', '`refs/heads/a..b` (two dots)'),
147 badName('at-brace', 'refs/heads/a@{b', '`refs/heads/a@{b` (`@{`)'),
148 badName('lock-suffix', 'refs/heads/x.lock', '`refs/heads/x.lock` (a `.lock` suffix)'),
149 badName('control-char', 'refs/heads/a\u0001b', 'a name with a control character (0x01)'),
150 badName('del-char', 'refs/heads/a\u007fb', 'a name with DEL (0x7f)'),
151 badName('space', 'refs/heads/a b', 'a name with a space'),
152 badName('colon', 'refs/heads/a:b', 'a name with a colon'),
153 badName('backslash', 'refs/heads/a\\b', 'a name with a backslash'),
154 badName('double-slash', 'refs/heads//x', '`refs/heads//x` (an empty component)'),
155 badName('trailing-slash', 'refs/heads/x/', '`refs/heads/x/` (a trailing slash)'),
156 badName('trailing-dot', 'refs/heads/x.', '`refs/heads/x.` (a trailing dot)'),
157 badName('dot-component', 'refs/heads/.x', '`refs/heads/.x` (a component starting with a dot)'),
158 badName('bare-head', 'HEAD', '`HEAD` itself (not under refs/)'),
159 { id: 'push.ref-name-rules#leading-dash', description: 'A create of `refs/heads/-<sender>` (a component starting with `-`, which check-ref-format allows and `git branch` does not) lands.', request: createRef('refs/heads/-<c>'), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-landed', ref: 'refs/heads/-<c>' } },
160 { id: 'push.ref-name-rules#refs-heads-at', description: 'A create of `refs/heads/@` (`@` alone is refused only as a whole name) lands.', request: createRef('refs/heads/@'), seed: BASE, curl: false, git: NO_GIT(ONE_FORM), ply: NO_PLY(ONE_FORM), expect: { tag: 'ref-landed', ref: 'refs/heads/@' } },
161 { id: 'push.ref-name-rules#refs-heads-head', description: 'A create of `refs/heads/HEAD` (a branch named HEAD: a valid ref name receive-pack accepts) lands.', request: createRef('refs/heads/HEAD'), seed: BASE, curl: false, git: NO_GIT(ONE_FORM), ply: NO_PLY(ONE_FORM), expect: { tag: 'ref-landed', ref: 'refs/heads/HEAD' } },
162 { id: 'push.ref-name-rules#component-200', description: 'A create of a branch whose last component is 200 bytes lands.', request: createRef(`refs/heads/<c>-${LONG(200, 'x')}`), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-landed', ref: `refs/heads/<c>-${LONG(200, 'x')}` } },
163 { id: 'push.ref-name-rules#path-1000', description: 'A create of a branch about 1000 bytes long in 19 components of 50 lands.', request: createRef(`refs/heads/<c>/${PATH_OF(19, 50)}`), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-landed', ref: `refs/heads/<c>/${PATH_OF(19, 50)}` } },
164 { id: 'push.ref-name-rules#component-300', description: 'A create of a branch whose last component is 300 bytes (over most filesystems\' 255-byte name limit): landed or refused, never half-written.', request: createRef(`refs/heads/<c>-${LONG(300, 'y')}`), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-either', ref: `refs/heads/<c>-${LONG(300, 'y')}` } },
165 { id: 'push.ref-name-rules#path-4000', description: 'A create of a branch about 4000 bytes long in 40 components of 99 (near PATH_MAX): landed or refused, never half-written.', request: createRef(`refs/heads/<c>/${PATH_OF(40, 99)}`), seed: BASE, curl: false, git: { tag: 'push-ref' }, ply: { tag: 'push-ref' }, expect: { tag: 'ref-either', ref: `refs/heads/<c>/${PATH_OF(40, 99)}` } },
166 // ---- unknown capabilities ----
167 { id: 'caps.receive-pack-capabilities#unknown-capability-on-push', description: 'A receive-pack command listing a capability the server never advertised (`frobnicate=1`) still lands: receive-pack ignores what it does not know.', request: createRef('refs/heads/wire-<c>', `${RS} frobnicate=1`), seed: BASE, curl: true, git: NO_GIT('git sends only capabilities the server advertised'), ply: NO_PLY('ply sends only capabilities the server advertised'), expect: { tag: 'ref-landed', ref: 'refs/heads/wire-<c>' } },
168 { id: 'caps.v2-capability-advertisement#unknown-capability-line', description: 'A v2 fetch whose capability section carries `frobnicate=1`, never advertised, is refused.', request: rpc('git-upload-pack', { tag: 'v2', command: 'fetch', capLines: ['agent=ply-wire-probe', 'frobnicate=1'], argLines: ['want <base>', 'no-progress', 'done'] }), seed: BASE, curl: true, git: NO_GIT('git sends only advertised capabilities'), ply: NO_PLY('ply sends only advertised capabilities'), expect: { tag: 'refused' } },
169 { id: 'caps.fetch-argument-gating#unknown-fetch-argument', description: 'A v2 fetch with an argument line no version of git defines (`frobnicate`) is refused.', request: rpc('git-upload-pack', { tag: 'v2', command: 'fetch', capLines: ['agent=ply-wire-probe'], argLines: ['want <base>', 'frobnicate', 'no-progress', 'done'] }), seed: BASE, curl: true, git: NO_GIT('git sends only arguments it defines'), ply: NO_PLY('ply sends only arguments it defines'), expect: { tag: 'refused' } },
170 { id: 'refs.ls-refs-listing#unknown-argument', description: 'A v2 ls-refs with an argument line no version of git defines (`frobnicate`) is refused.', request: rpc('git-upload-pack', { tag: 'v2', command: 'ls-refs', capLines: ['agent=ply-wire-probe'], argLines: ['frobnicate', 'ref-prefix refs/heads/'] }), seed: BASE, curl: true, git: NO_GIT('git sends only arguments it defines'), ply: NO_PLY('ply sends only arguments it defines'), expect: { tag: 'refused' } },
171 // ---- the dumb HTTP protocol ----
172 { id: 'http.expect-continue-and-dumb-http#dumb-info-refs', description: 'GET info/refs with no service (the dumb protocol): refused with a 4xx, or main at base.', request: { tag: 'get', path: '/info/refs' }, seed: BASE, curl: false, git: { tag: 'ls-remote-dumb' }, ply: NO_PLY('ply speaks only smart HTTP'), expect: { tag: 'dumb', path: '/info/refs' } },
173 { id: 'http.expect-continue-and-dumb-http#dumb-head', description: 'GET HEAD (the dumb protocol\'s symref file): refused with a 4xx, or `ref: refs/heads/main`.', request: { tag: 'get', path: '/HEAD' }, seed: BASE, curl: false, git: NO_GIT('git reads HEAD only after a dumb info/refs, which the info-refs plan covers'), ply: NO_PLY('ply speaks only smart HTTP'), expect: { tag: 'dumb', path: '/HEAD' } },
174 { id: 'http.expect-continue-and-dumb-http#dumb-objects-info-packs', description: 'GET objects/info/packs: refused with a 4xx, or `P pack-<id>.pack` lines.', request: { tag: 'get', path: '/objects/info/packs' }, seed: BASE, curl: false, git: NO_GIT('git reads it only after a dumb info/refs, which the info-refs plan covers'), ply: NO_PLY('ply speaks only smart HTTP'), expect: { tag: 'dumb', path: '/objects/info/packs' } },
175 // ---- a 2001-ref advertisement ----
176 { id: 'refs.ls-refs-listing#two-thousand-refs', description: 'v2 ls-refs of a repository with main, 1500 branches and 500 tags lists all 2001 with their ids.', request: rpc('git-upload-pack', { tag: 'ls-refs-all' }), seed: MANY_REFS, curl: true, git: { tag: 'ls-remote-all', protocol: 'v2' }, ply: { tag: 'ls-refs-all' }, expect: { tag: 'listing' } },
177 { id: 'refs.v0-upload-pack-advertisement#two-thousand-refs', description: 'The v0 upload-pack advertisement of the same 2001-ref repository lists all 2001 with their ids.', request: { tag: 'advertise', service: 'git-upload-pack', protocol: 'v0' }, seed: MANY_REFS, curl: true, git: { tag: 'ls-remote-all', protocol: 'v0' }, ply: NO_PLY('ply asks for v2 and refuses a v0 answer (src/caps.ts)'), expect: { tag: 'listing' } },
178];
180export const WIRE: readonly WirePlan[] = [
181 // ---- request content encoding ----
182 { id: 'http.request-content-encoding#gzip-ls-refs', description: 'A gzip-encoded v2 ls-refs (Content-Encoding: gzip) is read as the plain request: main at base.', request: { ...rpc('git-upload-pack', { tag: 'ls-refs' }), encoding: GZIP }, curl: true, git: NO_GIT('git gzips an upload-pack body only past 1 KiB of haves; not expressible as a fixed request'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'ls-refs-main' } },
183 { id: 'http.request-content-encoding#gzip-receive-pack', description: 'A gzip-encoded receive-pack request (commands and pack) lands.', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), encoding: GZIP }, curl: true, git: NO_GIT('git never gzips a receive-pack body'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'landed' } },
184 { id: 'http.request-content-encoding#corrupt-gzip', description: 'A gzip receive-pack body whose deflate stream is damaged is refused, and the ref is not created.', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), encoding: { tag: 'gzip-corrupt' } }, curl: true, git: NO_GIT('git never gzips a receive-pack body'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
185 // ---- framing ----
186 { id: 'http.content-length-framing#chunked-receive-pack', description: 'A receive-pack request sent with Transfer-Encoding: chunked lands (stock git does this past http.postBuffer).', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), framing: { tag: 'chunked' } }, curl: true, git: { tag: 'push-chunked' }, ply: NO_PLY('ply always states the length (pushPack length)'), seed: BASE, expect: { tag: 'landed' } },
187 { id: 'http.content-length-framing#length-short', description: 'A receive-pack request whose Content-Length is 64 bytes short of its body: the server reads a truncated pack and refuses it; the ref is not created.', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), framing: { tag: 'length-off', by: -64 } }, curl: false, git: NO_GIT('git frames its own requests'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
188 { id: 'http.content-length-framing#length-long', description: 'A receive-pack request whose Content-Length is 64 bytes more than it sends before half-closing: refused, the ref is not created.', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), framing: { tag: 'length-off', by: 64 } }, curl: false, git: NO_GIT('git frames its own requests'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
189 { id: 'http.expect-continue-and-dumb-http#expect-100-receive-pack', description: 'A receive-pack request with Expect: 100-continue lands, whether or not the server sends the interim 100.', request: { ...rpc('git-receive-pack', { tag: 'push-create' }), framing: { tag: 'expect-continue' } }, curl: true, git: NO_GIT('git sends no Expect header (it clears curl\'s)'), ply: NO_PLY('ply never sends Expect'), seed: BASE, expect: { tag: 'landed' } },
190 // ---- malformed requests ----
191 { id: 'errors.malformed-requests-to-server#nonhex-length', description: 'A v2 upload-pack body whose first pkt-line length is `zzzz` is refused.', request: rpc('git-upload-pack', { tag: 'bytes', latin1: 'zzzzcommand=ls-refs\n0000' }), curl: true, git: NO_GIT('git writes well-formed pkt-lines'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
192 { id: 'errors.malformed-requests-to-server#oversized-length', description: 'A v2 upload-pack body whose first pkt-line claims 65535 bytes (over the 65520 maximum) and holds 16 is refused.', request: rpc('git-upload-pack', { tag: 'bytes', latin1: 'ffffcommand=ls-refs\n0000' }), curl: true, git: NO_GIT('git writes well-formed pkt-lines'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
193 { id: 'errors.malformed-requests-to-server#missing-flush', description: 'A v2 ls-refs whose arguments end without a flush packet is refused (or answered with nothing).', request: rpc('git-upload-pack', { tag: 'ls-refs-no-flush' }), curl: true, git: NO_GIT('git writes well-formed pkt-lines'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
194 { id: 'errors.malformed-requests-to-server#unknown-command', description: 'A v2 command=frobnicate is refused (ERR or 4xx).', request: rpc('git-upload-pack', { tag: 'unknown-command' }), curl: true, git: NO_GIT('git sends only commands it knows'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
195 { id: 'errors.malformed-requests-to-server#wrong-content-type', description: 'A well-formed v2 ls-refs POSTed as text/plain is refused.', request: { ...rpc('git-upload-pack', { tag: 'ls-refs' }), contentType: { tag: 'other', value: 'text/plain' } }, curl: true, git: NO_GIT('git sends the service content type'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
196 { id: 'errors.malformed-requests-to-server#bad-service', description: 'GET info/refs?service=git-frobnicate is refused.', request: { tag: 'advertise', service: 'git-frobnicate', protocol: 'v2' }, curl: true, git: NO_GIT('git names only real services'), ply: PLY_NEVER, seed: BASE, expect: { tag: 'refused' } },
197 // ---- v0 advertisement, object-info, filter ----
198 { id: 'refs.v0-upload-pack-advertisement#no-protocol-header', description: 'GET info/refs?service=git-upload-pack without Git-Protocol is the v0 advertisement: the service line, main at base, capabilities.', request: { tag: 'advertise', service: 'git-upload-pack', protocol: 'v0' }, curl: true, git: { tag: 'ls-remote-v0' }, ply: NO_PLY('ply asks for v2 and refuses a v0 answer (src/caps.ts)'), seed: BASE, expect: { tag: 'v0-advertisement' } },
199 { id: 'caps.object-info#size', description: 'v2 object-info for base\'s a.txt: its size when the advertisement lists object-info, refused when it does not.', request: rpc('git-upload-pack', { tag: 'object-info' }), curl: true, git: NO_GIT('stock git 2.47 has no command that sends object-info over HTTP'), ply: NO_PLY('no ply operation sends object-info'), seed: BASE, expect: { tag: 'object-info' } },
200 { id: 'fetch.filter-sparse-oid#refused', description: 'A v2 fetch with filter sparse:oid=<blob> is refused (blob:none is the only filter allowed).', request: rpc('git-upload-pack', { tag: 'fetch-filter', filter: 'sparse:oid' }), curl: true, git: { tag: 'fetch-filter' }, ply: { tag: 'fetch-filter' }, seed: BASE, expect: { tag: 'refused' } },
201 // ---- status classes (Artifacts only) ----
202 { id: 'errors.http-status-classes#no-credential', description: 'The upload-pack advertisement of a private repository with no credential: 401.', request: { tag: 'credential', credential: 'none' }, curl: true, git: { tag: 'ls-remote' }, ply: { tag: 'ls-refs' }, seed: BASE, expect: { tag: 'status', statuses: [401] } },
203 { id: 'errors.http-status-classes#bogus-token', description: 'A bearer token that was never minted: 401.', request: { tag: 'credential', credential: 'bogus' }, curl: true, git: { tag: 'ls-remote' }, ply: { tag: 'ls-refs' }, seed: BASE, expect: { tag: 'status', statuses: [401] } },
204 { id: 'errors.http-status-classes#revoked-token', description: 'A revoked token: 403.', request: { tag: 'credential', credential: 'revoked' }, curl: true, git: { tag: 'ls-remote' }, ply: { tag: 'ls-refs' }, seed: BASE, expect: { tag: 'status', statuses: [403] } },
205 { id: 'errors.http-status-classes#missing-repo', description: 'A repository-scoped token on a path it does not cover, where no repository exists: 403 or 404 (whether the answer reveals that the repository is absent is the server\'s choice).', request: { tag: 'credential', credential: 'missing-repo' }, curl: true, git: { tag: 'ls-remote' }, ply: { tag: 'ls-refs' }, seed: BASE, expect: { tag: 'status', statuses: [403, 404] } },
206 ...PHASE4,
207];
209// Corners a plan runs with, in order.
210export function cornersOf(p: WirePlan): readonly Corner[] {
211 return [
212 'raw' as const,
213 ...(p.curl ? ['curl' as const] : []),
214 ...(p.git.tag === 'none' ? [] : ['git' as const]),
215 ...(p.ply.tag === 'none' ? [] : ['ply' as const]),
216 ];
217}
218// Whether the reference can answer the plan (git http-backend has no authentication).
219export const onReference = (p: WirePlan): boolean => p.request.tag !== 'credential';
221// Results that do not meet their plan's answer and are expected not to, each with its reason. An entry no result used,
222// in a run that sent its plan to its target with its sender, fails that run.
223export type WireAllow = { readonly plan: WireId; readonly target: 'ref' | 'art'; readonly corner: Corner; readonly cls: string; readonly reason: string };
224export const WIRE_ALLOW: readonly WireAllow[] = [
225 {
226 plan: 'http.content-length-framing#length-long', target: 'ref', corner: 'raw', cls: 'status:400',
227 reason: 'The reference\'s Node HTTP front end answers 400 when the client half-closes short of its Content-Length, but it has already piped the whole body to git http-backend, and the pack is complete (self-delimited, trailer intact), so receive-pack applies it: the client is told 400 and the ref exists. A property of test/server.js\'s shim, not of git; Artifacts\' answer is judged on its own.',
228 },
229];
Diagnostics7 git calls · 180 ms
CallStatusSizeTime0180 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 KiB · 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=11990 git.response.cache=HIT git.response.duration_ms=2 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=2 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=10Open pack map
fetchtree:0200919 B · 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=919 git.response.cache=HIT git.response.duration_ms=2 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=5323b9266eea5ded637285d1c5320699f12be76eOpen pack map
fetchtree:02005.6 KiB · hit2 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=2 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=be7e0453974a5fe832f9065a33bb7e3434c10e9bOpen pack map
fetchtree:0200305 B · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=167 git.response.bytes=305 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=facf357dda5424ce8c1bda8ebca6cacc9b5bfc3a 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=305 git.pkt.payload.max=278 git.sideband.band1.bytes=278 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=278 git.pack.trailer=36c263093b3db739addfdbaa3928c1028217ea9eOpen pack map
fetch2007.1 KiB168 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=7285 git.response.cache=MISS git.response.duration_ms=168 git.fetch.wants=523ee28da6fe82aefc3fda635bc61af4c2f1a2bc 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=7285 git.pkt.payload.max=7258 git.sideband.band1.bytes=7258 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
- a5e3181beb1bcf5b
- Request
- b498c4cc…
- 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