GitHubivarvong
ply
main
1// Regex gate. Text written by a remote or a caller is handled in time linear in its length, and a backtracking pattern
2// is the easiest way to break that without noticing (three were found in one review: a slash trim in transport.ts,
3// TOO_LARGE in push.ts, the squash message trim in rebase.ts). So every regular expression under src/ is inventoried:
4//
5// 1. every regex literal and every RegExp construction in src/ (found with the TypeScript compiler API) must have an
6// entry in scripts/regex-inventory.mjs with the same file and the same pattern text; an entry whose pattern is no
7// longer in that file fails too (a stale entry, or a known-bad marker left behind after its fix landed). A regex
8// built any other way cannot have a row and fails where it stands: RegExp used as a value other than the callee
9// of RegExp(...) / new RegExp(...), and String#match, matchAll or search given anything but a regex literal or a
10// construction written at the call (see regexesIn; the Cache API's cache.match is the one named allowance);
11// 2. each entry says what text the pattern is applied to (`input`: remote, stored, caller or internal), why it is
12// linear (`linear`), and for remote, stored or caller text gives an adversarial input generator
13// (`adversarial(n)`), which test/regex-linear.test.js runs at n, 2n and 4n as a ratio test (4 times the length
14// must cost less than 9 times the time; never an absolute time). That test is the gate's first line;
15// 3. the second line: shapes that backtrack are refused outright, whatever the inventory says: a quantifier inside a
16// quantified group (nested); two variable-length quantified atoms next to each other that can match the same
17// character (adjacent, also across capture groups: /(\d+)(\d*)/); an unanchored unbounded run followed by something that can fail, such as /\/+$/ or
18// /\n+$/ (every character of a long run starts the run again); and alternatives under a quantifier that can start
19// with the same character, such as /(a|ab)*c/. An entry marked `knownBad: '<branch that fixes it>'` is exempt
20// from 3, is listed on every run, must still be in the source (when the fix lands the entry fails the gate until
21// it is removed), and the ratio test asserts that its generator does show a superlinear cost.
22//
23// node scripts/regex-gate.mjs check, exit 1 on any problem
24// node scripts/regex-gate.mjs --list print every pattern found with its inventory verdict
25// node scripts/regex-gate.mjs --root d check the tree under d (d/src) against this inventory (for scratch copies)
26import { readdirSync } from 'node:fs';
27import { join, resolve } from 'node:path';
28import { pathToFileURL } from 'node:url';
29// TypeScript 7: the compiler API is the native compiler behind these two entry points.
30import { API } from 'typescript/unstable/sync';
31import { SyntaxKind, isRegularExpressionLiteral } from 'typescript/unstable/ast';
33const walk = dir => readdirSync(dir, { withFileTypes: true }).flatMap(entry => {
34 const path = join(dir, entry.name).split('\\').join('/');
35 if (entry.isDirectory()) return walk(path);
36 return path.endsWith('.ts') ? [path] : [];
37});
39// String methods that compile a string argument into a RegExp: s.match('(a+)+$') builds the pattern at the call.
40const STRING_REGEX_METHODS = new Set(['match', 'matchAll', 'search']);
41// Calls with one of those names that are not String methods. Each is allowed by its file and its receiver, and nowhere
42// else: the same call in another file, or on another receiver in that file, is refused.
43export const NOT_STRING_METHODS = [
44 { file: 'src/packcache.ts', receiver: 'cache', method: 'match', why: 'the Cache API: cache.match(key) looks a stored Response up by its URL key and compiles nothing' },
45];
47// Every regex in one parsed source file: literals (`/x/u`), and `RegExp(...)` / `new RegExp(...)` (pattern text = the
48// whole expression as written, since its arguments may be computed). Every other way to build one cannot be given a
49// row, so it is found too and reported as kind 'refused' (gate() fails on each):
50// - RegExp referenced as a value anywhere but as the callee of those two forms: `new globalThis.RegExp(...)`,
51// `new (RegExp)(...)`, `globalThis['RegExp']`, `const R = RegExp`, `Reflect.construct(RegExp, ...)`,
52// `class X extends RegExp`. A type position (`: RegExp`, `typeof RegExp`, `implements`) is not a value;
53// - String#match, matchAll and search called with anything but a regex literal or a RegExp construction written at
54// the call (each of which needs its own row): the engine compiles any other argument as a pattern.
55export function regexesIn(file, sf) {
56 const found = [];
57 const lineOf = node => sf.getLineAndCharacterOfPosition(node.end).line + 1;
58 const textOf = node => sf.text.slice(node.pos, node.end).trim();
59 const refuse = (node, why) => found.push({ file, line: lineOf(node), pattern: textOf(node), kind: 'refused', why });
60 const isConstruction = node => (node.kind === SyntaxKind.NewExpression || node.kind === SyntaxKind.CallExpression) && node.expression.kind === SyntaxKind.Identifier && node.expression.text === 'RegExp';
61 const sameNode = (a, b) => a.kind === b.kind && a.pos === b.pos && a.end === b.end;
62 // The member a node reads: x.name, x?.name, x['name'], x[`name`] (undefined for anything else, a computed key included).
63 const memberName = node => {
64 if (node.kind === SyntaxKind.PropertyAccessExpression) return node.name.text;
65 if (node.kind !== SyntaxKind.ElementAccessExpression) return undefined;
66 const key = node.argumentExpression;
67 return key.kind === SyntaxKind.StringLiteral || key.kind === SyntaxKind.NoSubstitutionTemplateLiteral ? key.text : undefined;
68 };
69 const unwrapped = node => (node.kind === SyntaxKind.ParenthesizedExpression || node.kind === SyntaxKind.NonNullExpression ? unwrapped(node.expression) : node);
70 // A type position: a type node, or a heritage clause that names a type (`implements`, an interface's `extends`).
71 const typePosition = (node, parent) => (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode)
72 || (node.kind === SyntaxKind.HeritageClause && (node.token === SyntaxKind.ImplementsKeyword || parent.kind === SyntaxKind.InterfaceDeclaration));
73 const visit = (node, parent, inType) => {
74 if (isRegularExpressionLiteral(node)) found.push({ file, line: lineOf(node), pattern: node.text, kind: 'literal' });
75 else if (isConstruction(node)) found.push({ file, line: lineOf(node), pattern: textOf(node), kind: 'construction' });
76 else if (node.kind === SyntaxKind.Identifier && node.text === 'RegExp') {
77 if (!inType && !(isConstruction(parent) && sameNode(parent.expression, node))) refuse(parent, 'RegExp is used as a value here, not as the callee of RegExp(...) or new RegExp(...): the gate cannot inventory what is built from it, write the construction directly');
78 } else if (node.kind === SyntaxKind.ElementAccessExpression && memberName(node) === 'RegExp') {
79 refuse(node, "['RegExp'] reads the constructor as a value: the gate cannot inventory what is built from it, write RegExp(...) or new RegExp(...) directly");
80 } else if (node.kind === SyntaxKind.CallExpression) {
81 const callee = unwrapped(node.expression);
82 const method = memberName(callee);
83 if (method !== undefined && STRING_REGEX_METHODS.has(method)) {
84 const receiver = callee.expression.kind === SyntaxKind.Identifier ? callee.expression.text : undefined;
85 const allowed = NOT_STRING_METHODS.some(a => a.file === file && a.receiver === receiver && a.method === method);
86 const arg = node.arguments[0];
87 if (!allowed && (arg === undefined || !(isRegularExpressionLiteral(arg) || isConstruction(arg)))) {
88 refuse(node, `String#${method} compiles its argument as a pattern: pass a regex literal or a RegExp construction written at the call (with its own row), or use RegExp#exec on an inventoried pattern`);
89 }
90 }
91 }
92 node.forEachChild(child => visit(child, node, inType || typePosition(child, node)));
93 };
94 visit(sf, sf, false);
95 return found;
96}
98// `/source/flags` → { source, flags }. The last slash ends the source: flags never contain one.
99export function splitLiteral(pattern) {
100 const end = pattern.lastIndexOf('/');
101 return { source: pattern.slice(1, end), flags: pattern.slice(end + 1) };
102}
104// ---- static shape -------------------------------------------------------------------------------------------------
105// A small parser for the pattern syntax, enough to see quantifiers, groups and single-character atoms. It never has to
106// understand a character class or an escape: what an atom can match is asked of the engine itself (CHARS below).
107const UNBOUNDED = 32; // a {n,m} with m above this repeats enough to count as unbounded
108const SAMPLE = [...Array.from({ length: 0x250 }, (_, i) => i), 0x2028, 0x2029, 0x3000, 0xfeff, 0x4e2d, 0x1f600];
109const ALL = new Set(SAMPLE);
110function charsOf(src, flags) {
111 const kept = [...flags].filter(f => 'iusv'.includes(f)).join('');
112 let re;
113 try { re = new RegExp(`^(?:${src})$`, kept); } catch { return ALL; }
114 return new Set(SAMPLE.filter(cp => re.test(String.fromCodePoint(cp))));
115}
116function parsePattern(source, flags) {
117 let i = 0;
118 const classEnd = () => { // from '[' to its matching ']' (v-flag classes nest)
119 let depth = 0;
120 for (; i < source.length; i += 1) {
121 const c = source[i];
122 if (c === '\\') i += 1;
123 else if (c === '[') depth += 1;
124 else if (c === ']') { depth -= 1; if (depth === 0) { i += 1; return; } }
125 }
126 };
127 const escapeEnd = () => { // from '\\' past the whole escape
128 const c = source[i + 1];
129 i += 2;
130 const braced = () => { if (source[i] === '{') i = source.indexOf('}', i) + 1; };
131 if (c === 'p' || c === 'P') braced();
132 else if (c === 'u') { if (source[i] === '{') braced(); else i += 4; }
133 else if (c === 'x') i += 2;
134 else if (c === 'c') i += 1;
135 else if (c === 'k') i = source.indexOf('>', i) + 1;
136 return c;
137 };
138 const quantifier = () => {
139 const c = source[i];
140 let q = null;
141 if (c === '*') q = { min: 0, max: Infinity, len: 1 };
142 else if (c === '+') q = { min: 1, max: Infinity, len: 1 };
143 else if (c === '?') q = { min: 0, max: 1, len: 1 };
144 else if (c === '{') {
145 const m = /^\{(\d+)(,(\d*))?\}/u.exec(source.slice(i, i + 24));
146 if (m) q = { min: Number(m[1]), max: m[2] === undefined ? Number(m[1]) : m[3] === '' ? Infinity : Number(m[3]), len: m[0].length };
147 }
148 if (q === null) return { min: 1, max: 1 };
149 i += q.len;
150 if (source[i] === '?') i += 1; // lazy: the same search space
151 return { min: q.min, max: q.max };
152 };
153 const alternation = () => {
154 const alts = [[]];
155 while (i < source.length && source[i] !== ')') {
156 if (source[i] === '|') { i += 1; alts.push([]); continue; }
157 const start = i;
158 const c = source[i];
159 let atom;
160 if (c === '(') {
161 i += 1;
162 let look = false;
163 if (source[i] === '?') {
164 const head = /^\?(?:[=!]|<[=!])/u.exec(source.slice(i, i + 3));
165 if (head) { look = true; i += head[0].length; }
166 else if (source[i + 1] === '<') i = source.indexOf('>', i) + 1;
167 else i = source.indexOf(':', i) + 1; // (?: and (?flags:
168 }
169 const body = alternation();
170 i += 1; // ')'
171 atom = { type: look ? 'look' : 'group', body };
172 } else if (c === '[') { classEnd(); atom = { type: 'char', chars: charsOf(source.slice(start, i), flags) }; }
173 else if (c === '\\') {
174 const e = escapeEnd();
175 if (e === 'b' || e === 'B') atom = { type: 'assert' };
176 else if (e === 'k' || (e >= '1' && e <= '9')) atom = { type: 'char', chars: ALL }; // a backreference: anything
177 else atom = { type: 'char', chars: charsOf(source.slice(start, i), flags) };
178 } else if (c === '^' || c === '$') { i += 1; atom = { type: 'assert' }; }
179 else { i += String.fromCodePoint(source.codePointAt(i)).length; atom = { type: 'char', chars: charsOf(c === '.' ? '.' : source.slice(start, i).replace(/[/{}\]]/u, '\\$&'), flags) }; }
180 const q = quantifier();
181 alts[alts.length - 1].push({ ...atom, ...q, text: source.slice(start, i) });
182 }
183 return alts;
184 };
185 return alternation();
186}
187const unbounded = item => item.max > UNBOUNDED;
188const variable = item => item.max !== item.min;
189const zeroWidth = item => item.type === 'assert' || item.type === 'look';
190const hasUnbounded = alts => alts.some(seq => seq.some(item => unbounded(item) || ((item.type === 'group' || item.type === 'look') && hasUnbounded(item.body))));
191const charsIn = item => {
192 if (item.type === 'char') return item.chars;
193 if (item.type === 'group') return new Set(item.body.flatMap(seq => seq.flatMap(inner => [...charsIn(inner)])));
194 return new Set();
195};
196const overlap = (a, b) => { for (const cp of a) if (b.has(cp)) return true; return false; };
197// What an alternative can start with: every atom up to and including the first one that must match.
198const firstChars = seq => {
199 const chars = new Set();
200 for (const item of seq) {
201 if (zeroWidth(item)) continue;
202 for (const cp of charsIn(item)) chars.add(cp);
203 if (item.min > 0) break;
204 }
205 return chars;
206};
207// What an atom can start with: for a group, what its alternatives can start with (a group that must open with a
208// character the run before it cannot match is a delimiter, not a second run).
209const startChars = item => (item.type === 'group' ? new Set(item.body.flatMap(alt => [...firstChars(alt)])) : charsIn(item));
210// A group matched exactly once with one alternative is transparent: in /x(\d+)(\d*)y/ the two runs sit next to each
211// other although each is inside its own capture group.
212const flat = seq => seq.flatMap(item => (item.type === 'group' && item.min === 1 && item.max === 1 && item.body.length === 1 ? flat(item.body[0]) : [item]));
213const isRun = item => !zeroWidth(item) && (unbounded(item) || (item.type === 'group' && hasUnbounded(item.body)));
214const canFail = item => zeroWidth(item) || item.min > 0;
215// The shapes refused: returns a list of reasons, empty when the pattern has none of them.
216export function shapeProblems(source, flags) {
217 const problems = [];
218 const check = alts => {
219 for (const seq of alts) {
220 seq.forEach(item => {
221 if (item.type === 'group' || item.type === 'look') {
222 if (item.type === 'group' && unbounded(item) && hasUnbounded(item.body)) problems.push(`nested quantifier: ${item.text} repeats a group that itself repeats`);
223 // (a|ab)*: after any prefix the engine may take either alternative, so a failure retries every split.
224 if (item.type === 'group' && unbounded(item) && item.body.some((alt, k) => item.body.slice(k + 1).some(later => overlap(firstChars(alt), firstChars(later))))) {
225 problems.push(`overlapping alternatives under a quantifier: two alternatives of ${item.text} can start with the same character`);
226 }
227 check(item.body);
228 }
229 });
230 const line = flat(seq);
231 line.forEach((item, at) => {
232 if (zeroWidth(item) || !variable(item)) return;
233 for (let next = at + 1; next < line.length; next += 1) {
234 const other = line[next];
235 if (zeroWidth(other)) continue;
236 if (variable(other) && (unbounded(item) || unbounded(other)) && overlap(charsIn(item), startChars(other))) {
237 problems.push(`adjacent quantified atoms ${item.text} and ${other.text} can match the same character`);
238 }
239 if (other.min > 0) break; // a required atom ends the run the first one could trade characters with
240 }
241 });
242 }
243 };
244 const top = parsePattern(source, flags);
245 check(top);
246 // An unanchored unbounded run followed by something that can fail (/\/+$/ on '////…x'): the search starts the run
247 // again at each of its characters and each start walks to the end of the run before failing. It needs the pattern to
248 // be able to start inside the run: nothing before the run, or only atoms the run's own characters can match.
249 for (const seq of top) {
250 const first = seq.find(item => item.type !== 'look');
251 const caret = first !== undefined && first.type === 'assert' && first.text === '^';
252 seq.forEach((item, at) => {
253 if (!isRun(item)) return;
254 const chars = charsIn(item);
255 // ^ under the m flag also matches after every newline: it anchors only a run that cannot cross one.
256 if (flags.includes('y') || (caret && !(flags.includes('m') && chars.has(10)))) return;
257 const restarts = seq.slice(0, at).every(before => zeroWidth(before) || overlap(charsIn(before), chars));
258 const failing = seq.slice(at + 1).find(canFail);
259 if (restarts && failing !== undefined) problems.push(`unanchored run ${item.text} is followed by ${failing.text}, which can fail: every character of a long run starts the run again`);
260 });
261 }
262 return [...new Set(problems)]; // a transparent group's atoms are seen from outside and from inside it
263}
265// ---- the gate -----------------------------------------------------------------------------------------------------
266const INPUTS = ['remote', 'stored', 'caller', 'internal'];
267export function gate(found, inventory) {
268 const problems = [];
269 const keyOf = x => `${x.file}\n${x.pattern}`;
270 const counts = new Map();
271 for (const f of found) {
272 if (f.kind === 'refused') problems.push(`${f.file}:${f.line}: ${f.pattern}: ${f.why}`);
273 else counts.set(keyOf(f), [...(counts.get(keyOf(f)) ?? []), f]);
274 }
275 const seen = new Set();
276 for (const entry of inventory) {
277 const key = keyOf(entry);
278 const where = `${entry.file}: ${entry.pattern}`;
279 if (seen.has(key)) { problems.push(`${where}: listed twice in the inventory`); continue; }
280 seen.add(key);
281 const uses = counts.get(key) ?? [];
282 if (uses.length === 0) {
283 problems.push(entry.knownBad === undefined
284 ? `${where}: inventory entry matches no pattern in the source (the pattern changed or was removed: update or delete the entry)`
285 : `${where}: known-bad pattern is no longer in the source: its fix landed (${entry.knownBad}), remove the entry or replace it with a checked one`);
286 continue;
287 }
288 if ((entry.count ?? 1) !== uses.length) problems.push(`${where}: used ${uses.length} time(s) (lines ${uses.map(u => u.line).join(', ')}), inventory says ${entry.count ?? 1}`);
289 if (!INPUTS.includes(entry.input)) problems.push(`${where}: input must be one of ${INPUTS.join(', ')}`);
290 if (typeof entry.linear !== 'string' || entry.linear.length < 12) problems.push(`${where}: say why it is linear`);
291 if (entry.knownBad !== undefined && (typeof entry.knownBad !== 'string' || entry.knownBad.length < 8)) problems.push(`${where}: knownBad names the branch that fixes it`);
292 if (entry.input !== 'internal' && typeof entry.adversarial !== 'function') problems.push(`${where}: ${entry.input} text needs an adversarial(n) generator for the ratio test`);
293 if (uses[0].kind === 'construction' && entry.input !== 'internal' && typeof entry.build !== 'function') problems.push(`${where}: a constructed RegExp on ${entry.input} text needs build() for the ratio test`);
294 if (entry.knownBad !== undefined) continue;
295 if (uses[0].kind === 'literal') {
296 const { source, flags } = splitLiteral(entry.pattern);
297 for (const p of shapeProblems(source, flags)) problems.push(`${where}: ${p}`);
298 }
299 }
300 for (const [key, uses] of counts) {
301 if (seen.has(key)) continue;
302 for (const u of uses) {
303 const shape = u.kind === 'literal' ? shapeProblems(...Object.values(splitLiteral(u.pattern))) : [];
304 problems.push(`${u.file}:${u.line}: ${u.pattern}: not in scripts/regex-inventory.mjs${shape.length > 0 ? ` (and refused by shape: ${shape.join('; ')})` : ''}`);
305 }
306 }
307 return problems;
308}
310// Every regex under <root>/src, read from the TypeScript program of <root>/tsconfig.check.json.
311export function findAll(root) {
312 const abs = resolve(root);
313 const api = new API({ cwd: abs });
314 try {
315 const { program } = api.updateSnapshot({ openProject: join(abs, 'tsconfig.check.json') }).getProjects()[0];
316 return walk(join(abs, 'src')).sort().flatMap(path => {
317 const sf = program.getSourceFile(path);
318 if (sf === undefined) throw new Error(`regex-gate: ${path} is not in the TypeScript program`);
319 return regexesIn(path.slice(abs.length + 1), sf);
320 });
321 } finally { api.close(); }
322}
324if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
325 const { INVENTORY } = await import('./regex-inventory.mjs');
326 const rootAt = process.argv.indexOf('--root');
327 const root = rootAt === -1 ? '.' : process.argv[rootAt + 1];
328 const found = findAll(root);
329 if (process.argv.includes('--list')) {
330 for (const f of found) {
331 const entry = INVENTORY.find(e => e.file === f.file && e.pattern === f.pattern);
332 const verdict = f.kind === 'refused' ? `REFUSED: ${f.why}` : entry === undefined ? 'NOT INVENTORIED' : entry.knownBad === undefined ? `${entry.input}: ${entry.linear}` : `KNOWN BAD (fix: ${entry.knownBad})`;
333 console.log(`${f.file}:${f.line}\t${f.pattern}\t${verdict}`);
334 }
335 }
336 const problems = gate(found, INVENTORY);
337 for (const p of problems) console.error(`regex-gate: ${p}`);
338 if (problems.length > 0) { console.error(`regex-gate: ${problems.length} problem(s); see the header of scripts/regex-gate.mjs`); process.exit(1); }
339 const knownBad = INVENTORY.filter(e => e.knownBad !== undefined);
340 for (const e of knownBad) console.log(`regex-gate: KNOWN BAD ${e.file}: ${e.pattern} (fix: ${e.knownBad})`);
341 console.log(`regex-gate: ${found.length} pattern(s) in src/, all inventoried, none of a refused shape (${knownBad.length} known-bad, listed above)`);
342}
Diagnostics6 git calls · 74 ms
CallStatusSizeTime074 ms
discover200191 B2 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=3 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 · 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=919 git.response.cache=HIT git.response.duration_ms=3 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:0200831 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=64 git.response.bytes=831 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=b9290e370bd091fd3272931655a175dd1a7af82d 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=831 git.pkt.payload.max=804 git.sideband.band1.bytes=804 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=804 git.pack.trailer=81ddc1f73214935b4ee953ad84f959db955ce0d1Open pack map
fetch2007.4 KiB65 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=7531 git.response.cache=MISS git.response.duration_ms=65 git.fetch.wants=0a726b0dde9fdcf0e83ba858d4c9d2c6e6ff9b63 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=7531 git.pkt.payload.max=7504 git.sideband.band1.bytes=7504 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
- a5e0f8432c7b332c
- Request
- 331b8a7f…
- 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