main
ply4 git calls735 ms45 KiB1 cachedprotocol v2
745 lines25 KiBRaw
1// CD correctness gate (2026-11-08 incident): after each successful blob read, a warm re-read of the
2// same path must return identical body bytes. An empty/short Workers Cache hit fails the smoke and
3// blocks promote / triggers live rollback. Do not remove these *-warm steps.
4import {
5 HTTP_BAD_REQUEST,
6 HTTP_METHOD_NOT_ALLOWED,
7 HTTP_NOT_FOUND,
8 HTTP_OK,
9 HTTP_UNAUTHORIZED,
10 SMOKE_FLAG_KEY,
11 SMOKE_UNIT_ID,
12} from './flags-smoke.ts'
13import type { RayNeed, Expect, Saved } from './judge.ts'
15export type HttpStep = {
16 readonly name: string
17 readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
18 readonly path: string
19 readonly query?: Readonly<Record<string, string>>
20 readonly body?: (saved: Saved) => object
21 readonly expect: Expect
22 readonly ray: RayNeed
23 readonly rayIncludes?: string
24 readonly save?: readonly { readonly key: string; readonly field: string }[]
25 /** False skips the Worker bearer. The 401 is decided before any upstream call. */
26 readonly ply?: boolean
27 /** False skips Git-Token. */
28 readonly git?: boolean
31/**
32 * A single-file find/replace edit (ply's editFile) after the squash. Telemetry requires its ply spans (`git.edit`,
33 * `git.edit.tree`, `git.edit.blob`, upload-pack, receive-pack) in Workers tracing: scripts/cd/span-check.ts, issue #67.
34 */
35export const TRACED_EDIT_STEP = 'edit-traced'
37const T = 1_700_000_000
38const ZERO = '0'.repeat(40)
40function author(time: number, tz = '+0000') {
41 return { name: 'ply cd', email: 'cd@ply.invalid', tz, time }
44function committer(time: number) {
45 return { name: 'ply cd committer', email: 'commit@ply.invalid', tz: '-0800', time }
48/** 64 KiB of 'm' — large enough to exercise blob-cache tee/put; small enough for smoke. */
49const MEDIUM_BLOB = 'm'.repeat(65_536)
51/** The second commit, shared so a replay onto another branch produces the same tree. */
52export function secondChanges(): readonly Record<string, string>[] {
53 return [
54 { op: 'edit', path: 'src/a.txt', find: 'v1', replace: 'v2' },
55 { op: 'delete', path: 'src/keep.txt' },
56 { op: 'create', path: 'ADDED.txt', content: 'added\n' },
57 { op: 'rename', path: 'old.txt', to: 'new.txt' },
58 { op: 'write', path: 'notes/w.txt', content: 'w\n' },
59 ]
62/** The same patch plus a path that exists only on the target. That is a conflict, not an empty pick. */
63export function widerChanges(): readonly Record<string, string>[] {
64 return [...secondChanges(), { op: 'create', path: 'extra.txt', content: 'only here\n' }]
67function rootChanges(): readonly Record<string, string>[] {
68 return [
69 { op: 'create', path: 'README.md', content: 'hello\n' },
70 { op: 'create', path: 'src/a.txt', content: 'v1\n' },
71 { op: 'create', path: 'src/keep.txt', content: 'keep\n' },
72 { op: 'create', path: 'old.txt', content: 'x\n' },
73 { op: 'create', path: 'bin/run', content: '#!/bin/sh\n', mode: '100755' },
74 { op: 'create', path: 'link', content: 'README.md', mode: '120000' },
75 { op: 'create', path: 'blob/medium.bin', content: MEDIUM_BLOB },
76 ]
80const write = (name: string, body: (saved: Saved) => Record<string, unknown>, expect: Expect, save?: HttpStep['save']): HttpStep => ({
81 name,
82 method: 'POST',
83 path: '/v1/edit',
84 body,
85 expect,
86 ray: 'required',
87 rayIncludes: 'receive-pack=',
88 save,
89})
91const read = (name: string, path: string, expect: Expect, rayIncludes?: string): HttpStep => ({
92 name,
93 method: 'GET',
94 path: '/v1/read',
95 query: { path },
96 expect,
97 // Fill rays ride on cached CAS responses (HIT = stored fill rays); required on every Artifacts hop.
98 ray: 'required',
99 rayIncludes,
100})
102/** Flag routes, before the git lifecycle. They do not talk to Artifacts. Eval reads the rules snapshot. */
103function flagChecks(): readonly HttpStep[] {
104 const quiet = { git: false, ray: 'absent' as const }
105 const unsupported = { kind: 'code' as const, status: HTTP_METHOD_NOT_ALLOWED, code: 'unsupported' }
106 const refused = (name: string, method: HttpStep['method'], path: string): HttpStep => ({
107 name,
108 method,
109 path,
110 ...quiet,
111 expect: unsupported,
112 })
113 return [
114 {
115 name: 'flags-unauth',
116 method: 'GET',
117 path: '/v1/flags',
118 ply: false,
119 ...quiet,
120 expect: { kind: 'code', status: HTTP_UNAUTHORIZED, code: 'unauthorized' },
121 },
122 {
123 name: 'flags-rules',
124 method: 'GET',
125 path: '/v1/flags',
126 ...quiet,
127 expect: { kind: 'flags-rules' },
128 },
129 {
130 name: 'flags-eval',
131 method: 'POST',
132 path: '/v1/flags/eval',
133 ...quiet,
134 body: () => ({ unit: SMOKE_UNIT_ID, keys: [SMOKE_FLAG_KEY] }),
135 expect: { kind: 'flags-eval' },
136 },
137 {
138 name: 'flags-eval-body',
139 method: 'POST',
140 path: '/v1/flags/eval',
141 ...quiet,
142 body: () => ({ keys: [SMOKE_FLAG_KEY] }),
143 expect: { kind: 'code', status: HTTP_BAD_REQUEST, code: 'bad_request', message: /unit is required/ },
144 },
145 {
146 name: 'flags-eval-key',
147 method: 'POST',
148 path: '/v1/flags/eval',
149 ...quiet,
150 body: () => ({ unit: SMOKE_UNIT_ID, keys: ['NOT_A_KEY'] }),
151 expect: { kind: 'code', status: HTTP_BAD_REQUEST, code: 'bad_request', message: /flag key is not valid/ },
152 },
153 refused('flags-put', 'PUT', '/v1/flags'),
154 refused('flags-post', 'POST', '/v1/flags'),
155 refused('flags-patch', 'PATCH', '/v1/flags'),
156 refused('flags-delete', 'DELETE', '/v1/flags'),
157 refused('flags-eval-get', 'GET', '/v1/flags/eval'),
158 {
159 name: 'usage-off',
160 method: 'GET',
161 path: '/',
162 ply: false,
163 ...quiet,
164 expect: { kind: 'usage-off' },
165 },
166 ]
169/**
170 * One empty Artifacts repo, never seeded with stock git. Oids returned by earlier steps are
171 * passed into later ones. The order is the contract in src/index.js.
172 */
173export function lifecycle(): readonly HttpStep[] {
174 return [
175 ...flagChecks(),
176 {
177 name: 'ply-unauth',
178 method: 'GET',
179 path: '/v1/commit',
180 ply: false,
181 git: false,
182 expect: { kind: 'code', status: 401, code: 'unauthorized' },
183 ray: 'absent',
184 },
185 { name: 'commit-empty', method: 'GET', path: '/v1/commit', expect: { kind: 'empty-commit' }, ray: 'required' },
186 {
187 name: 'commit-empty-main',
188 method: 'GET',
189 path: '/v1/commit',
190 query: { ref: 'main' },
191 expect: { kind: 'empty-commit' },
192 ray: 'required',
193 },
194 {
195 name: 'commit-missing',
196 method: 'GET',
197 path: '/v1/commit',
198 query: { ref: 'nope' },
199 expect: { kind: 'code', status: 404, code: 'not_found' },
200 ray: 'required',
201 },
202 { name: 'refs-empty', method: 'GET', path: '/v1/refs', expect: { kind: 'refs-empty' }, ray: 'required' },
203 {
204 name: 'branch-unborn',
205 method: 'POST',
206 path: '/v1/branch',
207 body: () => ({ ref: 'tmp' }),
208 expect: { kind: 'code', status: 400, code: 'bad_request', message: /from is required when the remote HEAD is unborn/ },
209 ray: 'required',
210 },
211 {
212 name: 'branch-zero',
213 method: 'POST',
214 path: '/v1/branch',
215 body: () => ({ ref: 'tmp', from: ZERO }),
216 expect: { kind: 'code', status: 400, code: 'bad_request', message: /zero oid/ },
217 ray: 'optional',
218 },
219 {
220 name: 'edit-zero-base',
221 method: 'POST',
222 path: '/v1/edit',
223 body: () => ({ base: ZERO, path: 'a.txt', content: 'a\n', author: author(T), message: 'no' }),
224 expect: { kind: 'code', status: 400, code: 'bad_request', message: /zero oid/ },
225 ray: 'optional',
226 },
227 write('root-create', () => ({ message: 'init', author: author(T), changes: rootChanges() }), {
228 kind: 'outcome', status: 200, outcome: 'commit', noop: false, nullFields: ['oldOid'],
229 }, [{ key: 'c0', field: 'oid' }]),
230 {
231 name: 'tree-root',
232 method: 'GET',
233 path: '/v1/tree',
234 expect: { kind: 'tree', names: ['README.md', 'src', 'old.txt', 'bin', 'link', 'blob'] },
235 ray: 'required',
236 },
237 read('read-readme', 'README.md', { kind: 'text', status: 200, text: 'hello\n' }, 'fetch='),
238 // Warm re-read of the same blob: body bytes must match. Empty cache hits fail this (2026-11-08).
239 read('read-readme-warm', 'README.md', { kind: 'text', status: 200, text: 'hello\n' }),
240 // After a warm Workers Cache fill, an unauthenticated /v1/read must still 401 (auth never skipped).
241 {
242 name: 'read-readme-warm-unauth',
243 method: 'GET',
244 path: '/v1/read',
245 query: { path: 'README.md' },
246 ply: false,
247 git: false,
248 expect: { kind: 'code', status: HTTP_UNAUTHORIZED, code: 'unauthorized' },
249 ray: 'absent',
250 },
251 read('read-medium', 'blob/medium.bin', { kind: 'text', status: 200, text: MEDIUM_BLOB }, 'fetch='),
252 read('read-medium-warm', 'blob/medium.bin', { kind: 'text', status: 200, text: MEDIUM_BLOB }),
253 write('edit-update', () => ({
254 message: 'second',
255 author: author(T + 100),
256 committer: committer(T + 100),
257 changes: secondChanges(),
258 }), {
259 kind: 'outcome', status: 200, outcome: 'commit', equals: [{ field: 'oldOid', key: 'c0' }],
260 }, [{ key: 'c1', field: 'oid' }]),
261 // Ref freshness: after write + RefCache purge, /v1/commit must see c1 (not a stale ref hit).
262 {
263 name: 'commit-fresh-after-write',
264 method: 'GET',
265 path: '/v1/commit',
266 expect: { kind: 'parents', count: 1, oidEquals: 'c1' },
267 ray: 'required',
268 },
269 {
270 name: 'merge-zero',
271 method: 'POST',
272 path: '/v1/merge',
273 body: () => ({ ref: 'main', from: ZERO, author: author(T + 105) }),
274 expect: { kind: 'code', status: 400, code: 'bad_request', message: /zero oid/ },
275 ray: 'optional',
276 },
277 {
278 name: 'merge-from-oid',
279 method: 'POST',
280 path: '/v1/merge',
281 body: saved => ({ from: saved.c0, author: author(T + 106) }),
282 expect: { kind: 'outcome', status: 200, outcome: 'up_to_date', noop: true },
283 ray: 'required',
284 },
285 read('read-edited', 'src/a.txt', { kind: 'text', status: 200, text: 'v2\n' }, 'fetch='),
286 read('read-edited-warm', 'src/a.txt', { kind: 'text', status: 200, text: 'v2\n' }),
287 read('read-added', 'ADDED.txt', { kind: 'text', status: 200, text: 'added\n' }, 'fetch='),
288 read('read-added-warm', 'ADDED.txt', { kind: 'text', status: 200, text: 'added\n' }),
289 read('read-renamed', 'new.txt', { kind: 'text', status: 200, text: 'x\n' }, 'fetch='),
290 read('read-renamed-warm', 'new.txt', { kind: 'text', status: 200, text: 'x\n' }),
291 read('read-written', 'notes/w.txt', { kind: 'text', status: 200, text: 'w\n' }, 'fetch='),
292 read('read-written-warm', 'notes/w.txt', { kind: 'text', status: 200, text: 'w\n' }),
293 read('read-deleted', 'src/keep.txt', { kind: 'code', status: 404, code: 'not_found' }),
294 {
295 name: 'cas-stale',
296 method: 'POST',
297 path: '/v1/edit',
298 body: saved => ({ message: 'stale', author: author(T + 110), head: saved.c0, path: 'README.md', find: 'hello', replace: 'stale' }),
299 expect: { kind: 'code', status: 409, code: 'cas_conflict' },
300 ray: 'required',
301 },
302 {
303 name: 'match-count',
304 method: 'POST',
305 path: '/v1/edit',
306 body: () => ({ message: 'count', author: author(T + 120), path: 'src/a.txt', find: 'no-such-marker', replace: 'z' }),
307 expect: { kind: 'code', status: 422, code: 'match_count' },
308 ray: 'required',
309 },
310 {
311 name: 'branch-create',
312 method: 'POST',
313 path: '/v1/branch',
314 body: saved => ({ ref: 'other', from: saved.c0 }),
315 expect: { kind: 'outcome', status: 201, outcome: 'created', equals: [{ field: 'oid', key: 'c0' }] },
316 ray: 'required',
317 rayIncludes: 'receive-pack=',
318 },
319 write('branch-replay', () => ({
320 ref: 'other',
321 message: 'replay',
322 author: author(T + 200),
323 changes: secondChanges(),
324 }), {
325 kind: 'outcome', status: 200, outcome: 'commit', differs: [{ field: 'oid', key: 'c1' }],
326 }, [{ key: 'otherTip', field: 'oid' }]),
327 {
328 name: 'cherry-applied',
329 method: 'POST',
330 path: '/v1/cherry-pick',
331 body: saved => ({ ref: 'other', commit: saved.c1, committer: author(T + 210) }),
332 expect: { kind: 'outcome', status: 200, outcome: 'empty', noop: true, equals: [{ field: 'oid', key: 'otherTip' }] },
333 ray: 'required',
334 },
335 {
336 name: 'cherry-allow-empty',
337 method: 'POST',
338 path: '/v1/cherry-pick',
339 body: saved => ({ ref: 'other', commit: saved.c1, committer: author(T + 220), allowEmpty: true }),
340 expect: { kind: 'outcome', status: 200, outcome: 'cherry_pick', noop: false, differs: [{ field: 'oid', key: 'otherTip' }] },
341 ray: 'required',
342 rayIncludes: 'receive-pack=',
343 save: [{ key: 'emptyPick', field: 'oid' }],
344 },
345 {
346 name: 'branch-wider',
347 method: 'POST',
348 path: '/v1/branch',
349 body: saved => ({ ref: 'wider', from: saved.c0 }),
350 expect: { kind: 'outcome', status: 201, outcome: 'created' },
351 ray: 'required',
352 rayIncludes: 'receive-pack=',
353 },
354 write('wider-file', () => ({
355 ref: 'wider',
356 message: 'wider',
357 author: author(T + 230),
358 changes: widerChanges(),
359 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'widerTip', field: 'oid' }]),
360 {
361 name: 'cherry-wider',
362 method: 'POST',
363 path: '/v1/cherry-pick',
364 body: saved => ({ ref: 'wider', commit: saved.c1, committer: author(T + 240) }),
365 expect: { kind: 'code', status: 409, code: 'merge_conflict' },
366 ray: 'required',
367 },
368 {
369 name: 'cherry-wider-empty',
370 method: 'POST',
371 path: '/v1/cherry-pick',
372 body: saved => ({ ref: 'wider', commit: saved.c1, committer: author(T + 250), allowEmpty: true }),
373 expect: { kind: 'code', status: 409, code: 'merge_conflict' },
374 ray: 'required',
375 },
376 {
377 name: 'branch-feat',
378 method: 'POST',
379 path: '/v1/branch',
380 body: saved => ({ ref: 'feat', from: saved.c1 }),
381 expect: { kind: 'outcome', status: 201, outcome: 'created', equals: [{ field: 'oid', key: 'c1' }] },
382 ray: 'required',
383 rayIncludes: 'receive-pack=',
384 },
385 write('feat-file', () => ({
386 ref: 'feat',
387 message: 'feat file',
388 author: author(T + 300),
389 changes: [{ op: 'create', path: 'feat.txt', content: 'feat\n' }],
390 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'feat', field: 'oid' }]),
391 {
392 name: 'cherry-pick',
393 method: 'POST',
394 path: '/v1/cherry-pick',
395 body: saved => ({ commit: saved.feat, committer: author(T + 310) }),
396 expect: { kind: 'outcome', status: 200, outcome: 'cherry_pick' },
397 ray: 'required',
398 rayIncludes: 'receive-pack=',
399 save: [{ key: 'picked', field: 'oid' }],
400 },
401 {
402 name: 'branch-rwide',
403 method: 'POST',
404 path: '/v1/branch',
405 body: saved => ({ ref: 'rwide', from: saved.picked }),
406 expect: { kind: 'outcome', status: 201, outcome: 'created' },
407 ray: 'required',
408 rayIncludes: 'receive-pack=',
409 },
410 write('rwide-file', () => ({
411 ref: 'rwide',
412 message: 'rwide extra',
413 author: author(T + 330),
414 changes: [{ op: 'create', path: 'rwide.txt', content: 'extra\n' }],
415 }), { kind: 'outcome', status: 200, outcome: 'commit' }),
416 {
417 name: 'revert-wider',
418 method: 'POST',
419 path: '/v1/revert',
420 body: saved => ({ ref: 'rwide', commit: saved.picked, committer: author(T + 340) }),
421 expect: { kind: 'outcome', status: 200, outcome: 'revert' },
422 ray: 'required',
423 },
424 {
425 name: 'revert',
426 method: 'POST',
427 path: '/v1/revert',
428 body: saved => ({ commit: saved.picked, committer: author(T + 320) }),
429 expect: { kind: 'outcome', status: 200, outcome: 'revert' },
430 ray: 'required',
431 rayIncludes: 'receive-pack=',
432 save: [{ key: 'reverted', field: 'oid' }],
433 },
434 {
435 name: 'branch-ff',
436 method: 'POST',
437 path: '/v1/branch',
438 body: saved => ({ ref: 'ff', from: saved.reverted }),
439 expect: { kind: 'outcome', status: 201, outcome: 'created' },
440 ray: 'required',
441 rayIncludes: 'receive-pack=',
442 },
443 write('ff-file', () => ({
444 ref: 'ff',
445 message: 'ff file',
446 author: author(T + 400),
447 changes: [{ op: 'create', path: 'ff.txt', content: 'ff\n' }],
448 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'ffTip', field: 'oid' }]),
449 {
450 name: 'merge-ff',
451 method: 'POST',
452 path: '/v1/merge',
453 body: () => ({ from: 'ff', author: author(T + 410), message: 'merge ff' }),
454 expect: { kind: 'outcome', status: 200, outcome: 'fast_forward', equals: [{ field: 'oid', key: 'ffTip' }] },
455 ray: 'required',
456 rayIncludes: 'receive-pack=',
457 },
458 {
459 name: 'branch-diverge',
460 method: 'POST',
461 path: '/v1/branch',
462 body: saved => ({ ref: 'diverge', from: saved.ffTip }),
463 expect: { kind: 'outcome', status: 201, outcome: 'created' },
464 ray: 'required',
465 rayIncludes: 'receive-pack=',
466 },
467 write('diverge-file', () => ({
468 ref: 'diverge',
469 message: 'diverge',
470 author: author(T + 500),
471 changes: [{ op: 'create', path: 'div.txt', content: 'div\n' }],
472 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'divTip', field: 'oid' }]),
473 write('main-diverge', () => ({
474 message: 'main moves',
475 author: author(T + 510),
476 changes: [{ op: 'create', path: 'main-moved.txt', content: 'm\n' }],
477 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'mainMoved', field: 'oid' }]),
478 {
479 name: 'merge-ff-only',
480 method: 'POST',
481 path: '/v1/merge',
482 body: () => ({ from: 'diverge', author: author(T + 520), message: 'ff only', fastForwardOnly: true }),
483 expect: { kind: 'code', status: 409, code: 'not_fast_forward' },
484 ray: 'required',
485 },
486 {
487 name: 'branch-noff',
488 method: 'POST',
489 path: '/v1/branch',
490 body: saved => ({ ref: 'noff', from: saved.mainMoved }),
491 expect: { kind: 'outcome', status: 201, outcome: 'created' },
492 ray: 'required',
493 rayIncludes: 'receive-pack=',
494 },
495 write('noff-file', () => ({
496 ref: 'noff',
497 message: 'noff',
498 author: author(T + 600),
499 changes: [{ op: 'create', path: 'noff.txt', content: 'n\n' }],
500 }), { kind: 'outcome', status: 200, outcome: 'commit' }, [{ key: 'noffTip', field: 'oid' }]),
501 {
502 name: 'merge-noff',
503 method: 'POST',
504 path: '/v1/merge',
505 body: () => ({
506 from: 'noff',
507 author: author(T + 610),
508 committer: committer(T + 630),
509 message: 'merge noff',
510 noFastForward: true,
511 }),
512 expect: { kind: 'outcome', status: 200, outcome: 'merge' },
513 ray: 'required',
514 rayIncludes: 'receive-pack=',
515 save: [{ key: 'noffMerge', field: 'oid' }],
516 },
517 {
518 name: 'commit-noff-parents',
519 method: 'GET',
520 path: '/v1/commit',
521 query: { ref: 'main' },
522 expect: { kind: 'parents', count: 2, oidEquals: 'noffMerge' },
523 ray: 'required',
524 },
525 {
526 name: 'merge-stamps',
527 method: 'GET',
528 path: '/v1/commit',
529 query: { ref: 'main' },
530 expect: { kind: 'stamps', authorEmail: 'cd@ply.invalid', committerEmail: 'commit@ply.invalid' },
531 ray: 'required',
532 },
533 {
534 name: 'merge-diverged',
535 method: 'POST',
536 path: '/v1/merge',
537 body: () => ({ from: 'diverge', author: author(T + 620), message: 'merge diverged' }),
538 expect: { kind: 'outcome', status: 200, outcome: 'merge' },
539 ray: 'required',
540 rayIncludes: 'receive-pack=',
541 },
542 {
543 name: 'tag-light',
544 method: 'POST',
545 path: '/v1/tag',
546 body: saved => ({ name: 'v-light', target: saved.c0 }),
547 expect: { kind: 'outcome', status: 201, outcome: 'tag', equals: [{ field: 'oid', key: 'c0' }] },
548 ray: 'required',
549 rayIncludes: 'receive-pack=',
550 },
551 {
552 name: 'tag-annotated',
553 method: 'POST',
554 path: '/v1/tag',
555 body: saved => ({ name: 'v-ann', target: saved.c1, annotated: true, message: 'ann\n', tagger: author(T + 700) }),
556 expect: {
557 kind: 'outcome',
558 status: 201,
559 outcome: 'tag',
560 equals: [{ field: 'commit', key: 'c1' }],
561 differs: [{ field: 'oid', key: 'c1' }],
562 },
563 ray: 'required',
564 rayIncludes: 'receive-pack=',
565 save: [{ key: 'ann', field: 'oid' }],
566 },
567 {
568 name: 'tag-exists',
569 method: 'POST',
570 path: '/v1/tag',
571 body: saved => ({ name: 'v-light', target: saved.c0 }),
572 expect: { kind: 'code', status: 409, code: 'ref_exists' },
573 ray: 'required',
574 },
575 {
576 name: 'tag-stale',
577 method: 'DELETE',
578 path: '/v1/tag',
579 body: saved => ({ name: 'v-light', oid: saved.c1 }),
580 expect: { kind: 'code', status: 409, code: 'stale_expected' },
581 ray: 'required',
582 },
583 {
584 name: 'tag-delete',
585 method: 'DELETE',
586 path: '/v1/tag',
587 body: saved => ({ name: 'v-light', oid: saved.c0 }),
588 expect: { kind: 'outcome', status: 200, outcome: 'deleted' },
589 ray: 'required',
590 rayIncludes: 'receive-pack=',
591 },
592 {
593 name: 'branch-tmp',
594 method: 'POST',
595 path: '/v1/branch',
596 body: saved => ({ ref: 'tmp', from: saved.c0 }),
597 expect: { kind: 'outcome', status: 201, outcome: 'created' },
598 ray: 'required',
599 rayIncludes: 'receive-pack=',
600 },
601 {
602 name: 'branch-dup',
603 method: 'POST',
604 path: '/v1/branch',
605 body: saved => ({ ref: 'tmp', from: saved.c0 }),
606 expect: { kind: 'code', status: 409, code: 'ref_exists' },
607 ray: 'required',
608 },
609 {
610 name: 'branch-stale',
611 method: 'DELETE',
612 path: '/v1/branch',
613 body: saved => ({ ref: 'tmp', oid: saved.c1 }),
614 expect: { kind: 'code', status: 409, code: 'stale_expected' },
615 ray: 'required',
616 },
617 {
618 name: 'branch-delete',
619 method: 'DELETE',
620 path: '/v1/branch',
621 body: saved => ({ ref: 'tmp', oid: saved.c0 }),
622 expect: { kind: 'outcome', status: 200, outcome: 'deleted' },
623 ray: 'required',
624 rayIncludes: 'receive-pack=',
625 },
626 {
627 name: 'branch-rebase',
628 method: 'POST',
629 path: '/v1/branch',
630 body: saved => ({ ref: 'rebase', from: saved.c0 }),
631 expect: { kind: 'outcome', status: 201, outcome: 'created' },
632 ray: 'required',
633 rayIncludes: 'receive-pack=',
634 },
635 write('rebase-file', () => ({
636 ref: 'rebase',
637 message: 'rebase file',
638 author: author(T + 800),
639 changes: [{ op: 'create', path: 'rebase.txt', content: 'r\n' }],
640 }), { kind: 'outcome', status: 200, outcome: 'commit' }),
641 {
642 name: 'commit-main',
643 method: 'GET',
644 path: '/v1/commit',
645 expect: { kind: 'born' },
646 ray: 'required',
647 save: [{ key: 'mainTip', field: 'oid' }],
648 },
649 {
650 name: 'rebase-zero',
651 method: 'POST',
652 path: '/v1/rebase',
653 body: () => ({ ref: 'rebase', onto: ZERO, committer: author(T + 805) }),
654 expect: { kind: 'code', status: 400, code: 'bad_request', message: /zero oid/ },
655 ray: 'optional',
656 },
657 {
658 name: 'rebase',
659 method: 'POST',
660 path: '/v1/rebase',
661 body: saved => ({
662 ref: 'rebase',
663 onto: saved.mainTip,
664 committer: committer(T + 810),
665 author: author(T + 820),
666 }),
667 expect: { kind: 'outcome', status: 200, outcome: 'rebase' },
668 ray: 'required',
669 rayIncludes: 'receive-pack=',
670 },
671 {
672 name: 'branch-squash',
673 method: 'POST',
674 path: '/v1/branch',
675 body: saved => ({ ref: 'squash', from: saved.c0 }),
676 expect: { kind: 'outcome', status: 201, outcome: 'created' },
677 ray: 'required',
678 rayIncludes: 'receive-pack=',
679 },
680 write('squash-file-1', () => ({
681 ref: 'squash',
682 message: 'squash 1',
683 author: author(T + 900),
684 changes: [{ op: 'create', path: 'sq1.txt', content: '1\n' }],
685 }), { kind: 'outcome', status: 200, outcome: 'commit' }),
686 write('squash-file-2', () => ({
687 ref: 'squash',
688 message: 'squash 2',
689 author: author(T + 910),
690 changes: [{ op: 'create', path: 'sq2.txt', content: '2\n' }],
691 }), { kind: 'outcome', status: 200, outcome: 'commit' }),
692 {
693 name: 'squash',
694 method: 'POST',
695 path: '/v1/rebase',
696 body: () => ({ ref: 'squash', onto: 'main', committer: author(T + 920), squash: true, message: 'squashed' }),
697 expect: { kind: 'outcome', status: 200, outcome: 'squash' },
698 ray: 'required',
699 rayIncludes: 'receive-pack=',
700 },
701 write(TRACED_EDIT_STEP, () => ({
702 ref: 'squash',
703 message: 'traced',
704 author: author(T + 930),
705 path: 'sq1.txt',
706 find: '1',
707 replace: 'one',
708 }), { kind: 'outcome', status: 200, outcome: 'commit' }),
709 {
710 name: 'refs-final',
711 method: 'GET',
712 path: '/v1/refs',
713 expect: {
714 kind: 'refs-final',
715 has: ['refs/heads/main', 'refs/tags/v-ann'],
716 missing: ['refs/heads/tmp', 'refs/tags/v-light'],
717 head: 'refs/heads/main',
718 },
719 ray: 'required',
720 },
721 ]
724export function expectedStatus(step: HttpStep): number {
725 const expect = step.expect
726 if (
727 expect.kind === 'empty-commit'
728 || expect.kind === 'refs-empty'
729 || expect.kind === 'tree'
730 || expect.kind === 'parents'
731 || expect.kind === 'born'
732 || expect.kind === 'stamps'
733 || expect.kind === 'refs-final'
734 || expect.kind === 'flags-rules'
735 || expect.kind === 'flags-eval'
736 || expect.kind === 'usage-off'
737 ) return HTTP_OK
738 return expect.status
741/** Statuses a smoke request may log. flags-rules is 200 when the ruleset exists and 404 when it does not. */
742export function expectedStatuses(step: HttpStep): readonly number[] {
743 if (step.expect.kind === 'flags-rules') return [HTTP_OK, HTTP_NOT_FOUND]
744 return [expectedStatus(step)]
Diagnostics4 git calls · 735 ms
CallStatusSizeTime0735 ms
discover200152 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=4
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 · hit34 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=30
git.response.bytes=145
git.response.cache=HIT
git.response.duration_ms=30
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 KiB438 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=436
git.response.bytes=41349
git.response.cache=MISS
git.response.duration_ms=438
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
fetch2004.7 KiB263 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=263
git.response.bytes=4850
git.response.cache=MISS
git.response.duration_ms=263
git.fetch.wants=0d57191c1d4b8259cf8df8f56220f7bbba6cb516
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=4850
git.pkt.payload.max=4829
git.sideband.band1.bytes=4828
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
a5e23a12181be9de
Request
01843d80…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format