main
1// scripts/canary-verdict.mjs: the deploy telemetry gate's decision. Workers Observability loses ~1.4% of events, so an id
2// logged by no version is tolerated iff the smoke saw x-ply-version: <new> on it and at most max(2, 2%) of the phase's ids
3// are lost; an id logged by another version, or any bad event of <new>, always fails.
4import { test } from 'node:test';
5import assert from 'node:assert/strict';
6import { lossAllowance, parseRequests, verdict } from '../scripts/canary-verdict.mjs';
8const NEW = 'new-version', OLD = 'old-version';
9const healthy = { nonOk: 0, fivexx: 0, errorLogs: 0 };
10const reqs = (n, version = NEW) => Array.from({ length: n }, (_, i) => ({ id: `id${i}`, version, step: `read: step ${i}` }));
11// every id logged by NEW except those in `drop` (logged nowhere) and those in `other` (logged by OLD)
12const logs = (rs, drop = [], other = []) => new Map(rs.filter(r => !drop.includes(r.id)).map(r => [r.id, new Set([other.includes(r.id) ? OLD : NEW])]));
14test('all 119 matched: pass, no losses', () => {
15 const rs = reqs(119);
16 const v = verdict({ version: NEW, requests: rs, loggedBy: logs(rs), health: healthy });
17 assert.equal(v.pass, true);
18 assert.equal(v.matched, 119);
19 assert.equal(v.line, 'telemetry: 119/119 matched');
20});
22test('2 of 119 lost, smoke saw x-ply-version NEW on both: tolerated', () => {
23 const rs = reqs(119);
24 const v = verdict({ version: NEW, requests: rs, loggedBy: logs(rs, ['id3', 'id70']), health: healthy });
25 assert.equal(v.pass, true);
26 assert.deepEqual(v.lost.map(r => [r.id, r.step]), [['id3', 'read: step 3'], ['id70', 'read: step 70']]);
27 assert.equal(v.line, 'telemetry: 117/119 matched, 2 lost (tolerated)');
28});
30test('3 of 119 lost: over max(2, 2%) = 2, fails', () => {
31 const rs = reqs(119);
32 const v = verdict({ version: NEW, requests: rs, loggedBy: logs(rs, ['id1', 'id2', 'id3']), health: healthy });
33 assert.equal(lossAllowance(119), 2);
34 assert.equal(v.pass, false);
35 assert.equal(v.lost.length, 3);
36 assert.match(v.line, /3 lost \(NOT tolerated, allowance 2\).*FAIL/);
37});
39test('1 lost without the smoke recording x-ply-version NEW: fails', () => {
40 const rs = reqs(119);
41 rs[5] = { ...rs[5], version: null };
42 const v = verdict({ version: NEW, requests: rs, loggedBy: logs(rs, ['id5']), health: healthy });
43 assert.equal(v.pass, false);
44 assert.deepEqual(v.unconfirmed.map(r => r.id), ['id5']);
45 // a recorded answer from another version is no confirmation either
46 rs[5] = { ...rs[5], version: OLD };
47 assert.equal(verdict({ version: NEW, requests: rs, loggedBy: logs(rs, ['id5']), health: healthy }).pass, false);
48});
50test('1 logged by the old version: routing failure, fails even within the loss allowance', () => {
51 const rs = reqs(119);
52 const v = verdict({ version: NEW, requests: rs, loggedBy: logs(rs, [], ['id9']), health: healthy });
53 assert.equal(v.pass, false);
54 assert.deepEqual(v.otherVersion.map(r => [r.id, r.loggedBy]), [['id9', [OLD]]]);
55 assert.match(v.line, /1 other version/);
56});
58test('any non-ok invocation, 5xx or error log of NEW fails with every id matched', () => {
59 const rs = reqs(119);
60 for (const bad of [{ nonOk: 1 }, { fivexx: 1 }, { errorLogs: 1 }])
61 assert.equal(verdict({ version: NEW, requests: rs, loggedBy: logs(rs), health: { ...healthy, ...bad } }).pass, false);
62});
64test('allowance is max(2, floor(2%))', () => {
65 assert.deepEqual([10, 119, 150, 200, 1000].map(lossAllowance), [2, 2, 3, 4, 20]);
66});
68test('ids file: JSON lines with version + step; a bare id has no recorded version', () => {
69 assert.deepEqual(parseRequests('{"id":"a","version":"v","step":"gate: x"}\nb\n\n'), [
70 { id: 'a', version: 'v', step: 'gate: x' }, { id: 'b', version: null, step: '?' },
71 ]);
72});
Diagnostics4 git calls · 27 ms
CallStatusSizeTime027 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 · hit4 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=4 git.response.bytes=145 git.response.cache=HIT git.response.duration_ms=4 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 · 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=41349 git.response.cache=HIT git.response.duration_ms=3 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=61Open pack map
fetch2001.3 KiB · hit20 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=20 git.response.bytes=1369 git.response.cache=HIT git.response.duration_ms=20 git.fetch.wants=346364c9040e5415917128458516216605a9996c 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=1369 git.pkt.payload.max=1348 git.sideband.band1.bytes=1347 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
- a5e35ea43c435cd4
- Request
- e4b13266…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format