main
1// The telemetry gate's decision (scripts/canary-o11y.mjs), pure so it is unit-tested (test/canary-verdict.test.js).
2//
3// Workers Observability loses ~1.4% of events, in bursts: whole invocations (ply.request log, invocation event, sometimes
4// the trace) that are still absent 15 min later (≈12 of ~830 smoke requests, 2026-10-31; lab_notebook
5// ply-issues-2026-10-30.md). A strict "every smoke id logged by <version>" gate fails healthy deploys, so (CoS decision,
6// 2026-10-31) a smoke id is classified as:
7// matched logged by <version>.
8// otherVersion logged only by a different version: a routing failure. Always fails.
9// lost logged by no version, and the smoke recorded x-ply-version: <version> on its response. Tolerated while
10// at most max(2, 2%) of the phase's ids are lost; beyond that the gate fails.
11// unconfirmed logged by no version, and the smoke did not record <version> answering it. Always fails: nothing proves
12// which version ran it.
13// Any non-ok invocation, 5xx ply.request log or error log of <version> fails regardless.
15/** Lost ids a phase of `n` smoke requests may tolerate: max(2, 2% of n), rounded down. */
16export const lossAllowance = n => Math.max(2, Math.floor(n * 0.02));
18/**
19 * @param {object} a
20 * @param {string} a.version the version under test
21 * @param {{ id: string, version: string | null, step: string }[]} a.requests smoke requests: id, the x-ply-version the
22 * smoke saw on the response (null if unrecorded), and the smoke step
23 * @param {Map<string, Set<string>>} a.loggedBy id → every version that emitted a ply.request log line for it
24 * @param {{ nonOk: number, fivexx: number, errorLogs: number }} a.health bad events of `version` in the phase
25 */
26export function verdict({ version, requests, loggedBy, health }) {
27 const byId = new Map();
28 for (const r of requests) if (!byId.has(r.id) || (byId.get(r.id).version !== version && r.version === version)) byId.set(r.id, r);
29 const reqs = [...byId.values()];
30 const matched = [], otherVersion = [], lost = [], unconfirmed = [];
31 for (const r of reqs) {
32 const vs = loggedBy.get(r.id) ?? new Set();
33 if (vs.has(version)) matched.push(r);
34 else if (vs.size) otherVersion.push({ ...r, loggedBy: [...vs] });
35 else if (r.version === version) lost.push(r);
36 else unconfirmed.push(r);
37 }
38 const allowance = lossAllowance(reqs.length);
39 const reasons = [];
40 if (otherVersion.length) reasons.push(`${otherVersion.length} logged by another version`);
41 if (unconfirmed.length) reasons.push(`${unconfirmed.length} lost without x-ply-version ${version} recorded by the smoke`);
42 if (lost.length > allowance) reasons.push(`${lost.length} lost > allowance ${allowance}`);
43 if (health.nonOk) reasons.push(`${health.nonOk} non-ok invocations`);
44 if (health.fivexx) reasons.push(`${health.fivexx} 5xx`);
45 if (health.errorLogs) reasons.push(`${health.errorLogs} error logs`);
46 const pass = reasons.length === 0;
47 const parts = [`${matched.length}/${reqs.length} matched`];
48 if (lost.length) parts.push(`${lost.length} lost (${lost.length <= allowance ? 'tolerated' : `NOT tolerated, allowance ${allowance}`})`);
49 if (unconfirmed.length) parts.push(`${unconfirmed.length} lost unconfirmed`);
50 if (otherVersion.length) parts.push(`${otherVersion.length} other version`);
51 const line = `telemetry: ${parts.join(', ')}${pass ? '' : ` FAIL: ${reasons.join('; ')}`}`;
52 return { pass, total: reqs.length, matched: matched.length, allowance, lost, unconfirmed, otherVersion, reasons, line };
53}
55/**
56 * Smoke requests from an ids file (`npm run cd` smoke JSON): one JSON object { id, version, step } per line. A bare id line
57 * (the pre-2026-10-31 format) has no recorded version, so a loss of it is never tolerated.
58 */
59export function parseRequests(text) {
60 return text.split('\n').map(s => s.trim()).filter(Boolean).map(s => {
61 if (!s.startsWith('{')) return { id: s, version: null, step: '?' };
62 const o = JSON.parse(s);
63 return { id: String(o.id), version: o.version ?? null, step: String(o.step ?? '?') };
64 });
65}
Diagnostics4 git calls · 27 ms
CallStatusSizeTime027 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 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 · hit3 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=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.7 KiB · hit21 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=1721 git.response.cache=HIT git.response.duration_ms=21 git.fetch.wants=a91511437b6b256012d80f4d40593c25245fcae1 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=1721 git.pkt.payload.max=1700 git.sideband.band1.bytes=1699 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
- a5e346261b18f4d4
- Request
- 4a6da337…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format