main
ply4 git calls296 ms47 KiB2 cachedprotocol v2
519 lines22 KiBRaw
1import { spawnSync } from 'node:child_process'
2import { startClientHealth, stopClientHealth } from './client-health.ts'
3import { readFile } from 'node:fs/promises'
4import { hostname } from 'node:os'
5import { basename, join, resolve } from 'node:path'
6import { fileURLToPath } from 'node:url'
7import { ROOT } from './cf.ts'
8import { loadConfig, publicConfig, type CdConfig } from './config.ts'
9import { splitPolicy } from './policy.ts'
10import { writeDebrief } from './debrief.ts'
11import { VERSION_ID } from './deploy-plan.ts'
12import { appendFalsePositive, RunLog, withRun } from './log.ts'
13import { runPipeline } from './pipeline.ts'
14import { binaryNodeVersion, checkNode, NODE_IMAGE_BIN, nodeSatisfies, pathWithNodeBin, selectNode } from './preflight.ts'
15import { errorMessage, run } from './proc.ts'
16import { unfinishedRunDir } from './reconcile.ts'
17import { pruneRuns, retentionLine } from './retention.ts'
18import { checkoutReason, isReleaseId, readCheckout, releaseId, releasePair, type ReleaseId } from './release.ts'
19import { reportLedger } from './report.ts'
20import { createRunDir, RUN_ID, writeJson } from './run-dir.ts'
21import { acquireLock, realLockIo } from './lock.ts'
22import { readPlyPin, resolvePlySha, stageBump } from './stage-bump.ts'
23import { stageDeploy } from './stage-deploy.ts'
24import { stageRamp } from './stage-ramp.ts'
25import { stageRollback } from './stage-rollback.ts'
26import { stageSmoke, stageSweep } from './stage-smoke.ts'
27import { stageTelemetry } from './stage-telemetry.ts'
28import { withCommandSink } from './trace.ts'
29import { readTokenFile } from './token.ts'
30import { parseSince } from './config.ts'
32export type Parsed =
33 | {
34 readonly kind: 'cd'
35 readonly sha: string | null
36 readonly noBump: boolean
37 /** `--ramp` was passed. It is a no-op since 2026-11-08 (the ramp is the only path); the run says so. */
38 readonly rampFlag: boolean
39 readonly replaceCanary: string | null
40 }
41 | { readonly kind: 'bump'; readonly sha: string | null }
42 | { readonly kind: 'deploy-canary'; readonly replaceCanary: string | null }
43 | { readonly kind: 'smoke'; readonly version: string | null; readonly expectVersion: string | null }
44 | { readonly kind: 'telemetry'; readonly version: string; readonly since: string; readonly report: string | null }
45 | { readonly kind: 'ramp'; readonly version: string; readonly previous: string | null; readonly verdict: string | null }
46 | { readonly kind: 'rollback'; readonly to: string }
47 | { readonly kind: 'report' }
48 | { readonly kind: 'annotate'; readonly runId: string; readonly reason: string }
49 | { readonly kind: 'debrief'; readonly runDir: string }
50 | { readonly kind: 'sweep' }
51 | { readonly kind: 'usage' }
52 | { readonly kind: 'error'; readonly reason: string }
54function flag(argv: readonly string[], name: string): string | null {
55 const index = argv.indexOf(`--${name}`)
56 if (index < 0) return null
57 const value = argv[index + 1]
58 if (!value || value.startsWith('--')) return null
59 return value
62function uuid(value: string | null): string | null {
63 if (value === null) return null
64 if (!VERSION_ID.test(value)) return null
65 return value
68/** `--no-bump` may name a sha only when that sha is already this checkout's ply pin. */
69export function noBumpSha(sha: string, pin: string | null): string | null {
70 if (sha === pin) return null
71 return '--no-bump deploys the checkout; --sha must equal the current pin'
74function parseCd(argv: readonly string[], pin: string | null): Parsed {
75 let sha: string | null = null
76 let noBump = false
77 let rampFlag = false
78 let replaceCanary: string | null = null
79 for (let i = 0; i < argv.length; i++) {
80 const arg = argv[i] ?? ''
81 if (arg === '--no-bump') {
82 noBump = true
83 continue
84 }
85 if (arg === '--ramp') {
86 rampFlag = true
87 continue
88 }
89 if (arg === '--replace-canary') {
90 const value = uuid(argv[i + 1] || null)
91 if (!value) return { kind: 'error', reason: '--replace-canary needs the version id now at 0%' }
92 replaceCanary = value
93 i += 1
94 continue
95 }
96 if (arg === '--sha') {
97 const value = argv[i + 1]
98 if (!value || value.startsWith('--') || !/^[0-9a-f]{40}$/.test(value)) {
99 return { kind: 'error', reason: '--sha must be 40 hex characters' }
100 }
101 sha = value
102 i += 1
103 continue
104 }
105 return { kind: 'error', reason: arg.startsWith('--') ? `unknown option ${arg}` : `unknown command ${arg}` }
106 }
107 if (noBump && sha) {
108 const mismatch = noBumpSha(sha, pin)
109 if (mismatch) return { kind: 'error', reason: mismatch }
110 }
111 return { kind: 'cd', sha, noBump, rampFlag, replaceCanary }
114export function parseArgs(argv: readonly string[], pin: string | null = null): Parsed {
115 const [command, ...rest] = argv
116 if (command === 'help' || command === '--help' || command === '-h') return { kind: 'usage' }
117 if (!command || command === 'cd' || command.startsWith('--')) {
118 return parseCd(command === 'cd' ? rest : argv, pin)
119 }
120 if (command === 'bump') {
121 const sha = flag(rest, 'sha')
122 if (sha !== null && !/^[0-9a-f]{40}$/.test(sha)) return { kind: 'error', reason: '--sha must be 40 hex characters' }
123 return { kind: 'bump', sha }
124 }
125 if (command === 'deploy-canary') {
126 if (rest.length === 0) return { kind: 'deploy-canary', replaceCanary: null }
127 const replaceCanary = uuid(flag(rest, 'replace-canary'))
128 if (!replaceCanary || rest.length !== 2) return { kind: 'error', reason: 'deploy-canary takes only --replace-canary <version id now at 0%>' }
129 return { kind: 'deploy-canary', replaceCanary }
130 }
131 if (command === 'smoke') {
132 const version = flag(rest, 'version')
133 const expectVersion = flag(rest, 'expect-version')
134 if (Boolean(version) === Boolean(expectVersion)) return { kind: 'error', reason: 'smoke needs --version or --expect-version' }
135 const id = uuid(version ?? expectVersion)
136 if (!id) return { kind: 'error', reason: 'version id must be a uuid' }
137 return { kind: 'smoke', version: version ? id : null, expectVersion: expectVersion ? id : null }
138 }
139 if (command === 'telemetry') {
140 const version = uuid(flag(rest, 'version'))
141 const since = flag(rest, 'since')
142 if (!version || !since) return { kind: 'error', reason: 'telemetry needs --version and --since' }
143 return { kind: 'telemetry', version, since, report: flag(rest, 'report') }
144 }
145 if (command === 'ramp') {
146 const version = uuid(flag(rest, 'version'))
147 if (!version) return { kind: 'error', reason: 'ramp needs --version' }
148 const previous = flag(rest, 'previous')
149 if (previous !== null && !VERSION_ID.test(previous)) return { kind: 'error', reason: '--previous must be a uuid' }
150 return { kind: 'ramp', version, previous, verdict: flag(rest, 'verdict') }
151 }
152 if (command === 'rollback') {
153 const to = uuid(flag(rest, 'to'))
154 if (!to) return { kind: 'error', reason: 'rollback needs --to <version id>' }
155 return { kind: 'rollback', to }
156 }
157 if (command === 'report') return { kind: 'report' }
158 if (command === 'annotate') {
159 const runId = rest[0]
160 if (!runId || runId.startsWith('--')) return { kind: 'error', reason: 'annotate needs a run id' }
161 if (!RUN_ID.test(runId)) return { kind: 'error', reason: 'run id must look like 2026-11-01T00-10-02-620Z' }
162 const reason = flag(rest, 'false-positive')
163 if (reason === null) return { kind: 'error', reason: 'annotate needs --false-positive "reason"' }
164 if (!reason.trim() || /[\n\r]/.test(reason)) return { kind: 'error', reason: 'false-positive reason must be one line' }
165 return { kind: 'annotate', runId, reason: reason.trim() }
166 }
167 if (command === 'debrief') {
168 const runDir = rest[0]
169 if (!runDir || runDir.startsWith('--')) return { kind: 'error', reason: 'debrief needs a run directory' }
170 return { kind: 'debrief', runDir }
171 }
172 if (command === 'sweep') {
173 if (rest.length > 0) return { kind: 'error', reason: 'sweep takes no arguments' }
174 return { kind: 'sweep' }
175 }
176 return { kind: 'error', reason: `unknown command ${command}` }
179export function usageText(): string {
180 return [
181 'usage: npm run cd -- [--policy <path>] [command]',
182 ' cd [--sha <40 hex>] [--no-bump] [--replace-canary <id>]',
183 ' [--sha <40 hex>] [--no-bump] [--replace-canary <id>]',
184 ' 0% canary, pinned smoke + telemetry, then the stepped ramp in the policy (steps) to 100%;',
185 ' live smoke + telemetry + visual smoke during the 100% step (auto-rollback). The ramp is the only path:',
186 ' --ramp is accepted and ignored. --replace-canary lets this run replace that version at 0%.',
187 ' One run at a time: the deployment lock (PLY_CD_LOCK, ~/.local/state/ply-cd/deploy.lock) refuses a second.',
188 ' bump [--sha <40 hex>]',
189 ' deploy-canary [--replace-canary <id>]',
190 ' smoke --version <id> | --expect-version <id>',
191 ' telemetry --version <id> --since <iso|epoch> --report smoke.json',
192 ' ramp --version <id> [--previous <id>] [--verdict telemetry.json]',
193 ' rollback --to <id>',
194 ' report',
195 ' annotate <run-id> --false-positive "reason"',
196 ' debrief <run-dir>',
197 ' sweep',
198 ].join('\n')
201function finish(log: (line: string) => void, code: number, line: string): number {
202 log(line)
203 return code
206async function toolLine(cmd: string, args: readonly string[]): Promise<string> {
207 const result = await run(cmd, args, { cwd: ROOT })
208 const line = (result.stdout || result.stderr).trim().split('\n')[0] ?? ''
209 return result.code === 0 && line ? line : `${cmd} unavailable`
212async function identity(config: CdConfig) {
213 const pkg = JSON.parse(await readFile(join(ROOT, 'package.json'), 'utf8')) as { dependencies?: { ply?: string } }
214 const spec = pkg.dependencies?.ply ?? ''
215 const pin = /#([0-9a-f]{40})$/.exec(spec)
216 const plyWeb = await toolLine('git', ['rev-parse', 'HEAD'])
217 return {
218 config: publicConfig(config),
219 tools: {
220 node: process.version,
221 cf: await toolLine(join(ROOT, 'node_modules', '.bin', 'cf'), ['--version']),
222 git: await toolLine('git', ['--version']),
223 },
224 plySha: pin?.[1] ?? null,
225 plyWebSha: plyWeb === 'git unavailable' ? 'unknown' : plyWeb,
226 host: hostname(),
227 }
230async function commandRelease(parsed: Parsed): Promise<ReleaseId | string | null> {
231 if (parsed.kind !== 'cd' && parsed.kind !== 'deploy-canary') return null
232 const checkout = await readCheckout(ROOT)
233 if (!checkout.ok) return `cd: harness_fault ${checkoutReason(checkout)}`
234 let ply: string | null
235 try {
236 if (parsed.kind === 'deploy-canary') ply = await readPlyPin()
237 else if (parsed.noBump) ply = parsed.sha ?? await readPlyPin()
238 else ply = await resolvePlySha(parsed.sha)
239 } catch (error) {
240 return `cd: harness_fault bad-ply-sha: ${errorMessage(error)}`
241 }
242 if (!ply) return 'cd: harness_fault bad-ply-sha: package.json has no ply pin'
243 const made = releaseId(ply, checkout.web)
244 if (!isReleaseId(made)) return `cd: harness_fault ${made.kind}: ply and ply-web shas must be 40 hex`
245 return made
248/** Leave the process on a Node that satisfies `package.json` engines when this one does not. */
249function reexecNode(): number | null {
250 if (process.env.PLY_CD_NODE_REEXEC === '1' || nodeSatisfies(process.version)) return null
251 const candidates = []
252 const preferred = process.env.PLY_NODE
253 if (preferred) candidates.push({ bin: preferred, version: binaryNodeVersion(preferred) })
254 candidates.push({ bin: NODE_IMAGE_BIN, version: binaryNodeVersion(NODE_IMAGE_BIN) })
255 const better = selectNode(process.version, candidates)
256 if (!better) return null
257 const child = spawnSync(better, [...process.execArgv, ...process.argv.slice(1)], {
258 stdio: 'inherit',
259 env: { ...process.env, PLY_CD_NODE_REEXEC: '1', PATH: pathWithNodeBin(better, process.env.PATH) },
260 })
261 return child.status === null ? 1 : child.status
264export async function cli(argv: readonly string[], env: NodeJS.ProcessEnv, log: (line: string) => void = console.log): Promise<number> {
265 const switched = reexecNode()
266 if (switched !== null) return switched
267 const nodeError = checkNode(process.version)
268 if (nodeError) return finish(log, 1, `cd: harness_fault preflight: ${nodeError}`)
269 const split = splitPolicy(argv)
270 if ('error' in split) return finish(log, 2, split.error)
271 const parsed = parseArgs(split.argv, await readPlyPin())
272 if (parsed.kind === 'usage') return finish(log, 2, usageText())
273 if (parsed.kind === 'error') return finish(log, 2, parsed.reason)
274 let config: CdConfig
275 try {
276 config = loadConfig(env, split.policyPath ?? undefined)
277 } catch (error) {
278 return finish(log, 2, errorMessage(error))
279 }
280 if (parsed.kind === 'report') {
281 log(await reportLedger(config.ledgerPath))
282 return 0
283 }
284 if (parsed.kind === 'annotate') {
285 try {
286 await appendFalsePositive(config.ledgerPath, parsed.runId, parsed.reason)
287 return finish(log, 0, `annotated ${parsed.runId} as a false positive`)
288 } catch (error) {
289 return finish(log, 1, `cd: FAIL annotate: ${errorMessage(error)}`)
290 }
291 }
292 if (parsed.kind === 'debrief') {
293 try {
294 const path = await writeDebrief(resolve(parsed.runDir))
295 return finish(log, 0, `debrief: ${path}`)
296 } catch (error) {
297 return finish(log, 1, `cd: FAIL debrief: ${errorMessage(error)}`)
298 }
299 }
300 const opened = await commandRelease(parsed)
301 if (typeof opened === 'string') return finish(log, 1, opened)
302 const release = opened
303 const needsToken = parsed.kind === 'cd' || parsed.kind === 'smoke' || parsed.kind === 'ramp'
304 let token = ''
305 if (needsToken) {
306 try {
307 token = await readTokenFile(config.tokenFile)
308 } catch (error) {
309 return finish(log, 1, `cd: harness_fault preflight: ${errorMessage(error)}`)
310 }
311 }
312 // Every command that writes the deployment holds the lock for its whole run (scripts/cd/lock.ts).
313 const writes = parsed.kind === 'cd' || parsed.kind === 'deploy-canary' || parsed.kind === 'ramp' || parsed.kind === 'rollback'
314 const lock = writes
315 ? await acquireLock(config.lockPath, { command: ['cd', ...argv].join(' '), cwd: ROOT, pid: process.pid }, realLockIo)
316 : null
317 if (lock && !lock.ok) return finish(log, 1, `cd: state_conflict lock: ${lock.reason}`)
318 if (lock && lock.ok) {
319 log(`lock: ${lock.path} (pid ${lock.holder.pid})`)
320 if (lock.tookOver) log(`lock: took over a stale lock from pid ${lock.tookOver.pid} (${lock.tookOver.startedAt}), which is no longer running`)
321 }
322 try {
323 return await runLocked(parsed, config, token, release, log)
324 } finally {
325 if (lock && lock.ok) await lock.release()
326 }
329async function runLocked(
330 parsed: Exclude<Parsed, { kind: 'usage' | 'error' | 'report' | 'debrief' | 'annotate' }>,
331 config: CdConfig,
332 token: string,
333 release: ReleaseId | null,
334 log: (line: string) => void,
335): Promise<number> {
336 if (parsed.kind === 'cd' && parsed.rampFlag) log('cd: --ramp is ignored: the stepped ramp is the only promotion path since 2026-11-08')
337 const existing = parsed.kind === 'cd' && release ? await unfinishedRunDir(config.runRoot, release) : null
338 try {
339 log(retentionLine(await pruneRuns(config.runRoot, existing ? [basename(existing)] : [])))
340 } catch (error) {
341 // Retention never blocks a deploy. The next run tries again.
342 log(`retention: skipped: ${errorMessage(error)}`)
343 }
344 const runDir = existing ?? await createRunDir(config.runRoot)
345 const runLog = existing
346 ? await RunLog.reopen(runDir, config.ledgerPath)
347 : await RunLog.open(runDir, config.ledgerPath, basename(runDir))
348 log(`run: ${runDir}`)
349 if (existing) log(`resume: ${runDir}`)
350 return withRun(runLog, () => withCommandSink(note => runLog.noteCommand(note), async () => {
351 let code = 1
352 let reason: string | null = 'run ended before finish'
353 try {
354 if (token) runLog.conceal(token)
355 if (existing && release) {
356 await runLog.resumed(release.ply, releasePair(release))
357 } else {
358 const started = await identity(config)
359 const pair = release ? releasePair(release) : null
360 const recorded = {
361 ...started,
362 ...(pair ? { plySha: pair.ply, plyWebSha: pair.web, release: pair } : { release: null }),
363 config: pair ? { ...started.config, sha: pair.ply, release: pair } : started.config,
364 }
365 await runLog.started(recorded)
366 }
367 await runLog.recordPolicy({
368 sha256: config.policySha256,
369 path: config.policyPath,
370 body: config.policyBody,
371 release: release ? releasePair(release) : null,
372 })
373 // Watch this process's own clocks for the whole run (client-health.ts): a stalled box is never a product verdict.
374 startClientHealth()
375 const outcome = await dispatch(parsed, config, token, runDir, runLog, log, release)
376 code = outcome.code
377 reason = outcome.reason
378 return code
379 } catch (error) {
380 reason = errorMessage(error)
381 runLog.patch({ fault: 'harness_fault' })
382 await runLog.error(reason, { stage: 'run', fault: 'harness_fault' })
383 log(`cd: harness_fault run: ${reason}`)
384 return 1
385 } finally {
386 const stalls = stopClientHealth()
387 if (stalls.length > 0) log(`client: ${stalls.length} stall(s) this run: ${stalls.map(stall => `${new Date(stall.from).toISOString()} ${stall.ms} ms`).join(', ')}`)
388 if (!runLog.finished) await runLog.finish(code, code === 0 ? null : reason)
389 if (!runLog.sealed) await runLog.seal()
390 }
391 }))
394type Outcome = { readonly code: number; readonly reason: string | null }
396async function dispatch(
397 parsed: Exclude<Parsed, { kind: 'usage' | 'error' | 'report' | 'debrief' | 'annotate' }>,
398 config: CdConfig,
399 token: string,
400 runDir: string,
401 runLog: RunLog,
402 log: (line: string) => void,
403 release: ReleaseId | null,
404): Promise<Outcome> {
405 if (parsed.kind === 'cd') {
406 if (!release) return { code: 1, reason: 'cd: harness_fault bad-ply-sha: release was not read' }
407 const exit = await runPipeline(config, { token, sha: parsed.sha, noBump: parsed.noBump, replaceCanary: parsed.replaceCanary, release, log, runDir, runLog })
408 return { code: exit.code, reason: exit.reason }
409 }
410 if (parsed.kind === 'bump') {
411 const result = await stageBump(config, parsed.sha)
412 await writeJson(runDir, 'bump.json', result)
413 if (result.kind === 'fail') {
414 runLog.patch({ fault: 'harness_fault' })
415 const line = `cd: harness_fault bump: ${result.reason}`
416 log(line)
417 return { code: 1, reason: line }
418 }
419 const line = result.value.committed ? `cd: PASS bump ${result.value.sha}` : `cd: PASS bump unchanged ${result.value.sha}`
420 log(line)
421 return { code: 0, reason: null }
422 }
423 if (parsed.kind === 'deploy-canary') {
424 if (!release) return { code: 1, reason: 'cd: harness_fault bad-ply-sha: release was not read' }
425 const result = await stageDeploy(config, release, { replaceCanary: parsed.replaceCanary })
426 await writeJson(runDir, 'deploy.json', result)
427 if (result.kind === 'fail') {
428 runLog.patch({ fault: result.fault })
429 const line = `cd: ${result.fault === 'worker' ? 'FAIL' : result.fault} deploy-canary: ${result.reason}`
430 log(line)
431 return { code: 1, reason: line }
432 }
433 log(`version: ${result.value.version}`)
434 log(`previous: ${result.value.previous}`)
435 log(`cd: PASS deploy-canary ${result.value.version}`)
436 return { code: 0, reason: null }
437 }
438 if (parsed.kind === 'smoke') {
439 const version = parsed.version ?? parsed.expectVersion
440 const result = await stageSmoke(config, { version, pin: parsed.version !== null, token, runDir })
441 if (result.kind === 'fail') {
442 runLog.patch({ fault: result.fault })
443 const line = `cd: ${result.fault === 'worker' ? 'FAIL' : result.fault} smoke: ${result.reason}`
444 log(line)
445 return { code: 1, reason: line }
446 }
447 log(`cd: PASS smoke ${version}`)
448 return { code: 0, reason: null }
449 }
450 if (parsed.kind === 'telemetry') {
451 let since = 0
452 try {
453 since = parseSince(parsed.since)
454 } catch (error) {
455 const line = errorMessage(error)
456 log(line)
457 return { code: 2, reason: line }
458 }
459 if (!parsed.report) {
460 log('telemetry needs --report')
461 return { code: 2, reason: 'telemetry needs --report' }
462 }
463 const result = await stageTelemetry(config, { version: parsed.version, since, reportPath: parsed.report, runDir, live: false })
464 if (result.kind === 'fail') {
465 const line = `cd: ${result.fault === 'worker' ? 'FAIL' : result.fault} telemetry: ${result.reason}`
466 log(line)
467 return { code: 1, reason: line }
468 }
469 log(result.value.line)
470 log(`cd: PASS telemetry ${parsed.version}`)
471 return { code: 0, reason: null }
472 }
473 if (parsed.kind === 'sweep') {
474 const result = await stageSweep(config, runDir)
475 if (result.kind === 'unlistable') {
476 runLog.patch({ fault: 'harness_fault' })
477 const line = `cd: harness_fault sweep: ${result.detail}`
478 log(line)
479 return { code: 1, reason: line }
480 }
481 if (result.leaks.length > 0) log(`cleanup_leak: ${result.leaks.join(' ')}`)
482 const line = `cd: PASS sweep deleted ${result.deleted.length}`
483 log(line)
484 return { code: 0, reason: null }
485 }
486 if (parsed.kind === 'ramp') {
487 const result = await stageRamp(config, {
488 version: parsed.version,
489 previous: parsed.previous,
490 verdictPath: parsed.verdict,
491 runDir,
492 token,
493 log,
494 })
495 if (result.kind === 'fail') {
496 const line = `cd: ${result.fault === 'worker' ? 'FAIL' : result.fault} ramp: ${result.reason}`
497 log(line)
498 return { code: 1, reason: line }
499 }
500 log(`version: ${result.value.version}`)
501 log(`previous: ${result.value.previous}`)
502 log(`cd: PASS ramp ${result.value.version}`)
503 return { code: 0, reason: null }
504 }
505 const result = await stageRollback(config, parsed.to)
506 await writeJson(runDir, 'rollback.json', result)
507 if (result.kind === 'fail') {
508 const line = `cd: FAIL rollback: ${result.reason}`
509 log(line)
510 return { code: 1, reason: line }
511 }
512 log(`cd: PASS rollback ${parsed.to}`)
513 return { code: 0, reason: null }
516const entry = process.argv[1]
517if (entry && resolve(entry) === fileURLToPath(import.meta.url)) {
518 cli(process.argv.slice(2), process.env).then(code => process.exit(code))
Diagnostics4 git calls · 296 ms
CallStatusSizeTime0296 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
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 1020040 KiB · hit7 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=41349
git.response.cache=HIT
git.response.duration_ms=7
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=526b305930b8ef382f2d7a1f9c0238730a585921
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=41349
git.pkt.payload.max=41254
git.sideband.band1.bytes=41253
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=61
git.pack.bytes=41253
git.pack.ofs_delta=0
git.pack.ref_delta=0
git.pack.chain.max=0
git.pack.trailer=ab60efef4b7243678c75de64a4386986ee885c1c
git.pack.full=61
Open pack map
fetch2005.9 KiB286 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=286
git.response.bytes=6021
git.response.cache=MISS
git.response.duration_ms=286
git.fetch.wants=d1c3220b157432fdc23bcc513c22b298bac3e6cc
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=6021
git.pkt.payload.max=6000
git.sideband.band1.bytes=5999
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-web.git
Ref
refs/heads/main
Commit
526b305930b8ef382f2d7a1f9c0238730a585921
cf-ray
a5e2ce65c99aefad
Request
d2285a12…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format