@mark1russell7/kind 0.11.5 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as updatesOf, $t as Declaration, A as TriggerV1, An as nodeNames, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Cn as NODE_IMAGES, Ct as outcomesOf, D as PredictionV1, Dn as goDuration, Dt as requestsOf, E as LoadSample, En as cidrRange, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mn as scenarioProblems, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, On as kindConfig, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, Sn as KubeProxyMode, St as kernelCounts, T as KindVerdictV1, Tn as cidrOverlap, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as WindowPrediction, _t as dropOf, a as STAGES, an as MeshFlavor, at as RecordLine, b as FORMAT_V1, bn as KindConfig, bt as intakeOf, c as readRecord, cn as Prediction, ct as SliceLine, d as calibrationOf, dn as Replica, dt as TunnelLine, en as EdgeProtocol, et as Endpoint, f as cellsTable, fn as ResetReuse, ft as ZtunnelPodLine, g as BandV1, gn as TriggerKind, gt as deletionOf, h as timeSpread, hn as Trigger, ht as byNode, i as quantileOf, in as Mesh, it as PropagationSource, j as judge, jn as scenario, jt as signalOf, k as RunFactsV1, kn as kubeProxyPatch, kt as restartsAt, l as Judged, ln as RedisDeclaration, lt as SocketLine, m as predictionText, mn as Template, mt as byClients, n as medianInterval, nn as KindRun, nt as Line, o as kindCellRecordSchema, on as MeshMode, ot as Request, p as medianText, pn as Stack, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as KubeletProbe, rt as PodLine, s as kindCellRecordV1Schema, sn as PodSettings, st as RulesLine, t as RELATIVE, tn as KindCell, tt as HBONE_PORT, u as TimeSpread, un as Reference, ut as TCP_STATE, v as EnvironmentManifest, vn as Workload, vt as emptyOf, w as KindCellV1, wn as NodeImage, wt as podsAt, x as KindCellRecord, xn as KindScenario, xt as isTunnelState, y as FORMAT, yn as KUBE_PROXY_MODES, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-C2xZR_Tv.js";
1
+ import { $ as updatesOf, $t as Declaration, A as TriggerV1, An as nodeNames, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Cn as NODE_IMAGES, Ct as outcomesOf, D as PredictionV1, Dn as goDuration, Dt as requestsOf, E as LoadSample, En as cidrRange, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mn as scenarioProblems, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, On as kindConfig, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, Sn as KubeProxyMode, St as kernelCounts, T as KindVerdictV1, Tn as cidrOverlap, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as WindowPrediction, _t as dropOf, a as STAGES, an as MeshFlavor, at as RecordLine, b as FORMAT_V1, bn as KindConfig, bt as intakeOf, c as readRecord, cn as Prediction, ct as SliceLine, d as calibrationOf, dn as Replica, dt as TunnelLine, en as EdgeProtocol, et as Endpoint, f as cellsTable, fn as ResetReuse, ft as ZtunnelPodLine, g as BandV1, gn as TriggerKind, gt as deletionOf, h as timeSpread, hn as Trigger, ht as byNode, i as quantileOf, in as Mesh, it as PropagationSource, j as judge, jn as scenario, jt as signalOf, k as RunFactsV1, kn as kubeProxyPatch, kt as restartsAt, l as Judged, ln as RedisDeclaration, lt as SocketLine, m as predictionText, mn as Template, mt as byClients, n as medianInterval, nn as KindRun, nt as Line, o as kindCellRecordSchema, on as MeshMode, ot as Request, p as medianText, pn as Stack, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as KubeletProbe, rt as PodLine, s as kindCellRecordV1Schema, sn as PodSettings, st as RulesLine, t as RELATIVE, tn as KindCell, tt as HBONE_PORT, u as TimeSpread, un as Reference, ut as TCP_STATE, v as EnvironmentManifest, vn as Workload, vt as emptyOf, w as KindCellV1, wn as NodeImage, wt as podsAt, x as KindCellRecord, xn as KindScenario, xt as isTunnelState, y as FORMAT, yn as KUBE_PROXY_MODES, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-DnB9wEwC.js";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
3
  import { CheckFn, Finding, HealthServer, Poll, Rule, Scenario, ServiceBuilder, ServiceDescription, Stage, StopWay, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
4
4
  import { BuildImage } from "@mark1russell7/harness";
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as signalOf, A as medianInterval, B as emptyOf, C as propagationOf, D as unitOf, E as reusesReset, F as backendsAt, G as outcomesOf, H as intakeOf, I as byClients, J as recordsOf, K as podsAt, L as byNode, M as quantileOf, N as HBONE_PORT, O as updatesOf, P as TCP_STATE, Q as rulesOf, R as deletionOf, S as observationEnd, T as referenceOf, U as isTunnelState, V as failuresOf, W as kernelCounts, X as restartOf, Y as requestsOf, Z as restartsAt, _ as checkRun, _t as seconds, a as calibrationOf, at as stoppingOf, b as judgeKind, c as predictionText, ct as ztunnelPodsOf, d as FORMAT_V1, dt as HEALTH_PORT, et as signalsOf, f as judge, ft as LOG_LABEL, g as LAST_SLACK, gt as bandOf, h as KIND_NOISE, ht as SERVER, i as readRecord, it as socketsOf, j as middle, k as RELATIVE, l as timeSpread, lt as ztunnelReplaced, m as upgradeCell, mt as REDIS, n as kindCellRecordSchema, nt as sliceEmptyOf, o as cellsTable, ot as transitionOf, p as upgrade, pt as PORT, q as podsOf, r as kindCellRecordV1Schema, rt as slicesOf, s as medianText, st as tunnelsOf, t as STAGES, tt as sliceDropOf, u as FORMAT, ut as CLIENT, v as deletionsOf, vt as secondsOf, w as propagationSource, x as observationAfter, y as factsOf, yt as showBand, z as dropOf } from "./judge-Dw57nCkP.js";
1
+ import { $ as signalOf, A as medianInterval, B as emptyOf, C as propagationOf, D as unitOf, E as reusesReset, F as backendsAt, G as outcomesOf, H as intakeOf, I as byClients, J as recordsOf, K as podsAt, L as byNode, M as quantileOf, N as HBONE_PORT, O as updatesOf, P as TCP_STATE, Q as rulesOf, R as deletionOf, S as observationEnd, T as referenceOf, U as isTunnelState, V as failuresOf, W as kernelCounts, X as restartOf, Y as requestsOf, Z as restartsAt, _ as checkRun, _t as seconds, a as calibrationOf, at as stoppingOf, b as judgeKind, c as predictionText, ct as ztunnelPodsOf, d as FORMAT_V1, dt as HEALTH_PORT, et as signalsOf, f as judge, ft as LOG_LABEL, g as LAST_SLACK, gt as bandOf, h as KIND_NOISE, ht as SERVER, i as readRecord, it as socketsOf, j as middle, k as RELATIVE, l as timeSpread, lt as ztunnelReplaced, m as upgradeCell, mt as REDIS, n as kindCellRecordSchema, nt as sliceEmptyOf, o as cellsTable, ot as transitionOf, p as upgrade, pt as PORT, q as podsOf, r as kindCellRecordV1Schema, rt as slicesOf, s as medianText, st as tunnelsOf, t as STAGES, tt as sliceDropOf, u as FORMAT, ut as CLIENT, v as deletionsOf, vt as secondsOf, w as propagationSource, x as observationAfter, y as factsOf, yt as showBand, z as dropOf } from "./judge-Cs91dOGO.js";
2
2
  import { valueIn } from "@mark1russell7/quantity";
3
3
  import { execFile, execFileSync } from "node:child_process";
4
4
  import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -329,7 +329,7 @@ const deletionsOf = (run) => run.replicas.flatMap((replica) => {
329
329
  /** This function tells if a prediction is a window for each deleted replica. */
330
330
  const eachOf = (prediction) => prediction.kind === "window" && prediction.each === true;
331
331
  /** This function gives the window of the failed requests of a prediction: a window, the window of `ends`, or null. */
332
- const windowOf = (prediction) => prediction.kind === "window" ? prediction : prediction.kind === "ends" || prediction.kind === "leaves" ? prediction.window ?? null : null;
332
+ const windowOf = (prediction) => prediction.kind === "window" ? prediction : prediction.kind === "ends" || prediction.kind === "leaves" || prediction.kind === "removal" ? prediction.window ?? null : null;
333
333
  /**
334
334
  * This function gives how long a run observes after the end reference of its last window, or null
335
335
  * when its prediction sets no such time. The judge closes a window `end.band.hi` + δ after its end
@@ -563,10 +563,21 @@ const checkRun = (cell, run) => {
563
563
  hi: band.hi + .05
564
564
  })) problems.push(`the rules of ${node} had no backend at ${sec(drop.t - fault)} s`);
565
565
  }
566
- return done(problems.length === 0, problems.length === 0 ? `the Service was empty at ${value} s` : problems.join("; "), value, {
566
+ const inner = prediction.window === void 0 ? null : checkRun({
567
+ ...cell,
568
+ prediction: prediction.window
569
+ }, run);
570
+ if (inner !== null && !inner.ok) problems.push(inner.why);
571
+ const agrees = inner === null ? `the Service was empty at ${value} s` : `the Service was empty at ${value} s; ${inner.why}`;
572
+ const checked = done(problems.length === 0, problems.length === 0 ? agrees : problems.join("; "), value, {
573
+ ...inner === null ? {} : inner.facts,
567
574
  sliceEmpty: seconds(value),
568
575
  rules
569
576
  });
577
+ return inner?.tail === void 0 ? checked : {
578
+ ...checked,
579
+ tail: inner.tail
580
+ };
570
581
  }
571
582
  case "leaves": {
572
583
  const fault = run.acts.fault;
@@ -953,10 +964,7 @@ const upgradePrediction = (prediction) => {
953
964
  ...answer === void 0 ? {} : { answer: band(answer) }
954
965
  };
955
966
  }
956
- case "removal": return {
957
- ...prediction,
958
- band: band(prediction.band)
959
- };
967
+ case "removal":
960
968
  case "leaves": {
961
969
  const { window, ...rest } = prediction;
962
970
  return {
@@ -1067,7 +1075,7 @@ const predictionText = (prediction) => {
1067
1075
  switch (prediction.kind) {
1068
1076
  case "none": return prediction.outcomes === void 0 ? "no failure" : `no ${prediction.outcomes.join(", ")}`;
1069
1077
  case "window": return `failures only from ${atBand(prediction.start.from, prediction.start.band)}${prediction.end === null ? "" : ` to ${atBand(prediction.end.from, prediction.end.band)}`}${prediction.each === true ? ", of each deleted replica" : ""}${prediction.nodes === "paused" ? ", on the paused node" : ""}${prediction.certain ? ", at least one" : ""}${prediction.outcomes === void 0 ? "" : `, each one ${prediction.outcomes.join(" or ")}`}${prediction.afterReset === void 0 ? "" : `, or a ${prediction.afterReset.outcome} up to ${format(prediction.afterReset.life)} after a reset on its port`}${prediction.propagation === void 0 ? "" : `, the rules drop the replica in ${showBand(prediction.propagation)}`}`;
1070
- case "removal": return `Service empty in ${showBand(prediction.band)}`;
1078
+ case "removal": return `Service empty in ${showBand(prediction.band)}${prediction.window === void 0 ? "" : `; ${predictionText(prediction.window)}`}`;
1071
1079
  case "leaves": return `the replica leaves in ${showBand(prediction.band)}${prediction.window === void 0 ? "" : `; ${predictionText(prediction.window)}`}`;
1072
1080
  case "restarts": return prediction.band === null ? "no restart" : `each replica SIGTERM in ${showBand(prediction.band)}`;
1073
1081
  case "stays": return "stays ready, no refusal";
@@ -1365,6 +1373,7 @@ const recordOf = (a, main) => {
1365
1373
  z.object({
1366
1374
  kind: z.literal("removal"),
1367
1375
  band,
1376
+ window: window.optional(),
1368
1377
  why: z.string()
1369
1378
  }),
1370
1379
  z.object({
@@ -1549,4 +1558,4 @@ const readRecord = (data) => {
1549
1558
  //#endregion
1550
1559
  export { signalOf as $, medianInterval as A, emptyOf as B, propagationOf as C, unitOf as D, reusesReset as E, backendsAt as F, outcomesOf as G, intakeOf as H, byClients as I, recordsOf as J, podsAt as K, byNode as L, quantileOf as M, HBONE_PORT as N, updatesOf as O, TCP_STATE as P, rulesOf as Q, deletionOf as R, observationEnd as S, referenceOf as T, isTunnelState as U, failuresOf as V, kernelCounts as W, restartOf as X, requestsOf as Y, restartsAt as Z, checkRun as _, seconds as _t, calibrationOf as a, stoppingOf as at, judgeKind as b, predictionText as c, ztunnelPodsOf as ct, FORMAT_V1 as d, HEALTH_PORT as dt, signalsOf as et, judge as f, LOG_LABEL as ft, LAST_SLACK as g, bandOf as gt, KIND_NOISE as h, SERVER as ht, readRecord as i, socketsOf as it, middle as j, RELATIVE as k, timeSpread as l, ztunnelReplaced as lt, upgradeCell as m, REDIS as mt, kindCellRecordSchema as n, sliceEmptyOf as nt, cellsTable as o, transitionOf as ot, upgrade as p, PORT as pt, podsOf as q, kindCellRecordV1Schema as r, slicesOf as rt, medianText as s, tunnelsOf as st, STAGES as t, sliceDropOf as tt, FORMAT as u, CLIENT as ut, deletionsOf as v, secondsOf as vt, propagationSource as w, observationAfter as x, factsOf as y, showBand as yt, dropOf as z };
1551
1560
 
1552
- //# sourceMappingURL=judge-Dw57nCkP.js.map
1561
+ //# sourceMappingURL=judge-Cs91dOGO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judge-Cs91dOGO.js","names":["time","time"],"sources":["../src/bands.ts","../src/names.ts","../src/observe.ts","../src/stats.ts","../src/verdict.ts","../src/record.ts","../src/report.ts","../src/schema.ts"],"sourcesContent":["import type { Quantity } from \"@mark1russell7/quantity\";\nimport { valueIn } from \"@mark1russell7/quantity\";\nimport type { Band } from \"./cell.ts\";\n\n/** This module makes and prints the bands of the predictions. It imports only the amounts. */\n\n/** This function gives a time in seconds as a quantity. */\nexport const seconds = (value: number): Quantity => ({ value, unit: \"s\" });\n\n/** This function gives a band from its two ends in seconds. */\nexport const bandOf = (lo: number, hi: number): Band => ({ lo: seconds(lo), hi: seconds(hi) });\n\n/** This function gives the two ends of a band as numbers of seconds, for arithmetic. */\nexport const secondsOf = (band: Band): { readonly lo: number; readonly hi: number } => ({\n lo: valueIn(band.lo, \"s\"),\n hi: valueIn(band.hi, \"s\"),\n});\n\n/** This function gives a band in a short form for a name or a table: `[28, 49] s`. */\nexport const showBand = (band: Band): string => {\n const { lo, hi } = secondsOf(band);\n return `[${lo}, ${hi}] s`;\n};\n","// The names and the ports of the objects of a cell. The judge reads them, thus this module imports\n// nothing.\n\n/** These are the ports of the app: its server, and its health server for the probes. */\nexport const PORT = 8080;\nexport const HEALTH_PORT = 9000;\n/** This label makes the watcher follow the log of a pod. */\nexport const LOG_LABEL = \"lab.systems/log\";\n/** These are the names of the objects of a cell. */\nexport const SERVER = \"lab\";\nexport const CLIENT = \"client\";\nexport const REDIS = \"redis\";\n","/**\n * This module reads a run from its lines. Each time is in milliseconds on CLOCK_MONOTONIC. All the\n * containers of the VM share that clock: the clients, the service, the agents, the injector, the\n * watcher and the prober.\n */\n\n/**\n * A line is one JSON line of a source of a run, with its stamp `t` in milliseconds on\n * CLOCK_MONOTONIC. It is a request of a client, a record of the service, a line of grpc-go or a probe answer. It is\n * also a pod, an EndpointSlice or an event of the API. Or it is the backends of the rules of a\n * node, a kernel record, or an act of the lab. A record keeps each line as its source wrote it.\n */\nexport interface Line {\n readonly ev: string;\n readonly t: number;\n readonly [field: string]: unknown;\n}\n\n/**\n * A request is one request of a client: its start, its duration in ms, its outcome, its client and\n * the node of the client. The backend (`b`) is the pod that answered. The local port (`lp`) is on\n * each request from 0.1.3, and on the failed ones before it. A conntrack entry is per port, thus the\n * requests on one port show which connection a stale entry came from.\n */\nexport interface Request {\n readonly t: number;\n readonly d: number;\n readonly o: string;\n readonly p: string;\n readonly n: string;\n readonly b?: string;\n readonly lp?: number | null;\n}\n\n/** A pod line is one state of a pod, as the watcher received it. */\nexport interface PodLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly node: string | null;\n readonly ip: string | null;\n readonly del: boolean;\n readonly ready: boolean;\n readonly phase: string | null;\n readonly cs: ReadonlyArray<{ readonly n: string; readonly r: boolean; readonly rc: number; readonly st: string; readonly id: string | null }>;\n readonly labels: Readonly<Record<string, string>>;\n}\n\n/** An endpoint is one endpoint of an EndpointSlice: its address, its conditions and its pod. */\nexport interface Endpoint {\n readonly ip: string | null;\n readonly r: boolean | null;\n readonly s: boolean | null;\n readonly x: boolean | null;\n readonly pod: string | null;\n readonly node: string | null;\n}\n\n/** A slice line is one state of an EndpointSlice. */\nexport interface SliceLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly svc: string | null;\n readonly eps: readonly Endpoint[];\n}\n\n/**\n * A rules line is the backends of the Service in the rules of one node, after a change. `prev` is the\n * start of the poll before it. An EDS line has the same fields (`ev` is `eds`). It gives the healthy\n * hosts of the server cluster in the Envoy of the client sidecar on the node.\n */\nexport interface RulesLine {\n readonly t: number;\n readonly prev: number | null;\n readonly node: string;\n readonly b: readonly string[];\n}\n\n/**\n * A propagation source is the poll whose lines give the backends of each node:\n * - `rules`: the rules of kube-proxy in the namespaces of the node.\n * - `eds`: the hosts of the server cluster in the Envoy of the client sidecar on the node. In a sidecar\n * mesh, the client sidecar picks the backend of each call, thus kube-proxy is not on the path.\n */\nexport type PropagationSource = \"rules\" | \"eds\";\n\n/** A record line is one transition of a machine of the service, with its own stamp `at`. */\nexport interface RecordLine {\n readonly t: number;\n readonly at: number;\n readonly p: string;\n readonly m: string;\n readonly i: string;\n readonly from: string;\n readonly to: string;\n readonly on: string;\n readonly d: string | null;\n}\n\n/**\n * A socket line is the connect or the close of a socket of the channel of a gRPC client\n * (`client-lines.ts`). It gives the client (`p`) and its node (`n`), and the local port of the socket.\n * A close also gives the code of an error of the socket (`err`), or null for a close with no error.\n */\nexport interface SocketLine {\n readonly t: number;\n readonly what: \"connect\" | \"close\";\n readonly p: string;\n readonly n: string;\n readonly lp: number | null;\n readonly err?: string | null;\n /** This address is the local address of the socket at its connect: the address of the client pod. Lines before 0.8.0 do not have it. */\n readonly la?: string | null;\n}\n\n/** This port is the HBONE port of ztunnel in each pod of the ambient mesh of Istio 1.31.3: the mesh leg ends there. */\nexport const HBONE_PORT = 15008;\n\n/** These are the states of a TCP socket of Linux that a tunnel line names (include/net/tcp_states.h of Linux v6.17, lines 12–28). */\nexport const TCP_STATE = { established: 1, finWait1: 4, closeWait: 8 } as const;\n\n/**\n * A tunnel line is a change of the state of a TCP socket with the HBONE port at one end, from the\n * prober (`kernel.state`). `src` and `dst` are each an address and a port, `a.b.c.d:port`. The stamp\n * `t` is in ms on CLOCK_MONOTONIC.\n */\nexport interface TunnelLine {\n readonly t: number;\n readonly src: string;\n readonly dst: string;\n readonly old: number;\n readonly new: number;\n}\n\n/** This function tells if a kernel record is a change of the state of a socket of the HBONE port. */\nexport const isTunnelState = (record: Readonly<Record<string, unknown>>): boolean =>\n record[\"ev\"] === \"state\" && [record[\"src\"], record[\"dst\"]].some((end) => typeof end === \"string\" && end.endsWith(`:${HBONE_PORT}`));\n\n/** This function gives the tunnel lines of a run, in sequence of their stamps. */\nexport const tunnelsOf = (lines: readonly Line[]): TunnelLine[] =>\n lines.filter((line) => line.ev === \"kernel.state\").map((line) => line as unknown as TunnelLine).sort((a, b) => a.t - b.t);\n\nconst of = <T>(lines: readonly Line[], ev: string): T[] => lines.filter((line) => line.ev === ev) as unknown as T[];\n\nexport const requestsOf = (lines: readonly Line[]): Request[] => of<Request>(lines, \"req\");\nexport const podsOf = (lines: readonly Line[]): PodLine[] => of<PodLine>(lines, \"pod\").sort((a, b) => a.t - b.t);\nexport const slicesOf = (lines: readonly Line[], svc: string): SliceLine[] =>\n of<SliceLine>(lines, \"slice\").filter((line) => line.svc === svc);\nexport const rulesOf = (lines: readonly Line[], source: PropagationSource = \"rules\"): RulesLine[] =>\n of<RulesLine>(lines, source).sort((a, b) => a.t - b.t);\nexport const recordsOf = (lines: readonly Line[]): RecordLine[] => of<RecordLine>(lines, \"rec\");\nexport const socketsOf = (lines: readonly Line[]): SocketLine[] => of<SocketLine>(lines, \"sock\").sort((a, b) => a.t - b.t);\n\n/** This function gives the requests that did not succeed, in sequence of their start. */\nexport const failuresOf = (lines: readonly Line[]): Request[] =>\n requestsOf(lines)\n .filter((request) => request.o !== \"ok\")\n .sort((a, b) => a.t - b.t);\n\n/** This function counts the outcomes of the requests, by outcome. */\nexport const outcomesOf = (requests: readonly Request[]): Record<string, number> => {\n const out: Record<string, number> = {};\n for (const request of requests) out[request.o] = (out[request.o] ?? 0) + 1;\n return out;\n};\n\n/**\n * This function orders the replicas by how many clients each one answered last, the most first,\n * then by name. `answers` gives the backend of the last answer of each client, by client. A client\n * of gRPC holds its connection to one replica, thus the first replica is the one whose stop the\n * most clients see.\n */\nexport const byClients = <T extends { readonly pod: string }>(replicas: readonly T[], answers: ReadonlyMap<string, string>): T[] => {\n const count = (pod: string): number => [...answers.values()].filter((backend) => backend === pod).length;\n return [...replicas].sort((a, b) => count(b.pod) - count(a.pod) || a.pod.localeCompare(b.pod));\n};\n\n/** This function gives the requests of each node, by the name of the node. */\nexport const byNode = (requests: readonly Request[]): Map<string, Request[]> => {\n const out = new Map<string, Request[]>();\n for (const request of requests) out.set(request.n, [...(out.get(request.n) ?? []), request]);\n return out;\n};\n\n/** This function gives the time that the watcher first received a deletion timestamp of one of the pods, after a time. */\nexport const deletionOf = (lines: readonly Line[], pods: readonly string[], after: number): number | null =>\n podsOf(lines).find((pod) => pods.includes(pod.name) && pod.del && pod.t >= after)?.t ?? null;\n\n/**\n * A ztunnel pod line is an event of a ztunnel pod in istio-system, from the watcher (`image/watch.mjs`).\n * Its `type` is the type of the event of the API, and `cs` gives the readiness of each container (`r`).\n */\nexport interface ZtunnelPodLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly node: string | null;\n readonly del: boolean;\n readonly cs: ReadonlyArray<{ readonly r: boolean }>;\n}\n\nexport const ztunnelPodsOf = (lines: readonly Line[]): ZtunnelPodLine[] => of<ZtunnelPodLine>(lines, \"ztunnel-pod\").sort((a, b) => a.t - b.t);\n\n/** This function gives the time that the watcher first received a deletion timestamp of a ztunnel pod, after a time: the reference `restart`. */\nexport const restartOf = (lines: readonly Line[], after: number): number | null => ztunnelPodsOf(lines).find((pod) => pod.del && pod.t >= after)?.t ?? null;\n\n/**\n * This function tells if a restart of ztunnel is over. Each ztunnel pod that got a deletion in the\n * lines is gone. Each node has a ready ztunnel pod with no deletion. It is false when no ztunnel pod\n * got a deletion.\n */\nexport const ztunnelReplaced = (lines: readonly Line[], nodes: readonly string[]): boolean => {\n const last = new Map<string, ZtunnelPodLine>();\n for (const pod of ztunnelPodsOf(lines)) last.set(pod.name, pod);\n const deleted = [...last.values()].filter((pod) => pod.del || pod.type === \"DELETED\");\n if (deleted.length === 0 || deleted.some((pod) => pod.type !== \"DELETED\")) return false;\n const ready = new Set(\n [...last.values()].filter((pod) => !pod.del && pod.type !== \"DELETED\" && pod.cs.length > 0 && pod.cs.every((status) => status.r)).map((pod) => pod.node),\n );\n return nodes.every((node) => ready.has(node));\n};\n\n/** This function gives the stamp of a transition of the service in a pod: the first matching record of a machine, after a time. */\nexport const transitionOf = (\n lines: readonly Line[],\n pod: string,\n machine: string,\n match: (record: RecordLine) => boolean,\n after: number,\n): number | null =>\n recordsOf(lines).find((record) => record.p === pod && record.m === machine && record.at >= after && match(record))?.at ?? null;\n\n/**\n * This function gives the line `stopping` of grpc-go in a pod, after a time. The server writes it at\n * SIGTERM. Then GracefulStop closes its listener and sends GOAWAY on each connection.\n */\nexport const stoppingOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n lines.find((line) => line.ev === \"stopping\" && line[\"p\"] === pod && line.t >= after)?.t ?? null;\n\n/**\n * This function gives when the server of a pod stopped its intake. That is the start of the phase\n * `stop intake` of the service, or the line `stopping` of grpc-go.\n */\nexport const intakeOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n transitionOf(lines, pod, \"drain\", (record) => record.to === \"stop intake\", after) ?? stoppingOf(lines, pod, after);\n\n/** This function gives when the server of a pod received its exit signal: a record of the service, or the line `stopping` of grpc-go. */\nexport const signalOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n transitionOf(lines, pod, \"exit\", (record) => record.on === \"exit.request\", after) ?? stoppingOf(lines, pod, after);\n\n/**\n * This function gives when the rules of a node stopped the selection of a backend: the first poll\n * after a time without it. The change came after `prev`, the poll before it, and at the latest at `t`.\n * The source `eds` gives the same for the client sidecar of the node.\n */\nexport const dropOf = (lines: readonly Line[], node: string, backend: string, after: number, source: PropagationSource = \"rules\"): RulesLine | null =>\n rulesOf(lines, source).find((line) => line.node === node && line.t >= after && !line.b.includes(backend)) ?? null;\n\n/** This function gives when the rules of a node had no backend of the Service, after a time. */\nexport const emptyOf = (lines: readonly Line[], node: string, after: number): RulesLine | null =>\n rulesOf(lines).find((line) => line.node === node && line.t >= after && line.b.length === 0) ?? null;\n\n/** This function gives when an EndpointSlice of the Service first had no ready endpoint, after a time. */\nexport const sliceEmptyOf = (lines: readonly Line[], svc: string, after: number): number | null =>\n slicesOf(lines, svc).find((slice) => slice.t >= after && !slice.eps.some((endpoint) => endpoint.r === true))?.t ?? null;\n\n/** This function gives when the endpoint of an address was first not ready in the EndpointSlice of the Service, after a time. */\nexport const sliceDropOf = (lines: readonly Line[], svc: string, ip: string, after: number): number | null =>\n slicesOf(lines, svc).find((slice) => slice.t >= after && !slice.eps.some((endpoint) => endpoint.ip === ip && endpoint.r === true))?.t ?? null;\n\n/** This function gives the latest state of each pod at a time, by its name. A deleted pod is not in it. */\nexport const podsAt = (lines: readonly Line[], at: number): Map<string, PodLine> => {\n const out = new Map<string, PodLine>();\n for (const pod of podsOf(lines)) {\n if (pod.t > at) break;\n if (pod.type === \"DELETED\") out.delete(pod.name);\n else out.set(pod.name, pod);\n }\n return out;\n};\n\n/** This function gives the latest backends of each node at a time, by node. */\nexport const backendsAt = (lines: readonly Line[], at: number): Map<string, readonly string[]> => {\n const out = new Map<string, readonly string[]>();\n for (const line of rulesOf(lines)) {\n if (line.t > at) break;\n out.set(line.node, line.b);\n }\n return out;\n};\n\n/** This function gives the kernel records of the kinds that the lab keeps, counted by kind. */\nexport const kernelCounts = (lines: readonly Line[]): Record<string, number> => {\n const out: Record<string, number> = {};\n for (const line of lines) if (line.ev.startsWith(\"kernel.\")) out[line.ev.slice(7)] = (out[line.ev.slice(7)] ?? 0) + 1;\n return out;\n};\n\n/** This function gives the SIGTERM of each pod in a set after a time, by pod. A pod without one is not in it. */\nexport const signalsOf = (lines: readonly Line[], pods: readonly string[], after: number): Map<string, number> => {\n const out = new Map<string, number>();\n for (const pod of pods) {\n const at = signalOf(lines, pod, after);\n if (at !== null) out.set(pod, at);\n }\n return out;\n};\n\n/** This function gives the restart count of each container of each pod at a time, summed by pod. */\nexport const restartsAt = (lines: readonly Line[], at: number): Map<string, number> => {\n const out = new Map<string, number>();\n for (const [name, pod] of podsAt(lines, at)) out.set(name, pod.cs.reduce((sum, status) => sum + status.rc, 0));\n return out;\n};\n","// The statistics of a kind verdict: the median, the interval of the median and a quantile. They are\n// the statistics of the verdict of the harness, and a test holds them to it. The judge reads a\n// record without the harness, because the harness loads its Docker lab.\n\n/** This fraction, δ_rel, is how far the median of a cell can be outside its band and stay equivalent. */\nexport const RELATIVE = 0.05;\n\n/** This function gives the median of sorted values: the middle value, or the mean of the two middle values. */\nexport const middle = (sorted: readonly number[]): number => {\n const half = Math.floor(sorted.length / 2);\n return sorted.length % 2 === 1 ? sorted[half]! : (sorted[half - 1]! + sorted[half]!) / 2;\n};\n\n/** This function gives the value at quantile p of sorted values, by nearest rank: x_(⌈p·n⌉). */\nexport const quantileOf = (sorted: readonly number[], p: number): number =>\n sorted[Math.min(sorted.length, Math.max(1, Math.ceil(p * sorted.length))) - 1]!;\n\n/** This function gives P(X ≤ j) for X ~ Binomial(n, 1/2), exactly. */\nconst below = (n: number, j: number): number => {\n let term = 1;\n let sum = 0;\n for (let i = 0; i <= j; i += 1) {\n sum += term;\n term = (term * (n - i)) / (i + 1);\n }\n return sum / 2 ** n;\n};\n\n/**\n * This function gives the distribution-free interval of a median: [x_(k), x_(n+1−k)], for the\n * largest k whose two tails each hold 2.5 % or less. For eleven runs, it gives [x_(2), x_(10)],\n * at 98.8 %.\n */\nexport const medianInterval = (sorted: readonly number[]): [number, number] => {\n const n = sorted.length;\n let k = 0;\n while (k + 1 <= n / 2 && below(n, k) <= 0.025) k += 1;\n return k === 0 ? [sorted[0]!, sorted[n - 1]!] : [sorted[k - 1]!, sorted[n - k]!];\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { valueIn } from \"@mark1russell7/quantity\";\nimport { seconds, secondsOf } from \"./bands.ts\";\nimport type { KindCell, KindRun, Prediction, Reference, ResetReuse, WindowPrediction } from \"./cell.ts\";\nimport { PORT, SERVER } from \"./names.ts\";\nimport type { Line, PropagationSource, Request } from \"./observe.ts\";\nimport {\n HBONE_PORT,\n TCP_STATE,\n byNode,\n deletionOf,\n dropOf,\n emptyOf,\n failuresOf,\n intakeOf,\n outcomesOf,\n podsOf,\n requestsOf,\n restartOf,\n signalsOf,\n sliceDropOf,\n sliceEmptyOf,\n socketsOf,\n tunnelsOf,\n} from \"./observe.ts\";\nimport { RELATIVE, medianInterval, middle } from \"./stats.ts\";\n\n/**\n * This time is δ for kind: each time of a run lands in its band ± δ. Its parts are the interval of\n * the poll of the rules (50 ms) and the delay of the watcher. The watcher receives each change after\n * the API server writes it.\n */\nexport const KIND_NOISE: Quantity = { value: 100, unit: \"ms\" };\n/**\n * This time is how much earlier than the end of its window the last failed request can start. A\n * request goes to the closed pod by the choice of the rules, thus the last ones before the end can\n * go to another pod. At 50 requests a second and two pods, 12 requests in sequence miss the closed\n * pod with a chance of 1 in 4096.\n */\nexport const LAST_SLACK: Quantity = { value: 250, unit: \"ms\" };\n\n/** These are δ and the slack in milliseconds, the unit of the stamps. */\nconst NOISE = valueIn(KIND_NOISE, \"ms\");\nconst SLACK = valueIn(LAST_SLACK, \"ms\");\n\n/** A propagated change is when the rules of a node first had it: after the poll `after`, and by the poll `by`. */\nexport interface Propagated<A = Quantity> {\n readonly after: A | null;\n readonly by: A;\n}\n\n/**\n * The facts of a run are what each table reads: its failures by outcome and node, and the times of\n * its target. A count stays a number, and so does a stamp: `first`, `last` and `deletion` are\n * readings of CLOCK_MONOTONIC in milliseconds. Each other time is an amount after a reference. The\n * parameter `A` is the form of an amount: a quantity in the format `/2`, seconds in the format `/1`.\n */\nexport interface RunFacts<A = Quantity> {\n readonly failures: number;\n readonly outcomes: Readonly<Record<string, number>>;\n readonly byNode: Readonly<Record<string, number>>;\n readonly first: number | null;\n readonly last: number | null;\n readonly deletion: number | null;\n readonly intakeAfterDeletion: A | null;\n readonly sliceAfter: A | null;\n /** This record is the propagation of the target to the rules of each node, by node. */\n readonly propagation: Readonly<Record<string, Propagated<A> | null>>;\n /** This time is when the EndpointSlice had no ready endpoint, after the fault (`removal`). */\n readonly sliceEmpty?: A | undefined;\n /** These times are when the rules of each node had no backend, after the fault (`removal`). */\n readonly rules?: Readonly<Record<string, A | null>> | undefined;\n /** This time is when the target left the EndpointSlice, after the fault (`leaves`). */\n readonly left?: A | undefined;\n /** These times are the SIGTERM of each replica, after the fault (`restarts`). */\n readonly signals?: ReadonlyArray<A | null> | undefined;\n /**\n * These are the replicas of a window for each deleted replica (`each`). Each one is a replica of the\n * run with a deletion after its start, with the stamps of its intake and of its deletion.\n */\n readonly deletions?: readonly Deleted[] | undefined;\n /** These are the first LDS updates of the sidecar of each server pod after the fault, by pod (`updatesOf`). */\n readonly updates?: Readonly<Record<string, Propagated<A> | null>> | undefined;\n /** These are the first LDS updates of the sidecar of each server pod after the heal, by pod. */\n readonly healUpdates?: Readonly<Record<string, Propagated<A> | null>> | undefined;\n /** These are the first close of the socket of each client after the reference (`ends`), by client, or null for none. */\n readonly closes?: Readonly<Record<string, A | null>> | undefined;\n}\n\n/** A deleted replica is a replica of a run that got a deletion. It gives its pod, and the stamps of its intake (or null) and of its deletion. */\nexport interface Deleted {\n readonly pod: string;\n readonly intake: number | null;\n readonly deletion: number;\n}\n\n/**\n * A run check is the judgement of one run: if it agrees with the prediction, why, its main value,\n * and its facts. The main value is a time, or a count of requests or of replicas (`unitOf`).\n */\nexport interface RunCheck<A = Quantity> {\n readonly ok: boolean;\n readonly why: string;\n readonly value: A | null;\n readonly facts: RunFacts<A>;\n /**\n * This text tells why a run that agrees with the law is past its calibrated band. A request failed\n * after the window, but before the rules of its node dropped the target. Such a run makes its cell\n * `extend`, and the cell does not hold (D-EXTEND).\n */\n readonly tail?: string | undefined;\n}\n\n/** A kind decision is the result of a kind cell. */\nexport type KindDecision = \"holds\" | \"fails\" | \"extend\" | \"measured\" | \"calibration\" | \"void\";\n\n/** A kind verdict is the judgement of a cell on its counted runs. */\nexport interface KindVerdict<A = Quantity> {\n readonly decision: KindDecision;\n readonly counted: number;\n readonly voided: number;\n readonly failed: number;\n /** This amount is the median of the main value of the counted runs, or null. */\n readonly median: A | null;\n readonly why: string;\n readonly checks: ReadonlyArray<RunCheck<A>>;\n}\n\n/**\n * This function gives the unit of the main value of a cell, from its prediction:\n * - `s` for a time: the removal, the departure or the restart of a band, the end of a stall, or a close.\n * - `{request}` for the failed requests: no failure, a window, a fleet that stays, and a measurement.\n * - `{replica}` for the replicas that received SIGTERM, when no replica must restart.\n * - `{socket}` for the sockets of the clients that ended, when no socket must end.\n */\nexport const unitOf = (prediction: { readonly kind: Prediction[\"kind\"]; readonly band?: unknown }): string => {\n switch (prediction.kind) {\n case \"removal\":\n case \"leaves\":\n case \"stalls\":\n return \"s\";\n case \"restarts\":\n return prediction.band === null ? \"{replica}\" : \"s\";\n case \"ends\":\n return prediction.band === null ? \"{socket}\" : \"s\";\n default:\n return \"{request}\";\n }\n};\n\nconst sec = (ms: number): number => Math.round(ms) / 1000;\nconst inBand = (value: number, band: { readonly lo: number; readonly hi: number }): boolean =>\n value >= band.lo - NOISE / 1000 && value <= band.hi + NOISE / 1000;\nconst time = (value: number | null): Quantity | null => (value === null ? null : seconds(value));\n\n/**\n * This function tells if a failed request is the reuse of a port that a reset closed. The same\n * client had a reset on the same port, up to `life` before the request. The request ends with\n * `outcome`.\n */\nexport const reusesReset = (request: Request, requests: readonly Request[], reuse: ResetReuse): boolean => {\n if (request.o !== reuse.outcome || request.lp === undefined || request.lp === null) return false;\n const life = valueIn(reuse.life, \"ms\") + NOISE;\n return requests.some(\n (earlier) =>\n earlier.o === \"reset\" &&\n earlier.p === request.p &&\n earlier.lp === request.lp &&\n earlier.t + earlier.d <= request.t &&\n request.t - (earlier.t + earlier.d) <= life,\n );\n};\n\n/**\n * This function gives a reference event of a run, as a stamp, or null when the run does not have it.\n * The references `deletion` and `intake` are those of the target, or of the replica `pod`.\n */\nexport const referenceOf = (run: Pick<KindRun, \"start\" | \"acts\" | \"target\" | \"lines\">, from: Reference, pod: string | undefined = run.target?.pod): number | null => {\n const lines = run.lines as readonly Line[];\n if (from === \"fault\") return run.acts.fault;\n if (from === \"resume\") return run.acts.resume;\n if (from === \"heal\") return run.acts.heal;\n if (from === \"restart\") return restartOf(lines, run.start);\n if (pod === undefined) return null;\n if (from === \"deletion\") return deletionOf(lines, [pod], run.start);\n return intakeOf(lines, pod, run.start);\n};\n\n/**\n * This function gives the source of the propagation of a cell. In a sidecar mesh, the client sidecar\n * picks the backend of each call from its endpoints (EDS), thus the source is `eds`. Each other cell\n * goes through the rules of kube-proxy (`rules`).\n */\nexport const propagationSource = (cell: Pick<KindCell, \"mesh\">): PropagationSource => (cell.mesh?.mode === \"sidecar\" ? \"eds\" : \"rules\");\n\n/**\n * This function gives the propagation of each node for the target of a run, or for the replica of\n * the address `ip`. It is the time from its deletion (or its crash) to the first poll of the rules\n * of the node without it. The change came between the poll before (`after`) and that poll (`by`).\n * The source `eds` gives the poll of the client sidecar of each node.\n */\nexport const propagationOf = (\n run: KindRun,\n from: number | null,\n ip: string | undefined = run.target?.ip,\n source: PropagationSource = \"rules\",\n): Record<string, Propagated | null> => {\n const out: Record<string, Propagated | null> = {};\n if (ip === undefined || from === null) return out;\n const nodes = [...new Set((run.lines as readonly Line[]).filter((line) => line.ev === source).map((line) => String(line[\"node\"])))].sort();\n for (const node of nodes) {\n const drop = dropOf(run.lines as readonly Line[], node, `${ip}:${PORT}`, from, source);\n out[node] = drop === null ? null : { after: drop.prev === null ? null : seconds(sec(Math.max(0, drop.prev - from))), by: seconds(sec(drop.t - from)) };\n }\n return out;\n};\n\n/**\n * This function gives the first LDS update of the sidecar of each server pod after the stamp `from`.\n * The update came between the poll before (`after`) and the poll that saw it (`by`), after `from`.\n * A poller gives a line at each change of its counters. Thus a line after `from` with a poll before\n * it is an update, when its count `mod` is above the count before `from`. The first line of a poller\n * has no poll before it (`prev` is null), and it is no update.\n */\nexport const updatesOf = (run: Pick<KindRun, \"lines\">, from: number | null): Record<string, Propagated | null> => {\n const out: Record<string, Propagated | null> = {};\n if (from === null) return out;\n const lines = (run.lines as readonly Line[]).filter((line) => line.ev === \"lds\");\n for (const pod of [...new Set(lines.map((line) => String(line[\"pod\"])))].sort()) {\n const own = lines.filter((line) => String(line[\"pod\"]) === pod);\n const before = own.filter((line) => line.t <= from).at(-1);\n const base = before === undefined ? null : Number(before[\"mod\"]);\n const update = own.find((line) => line.t > from && typeof line[\"prev\"] === \"number\" && (base === null || Number(line[\"mod\"]) > base));\n const prev = update === undefined ? null : (update[\"prev\"] as number);\n out[pod] = update === undefined ? null : { after: seconds(sec(Math.max(0, prev! - from))), by: seconds(sec(update.t - from)) };\n }\n return out;\n};\n\n/** This function tells if the judge reads the LDS updates of a cell: the trigger is a policy of Istio. */\nconst listens = (cell: Pick<KindCell, \"trigger\">): boolean => cell.trigger.kind === \"authorization-policy\";\n\n/**\n * This function gives each replica of a run that got a deletion after the start of the run, in the\n * sequence of the deletions. A rolling update deletes each old replica in turn.\n */\nexport const deletionsOf = (run: KindRun): Deleted[] =>\n run.replicas\n .flatMap((replica) => {\n const deletion = referenceOf(run, \"deletion\", replica.pod);\n return deletion === null ? [] : [{ pod: replica.pod, intake: referenceOf(run, \"intake\", replica.pod), deletion }];\n })\n .sort((a, b) => a.deletion - b.deletion);\n\n/** This function tells if a prediction is a window for each deleted replica. */\nconst eachOf = (prediction: Prediction): boolean => prediction.kind === \"window\" && prediction.each === true;\n\n/**\n * A span is one window of a run, as stamps. It gives the replica of its references (or none), and its\n * two references. It also gives its ends with δ, and the deletion of its replica (`origin`). Then it\n * gives the propagation of that deletion to each node, and when the rules of a node dropped its replica.\n */\ninterface Span {\n readonly pod: string | undefined;\n readonly start: number;\n readonly end: number | null;\n readonly lo: number;\n readonly hi: number;\n readonly origin: number | null;\n readonly propagation: RunFacts[\"propagation\"];\n readonly dropped: (node: string) => number | null;\n}\n\n/** This function gives the window of the failed requests of a prediction: a window, the window of `ends`, or null. */\nconst windowOf = (prediction: Prediction): WindowPrediction | null =>\n prediction.kind === \"window\" ? prediction : prediction.kind === \"ends\" || prediction.kind === \"leaves\" || prediction.kind === \"removal\" ? (prediction.window ?? null) : null;\n\n/**\n * This function gives how long a run observes after the end reference of its last window, or null\n * when its prediction sets no such time. The judge closes a window `end.band.hi` + δ after its end\n * reference. A request that starts by then ends at most the timeout of the workload later: the\n * client cancels it then. A prediction with no window, or a window with no end, sets none.\n */\nexport const observationAfter = (cell: Pick<KindCell, \"prediction\" | \"workload\">): Quantity | null => {\n const window = windowOf(cell.prediction);\n if (window === null || window.end === null) return null;\n return seconds(sec(valueIn(window.end.band.hi, \"ms\") + valueIn(cell.workload.timeout, \"ms\") + NOISE));\n};\n\n/**\n * This function gives the earliest end of the observation of a run, as a stamp, or null when its\n * prediction sets none (`observationAfter`). It is that time after the latest end reference of a\n * window: of the target, or with `each`, of each replica that got a deletion. A run that ends before\n * it can miss its own failures. In a rolling update of gRPC, a call waits in the queue of its channel\n * for a stalled connect. It fails only at its timeout (kind run 40128267098). A reference that is not\n * in the lines yet does not count.\n *\n * The band of `ends` also sets an end: its reference, the end of the band and δ.\n */\nexport const observationEnd = (cell: KindCell, run: Pick<KindRun, \"start\" | \"acts\" | \"target\" | \"replicas\" | \"lines\">): number | null => {\n const ends: number[] = [];\n const prediction = cell.prediction;\n if (prediction.kind === \"ends\" && prediction.band !== null) {\n const at = referenceOf(run, prediction.from);\n if (at !== null) ends.push(at + valueIn(prediction.band.hi, \"ms\") + NOISE);\n }\n const after = observationAfter(cell);\n const window = windowOf(prediction);\n if (after !== null && window !== null && window.end !== null) {\n const from = window.end.from;\n const pods: ReadonlyArray<string | undefined> = window.each === true ? run.replicas.map((replica) => replica.pod) : [run.target?.pod];\n const references = pods.flatMap((pod) => {\n const at = referenceOf(run, from, pod);\n return at === null ? [] : [at];\n });\n if (references.length > 0) ends.push(Math.max(...references) + valueIn(after, \"ms\"));\n }\n return ends.length === 0 ? null : Math.max(...ends);\n};\n\n/** This function gives the facts of a run that each table reads: its failures by outcome and node, and the times of its target. */\nexport const factsOf = (cell: KindCell, run: KindRun): RunFacts => {\n const lines = run.lines as readonly Line[];\n const failures = failuresOf(lines).filter((request) => request.t >= run.start && request.t <= run.end);\n const deletion = referenceOf(run, \"deletion\");\n const intake = referenceOf(run, \"intake\");\n const crash = cell.trigger.kind === \"crash\" ? run.acts.fault : null;\n const from = deletion ?? crash;\n return {\n failures: failures.length,\n outcomes: outcomesOf(failures),\n byNode: Object.fromEntries([...byNode(failures)].map(([node, list]) => [node, list.length])),\n first: failures.length === 0 ? null : failures[0]!.t,\n last: failures.length === 0 ? null : failures.at(-1)!.t,\n deletion,\n intakeAfterDeletion: deletion === null || intake === null ? null : seconds(sec(intake - deletion)),\n sliceAfter: run.target === null || from === null ? null : time((() => {\n const at = sliceDropOf(lines, SERVER, run.target!.ip, from);\n return at === null ? null : sec(at - from);\n })()),\n propagation: propagationOf(run, from, undefined, propagationSource(cell)),\n ...(eachOf(cell.prediction) ? { deletions: deletionsOf(run) } : {}),\n ...(listens(cell) ? { updates: updatesOf(run, run.acts.fault), healUpdates: updatesOf(run, run.acts.heal) } : {}),\n };\n};\n\n/** This function judges one run against the prediction of its cell. */\nexport const checkRun = (cell: KindCell, run: KindRun): RunCheck => {\n const lines = run.lines as readonly Line[];\n const facts = factsOf(cell, run);\n const failures = failuresOf(lines).filter((request) => request.t >= run.start && request.t <= run.end);\n const prediction = cell.prediction;\n const unit = unitOf(prediction);\n const done = (ok: boolean, why: string, value: number | null, more: Partial<RunFacts> = {}): RunCheck => ({\n ok,\n why,\n value: value === null ? null : { value, unit },\n facts: { ...facts, ...more },\n });\n switch (prediction.kind) {\n case \"none\": {\n const excluded = prediction.outcomes;\n const counted = excluded === undefined ? failures : failures.filter((request) => excluded.includes(request.o));\n const what = excluded === undefined ? \"requests failed\" : `requests ended ${excluded.join(\", \")}`;\n return done(counted.length === 0, counted.length === 0 ? `no ${excluded === undefined ? \"request failed\" : `request ended ${excluded.join(\", \")}`}` : `${counted.length} ${what}: ${JSON.stringify(facts.outcomes)}`, counted.length);\n }\n case \"window\": {\n const each = prediction.each === true;\n const opens = secondsOf(prediction.start.band);\n const closes = prediction.end === null ? null : secondsOf(prediction.end.band);\n // a request after a window that started before the rules of its node dropped the replica of that\n // window agrees with the law: only the calibrated band is short (D-EXTEND). A request after the drop is still late\n const droppedAfter = (origin: number | null, propagation: RunFacts[\"propagation\"]) => (node: string): number | null => {\n const propagated = propagation[node];\n return origin === null || propagated === undefined || propagated === null ? null : origin + valueIn(propagated.by, \"ms\");\n };\n // the window of the target, or with `each` the window of each replica that got a deletion\n const pods: ReadonlyArray<string | undefined> = each ? (facts.deletions ?? []).map((deleted) => deleted.pod) : [run.target?.pod];\n if (pods.length === 0) return done(false, \"no replica of the run got a deletion\", null);\n const windows: Span[] = [];\n for (const pod of pods) {\n const start = referenceOf(run, prediction.start.from, pod);\n const end = prediction.end === null ? null : referenceOf(run, prediction.end.from, pod);\n if (start === null || (prediction.end !== null && end === null))\n return done(false, `the run has no ${start === null ? prediction.start.from : prediction.end!.from} reference${each ? ` for ${pod}` : \"\"}`, null);\n const origin = each ? referenceOf(run, \"deletion\", pod) : (facts.deletion ?? (cell.trigger.kind === \"crash\" ? run.acts.fault : null));\n const ip = run.replicas.find((replica) => replica.pod === pod)?.ip;\n const propagation = each ? propagationOf(run, origin, ip, propagationSource(cell)) : facts.propagation;\n windows.push({\n pod,\n start,\n end,\n lo: start + opens.lo * 1000 - NOISE,\n hi: end === null ? Number.POSITIVE_INFINITY : end + closes!.hi * 1000 + NOISE,\n origin,\n propagation,\n dropped: droppedAfter(origin, propagation),\n });\n }\n // a node that dropped the replica of a window after the propagation of the prediction, or kept it\n // past that bound to the end of the run: the run agrees with the law, but the band is short (D-EXTEND)\n const bound = prediction.propagation === undefined ? null : secondsOf(prediction.propagation).hi * 1000 + NOISE;\n const lateOf = (origin: number, propagated: { readonly by: Quantity } | null) => {\n const by = propagated === null ? null : valueIn(propagated.by, \"ms\");\n return { by, late: bound !== null && (by === null ? run.end - origin > bound : by > bound) };\n };\n // for a policy, the propagation is the LDS update of each server sidecar after the fault and after the heal\n const listened = listens(cell);\n const updates = (facts.updates ?? {}) as Readonly<Record<string, Propagated | null>>;\n const healUpdates = (facts.healUpdates ?? {}) as Readonly<Record<string, Propagated | null>>;\n const slow =\n bound === null\n ? []\n : listened\n ? ([[run.acts.fault, updates, \"the policy\"], [run.acts.heal, healUpdates, \"the delete of the policy\"]] as const).flatMap(([origin, by, what]) =>\n origin === null\n ? []\n : Object.entries(by).flatMap(([pod, propagated]) => {\n const late = lateOf(origin, propagated);\n return late.late ? [{ pod: what, node: pod, by: late.by }] : [];\n }),\n )\n : windows.flatMap(({ pod, origin, propagation }) =>\n origin === null\n ? []\n : Object.entries(propagation).flatMap(([node, propagated]) => {\n const late = lateOf(origin, propagated);\n return late.late ? [{ pod, node, by: late.by }] : [];\n }),\n );\n // the last LDS update after the heal: a call to its replica can fail until the next call to it after the update\n const lastHeal =\n !listened || run.acts.heal === null\n ? null\n : Object.values(healUpdates).reduce<number | null>((max, propagated) => (propagated === null ? max : Math.max(max ?? 0, valueIn(propagated.by, \"ms\"))), null);\n const relevant: Request[] = prediction.nodes === \"paused\" ? failures.filter((request) => request.n === run.paused) : failures;\n const others = prediction.nodes === \"paused\" ? failures.filter((request) => request.n !== run.paused) : [];\n const reuse = prediction.afterReset;\n const late = relevant.filter((request) => windows.every((window) => request.t < window.lo || request.t > window.hi));\n // a request outside the window that reuses the port of a reset is the CLOSE entry of that reset\n const reused = reuse === undefined ? [] : late.filter((request) => reusesReset(request, failures, reuse));\n const tailOf = (request: Request): Span | undefined =>\n reused.includes(request)\n ? undefined\n : windows.find((window) => {\n const drop = request.t > window.hi ? window.dropped(request.n) : null;\n return drop !== null && request.t <= drop + NOISE;\n });\n // a denial after the window, before the last LDS update after the heal and the next call to its replica\n const healTail = (request: Request): boolean =>\n lastHeal !== null && request.t > windows[0]!.hi && request.t <= run.acts.heal! + lastHeal + SLACK + NOISE;\n const tail = late.filter((request) => tailOf(request) !== undefined || healTail(request));\n const outside = late.filter((request) => !reused.includes(request) && !tail.includes(request));\n // a window that names its outcomes allows no other failure in it\n const allowed = prediction.outcomes;\n const wrong = allowed === undefined ? [] : relevant.filter((request) => !late.includes(request) && !allowed.includes(request.o));\n const bounds = (window: Span): string => `[${sec(window.lo - window.start)}, ${sec(window.hi - window.start)}] s`;\n const problems: string[] = [];\n if (outside.length > 0)\n problems.push(\n each\n ? `${outside.length} failed requests outside the window of each deleted replica: ${windows.map((window) => `${window.pod} ${bounds(window)}`).join(\", \")} after its ${prediction.start.from}`\n : `${outside.length} failed requests outside ${bounds(windows[0]!)} after ${prediction.start.from}`,\n );\n if (others.length > 0) problems.push(`${others.length} failed requests on nodes whose kube-proxy did not pause`);\n if (wrong.length > 0) problems.push(`${wrong.length} failed requests in the window ended ${JSON.stringify(outcomesOf(wrong))}, not ${allowed!.join(\", \")}`);\n if (prediction.certain && relevant.length === 0) problems.push(\"no request failed in a window that the law opens\");\n // the window that ends last: the last failed request comes near its end\n const final = windows.reduce((a, b) => ((b.end ?? Number.NEGATIVE_INFINITY) > (a.end ?? Number.NEGATIVE_INFINITY) ? b : a));\n if (prediction.certain && final.end !== null && relevant.length > 0) {\n const last = relevant.at(-1)!.t;\n const earliest = final.end + closes!.lo * 1000 - NOISE - SLACK;\n if (last < earliest) problems.push(`the last failed request started ${sec(earliest - last)} s before the window can end`);\n }\n const inside = relevant.filter((request) => !late.includes(request));\n const span = inside.length === 0 ? 0 : sec(inside.at(-1)!.t - inside[0]!.t);\n const where = each ? `the windows of ${windows.length} deleted replicas` : \"the window\";\n const agrees =\n reused.length === 0\n ? `${relevant.length} failed requests, all in ${where} (span ${span} s)`\n : `${inside.length} failed requests in ${where} (span ${span} s), and ${reused.length} on a port that a reset closed`;\n const checked = done(problems.length === 0, problems.length === 0 ? agrees : problems.join(\"; \"), relevant.length);\n if (problems.length > 0) return checked;\n const notes: string[] = [];\n if (tail.length > 0) {\n const last = tail.at(-1)!;\n const after = tailOf(last);\n notes.push(\n after === undefined\n ? `${tail.length} failed requests after the window, the last ${sec(last.t - windows[0]!.hi + NOISE)} s after it, before the last LDS update after the heal and the next call to its replica`\n : each\n ? `${tail.length} failed requests after a window, the last ${sec(last.t - after.hi + NOISE)} s after the window of ${after.pod} on ${last.n}, before the rules of ${last.n} dropped ${after.pod}`\n : `${tail.length} failed requests after the window, the last ${sec(last.t - after.hi + NOISE)} s after it on ${last.n}, before the rules of ${last.n} dropped the target`,\n );\n }\n if (slow.length > 0) {\n // a node that kept its replica to the end of the run is the latest\n const latest = slow.find((late) => late.by === null) ?? slow.reduce((a, b) => (b.by! > a.by! ? b : a));\n const bandHi = secondsOf(prediction.propagation!).hi;\n if (listened) {\n const update = latest.by === null ? `had no LDS update after ${latest.pod}` : `had its LDS update ${sec(latest.by)} s after ${latest.pod}`;\n notes.push(`${slow.length} LDS updates after the propagation of ${bandHi} s at the most, the latest: the sidecar of ${latest.node} ${update}`);\n } else {\n const what = each ? latest.pod : \"the target\";\n const drop = latest.by === null ? `kept ${what} to the end of the run` : `dropped ${what} ${sec(latest.by)} s after its deletion`;\n notes.push(`${slow.length} drops after the propagation of ${bandHi} s at the most, the latest: the rules of ${latest.node} ${drop}`);\n }\n }\n return notes.length === 0 ? checked : { ...checked, tail: notes.join(\"; \") };\n }\n case \"removal\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const empty = sliceEmptyOf(lines, SERVER, fault);\n if (empty === null) return done(false, \"the Service kept a ready endpoint\", null);\n const value = sec(empty - fault);\n const band = secondsOf(prediction.band);\n const problems: string[] = [];\n if (!inBand(value, band)) problems.push(`the EndpointSlice had no ready endpoint at ${value} s`);\n const nodes = [...new Set(lines.filter((line) => line.ev === \"rules\").map((line) => String(line[\"node\"])))].sort();\n const rules: Record<string, Quantity | null> = {};\n for (const node of nodes) {\n const drop = emptyOf(lines, node, fault);\n rules[node] = drop === null ? null : seconds(sec(drop.t - fault));\n if (drop === null) problems.push(`the rules of ${node} kept a backend`);\n else if (!inBand(sec(drop.t - fault), { lo: band.lo, hi: band.hi + 0.05 }))\n problems.push(`the rules of ${node} had no backend at ${sec(drop.t - fault)} s`);\n }\n // with a window, the failed requests of the run must also agree with it, as with `leaves`\n const inner = prediction.window === undefined ? null : checkRun({ ...cell, prediction: prediction.window }, run);\n if (inner !== null && !inner.ok) problems.push(inner.why);\n const agrees = inner === null ? `the Service was empty at ${value} s` : `the Service was empty at ${value} s; ${inner.why}`;\n const checked = done(problems.length === 0, problems.length === 0 ? agrees : problems.join(\"; \"), value, { ...(inner === null ? {} : inner.facts), sliceEmpty: seconds(value), rules });\n return inner?.tail === undefined ? checked : { ...checked, tail: inner.tail };\n }\n case \"leaves\": {\n const fault = run.acts.fault;\n if (fault === null || run.target === null) return done(false, \"the run has no fault stamp or no target\", null);\n const at = sliceDropOf(lines, SERVER, run.target.ip, fault);\n if (at === null) return done(false, `${run.target.pod} stayed ready in the EndpointSlice`, null);\n const value = sec(at - fault);\n const band = secondsOf(prediction.band);\n const problems: string[] = [];\n if (!inBand(value, band)) problems.push(`${run.target.pod} left the EndpointSlice at ${value} s`);\n const propagation = propagationOf(run, fault, undefined, propagationSource(cell));\n for (const [node, drop] of Object.entries(propagation)) {\n const by = drop === null ? null : valueIn(drop.by, \"s\");\n if (by === null) problems.push(`the rules of ${node} kept ${run.target.pod}`);\n else if (!inBand(by, { lo: band.lo, hi: band.hi + 0.05 })) problems.push(`the rules of ${node} dropped it at ${by} s`);\n }\n // with a window, the failed requests of the run must also agree with it, as with `ends`\n const inner = prediction.window === undefined ? null : checkRun({ ...cell, prediction: prediction.window }, run);\n if (inner !== null && !inner.ok) problems.push(inner.why);\n const left = inner === null ? `${run.target.pod} left at ${value} s` : `${run.target.pod} left at ${value} s; ${inner.why}`;\n const checked = done(problems.length === 0, problems.length === 0 ? left : problems.join(\"; \"), value, { ...(inner === null ? {} : inner.facts), left: seconds(value), propagation });\n return inner?.tail === undefined ? checked : { ...checked, tail: inner.tail };\n }\n case \"restarts\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const until = run.acts.heal ?? run.end;\n const pods = run.replicas.map((replica) => replica.pod);\n const signals = signalsOf(lines, pods, fault);\n const inside = [...signals].filter(([, at]) => at <= until);\n if (prediction.band === null)\n return done(inside.length === 0, inside.length === 0 ? \"no replica received SIGTERM\" : `${inside.length} replicas received SIGTERM`, inside.length);\n const band = secondsOf(prediction.band);\n const times = pods.map((pod) => {\n const at = signals.get(pod);\n return at === undefined ? null : sec(at - fault);\n });\n const missing = times.filter((each) => each === null).length;\n const off = times.filter((each): each is number => each !== null && !inBand(each, band));\n const known = times.filter((each): each is number => each !== null).sort((a, b) => a - b);\n const ok = missing === 0 && off.length === 0;\n return done(ok, ok ? `each replica received SIGTERM, at ${known.join(\", \")} s` : `${missing} replicas without SIGTERM, ${off.length} outside the band (${known.join(\", \")} s)`, known.length === 0 ? null : middle(known), { signals: times.map(time) });\n }\n case \"stays\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const until = run.end;\n const dropped = run.replicas.filter((replica) => {\n const at = sliceDropOf(lines, SERVER, replica.ip, fault);\n return at !== null && at <= until;\n });\n const refused = failures.filter((request) => request.o === \"refused\" && request.t >= fault);\n const problems: string[] = [];\n if (dropped.length > 0) problems.push(`${dropped.length} replicas left the EndpointSlice`);\n if (refused.length > 0) problems.push(`${refused.length} requests were refused`);\n return done(problems.length === 0, problems.length === 0 ? `the replicas stayed ready, ${failures.length} requests failed by their dependency` : problems.join(\"; \"), failures.length);\n }\n case \"stalls\": {\n const fault = run.acts.fault;\n const heal = run.acts.heal;\n if (fault === null || heal === null) return done(false, \"the run has no fault or heal stamp\", null);\n const old = new Set(run.replicas.map((replica) => replica.pod));\n // only the replicas of the service: the pod of Redis is not a part of the rollout\n const servers = podsOf(lines).filter((pod) => pod.labels[\"app\"] === SERVER);\n const pods = servers.filter((pod) => pod.t >= fault && pod.t <= heal);\n const deleted = pods.filter((pod) => old.has(pod.name) && pod.del);\n const newReady = pods.filter((pod) => !old.has(pod.name) && pod.ready);\n const after = servers.filter((pod) => pod.t > heal);\n const firstReady = after.find((pod) => !old.has(pod.name) && pod.ready);\n const finished = firstReady !== undefined && after.some((pod) => old.has(pod.name) && pod.type === \"DELETED\");\n const problems: string[] = [];\n if (deleted.length > 0) problems.push(`${new Set(deleted.map((pod) => pod.name)).size} old pods were deleted while Redis was down`);\n if (newReady.length > 0) problems.push(\"a new pod became ready while Redis was down\");\n if (!finished) problems.push(\"the rollout did not continue after Redis came back\");\n if (problems.length === 0)\n return done(true, `the rollout waited for Redis, and its first new pod was ready ${sec(firstReady!.t - heal)} s after Redis came back`, sec(firstReady!.t - heal));\n return done(false, problems.join(\"; \"), null);\n }\n case \"ends\":\n return checkEnds(cell, run, prediction, done);\n case \"measured\":\n return done(true, \"measured\", facts.failures);\n }\n};\n\n/**\n * This function judges a run against a prediction `ends`. Each client with an answer before the\n * reference is a client of the run. Its socket is the port of that answer (`lp`).\n * - With a band, the first close of a socket of each client after the reference must be in the band\n * ± δ. It must be the close of that socket. The main value is the middle of these times.\n * - With no band, no socket of a client can close after the reference. The first request of each client\n * after the heal must be `ok` on that socket. The main value is the count of the closes.\n *\n * With a window, the failed requests of the run must also agree with that window (`checkRun`). A\n * prediction of the tunnels (`of: \"tunnel\"`) has its own judge (`checkTunnels`).\n */\nconst checkEnds = (\n cell: KindCell,\n run: KindRun,\n prediction: Extract<Prediction, { readonly kind: \"ends\" }>,\n done: (ok: boolean, why: string, value: number | null, more?: Partial<RunFacts>) => RunCheck,\n): RunCheck => {\n const from = referenceOf(run, prediction.from);\n if (from === null) return done(false, `the run has no ${prediction.from} reference`, null);\n if (prediction.of === \"tunnel\") return checkTunnels(run, prediction, from, done);\n const lines = run.lines as readonly Line[];\n const calls = requestsOf(lines)\n .filter((request) => request.t >= run.start && request.t <= run.end)\n .sort((a, b) => a.t - b.t);\n // each client of the run, with its last answer before the reference\n const last = new Map<string, Request>();\n for (const request of calls) if (request.t < from && request.o === \"ok\") last.set(request.p, request);\n if (last.size === 0) return done(false, `no client had an answer before the ${prediction.from}`, null);\n const clients = [...last.keys()].sort();\n const shut = socketsOf(lines).filter((line) => line.what === \"close\" && line.t >= from && line.t <= run.end);\n const closes: Record<string, Quantity | null> = {};\n const times: number[] = [];\n const problems: string[] = [];\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n closes[client] = close === undefined ? null : seconds(sec(close.t - from));\n if (close !== undefined) times.push(sec(close.t - from));\n }\n let agrees: string;\n let value: number | null;\n if (prediction.band !== null) {\n const band = secondsOf(prediction.band);\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n const port = last.get(client)!.lp ?? null;\n if (close === undefined) problems.push(`the socket of ${client} did not end`);\n else if (port !== null && close.lp !== null && close.lp !== port) problems.push(`the first socket of ${client} to end had the port ${close.lp}, not the port ${port} of its last answer`);\n else if (!inBand(sec(close.t - from), band)) problems.push(`the socket of ${client} ended at ${sec(close.t - from)} s`);\n }\n const sorted = [...times].sort((a, b) => a - b);\n value = sorted.length === 0 ? null : middle(sorted);\n agrees = `the socket of each of ${clients.length} clients ended, at ${sorted.join(\", \")} s`;\n } else {\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n if (close !== undefined) problems.push(`the socket of ${client} ended ${sec(close.t - from)} s after the ${prediction.from}`);\n }\n // the first call after the heal goes on the socket of the last answer before the reference\n const resumed = run.acts.heal ?? from;\n for (const client of clients) {\n const port = last.get(client)!.lp ?? null;\n const next = calls.find((request) => request.p === client && request.t >= resumed);\n if (next === undefined) problems.push(`${client} sent no call after the heal`);\n else if (next.o !== \"ok\") problems.push(`the first call of ${client} after the heal ended ${next.o}`);\n else if ((next.lp ?? null) !== port) problems.push(`the first call of ${client} after the heal went on the port ${next.lp ?? \"none\"}, not ${port ?? \"none\"}`);\n }\n value = times.length;\n agrees = `no socket of ${clients.length} clients ended, and the first call of each one after the heal went on its socket`;\n }\n const inner = prediction.window === undefined ? null : checkRun({ ...cell, prediction: prediction.window }, run);\n if (inner !== null && !inner.ok) problems.push(inner.why);\n const why = problems.length > 0 ? problems.join(\"; \") : inner === null ? agrees : `${agrees}; ${inner.why}`;\n const checked = done(problems.length === 0, why, value, { ...(inner === null ? {} : inner.facts), closes });\n return inner?.tail === undefined ? checked : { ...checked, tail: inner.tail };\n};\n\n/**\n * This function judges a run against a prediction `ends` of the tunnels (`of: \"tunnel\"`). Each client\n * with an answer before the reference is a client of the run. Its tunnel is the HBONE connection of\n * its ztunnel. The tunnel goes from the address of its pod to the HBONE port of the replica of its\n * last answer before the heal. The address of the pod is the local address of a socket of the client\n * in the run (`la`).\n * - The first change of the tunnel out of ESTABLISHED after the reference must be in the band ± δ.\n * It must be to FIN_WAIT1: the side of the client closes the tunnel, and the peer does not close first.\n * - With `answer`, a change to CLOSE_WAIT in that band ± δ also agrees. The peer closed first, but as\n * an answer to the close of the client.\n * - The first request of each client after the heal must succeed. The main value is the middle of the ends.\n */\nconst checkTunnels = (\n run: KindRun,\n prediction: Extract<Prediction, { readonly kind: \"ends\" }>,\n from: number,\n done: (ok: boolean, why: string, value: number | null, more?: Partial<RunFacts>) => RunCheck,\n): RunCheck => {\n if (prediction.band === null) return done(false, \"a prediction of the tunnels needs a band\", null);\n const heal = run.acts.heal;\n if (heal === null) return done(false, \"the run has no heal\", null);\n const lines = run.lines as readonly Line[];\n const calls = requestsOf(lines)\n .filter((request) => request.t >= run.start && request.t <= run.end)\n .sort((a, b) => a.t - b.t);\n const clients = [...new Set(calls.filter((request) => request.t < from && request.o === \"ok\").map((request) => request.p))].sort();\n if (clients.length === 0) return done(false, `no client had an answer before the ${prediction.from}`, null);\n const band = secondsOf(prediction.band);\n const reply = prediction.answer === undefined ? null : secondsOf(prediction.answer);\n const tunnels = tunnelsOf(lines).filter((line) => line.t >= from && line.t <= run.end);\n const sockets = socketsOf(lines);\n const closes: Record<string, Quantity | null> = {};\n const times: number[] = [];\n const problems: string[] = [];\n for (const client of clients) {\n closes[client] = null;\n const answer = calls.filter((request) => request.p === client && request.t < heal && request.o === \"ok\").at(-1);\n const replica = run.replicas.find((each) => answer !== undefined && each.pod === answer.b);\n const address = sockets.find((line) => line.p === client && typeof line.la === \"string\" && line.la !== \"\")?.la;\n if (replica === undefined) {\n problems.push(`no replica of the run answered ${client} before the heal`);\n continue;\n }\n if (address === undefined || address === null) {\n problems.push(`no socket of ${client} gave the address of its pod`);\n continue;\n }\n const end = tunnels.find((line) => line.src.startsWith(`${address}:`) && line.dst === `${replica.ip}:${HBONE_PORT}` && line.old === TCP_STATE.established);\n if (end === undefined) {\n problems.push(`the tunnel of ${client} to ${replica.pod} did not end`);\n continue;\n }\n const at = sec(end.t - from);\n closes[client] = seconds(at);\n times.push(at);\n if (end.new === TCP_STATE.closeWait && reply !== null) {\n if (!inBand(at, reply)) problems.push(`the peer closed the tunnel of ${client} at ${at} s, outside the band of its answer`);\n } else if (end.new !== TCP_STATE.finWait1) problems.push(`the tunnel of ${client} went from ESTABLISHED to the state ${end.new}, not FIN_WAIT1: the peer closed first`);\n else if (!inBand(at, band)) problems.push(`the tunnel of ${client} ended at ${at} s`);\n const next = calls.find((request) => request.p === client && request.t >= heal);\n if (next === undefined) problems.push(`${client} sent no call after the heal`);\n else if (next.o !== \"ok\") problems.push(`the first call of ${client} after the heal ended ${next.o}`);\n }\n const sorted = [...times].sort((a, b) => a - b);\n const why =\n problems.length > 0\n ? problems.join(\"; \")\n : `the side of the client ended the tunnel of each of ${clients.length} clients, at ${sorted.join(\", \")} s, and the first call of each one after the heal succeeded`;\n return done(problems.length === 0, why, sorted.length === 0 ? null : middle(sorted), { closes });\n};\n\n/** This function judges a cell on its runs: each counted run must agree, and a median in a band must be equivalent to it. */\nexport const judgeKind = (cell: KindCell, runs: readonly KindRun[]): KindVerdict => {\n const counted = runs.filter((run) => !run.warmup && run.void === null);\n const voided = runs.filter((run) => !run.warmup && run.void !== null).length;\n const checks = counted.map((run) => checkRun(cell, run));\n // the main values of one cell share the unit of its prediction\n const values = checks.flatMap((check) => (check.value === null ? [] : [check.value.value])).sort((a, b) => a - b);\n const median: Quantity | null = values.length === 0 ? null : { value: middle(values), unit: unitOf(cell.prediction) };\n const failed = checks.filter((check) => !check.ok).length;\n if (counted.length === 0) return { decision: \"void\", counted: 0, voided, failed: 0, median: null, why: \"no counted run\", checks };\n if (cell.calibrates) return { decision: \"calibration\", counted: counted.length, voided, failed, median, why: \"a calibration of the propagation\", checks };\n if (cell.prediction.kind === \"measured\") return { decision: \"measured\", counted: counted.length, voided, failed: 0, median, why: cell.prediction.why, checks };\n const prediction = cell.prediction;\n const band = prediction.kind === \"removal\" || prediction.kind === \"leaves\" || prediction.kind === \"restarts\" || prediction.kind === \"ends\" ? prediction.band : null;\n if (failed > 0) {\n const first = checks.find((check) => !check.ok)!;\n return { decision: \"fails\", counted: counted.length, voided, failed, median, why: `${failed} of ${counted.length} runs disagree, the first: ${first.why}`, checks };\n }\n // a run past its calibrated band agrees with the law, but the band is short: the cell needs a longer one\n const tails = checks.filter((check) => check.tail !== undefined);\n if (tails.length > 0)\n return { decision: \"extend\", counted: counted.length, voided, failed, median, why: `${tails.length} of ${counted.length} runs are past the calibrated band, the first: ${tails[0]!.tail}`, checks };\n if (band !== null && values.length > 0) {\n const ends = secondsOf(band);\n const [from, to] = medianInterval(values);\n const wide = { lo: ends.lo * (1 - RELATIVE), hi: ends.hi * (1 + RELATIVE) };\n if (to < wide.lo || from > wide.hi)\n return { decision: \"fails\", counted: counted.length, voided, failed, median, why: `the median interval [${from}, ${to}] s is outside the band`, checks };\n if (from < wide.lo || to > wide.hi)\n return { decision: \"extend\", counted: counted.length, voided, failed, median, why: `the median interval [${from}, ${to}] s crosses the edge of the band`, checks };\n }\n return { decision: \"holds\", counted: counted.length, voided, failed, median, why: `${counted.length} of ${counted.length} runs agree`, checks };\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { seconds } from \"./bands.ts\";\nimport type { Band, KindCell, KindRun, Prediction, Trigger, WindowPrediction } from \"./cell.ts\";\nimport type { KindScenario } from \"./scenario.ts\";\nimport type { KindVerdict, Propagated, RunCheck, RunFacts } from \"./verdict.ts\";\nimport { judgeKind, unitOf } from \"./verdict.ts\";\n\n/**\n * This module is the raw record of a kind cell: its formats, and the upgrade from the format `/1`\n * to the format `/2`. The lab writes `/2`, and it does not write `/1` again. A reader reads a record\n * of `/1` through `upgrade`, and the meaning of each value stays the same.\n */\n\n/** This format is the format that the lab writes. Each amount in it is a quantity. */\nexport const FORMAT = \"systems.kind-cell-record/2\";\n/** This format is the first format. Its bands, its medians and its times are numbers. */\nexport const FORMAT_V1 = \"systems.kind-cell-record/1\";\n\n/** A load sample is what the VM did in 4 s before a run: when (a stamp of the wall clock in milliseconds), its idle share, and its busiest processes. */\nexport interface LoadSample {\n readonly t: number;\n readonly idle: number;\n readonly top: readonly string[];\n readonly foreign: readonly string[];\n}\n\n/** A cluster manifest is what a run records about its cluster: the versions, the images, the nodes and the mode as read back. */\nexport interface ClusterManifest {\n readonly kind: string;\n readonly nodeImage: string;\n readonly server: string;\n readonly mode: string;\n readonly docker: string;\n readonly nodes: ReadonlyArray<{\n readonly name: string;\n readonly kubelet: string;\n readonly kernel: string;\n readonly runtime: string;\n readonly os: string;\n }>;\n}\n\n/** An environment manifest is one cluster of a cell: its scenario, what the cluster was, and the images of the lab. */\nexport interface EnvironmentManifest {\n readonly env: number;\n readonly scenario: KindScenario;\n readonly cluster: ClusterManifest;\n readonly images: Readonly<Record<string, string>>;\n}\n\n/**\n * A kind cell result is a cell, its runs over its environments, the manifest of each environment,\n * and its verdict. The parameter `A` is the form of an amount.\n */\nexport interface KindCellResult<A = Quantity> {\n readonly cell: KindCell<A>;\n readonly runs: readonly KindRun[];\n readonly manifests: readonly EnvironmentManifest[];\n readonly loads: readonly LoadSample[];\n readonly verdict: KindVerdict<A>;\n /** This text is the time of the verdict, in ISO 8601. */\n readonly at: string;\n}\n\n/** A kind cell record is the raw record of a cell in the format `/2`: a result with its format. */\nexport interface KindCellRecord extends KindCellResult {\n readonly format: typeof FORMAT;\n}\n\n/** A kind cell record of the format `/1` gives each band, median, main value and time of a fact as a number. */\nexport interface KindCellRecordV1 extends KindCellResult<number> {\n readonly format: typeof FORMAT_V1;\n}\n\n/** These are the parts of the format `/1`, with numbers for amounts. */\nexport type BandV1 = Band<number>;\nexport type PredictionV1 = Prediction<number>;\nexport type TriggerV1 = Trigger<number>;\nexport type KindCellV1 = KindCell<number>;\nexport type KindVerdictV1 = KindVerdict<number>;\nexport type RunCheckV1 = RunCheck<number>;\nexport type RunFactsV1 = RunFacts<number>;\n\nconst time = (value: number | null): Quantity | null => (value === null ? null : seconds(value));\nconst band = (old: BandV1): Band => ({ lo: seconds(old.lo), hi: seconds(old.hi) });\n/** The format `/1` gives each part of `cpu.max` in microseconds. */\nconst microseconds = (value: number): Quantity => ({ value, unit: \"us\" });\n\nconst upgradeTrigger = (trigger: TriggerV1): Trigger => {\n const { cpuMax, ...rest } = trigger;\n return cpuMax === undefined ? rest : { ...rest, cpuMax: { quota: microseconds(cpuMax.quota), period: microseconds(cpuMax.period) } };\n};\n\nconst upgradeWindow = (window: WindowPrediction<number>): WindowPrediction => {\n const { afterReset, propagation, ...rest } = window;\n return {\n ...rest,\n start: { from: window.start.from, band: band(window.start.band) },\n end: window.end === null ? null : { from: window.end.from, band: band(window.end.band) },\n ...(afterReset === undefined ? {} : { afterReset: { life: seconds(afterReset.life), outcome: afterReset.outcome } }),\n ...(propagation === undefined ? {} : { propagation: band(propagation) }),\n };\n};\n\nconst upgradePrediction = (prediction: PredictionV1): Prediction => {\n switch (prediction.kind) {\n case \"window\":\n return upgradeWindow(prediction);\n // the format /1 has no prediction `ends`, but its type does\n case \"ends\": {\n const { window, answer, ...rest } = prediction;\n return {\n ...rest,\n band: prediction.band === null ? null : band(prediction.band),\n ...(window === undefined ? {} : { window: upgradeWindow(window) }),\n ...(answer === undefined ? {} : { answer: band(answer) }),\n };\n }\n // the format /1 has no window on `removal` and `leaves`, but their types do\n case \"removal\":\n case \"leaves\": {\n const { window, ...rest } = prediction;\n return { ...rest, band: band(prediction.band), ...(window === undefined ? {} : { window: upgradeWindow(window) }) };\n }\n case \"restarts\":\n return { ...prediction, band: prediction.band === null ? null : band(prediction.band) };\n default:\n return prediction;\n }\n};\n\n/** This function gives a cell of the format `/1` in the format `/2`: its bands in seconds, and its `cpu.max` in microseconds. */\nexport const upgradeCell = (cell: KindCellV1): KindCell => ({\n ...cell,\n trigger: upgradeTrigger(cell.trigger),\n prediction: upgradePrediction(cell.prediction),\n});\n\nconst upgradeFacts = (facts: RunFactsV1): RunFacts => {\n const propagated = (old: Propagated<number> | null): Propagated | null => (old === null ? null : { after: time(old.after), by: seconds(old.by) });\n const byKey = (record: Readonly<Record<string, Propagated<number> | null>>) => Object.fromEntries(Object.entries(record).map(([key, old]) => [key, propagated(old)]));\n const { sliceEmpty, rules, left, signals, updates, healUpdates, closes, ...rest } = facts;\n return {\n ...rest,\n intakeAfterDeletion: time(facts.intakeAfterDeletion),\n sliceAfter: time(facts.sliceAfter),\n propagation: byKey(facts.propagation),\n ...(updates === undefined ? {} : { updates: byKey(updates) }),\n ...(healUpdates === undefined ? {} : { healUpdates: byKey(healUpdates) }),\n ...(sliceEmpty === undefined ? {} : { sliceEmpty: seconds(sliceEmpty) }),\n ...(rules === undefined ? {} : { rules: Object.fromEntries(Object.entries(rules).map(([node, old]) => [node, time(old)])) }),\n ...(left === undefined ? {} : { left: seconds(left) }),\n ...(signals === undefined ? {} : { signals: signals.map((old) => time(old)) }),\n ...(closes === undefined ? {} : { closes: Object.fromEntries(Object.entries(closes).map(([client, old]) => [client, time(old)])) }),\n };\n};\n\n/**\n * This function gives a record in the format `/2`. A record of `/2` comes back as it is. A record\n * of `/1` gets each amount as a quantity, and each value stays the same:\n * - Each band and each time of a fact is in seconds, as `/1` gives it.\n * - The `cpu.max` of a throttle is in microseconds, as `/1` gives it.\n * - The median and the main value of each run get the unit of the prediction (`unitOf`): seconds,\n * failed requests (`{request}`) or replicas (`{replica}`).\n */\nexport const upgrade = (record: KindCellRecordV1 | KindCellRecord): KindCellRecord => {\n if (record.format === FORMAT) return record;\n const unit = unitOf(record.cell.prediction);\n const amount = (value: number | null): Quantity | null => (value === null ? null : { value, unit });\n const verdict = record.verdict;\n return {\n format: FORMAT,\n cell: upgradeCell(record.cell),\n runs: record.runs,\n manifests: record.manifests,\n loads: record.loads,\n verdict: {\n ...verdict,\n median: amount(verdict.median),\n checks: verdict.checks.map((check) => ({ ...check, value: amount(check.value), facts: upgradeFacts(check.facts) })),\n },\n at: record.at,\n };\n};\n\n/**\n * This function judges a record again, from its cell and its runs, with the judge of this version.\n * It reads a record of `/1` through `upgrade`. The verdict is in the format `/2`.\n */\nexport const judge = (record: KindCellRecordV1 | KindCellRecord): KindVerdict => {\n const current = upgrade(record);\n return judgeKind(current.cell, current.runs);\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { format, valueIn } from \"@mark1russell7/quantity\";\nimport { seconds, secondsOf, showBand } from \"./bands.ts\";\nimport type { Band, KindCell, KindRun, Prediction } from \"./cell.ts\";\nimport { quantileOf } from \"./stats.ts\";\nimport type { KindVerdict } from \"./verdict.ts\";\nimport { factsOf, propagationOf, propagationSource, referenceOf, updatesOf } from \"./verdict.ts\";\n\n/** A judged cell is a cell, its runs and its verdict: the part of a result that a report reads. */\nexport interface Judged {\n readonly cell: KindCell;\n readonly runs: readonly KindRun[];\n readonly verdict: KindVerdict;\n}\n\n/** A spread is the count, the extremes, the median and the 99th percentile of a set of times. */\nexport interface TimeSpread {\n readonly count: number;\n readonly min: Quantity;\n readonly median: Quantity;\n readonly p99: Quantity;\n readonly max: Quantity;\n}\n\n/** This function gives the spread of a set of times, or null for none. The percentile is by nearest rank. */\nexport const timeSpread = (times: readonly Quantity[]): TimeSpread | null => {\n if (times.length === 0) return null;\n const sorted = times.map((each) => valueIn(each, \"s\")).sort((a, b) => a - b);\n const half = Math.floor(sorted.length / 2);\n const median = sorted.length % 2 === 1 ? sorted[half]! : (sorted[half - 1]! + sorted[half]!) / 2;\n return {\n count: sorted.length,\n min: seconds(sorted[0]!),\n median: seconds(Math.round(median * 1000) / 1000),\n p99: seconds(quantileOf(sorted, 0.99)),\n max: seconds(sorted.at(-1)!),\n };\n};\n\n/** This function gives a reference with its band, and only the reference when the band is [0, 0] s. */\nconst atBand = (from: string, band: Band): string => {\n const { lo, hi } = secondsOf(band);\n return lo === 0 && hi === 0 ? `the ${from}` : `the ${from} + ${showBand(band)}`;\n};\n\n/** This function gives the prediction of a cell in a short form for a table. A prediction `ends` gives its window after its band. */\nexport const predictionText = (prediction: Prediction): string => {\n switch (prediction.kind) {\n case \"none\":\n return prediction.outcomes === undefined ? \"no failure\" : `no ${prediction.outcomes.join(\", \")}`;\n case \"window\":\n // a window with `each` is a window for each replica that got a deletion, from the references of that replica.\n // A window can open before its reference: a stale SYN_SENT entry fails the paused node up to its life before the intake\n return `failures only from ${atBand(prediction.start.from, prediction.start.band)}${prediction.end === null ? \"\" : ` to ${atBand(prediction.end.from, prediction.end.band)}`}${prediction.each === true ? \", of each deleted replica\" : \"\"}${prediction.nodes === \"paused\" ? \", on the paused node\" : \"\"}${prediction.certain ? \", at least one\" : \"\"}${prediction.outcomes === undefined ? \"\" : `, each one ${prediction.outcomes.join(\" or \")}`}${prediction.afterReset === undefined ? \"\" : `, or a ${prediction.afterReset.outcome} up to ${format(prediction.afterReset.life)} after a reset on its port`}${prediction.propagation === undefined ? \"\" : `, the rules drop the replica in ${showBand(prediction.propagation)}`}`;\n case \"removal\":\n return `Service empty in ${showBand(prediction.band)}${prediction.window === undefined ? \"\" : `; ${predictionText(prediction.window)}`}`;\n case \"leaves\":\n return `the replica leaves in ${showBand(prediction.band)}${prediction.window === undefined ? \"\" : `; ${predictionText(prediction.window)}`}`;\n case \"restarts\":\n return prediction.band === null ? \"no restart\" : `each replica SIGTERM in ${showBand(prediction.band)}`;\n case \"stays\":\n return \"stays ready, no refusal\";\n case \"stalls\":\n return \"the rollout waits for Redis\";\n case \"ends\": {\n const closes =\n prediction.band === null\n ? \"no socket of a client ends, and each one calls again on its socket\"\n : prediction.of === \"tunnel\"\n ? `the side of the client ends the tunnel of each client in ${atBand(prediction.from, prediction.band)}${prediction.answer === undefined ? \"\" : `, or the peer answers in ${atBand(prediction.from, prediction.answer)}`}, and each one calls again`\n : `the socket of each client ends in ${atBand(prediction.from, prediction.band)}`;\n return prediction.window === undefined ? closes : `${closes}; ${predictionText(prediction.window)}`;\n }\n case \"measured\":\n return \"measured\";\n }\n};\n\n/**\n * This function gives the main measurement of a cell in a short form: its median and what it\n * counts. For failed requests, it is the middle count of the counted runs.\n */\nexport const medianText = (judged: Judged): string => {\n const { cell, verdict } = judged;\n if (verdict.median === null) return \"\";\n if (verdict.median.unit === \"{request}\") {\n const counted = judged.runs.filter((run) => !run.warmup && run.void === null);\n const failures = counted.map((run) => factsOf(cell, run).failures).sort((a, b) => a - b);\n return `${failures.length === 0 ? 0 : failures[Math.floor(failures.length / 2)]} failed requests`;\n }\n return format(verdict.median, { digits: 4 });\n};\n\n/** This function gives the table of the cells in Markdown. Each row has the cell, its plan cell, its mode, its trigger, the prediction, the verdict, its runs and its median. */\nexport const cellsTable = (judged: readonly Judged[]): string =>\n [\n \"| Cell | Plan id | Mode | Trigger | Prediction | Verdict | Runs | Median |\",\n \"| --- | --- | --- | --- | --- | --- | --- | --- |\",\n ...judged.map((each) => {\n const { cell, verdict } = each;\n const runs = verdict.voided === 0 ? `${verdict.counted}` : `${verdict.counted} (+${verdict.voided} void)`;\n return `| ${cell.name} | ${cell.id} | ${cell.mode} | ${cell.trigger.kind} | ${predictionText(cell.prediction)} | ${verdict.decision} | ${runs} | ${medianText(each)} |`;\n }),\n ].join(\"\\n\");\n\n/**\n * This function gives the propagation of each calibration, by node. It is the time from the\n * deletion to the poll of the rules of each node without the pod. It also gives the time to the\n * EndpointSlice and to the stop of the intake.\n *\n * For a policy of Istio, the propagation is the LDS update of each server sidecar after the apply,\n * by node (`updatesOf`). Then `heal` is the update after the delete of the policy. `slice` and\n * `intake` are null.\n */\nexport const calibrationOf = (judged: Judged): {\n readonly nodes: Readonly<Record<string, TimeSpread | null>>;\n readonly all: TimeSpread | null;\n readonly slice: TimeSpread | null;\n readonly intake: TimeSpread | null;\n readonly heal?: TimeSpread | null | undefined;\n} => {\n const byNode: Record<string, Quantity[]> = {};\n const slice: Quantity[] = [];\n const intake: Quantity[] = [];\n const counted = judged.runs.filter((each) => !each.warmup && each.void === null);\n if (judged.cell.trigger.kind === \"authorization-policy\") {\n const heal: Quantity[] = [];\n for (const run of counted) {\n const nodeOf = (pod: string): string => run.replicas.find((replica) => replica.pod === pod)?.node ?? pod;\n for (const [pod, update] of Object.entries(updatesOf(run, run.acts.fault))) if (update !== null) (byNode[nodeOf(pod)] ??= []).push(update.by);\n for (const update of Object.values(updatesOf(run, run.acts.heal))) if (update !== null) heal.push(update.by);\n }\n const nodes = Object.fromEntries(Object.entries(byNode).map(([node, values]) => [node, timeSpread(values)]));\n return { nodes, all: timeSpread(Object.values(byNode).flat()), slice: null, intake: null, heal: timeSpread(heal) };\n }\n for (const run of counted) {\n const deletion = referenceOf(run, \"deletion\");\n for (const [node, drop] of Object.entries(propagationOf(run, deletion, undefined, propagationSource(judged.cell)))) if (drop !== null) (byNode[node] ??= []).push(drop.by);\n const facts = factsOf(judged.cell, run);\n if (facts.sliceAfter !== null) slice.push(facts.sliceAfter);\n if (facts.intakeAfterDeletion !== null) intake.push(facts.intakeAfterDeletion);\n }\n const nodes = Object.fromEntries(Object.entries(byNode).map(([node, values]) => [node, timeSpread(values)]));\n return { nodes, all: timeSpread(Object.values(byNode).flat()), slice: timeSpread(slice), intake: timeSpread(intake) };\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { extentSchema, quantitySchema } from \"@mark1russell7/quantity/schema\";\nimport type { Stage } from \"@mark1russell7/service\";\nimport { z } from \"zod\";\nimport type { EdgeProtocol, KindRun, TriggerKind } from \"./cell.ts\";\nimport type { KindCellRecord, KindCellRecordV1 } from \"./record.ts\";\nimport { FORMAT, FORMAT_V1, upgrade } from \"./record.ts\";\nimport type { KubeProxyMode } from \"./scenario.ts\";\nimport { unitOf } from \"./verdict.ts\";\n\n/**\n * This module holds the zod schemas of a kind cell record, in the formats `/1` and `/2`. It names\n * the stages of the shutdown itself, thus it does not load the service. A test holds the names to\n * the service.\n */\n\n/** These are the stages of the shutdown of the service, in their sequence. */\nexport const STAGES: readonly [Stage, ...Stage[]] = [\n \"fail readiness\",\n \"stop intake\",\n \"drain\",\n \"close transports\",\n \"stop the poller\",\n \"tear down dependencies\",\n \"close the health server\",\n \"flush the output\",\n];\n\nconst TRIGGERS = [\n \"pod-deletion\",\n \"rolling-update\",\n \"node-drain\",\n \"scale-in\",\n \"crash\",\n \"liveness-restart\",\n \"freeze-process\",\n \"rst\",\n \"blackhole\",\n \"peer-gone-without-close\",\n \"app-stall\",\n \"rollout\",\n \"cpu-throttle\",\n \"authorization-policy\",\n \"idle\",\n \"ztunnel-restart\",\n \"certificate-expiry\",\n \"cannot-serve\",\n] as const satisfies readonly TriggerKind[];\nconst MODES = [\"iptables\", \"ipvs\", \"nftables\"] as const satisfies readonly KubeProxyMode[];\n\nconst time = quantitySchema(\"time\");\nconst extent = extentSchema(\"time\");\nconst count = z.number().int().nonnegative();\nconst gate = z.enum([\"readiness\", \"liveness\"]);\nconst reference = z.enum([\"deletion\", \"intake\", \"fault\", \"resume\", \"heal\", \"restart\"]);\n\nconst probe = z.object({ period: time, threshold: count, timeout: time });\nconst timing = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"debounce\"), interval: time, failAfter: count, recoverAfter: count }),\n z.object({ type: z.literal(\"window\"), failAfter: time, recoverAfter: time.optional() }),\n]);\nconst knobs = z.object({\n connect_bound: time,\n request_timeout: time,\n driver_writeoff_time: extent,\n keepalive_idle: extent,\n heartbeat_interval: extent,\n heartbeat_timeout: time,\n client_retry_window: extent,\n retry_base: time,\n retry_cap: time,\n close_bound: time,\n max_connection_age: extent,\n retrans_giveup_time: extent,\n});\nconst declaration = z.object({\n poll: z.object({ interval: time, jitter: z.number().min(0).lt(1), timeout: time }),\n readiness: timing,\n liveness: timing,\n startup: time,\n phases: z.array(z.tuple([z.enum(STAGES), time])),\n cooperativeWindow: extent,\n couplings: z.array(z.object({ from: gate, to: gate, effect: z.literal(\"fails\") })),\n redis: z.object({ gates: gate.nullable(), knobs, misses: count }).nullable(),\n flag: gate.nullable(),\n watchdog: z.object({ tick: time, threshold: time }).nullable(),\n lameDuck: z.boolean().optional(),\n protocol: z.enum([\"http/1.1\", \"h2c\"] as const satisfies readonly EdgeProtocol[]).optional(),\n});\n\nconst replica = z.object({ pod: z.string(), node: z.string(), ip: z.string(), version: z.string() });\n/** A line keeps each field that its source wrote. The judge reads `ev`, `t` and the fields of its kind. */\nconst line = z.object({ ev: z.string(), t: z.number() }).catchall(z.unknown());\nconst run: z.ZodType<KindRun> = z.object({\n env: count,\n index: z.number().int(),\n warmup: z.boolean(),\n start: z.number(),\n end: z.number(),\n acts: z.object({ fault: z.number().nullable(), heal: z.number().nullable(), resume: z.number().nullable() }),\n target: replica.nullable(),\n paused: z.string().nullable(),\n replicas: z.array(replica),\n void: z.string().nullable(),\n lines: z.array(line),\n dropped: z.record(z.string(), count),\n notes: z.array(z.string()).optional(),\n});\nconst manifest = z.object({\n env: count,\n scenario: z.object({\n name: z.string(),\n kubernetes: z.string(),\n workers: count,\n kubeProxy: z.object({ mode: z.enum(MODES), minSyncPeriod: time, syncPeriod: time }),\n cni: z.literal(\"kindnet\"),\n podSubnet: z.string(),\n serviceSubnet: z.string(),\n }),\n cluster: z.object({\n kind: z.string(),\n nodeImage: z.string(),\n server: z.string(),\n mode: z.string(),\n docker: z.string(),\n nodes: z.array(z.object({ name: z.string(), kubelet: z.string(), kernel: z.string(), runtime: z.string(), os: z.string() })),\n }),\n images: z.record(z.string(), z.string()),\n});\nconst load = z.object({ t: z.number(), idle: z.number(), top: z.array(z.string()), foreign: z.array(z.string()) });\n\n/**\n * This function gives the schema of a record whose amounts have one form. The schema `a` is for a\n * time. The schema `main` is for the main value of a run: a time or a count.\n */\nconst recordOf = <A>(a: z.ZodType<A>, main: z.ZodType<A>) => {\n const band = z.object({ lo: a, hi: a });\n const window = z.object({\n kind: z.literal(\"window\"),\n nodes: z.enum([\"all\", \"paused\"]),\n start: z.object({ from: reference, band }),\n end: z.object({ from: reference, band }).nullable(),\n certain: z.boolean(),\n afterReset: z.object({ life: a, outcome: z.string() }).optional(),\n each: z.boolean().optional(),\n propagation: band.optional(),\n outcomes: z.array(z.string()).optional(),\n why: z.string(),\n });\n const prediction = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"none\"), outcomes: z.array(z.string()).optional(), why: z.string() }),\n window,\n z.object({ kind: z.literal(\"removal\"), band, window: window.optional(), why: z.string() }),\n z.object({ kind: z.literal(\"leaves\"), band, window: window.optional(), why: z.string() }),\n z.object({ kind: z.literal(\"restarts\"), band: band.nullable(), why: z.string() }),\n z.object({ kind: z.literal(\"stays\"), why: z.string() }),\n z.object({ kind: z.literal(\"stalls\"), why: z.string() }),\n z.object({ kind: z.literal(\"ends\"), from: reference, band: band.nullable(), window: window.optional(), of: z.enum([\"socket\", \"tunnel\"]).optional(), answer: band.optional(), why: z.string() }),\n z.object({ kind: z.literal(\"measured\"), why: z.string() }),\n ]);\n const cell = z.object({\n id: z.string(),\n name: z.string(),\n template: z.enum([\"T07\", \"T15\", \"T18\"]),\n stack: z.enum([\"service\", \"grpc\"]).optional(),\n mesh: z\n .object({ flavor: z.enum([\"sidecar\", \"ambient\"]), mode: z.enum([\"sidecar\", \"ambient\"]), ztunnel: z.record(z.string(), z.string()).optional() })\n .optional(),\n substitutes: z.string().nullable(),\n mode: z.enum(MODES),\n workers: count,\n trigger: z.object({\n kind: z.enum(TRIGGERS),\n hold: time.optional(),\n lead: time.optional(),\n cpuMax: z.object({ quota: a, period: a }).optional(),\n account: z.string().optional(),\n middlebox: time.optional(),\n retries: count.optional(),\n quiet: z.boolean().optional(),\n close: z.boolean().optional(),\n partition: z.boolean().optional(),\n serves: z.boolean().optional(),\n }),\n pod: z.object({ replicas: count, grace: time, preStop: time, readiness: probe, liveness: probe, startup: probe.nullable() }),\n declaration: declaration.nullable(),\n workload: z.object({\n every: time,\n timeout: time,\n connections: count.optional(),\n sessionCheck: z.object({ keepalive_time: extent, keepalive_timeout: time }).optional(),\n }),\n prediction,\n calibrates: z.boolean(),\n runs: count,\n });\n const facts = z.object({\n failures: count,\n outcomes: z.record(z.string(), count),\n byNode: z.record(z.string(), count),\n first: z.number().nullable(),\n last: z.number().nullable(),\n deletion: z.number().nullable(),\n intakeAfterDeletion: a.nullable(),\n sliceAfter: a.nullable(),\n propagation: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()),\n sliceEmpty: a.optional(),\n rules: z.record(z.string(), a.nullable()).optional(),\n left: a.optional(),\n signals: z.array(a.nullable()).optional(),\n deletions: z.array(z.object({ pod: z.string(), intake: z.number().nullable(), deletion: z.number() })).optional(),\n updates: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()).optional(),\n healUpdates: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()).optional(),\n closes: z.record(z.string(), a.nullable()).optional(),\n });\n const verdict = z.object({\n decision: z.enum([\"holds\", \"fails\", \"extend\", \"measured\", \"calibration\", \"void\"]),\n counted: count,\n voided: count,\n failed: count,\n median: main.nullable(),\n why: z.string(),\n checks: z.array(z.object({ ok: z.boolean(), why: z.string(), value: main.nullable(), facts, tail: z.string().optional() })),\n });\n return { cell, verdict, runs: z.array(run), manifests: z.array(manifest), loads: z.array(load), at: z.string() };\n};\n\nconst v2 = recordOf<Quantity>(time, quantitySchema([\"time\", \"count\"]));\nconst v1 = recordOf<number>(z.number(), z.number());\n\n/**\n * This schema accepts a record in the format `/2`. The median and the main value of each run must\n * have the unit of the prediction of the cell (`unitOf`).\n */\nexport const kindCellRecordSchema: z.ZodType<KindCellRecord> = z\n .object({ format: z.literal(FORMAT), ...v2 })\n .superRefine((record, ctx) => {\n const unit = unitOf(record.cell.prediction);\n const values = [record.verdict.median, ...record.verdict.checks.map((check) => check.value)];\n for (const value of values) {\n if (value !== null && value.unit !== unit)\n ctx.addIssue({ code: \"custom\", message: `the main value is in ${value.unit}, and the prediction ${record.cell.prediction.kind} gives ${unit}` });\n }\n });\n\n/** This schema accepts a record in the format `/1`. */\nexport const kindCellRecordV1Schema: z.ZodType<KindCellRecordV1> = z.object({ format: z.literal(FORMAT_V1), ...v1 });\n\n/** This function reads a record of either format from parsed JSON, and gives it in the format `/2`. */\nexport const readRecord = (data: unknown): KindCellRecord => {\n const format = typeof data === \"object\" && data !== null ? (data as { format?: unknown }).format : undefined;\n if (format === FORMAT_V1) return upgrade(kindCellRecordV1Schema.parse(data));\n if (format === FORMAT) return kindCellRecordSchema.parse(data);\n thro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MAAM;EAAU,SAAS,wBAAwB,MAAM,KAAK,uBAAuB,OAAO,KAAK,WAAW,KAAK,SAAS;CAAO,CAAC;AAErJ,CAAC;;AAGH,MAAa,yBAAsD,EAAE,OAAO;CAAE,QAAQ,EAAE,QAAQ,SAAS;CAAG,GAAG;AAAG,CAAC;;AAGnH,MAAa,cAAc,SAAkC;CAC3D,MAAM,SAAS,OAAO,SAAS,YAAY,SAAS,OAAQ,KAA8B,SAAS,KAAA;CACnG,IAAI,WAAA,8BAAsB,OAAO,QAAQ,uBAAuB,MAAM,IAAI,CAAC;CAC3E,IAAI,WAAA,8BAAmB,OAAO,qBAAqB,MAAM,IAAI;CAC7D,MAAM,IAAI,MAAM,qCAAqC,OAAO,MAAM,UAAU,QAAQ,OAAO,MAAM,GAAG;AACtG"}
@@ -327,6 +327,7 @@ interface ResetReuse<A = Quantity> {
327
327
  * With `each`, each replica of the run that gets a deletion has a window of its own, from its own
328
328
  * references. A request is late only when it is outside each of these windows.
329
329
  * - `removal`: the Service has no ready endpoint, and the rules of each node have no backend, in the band.
330
+ * With `window`, the failed requests also start in that window.
330
331
  * - `leaves`: the target replica leaves the EndpointSlice and the rules of each node in the band.
331
332
  * With `window`, the failed requests also start in that window.
332
333
  * - `restarts`: each replica receives SIGTERM in the band, or no replica does.
@@ -347,6 +348,7 @@ type Prediction<A = Quantity> = {
347
348
  } | WindowPrediction<A> | {
348
349
  readonly kind: "removal";
349
350
  readonly band: Band<A>;
351
+ readonly window?: WindowPrediction<A> | undefined;
350
352
  readonly why: string;
351
353
  } | {
352
354
  readonly kind: "leaves";
@@ -1066,4 +1068,4 @@ declare const quantileOf: (sorted: readonly number[], p: number) => number;
1066
1068
  declare const medianInterval: (sorted: readonly number[]) => [number, number];
1067
1069
  //#endregion
1068
1070
  export { updatesOf as $, Declaration as $t, TriggerV1 as A, nodeNames as An, rulesOf as At, RunCheck as B, ztunnelPodsOf as Bt, KindCellResult as C, NODE_IMAGES as Cn, outcomesOf as Ct, PredictionV1 as D, goDuration as Dn, requestsOf as Dt, LoadSample as E, cidrRange as En, recordsOf as Et, KIND_NOISE as F, slicesOf as Ft, judgeKind as G, PORT as Gt, checkRun as H, CLIENT as Ht, KindDecision as I, socketsOf as It, propagationOf as J, bandOf as Jt, observationAfter as K, REDIS as Kt, KindVerdict as L, stoppingOf as Lt, upgrade as M, scenarioProblems as Mn, signalsOf as Mt, upgradeCell as N, sliceDropOf as Nt, RunCheckV1 as O, kindConfig as On, restartOf as Ot, Deleted as P, sliceEmptyOf as Pt, unitOf as Q, Band as Qt, LAST_SLACK as R, transitionOf as Rt, KindCellRecordV1 as S, KubeProxyMode as Sn, kernelCounts as St, KindVerdictV1 as T, cidrOverlap as Tn, podsOf as Tt, deletionsOf as U, HEALTH_PORT as Ut, RunFacts as V, ztunnelReplaced as Vt, factsOf as W, LOG_LABEL as Wt, referenceOf as X, secondsOf as Xt, propagationSource as Y, seconds as Yt, reusesReset as Z, showBand as Zt, ClusterManifest as _, WindowPrediction as _n, dropOf as _t, STAGES as a, MeshFlavor as an, RecordLine as at, FORMAT_V1 as b, KindConfig as bn, intakeOf as bt, readRecord as c, Prediction as cn, SliceLine as ct, calibrationOf as d, Replica as dn, TunnelLine as dt, EdgeProtocol as en, Endpoint as et, cellsTable as f, ResetReuse as fn, ZtunnelPodLine as ft, BandV1 as g, TriggerKind as gn, deletionOf as gt, timeSpread as h, Trigger as hn, byNode as ht, quantileOf as i, Mesh as in, PropagationSource as it, judge as j, scenario as jn, signalOf as jt, RunFactsV1 as k, kubeProxyPatch as kn, restartsAt as kt, Judged as l, RedisDeclaration as ln, SocketLine as lt, predictionText as m, Template as mn, byClients as mt, medianInterval as n, KindRun as nn, Line as nt, kindCellRecordSchema as o, MeshMode as on, Request as ot, medianText as p, Stack as pn, backendsAt as pt, observationEnd as q, SERVER as qt, middle as r, KubeletProbe as rn, PodLine as rt, kindCellRecordV1Schema as s, PodSettings as sn, RulesLine as st, RELATIVE as t, KindCell as tn, HBONE_PORT as tt, TimeSpread as u, Reference as un, TCP_STATE as ut, EnvironmentManifest as v, Workload as vn, emptyOf as vt, KindCellV1 as w, NodeImage as wn, podsAt as wt, KindCellRecord as x, KindScenario as xn, isTunnelState as xt, FORMAT as y, KUBE_PROXY_MODES as yn, failuresOf as yt, Propagated as z, tunnelsOf as zt };
1069
- //# sourceMappingURL=judge-C2xZR_Tv.d.ts.map
1071
+ //# sourceMappingURL=judge-DnB9wEwC.d.ts.map
package/build/judge.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as updatesOf, $t as Declaration, A as TriggerV1, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Ct as outcomesOf, D as PredictionV1, Dt as requestsOf, E as LoadSample, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, Sn as KubeProxyMode, St as kernelCounts, T as KindVerdictV1, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as WindowPrediction, _t as dropOf, a as STAGES, an as MeshFlavor, at as RecordLine, b as FORMAT_V1, bt as intakeOf, c as readRecord, cn as Prediction, ct as SliceLine, d as calibrationOf, dn as Replica, dt as TunnelLine, en as EdgeProtocol, et as Endpoint, f as cellsTable, fn as ResetReuse, ft as ZtunnelPodLine, g as BandV1, gn as TriggerKind, gt as deletionOf, h as timeSpread, hn as Trigger, ht as byNode, i as quantileOf, in as Mesh, it as PropagationSource, j as judge, jt as signalOf, k as RunFactsV1, kt as restartsAt, l as Judged, ln as RedisDeclaration, lt as SocketLine, m as predictionText, mn as Template, mt as byClients, n as medianInterval, nn as KindRun, nt as Line, o as kindCellRecordSchema, on as MeshMode, ot as Request, p as medianText, pn as Stack, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as KubeletProbe, rt as PodLine, s as kindCellRecordV1Schema, sn as PodSettings, st as RulesLine, t as RELATIVE, tn as KindCell, tt as HBONE_PORT, u as TimeSpread, un as Reference, ut as TCP_STATE, v as EnvironmentManifest, vn as Workload, vt as emptyOf, w as KindCellV1, wt as podsAt, x as KindCellRecord, xt as isTunnelState, y as FORMAT, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-C2xZR_Tv.js";
1
+ import { $ as updatesOf, $t as Declaration, A as TriggerV1, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Ct as outcomesOf, D as PredictionV1, Dt as requestsOf, E as LoadSample, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, Sn as KubeProxyMode, St as kernelCounts, T as KindVerdictV1, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as WindowPrediction, _t as dropOf, a as STAGES, an as MeshFlavor, at as RecordLine, b as FORMAT_V1, bt as intakeOf, c as readRecord, cn as Prediction, ct as SliceLine, d as calibrationOf, dn as Replica, dt as TunnelLine, en as EdgeProtocol, et as Endpoint, f as cellsTable, fn as ResetReuse, ft as ZtunnelPodLine, g as BandV1, gn as TriggerKind, gt as deletionOf, h as timeSpread, hn as Trigger, ht as byNode, i as quantileOf, in as Mesh, it as PropagationSource, j as judge, jt as signalOf, k as RunFactsV1, kt as restartsAt, l as Judged, ln as RedisDeclaration, lt as SocketLine, m as predictionText, mn as Template, mt as byClients, n as medianInterval, nn as KindRun, nt as Line, o as kindCellRecordSchema, on as MeshMode, ot as Request, p as medianText, pn as Stack, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as KubeletProbe, rt as PodLine, s as kindCellRecordV1Schema, sn as PodSettings, st as RulesLine, t as RELATIVE, tn as KindCell, tt as HBONE_PORT, u as TimeSpread, un as Reference, ut as TCP_STATE, v as EnvironmentManifest, vn as Workload, vt as emptyOf, w as KindCellV1, wt as podsAt, x as KindCellRecord, xt as isTunnelState, y as FORMAT, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-DnB9wEwC.js";
2
2
  export { type Band, type BandV1, CLIENT, type ClusterManifest, type Declaration, type Deleted, type EdgeProtocol, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, HBONE_PORT, HEALTH_PORT, type Judged, KIND_NOISE, type KindCell, type KindCellRecord, type KindCellRecordV1, type KindCellResult, type KindCellV1, type KindDecision, type KindRun, type KindVerdict, type KindVerdictV1, type KubeProxyMode, type KubeletProbe, LAST_SLACK, LOG_LABEL, Line, type LoadSample, type Mesh, type MeshFlavor, type MeshMode, PORT, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, PropagationSource, REDIS, RELATIVE, RecordLine, type RedisDeclaration, type Reference, type Replica, Request, type ResetReuse, RulesLine, type RunCheck, type RunCheckV1, type RunFacts, type RunFactsV1, SERVER, STAGES, SliceLine, SocketLine, type Stack, TCP_STATE, type Template, type TimeSpread, type Trigger, type TriggerKind, type TriggerV1, TunnelLine, type WindowPrediction, type Workload, ZtunnelPodLine, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, deletionOf, deletionsOf, dropOf, emptyOf, factsOf, failuresOf, intakeOf, isTunnelState, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, medianInterval, medianText, middle, observationAfter, observationEnd, outcomesOf, podsAt, podsOf, predictionText, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartOf, restartsAt, reusesReset, rulesOf, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stoppingOf, timeSpread, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, ztunnelPodsOf, ztunnelReplaced };
package/build/judge.js CHANGED
@@ -1 +1 @@
1
- export { ut as CLIENT, u as FORMAT, d as FORMAT_V1, N as HBONE_PORT, dt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ft as LOG_LABEL, pt as PORT, mt as REDIS, k as RELATIVE, ht as SERVER, t as STAGES, P as TCP_STATE, F as backendsAt, gt as bandOf, I as byClients, L as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, R as deletionOf, v as deletionsOf, z as dropOf, B as emptyOf, y as factsOf, V as failuresOf, H as intakeOf, U as isTunnelState, f as judge, b as judgeKind, W as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, A as medianInterval, s as medianText, j as middle, x as observationAfter, S as observationEnd, G as outcomesOf, K as podsAt, q as podsOf, c as predictionText, C as propagationOf, w as propagationSource, M as quantileOf, i as readRecord, J as recordsOf, T as referenceOf, Y as requestsOf, X as restartOf, Z as restartsAt, E as reusesReset, Q as rulesOf, _t as seconds, vt as secondsOf, yt as showBand, $ as signalOf, et as signalsOf, tt as sliceDropOf, nt as sliceEmptyOf, rt as slicesOf, it as socketsOf, at as stoppingOf, l as timeSpread, ot as transitionOf, st as tunnelsOf, D as unitOf, O as updatesOf, p as upgrade, m as upgradeCell, ct as ztunnelPodsOf, lt as ztunnelReplaced } from "./judge-Dw57nCkP.js";
1
+ export { ut as CLIENT, u as FORMAT, d as FORMAT_V1, N as HBONE_PORT, dt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ft as LOG_LABEL, pt as PORT, mt as REDIS, k as RELATIVE, ht as SERVER, t as STAGES, P as TCP_STATE, F as backendsAt, gt as bandOf, I as byClients, L as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, R as deletionOf, v as deletionsOf, z as dropOf, B as emptyOf, y as factsOf, V as failuresOf, H as intakeOf, U as isTunnelState, f as judge, b as judgeKind, W as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, A as medianInterval, s as medianText, j as middle, x as observationAfter, S as observationEnd, G as outcomesOf, K as podsAt, q as podsOf, c as predictionText, C as propagationOf, w as propagationSource, M as quantileOf, i as readRecord, J as recordsOf, T as referenceOf, Y as requestsOf, X as restartOf, Z as restartsAt, E as reusesReset, Q as rulesOf, _t as seconds, vt as secondsOf, yt as showBand, $ as signalOf, et as signalsOf, tt as sliceDropOf, nt as sliceEmptyOf, rt as slicesOf, it as socketsOf, at as stoppingOf, l as timeSpread, ot as transitionOf, st as tunnelsOf, D as unitOf, O as updatesOf, p as upgrade, m as upgradeCell, ct as ztunnelPodsOf, lt as ztunnelReplaced } from "./judge-Cs91dOGO.js";
package/image/agent.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // The agent of a kind node. It runs in a privileged container in the PID namespace of the node
1
+ // The agent of a kind node. It operates in a privileged container in the PID namespace of the node
2
2
  // container, thus it sees the processes of each pod of the node, and PID 1 is the init of the node.
3
3
  //
4
4
  // node agent.mjs serve polls the rules of kube-proxy in the namespaces of the node, as
@@ -37,7 +37,7 @@ const node = process.env.NODE_NAME ?? "";
37
37
  const say = (line) => process.stdout.write(`${JSON.stringify({ ...line, node })}\n`);
38
38
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
39
39
 
40
- /** the backends of a Service in each mode of kube-proxy, as "ip:port" (with the weight for IPVS) */
40
+ /** These commands give the backends of a Service in each mode of kube-proxy, as "ip:port" (with the weight for IPVS). */
41
41
  const DUMP = {
42
42
  iptables: ["nsenter", "-t", "1", "-m", "-n", "--", "iptables-save", "-t", "nat"],
43
43
  nftables: ["nsenter", "-t", "1", "-m", "-n", "--", "nft", "list", "table", "ip", "kube-proxy"],
@@ -45,15 +45,15 @@ const DUMP = {
45
45
  };
46
46
 
47
47
  /**
48
- * the TCP lines of the conntrack table of the node's network namespace: those of the ClusterIP and
49
- * those of a handshake. A kernel without CONFIG_NF_CONNTRACK_PROCFS has no /proc/net/nf_conntrack
50
- * (the kernel of GitHub's runner, 6.17), thus the agent then asks netlink with the conntrack tool of
48
+ * This function reads the TCP lines of the conntrack table in the node's network namespace: those
49
+ * of the ClusterIP and those of a handshake. A kernel without CONFIG_NF_CONNTRACK_PROCFS has no
50
+ * /proc/net/nf_conntrack (the kernel of GitHub's runner, 6.17), thus the agent then asks netlink with the conntrack tool of
51
51
  * the node. Both give the same form of line. The first read decides the source. `text` is null when
52
52
  * no source answers, and `why` tells why.
53
53
  *
54
54
  * A dump through netlink walks each bucket of the table of the whole kernel with the softirqs off,
55
55
  * whatever its filter. A segment that comes in that walk waits for its end. Thus each read is one
56
- * dump of TCP, and the agent filters it. The workflow makes the table small (kind.yml)
56
+ * dump of TCP, and the agent filters it. The workflow makes the table small (kind.yml).
57
57
  */
58
58
  const SOURCES = {
59
59
  procfs: (ip) => [["nsenter", "-t", "1", "-n", "--", "grep", "-F", "-e", ` dst=${ip} `, "-e", "[UNREPLIED]", "-e", " SYN_RECV ", "/proc/net/nf_conntrack"]],
@@ -67,7 +67,7 @@ const conntrackOf = (ip) => {
67
67
  let ok = true;
68
68
  for (const [command, ...args] of SOURCES[name](ip)) {
69
69
  const run = spawnSync(command, args, { encoding: "utf8", maxBuffer: 64 << 20 });
70
- // grep exits 1 when no line matches; conntrack exits 0 with no entry
70
+ // grep exits 1 when no line matches, and conntrack exits 0 with no entry
71
71
  if (run.status === 0 || (name === "procfs" && run.status === 1)) {
72
72
  for (const line of (run.stdout ?? "").split("\n")) if (line.trim() !== "") lines.add(line);
73
73
  } else {
@@ -83,7 +83,7 @@ const conntrackOf = (ip) => {
83
83
  }
84
84
  return { text: null, why: why.join("; ") };
85
85
  };
86
- /** the PIDs of the clients of the node: the agent is in the PID namespace of the node, thus /proc holds each pod */
86
+ /** This function gives the PIDs of the clients of the node. The agent is in the PID namespace of the node, thus /proc holds each pod. */
87
87
  const clientsOf = () => {
88
88
  const out = [];
89
89
  for (const name of readdirSync("/proc")) {
@@ -98,10 +98,11 @@ const clientsOf = () => {
98
98
  };
99
99
 
100
100
  /**
101
- * the counters of dropped packets, by name. For the node: the drops of the backlogs and the squeezes
102
- * of the softirqs (the kernel, all CPUs), and the drops of each veth. For each client pod, through
103
- * /proc/<pid>/net: the IP discards and the sends with no route, the failed connects, the ICMP
104
- * errors of an unreachable destination, the drops of each interface, and the neighbors with no address yet
101
+ * This function gives the counters of dropped packets, by name. For the node, it gives the drops of
102
+ * the backlogs and the squeezes of the softirqs (the kernel, all CPUs), and the drops of each veth.
103
+ * For each client pod, it reads /proc/<pid>/net. There it gives the IP discards and the sends with
104
+ * no route, and the failed connects. It also gives the ICMP errors of an unreachable destination,
105
+ * the drops of each interface, and the neighbors with no address yet.
105
106
  */
106
107
  const countersOf = () => {
107
108
  const values = {};
@@ -136,7 +137,7 @@ const countersOf = () => {
136
137
  values[`client.${pid}.ip-out-discards`] = ip["OutDiscards"] ?? 0;
137
138
  values[`client.${pid}.ip-out-no-routes`] = ip["OutNoRoutes"] ?? 0;
138
139
  values[`client.${pid}.tcp-attempt-fails`] = tcp["AttemptFails"] ?? 0;
139
- // a refused connect is a reset, or an ICMP error such as the port unreachable of a reject rule
140
+ // a refused connect is a reset, or an ICMP error, for example the port unreachable of a reject rule
140
141
  values[`client.${pid}.icmp-in-unreachable`] = snmpOf(snmp, "Icmp")["InDestUnreachs"] ?? 0;
141
142
  for (const [name, drops] of Object.entries(devOf(own))) {
142
143
  if (name === "lo") continue;
@@ -149,9 +150,9 @@ const countersOf = () => {
149
150
  };
150
151
 
151
152
  /**
152
- * how often the agent reads the conntrack table, in ms. Three dumps each 250 ms on each node took
153
- * three quarters of the CPUs of a runner (run 39066066532), and the lab waited for an idle VM until
154
- * the end. An entry of a SYN with no reply lives 120 s, thus a read each second sees it
153
+ * This value tells how often the agent reads the conntrack table, in ms. Three dumps each 250 ms on
154
+ * each node took three quarters of the CPUs of a runner (CI 39066066532). Then the lab waited for an
155
+ * idle VM until the end. An entry of a SYN with no reply lives 120 s, thus a read each second sees it.
155
156
  */
156
157
  const CONNTRACK_EVERY = 1000;
157
158
 
@@ -266,12 +267,14 @@ const serve = async () => {
266
267
  };
267
268
 
268
269
  /**
269
- * the pollers of the sidecars of the node, of one kind: `eds` or `lds`. /tmp/<kind>.json gives the
270
- * interval and each pod of the node with a PID in it, and for `eds` the server cluster. The agent
271
- * starts one poller for each pod in the network namespace of that PID, and stops each one when the
272
- * file changes or goes. nsenter -n keeps the mount namespace of the agent, thus the poller is this
273
- * file, and its clock is the one of the VM. The EDS pollers read the client pods, and the LDS
274
- * pollers read the server pods
270
+ * This function controls the pollers of the sidecars of the node, of one kind: `eds` or `lds`.
271
+ * The file /tmp/<kind>.json gives the interval and each pod of the node with a PID in it. For
272
+ * `eds`, it also gives the server cluster. The agent starts one poller for each pod in the network
273
+ * namespace of that PID. It stops each poller when the file changes or goes.
274
+ *
275
+ * The command nsenter -n keeps the mount namespace of the agent. Thus the poller is this file, and
276
+ * its clock is the one of the VM. The EDS pollers read the client pods, and the LDS pollers read the
277
+ * server pods.
275
278
  */
276
279
  const pollers = async (kind) => {
277
280
  const file = `/tmp/${kind}.json`;
@@ -312,10 +315,10 @@ const pollers = async (kind) => {
312
315
  };
313
316
 
314
317
  /**
315
- * one poll loop of the admin endpoint of a sidecar, 127.0.0.1:15000 in the namespace of the pod
316
- * (envoy_bootstrap.json of Istio 1.31.3), each `every` ms. `read` gives the state of one answer, and
317
- * a line comes at each change of that state, with the start of the poll before it (`prev`), as a rules
318
- * line. Each second, a line `<kind>-alive` counts the polls
318
+ * This function is one poll loop of the admin endpoint of a sidecar, each `every` ms. The endpoint
319
+ * is 127.0.0.1:15000 in the namespace of the pod (envoy_bootstrap.json of Istio 1.31.3). `read`
320
+ * gives the state of one answer. A line comes at each change of that state, with the start of the
321
+ * poll before it (`prev`), as a rules line. Each second, a line `<kind>-alive` counts the polls.
319
322
  */
320
323
  const poll = async (kind, url, every, pod, read) => {
321
324
  let last = null;
@@ -359,8 +362,9 @@ const poll = async (kind, url, every, pod, read) => {
359
362
  };
360
363
 
361
364
  /**
362
- * one EDS poller. The filter of /clusters keeps the server cluster only (clusters_handler.cc of Envoy
363
- * v1.39.4). A line `eds` gives the healthy hosts (`b`), and each other host with its flags (`u`)
365
+ * This function is one EDS poller. The filter of /clusters keeps the server cluster only
366
+ * (clusters_handler.cc of Envoy v1.39.4). A line `eds` gives the healthy hosts (`b`), and each
367
+ * other host with its flags (`u`).
364
368
  */
365
369
  const eds = ({ cluster, every, pod }) =>
366
370
  poll("eds", `http://127.0.0.1:15000/clusters?filter=${encodeURIComponent(clusterFilter(cluster))}`, every, pod, (text) => {
@@ -369,8 +373,9 @@ const eds = ({ cluster, every, pod }) =>
369
373
  });
370
374
 
371
375
  /**
372
- * one LDS poller, in a server pod. The filter of /stats keeps the two counters of the listener
373
- * manager. A line `lds` gives each update of a listener (`mod`) and each update in place (`inPlace`)
376
+ * This function is one LDS poller, in a server pod. The filter of /stats keeps the two counters of
377
+ * the listener manager. A line `lds` gives each update of a listener (`mod`) and each update in
378
+ * place (`inPlace`).
374
379
  */
375
380
  const lds = ({ every, pod }) =>
376
381
  poll("lds", `http://127.0.0.1:15000/stats?filter=${encodeURIComponent(LDS_FILTER)}`, every, pod, (text) => {
package/image/client.mjs CHANGED
@@ -6,6 +6,7 @@
6
6
  // unreachable, or another error) and its local port (`lp`). With PROTOCOL h2c, each connection is a
7
7
  // session of HTTP/2, and each request is a stream on the next session in turn. With SESSION_CHECK,
8
8
  // each session has the session check of the service: a stream timeout or a PING with no ACK closes it.
9
+ // Each second, one line counts the PINGs of the checks and their ACKs (`pings`).
9
10
  import http from "node:http";
10
11
  import http2 from "node:http2";
11
12
  import net from "node:net";
@@ -32,7 +33,8 @@ let turn = 0;
32
33
  // each slot of HTTP/2 holds one session on its own socket, thus the client knows its local port. A
33
34
  // GOAWAY, a close or an error of the session makes the slot open a new session at its next stream.
34
35
  // kube-proxy picks a backend for that new connection. The old session ends the streams that it has.
35
- // The check of a session hears each frame of the peer: its SETTINGS, its PINGs, and each response
36
+ // The check of a session hears each frame of the peer: its SETTINGS, its PINGs, and each response.
37
+ // It sends each PING through `counted`, thus the client counts each PING and each ACK
36
38
  const sessionOf = () => {
37
39
  const socket = net.connect({ host, port: Number(port) });
38
40
  const session = http2.connect(`http://${host}:${port}`, { createConnection: () => socket });
@@ -42,7 +44,23 @@ const sessionOf = () => {
42
44
  held.check?.stop();
43
45
  };
44
46
  if (checkKnobs !== null) {
45
- held.check = sessionCheck(session, {
47
+ const counted = {
48
+ get connecting() {
49
+ return session.connecting;
50
+ },
51
+ ping(callback) {
52
+ const sent = session.ping((error) => {
53
+ if (error === null) pings.acked += 1;
54
+ callback(error);
55
+ });
56
+ if (sent) pings.sent += 1;
57
+ return sent;
58
+ },
59
+ destroy(error) {
60
+ session.destroy(error);
61
+ },
62
+ };
63
+ held.check = sessionCheck(counted, {
46
64
  knobs: checkKnobs,
47
65
  onClose: (cause) => {
48
66
  held.usable = false;
@@ -77,6 +95,15 @@ process.on("SIGHUP", () => {
77
95
  }, timeout + 100);
78
96
  });
79
97
 
98
+ // the PINGs of the session checks of this client. Each second, one line gives the PINGs that the client
99
+ // sent and the ACKs that it got in that second. A client with no check writes zeros, thus each record
100
+ // shows that the client counted
101
+ let pings = { sent: 0, acked: 0 };
102
+ setInterval(() => {
103
+ say({ ev: "pings", t: now(), sent: pings.sent, acked: pings.acked });
104
+ pings = { sent: 0, acked: 0 };
105
+ }, 1000);
106
+
80
107
  let pending = [];
81
108
  const flush = () => {
82
109
  if (pending.length === 0) return;
package/image/watch.mjs CHANGED
@@ -1,11 +1,11 @@
1
- // The watcher of a kind cell. It runs in a container on the Docker network of the cluster, thus in
1
+ // The watcher of a kind cell. It operates in a container on the Docker network of the cluster, thus in
2
2
  // the VM, and it stamps each event on CLOCK_MONOTONIC when it arrives. It watches the pods, the
3
3
  // EndpointSlices and the events of one namespace through the API, and it follows the log of each
4
4
  // pod with the label lab.systems/log=1. A log line is JSON with its own stamp, and the watcher
5
5
  // passes it on as it is.
6
6
  //
7
7
  // The sidecar of Istio (the container istio-proxy) is a native sidecar: an init container that
8
- // runs beside the app. The watcher follows it too. Its lines are the access log of Envoy (JSON, a
8
+ // operates beside the app. The watcher follows it too. Its lines are the access log of Envoy (JSON, a
9
9
  // stamp of the wall clock) and the text of pilot-agent. Each one becomes a line `proxy` with the
10
10
  // stamp of its arrival: evidence, not a time that a band reads. An access line of a call that
11
11
  // succeeded at its first attempt is only counted (`proxy-ok`, each second), thus the record keeps
@@ -43,10 +43,10 @@ const say = (line) => pending.push(`${JSON.stringify(line)}\n`);
43
43
  * opens again with no resource version, and the API gives each object again as ADDED.
44
44
  */
45
45
  const GONE = Symbol("gone");
46
- /** the result of a handler for an ERROR event: GONE for an expired resource version, else null */
46
+ /** This function gives the result of a handler for an ERROR event: GONE for an expired resource version, else null. */
47
47
  const errorOf = (status) => (status?.code === 410 ? GONE : null);
48
48
 
49
- /** a stream of lines from the API, again after each end, from the last resource version it saw */
49
+ /** This function opens a stream of lines from the API. After each end, it opens it again from the last resource version that it saw. */
50
50
  const stream = (path, query, onLine, again = true) => {
51
51
  let version = null;
52
52
  const open = () => {
@@ -104,9 +104,9 @@ const stateOf = (state) => {
104
104
  return "none";
105
105
  };
106
106
 
107
- /** the container of the sidecar of Istio */
107
+ /** This is the container of the sidecar of Istio. */
108
108
  const PROXY = "istio-proxy";
109
- /** the access lines of each sidecar that the watcher only counted, by pod, since the last count */
109
+ /** This map holds the access lines of each sidecar that the watcher only counted, by pod, since the last count. */
110
110
  const counted = new Map();
111
111
  setInterval(() => {
112
112
  const t = now();
@@ -114,11 +114,11 @@ setInterval(() => {
114
114
  counted.clear();
115
115
  }, 1000);
116
116
 
117
- /** an access line of Envoy that tells nothing more than its call: status 200, no flag, gRPC status 0, one attempt */
117
+ /** This function tells if an access line of Envoy tells nothing more than its call: status 200, no flag, gRPC status 0, one try. */
118
118
  const plain = (log) =>
119
119
  String(log.code) === "200" && (log.flags === "-" || log.flags === "" || log.flags === undefined) && String(log.grpc) === "0" && Number(log.attempts ?? 1) <= 1;
120
120
 
121
- /** a line of the sidecar: an access line of Envoy as JSON, or a text line of pilot-agent */
121
+ /** This function takes a line of the sidecar: an access line of Envoy as JSON, or a text line of pilot-agent. */
122
122
  const proxyLine = (pod, text) => {
123
123
  if (text.startsWith("{")) {
124
124
  try {
@@ -136,7 +136,7 @@ const proxyLine = (pod, text) => {
136
136
  say({ ev: "proxy", t: now(), p: pod, text: text.slice(0, 500) });
137
137
  };
138
138
 
139
- /** the namespace of the mesh, with the ztunnel pods */
139
+ /** This is the namespace of the mesh, with the ztunnel pods. */
140
140
  const MESH_NS = "istio-system";
141
141
 
142
142
  const following = new Set();
@@ -146,7 +146,7 @@ const follow = (ns, pod, container, id) => {
146
146
  following.add(key);
147
147
  stream(
148
148
  `/api/v1/namespaces/${ns}/pods/${pod}/log`,
149
- // a ztunnel ran before the cell: only its lines from the start of the watcher
149
+ // a ztunnel started before the cell: only its lines from the start of the watcher
150
150
  ns === MESH_NS ? { container, follow: "true", sinceSeconds: "5" } : { container, follow: "true" },
151
151
  (text) => {
152
152
  if (ns === MESH_NS) say({ ev: "ztunnel", t: now(), p: pod, text: text.slice(0, 500) });
@@ -176,7 +176,7 @@ for (const ns of namespaces) {
176
176
  last: stateOf(status.lastState),
177
177
  id: status.containerID ?? null,
178
178
  }));
179
- // the native sidecar of Istio is a running init container: its state, apart from the containers
179
+ // the native sidecar of Istio is an init container that operates: its state, apart from the containers
180
180
  const sidecars = (pod.status?.initContainerStatuses ?? [])
181
181
  .filter((status) => status.name === PROXY)
182
182
  .map((status) => ({ n: status.name, r: status.ready, rc: status.restartCount, st: stateOf(status.state), id: status.containerID ?? null }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/kind",
4
- "version": "0.11.5",
4
+ "version": "0.11.7",
5
5
  "description": "Kubernetes in Docker as a lab for connection timers: a kind cluster from a scenario, faults in the namespaces of its pods, observations on the one monotonic clock of the VM, and predictions from the ordering law. Its judge entry reads and judges a raw record without Docker.",
6
6
  "keywords": [
7
7
  "kubernetes",
@@ -1 +0,0 @@
1
- {"version":3,"file":"judge-Dw57nCkP.js","names":["time","time"],"sources":["../src/bands.ts","../src/names.ts","../src/observe.ts","../src/stats.ts","../src/verdict.ts","../src/record.ts","../src/report.ts","../src/schema.ts"],"sourcesContent":["import type { Quantity } from \"@mark1russell7/quantity\";\nimport { valueIn } from \"@mark1russell7/quantity\";\nimport type { Band } from \"./cell.ts\";\n\n/** This module makes and prints the bands of the predictions. It imports only the amounts. */\n\n/** This function gives a time in seconds as a quantity. */\nexport const seconds = (value: number): Quantity => ({ value, unit: \"s\" });\n\n/** This function gives a band from its two ends in seconds. */\nexport const bandOf = (lo: number, hi: number): Band => ({ lo: seconds(lo), hi: seconds(hi) });\n\n/** This function gives the two ends of a band as numbers of seconds, for arithmetic. */\nexport const secondsOf = (band: Band): { readonly lo: number; readonly hi: number } => ({\n lo: valueIn(band.lo, \"s\"),\n hi: valueIn(band.hi, \"s\"),\n});\n\n/** This function gives a band in a short form for a name or a table: `[28, 49] s`. */\nexport const showBand = (band: Band): string => {\n const { lo, hi } = secondsOf(band);\n return `[${lo}, ${hi}] s`;\n};\n","// The names and the ports of the objects of a cell. The judge reads them, thus this module imports\n// nothing.\n\n/** These are the ports of the app: its server, and its health server for the probes. */\nexport const PORT = 8080;\nexport const HEALTH_PORT = 9000;\n/** This label makes the watcher follow the log of a pod. */\nexport const LOG_LABEL = \"lab.systems/log\";\n/** These are the names of the objects of a cell. */\nexport const SERVER = \"lab\";\nexport const CLIENT = \"client\";\nexport const REDIS = \"redis\";\n","/**\n * This module reads a run from its lines. Each time is in milliseconds on CLOCK_MONOTONIC. All the\n * containers of the VM share that clock: the clients, the service, the agents, the injector, the\n * watcher and the prober.\n */\n\n/**\n * A line is one JSON line of a source of a run, with its stamp `t` in milliseconds on\n * CLOCK_MONOTONIC. It is a request of a client, a record of the service, a line of grpc-go or a probe answer. It is\n * also a pod, an EndpointSlice or an event of the API. Or it is the backends of the rules of a\n * node, a kernel record, or an act of the lab. A record keeps each line as its source wrote it.\n */\nexport interface Line {\n readonly ev: string;\n readonly t: number;\n readonly [field: string]: unknown;\n}\n\n/**\n * A request is one request of a client: its start, its duration in ms, its outcome, its client and\n * the node of the client. The backend (`b`) is the pod that answered. The local port (`lp`) is on\n * each request from 0.1.3, and on the failed ones before it. A conntrack entry is per port, thus the\n * requests on one port show which connection a stale entry came from.\n */\nexport interface Request {\n readonly t: number;\n readonly d: number;\n readonly o: string;\n readonly p: string;\n readonly n: string;\n readonly b?: string;\n readonly lp?: number | null;\n}\n\n/** A pod line is one state of a pod, as the watcher received it. */\nexport interface PodLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly node: string | null;\n readonly ip: string | null;\n readonly del: boolean;\n readonly ready: boolean;\n readonly phase: string | null;\n readonly cs: ReadonlyArray<{ readonly n: string; readonly r: boolean; readonly rc: number; readonly st: string; readonly id: string | null }>;\n readonly labels: Readonly<Record<string, string>>;\n}\n\n/** An endpoint is one endpoint of an EndpointSlice: its address, its conditions and its pod. */\nexport interface Endpoint {\n readonly ip: string | null;\n readonly r: boolean | null;\n readonly s: boolean | null;\n readonly x: boolean | null;\n readonly pod: string | null;\n readonly node: string | null;\n}\n\n/** A slice line is one state of an EndpointSlice. */\nexport interface SliceLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly svc: string | null;\n readonly eps: readonly Endpoint[];\n}\n\n/**\n * A rules line is the backends of the Service in the rules of one node, after a change. `prev` is the\n * start of the poll before it. An EDS line has the same fields (`ev` is `eds`). It gives the healthy\n * hosts of the server cluster in the Envoy of the client sidecar on the node.\n */\nexport interface RulesLine {\n readonly t: number;\n readonly prev: number | null;\n readonly node: string;\n readonly b: readonly string[];\n}\n\n/**\n * A propagation source is the poll whose lines give the backends of each node:\n * - `rules`: the rules of kube-proxy in the namespaces of the node.\n * - `eds`: the hosts of the server cluster in the Envoy of the client sidecar on the node. In a sidecar\n * mesh, the client sidecar picks the backend of each call, thus kube-proxy is not on the path.\n */\nexport type PropagationSource = \"rules\" | \"eds\";\n\n/** A record line is one transition of a machine of the service, with its own stamp `at`. */\nexport interface RecordLine {\n readonly t: number;\n readonly at: number;\n readonly p: string;\n readonly m: string;\n readonly i: string;\n readonly from: string;\n readonly to: string;\n readonly on: string;\n readonly d: string | null;\n}\n\n/**\n * A socket line is the connect or the close of a socket of the channel of a gRPC client\n * (`client-lines.ts`). It gives the client (`p`) and its node (`n`), and the local port of the socket.\n * A close also gives the code of an error of the socket (`err`), or null for a close with no error.\n */\nexport interface SocketLine {\n readonly t: number;\n readonly what: \"connect\" | \"close\";\n readonly p: string;\n readonly n: string;\n readonly lp: number | null;\n readonly err?: string | null;\n /** This address is the local address of the socket at its connect: the address of the client pod. Lines before 0.8.0 do not have it. */\n readonly la?: string | null;\n}\n\n/** This port is the HBONE port of ztunnel in each pod of the ambient mesh of Istio 1.31.3: the mesh leg ends there. */\nexport const HBONE_PORT = 15008;\n\n/** These are the states of a TCP socket of Linux that a tunnel line names (include/net/tcp_states.h of Linux v6.17, lines 12–28). */\nexport const TCP_STATE = { established: 1, finWait1: 4, closeWait: 8 } as const;\n\n/**\n * A tunnel line is a change of the state of a TCP socket with the HBONE port at one end, from the\n * prober (`kernel.state`). `src` and `dst` are each an address and a port, `a.b.c.d:port`. The stamp\n * `t` is in ms on CLOCK_MONOTONIC.\n */\nexport interface TunnelLine {\n readonly t: number;\n readonly src: string;\n readonly dst: string;\n readonly old: number;\n readonly new: number;\n}\n\n/** This function tells if a kernel record is a change of the state of a socket of the HBONE port. */\nexport const isTunnelState = (record: Readonly<Record<string, unknown>>): boolean =>\n record[\"ev\"] === \"state\" && [record[\"src\"], record[\"dst\"]].some((end) => typeof end === \"string\" && end.endsWith(`:${HBONE_PORT}`));\n\n/** This function gives the tunnel lines of a run, in sequence of their stamps. */\nexport const tunnelsOf = (lines: readonly Line[]): TunnelLine[] =>\n lines.filter((line) => line.ev === \"kernel.state\").map((line) => line as unknown as TunnelLine).sort((a, b) => a.t - b.t);\n\nconst of = <T>(lines: readonly Line[], ev: string): T[] => lines.filter((line) => line.ev === ev) as unknown as T[];\n\nexport const requestsOf = (lines: readonly Line[]): Request[] => of<Request>(lines, \"req\");\nexport const podsOf = (lines: readonly Line[]): PodLine[] => of<PodLine>(lines, \"pod\").sort((a, b) => a.t - b.t);\nexport const slicesOf = (lines: readonly Line[], svc: string): SliceLine[] =>\n of<SliceLine>(lines, \"slice\").filter((line) => line.svc === svc);\nexport const rulesOf = (lines: readonly Line[], source: PropagationSource = \"rules\"): RulesLine[] =>\n of<RulesLine>(lines, source).sort((a, b) => a.t - b.t);\nexport const recordsOf = (lines: readonly Line[]): RecordLine[] => of<RecordLine>(lines, \"rec\");\nexport const socketsOf = (lines: readonly Line[]): SocketLine[] => of<SocketLine>(lines, \"sock\").sort((a, b) => a.t - b.t);\n\n/** This function gives the requests that did not succeed, in sequence of their start. */\nexport const failuresOf = (lines: readonly Line[]): Request[] =>\n requestsOf(lines)\n .filter((request) => request.o !== \"ok\")\n .sort((a, b) => a.t - b.t);\n\n/** This function counts the outcomes of the requests, by outcome. */\nexport const outcomesOf = (requests: readonly Request[]): Record<string, number> => {\n const out: Record<string, number> = {};\n for (const request of requests) out[request.o] = (out[request.o] ?? 0) + 1;\n return out;\n};\n\n/**\n * This function orders the replicas by how many clients each one answered last, the most first,\n * then by name. `answers` gives the backend of the last answer of each client, by client. A client\n * of gRPC holds its connection to one replica, thus the first replica is the one whose stop the\n * most clients see.\n */\nexport const byClients = <T extends { readonly pod: string }>(replicas: readonly T[], answers: ReadonlyMap<string, string>): T[] => {\n const count = (pod: string): number => [...answers.values()].filter((backend) => backend === pod).length;\n return [...replicas].sort((a, b) => count(b.pod) - count(a.pod) || a.pod.localeCompare(b.pod));\n};\n\n/** This function gives the requests of each node, by the name of the node. */\nexport const byNode = (requests: readonly Request[]): Map<string, Request[]> => {\n const out = new Map<string, Request[]>();\n for (const request of requests) out.set(request.n, [...(out.get(request.n) ?? []), request]);\n return out;\n};\n\n/** This function gives the time that the watcher first received a deletion timestamp of one of the pods, after a time. */\nexport const deletionOf = (lines: readonly Line[], pods: readonly string[], after: number): number | null =>\n podsOf(lines).find((pod) => pods.includes(pod.name) && pod.del && pod.t >= after)?.t ?? null;\n\n/**\n * A ztunnel pod line is an event of a ztunnel pod in istio-system, from the watcher (`image/watch.mjs`).\n * Its `type` is the type of the event of the API, and `cs` gives the readiness of each container (`r`).\n */\nexport interface ZtunnelPodLine {\n readonly t: number;\n readonly type: string;\n readonly name: string;\n readonly node: string | null;\n readonly del: boolean;\n readonly cs: ReadonlyArray<{ readonly r: boolean }>;\n}\n\nexport const ztunnelPodsOf = (lines: readonly Line[]): ZtunnelPodLine[] => of<ZtunnelPodLine>(lines, \"ztunnel-pod\").sort((a, b) => a.t - b.t);\n\n/** This function gives the time that the watcher first received a deletion timestamp of a ztunnel pod, after a time: the reference `restart`. */\nexport const restartOf = (lines: readonly Line[], after: number): number | null => ztunnelPodsOf(lines).find((pod) => pod.del && pod.t >= after)?.t ?? null;\n\n/**\n * This function tells if a restart of ztunnel is over. Each ztunnel pod that got a deletion in the\n * lines is gone. Each node has a ready ztunnel pod with no deletion. It is false when no ztunnel pod\n * got a deletion.\n */\nexport const ztunnelReplaced = (lines: readonly Line[], nodes: readonly string[]): boolean => {\n const last = new Map<string, ZtunnelPodLine>();\n for (const pod of ztunnelPodsOf(lines)) last.set(pod.name, pod);\n const deleted = [...last.values()].filter((pod) => pod.del || pod.type === \"DELETED\");\n if (deleted.length === 0 || deleted.some((pod) => pod.type !== \"DELETED\")) return false;\n const ready = new Set(\n [...last.values()].filter((pod) => !pod.del && pod.type !== \"DELETED\" && pod.cs.length > 0 && pod.cs.every((status) => status.r)).map((pod) => pod.node),\n );\n return nodes.every((node) => ready.has(node));\n};\n\n/** This function gives the stamp of a transition of the service in a pod: the first matching record of a machine, after a time. */\nexport const transitionOf = (\n lines: readonly Line[],\n pod: string,\n machine: string,\n match: (record: RecordLine) => boolean,\n after: number,\n): number | null =>\n recordsOf(lines).find((record) => record.p === pod && record.m === machine && record.at >= after && match(record))?.at ?? null;\n\n/**\n * This function gives the line `stopping` of grpc-go in a pod, after a time. The server writes it at\n * SIGTERM. Then GracefulStop closes its listener and sends GOAWAY on each connection.\n */\nexport const stoppingOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n lines.find((line) => line.ev === \"stopping\" && line[\"p\"] === pod && line.t >= after)?.t ?? null;\n\n/**\n * This function gives when the server of a pod stopped its intake. That is the start of the phase\n * `stop intake` of the service, or the line `stopping` of grpc-go.\n */\nexport const intakeOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n transitionOf(lines, pod, \"drain\", (record) => record.to === \"stop intake\", after) ?? stoppingOf(lines, pod, after);\n\n/** This function gives when the server of a pod received its exit signal: a record of the service, or the line `stopping` of grpc-go. */\nexport const signalOf = (lines: readonly Line[], pod: string, after: number): number | null =>\n transitionOf(lines, pod, \"exit\", (record) => record.on === \"exit.request\", after) ?? stoppingOf(lines, pod, after);\n\n/**\n * This function gives when the rules of a node stopped the selection of a backend: the first poll\n * after a time without it. The change came after `prev`, the poll before it, and at the latest at `t`.\n * The source `eds` gives the same for the client sidecar of the node.\n */\nexport const dropOf = (lines: readonly Line[], node: string, backend: string, after: number, source: PropagationSource = \"rules\"): RulesLine | null =>\n rulesOf(lines, source).find((line) => line.node === node && line.t >= after && !line.b.includes(backend)) ?? null;\n\n/** This function gives when the rules of a node had no backend of the Service, after a time. */\nexport const emptyOf = (lines: readonly Line[], node: string, after: number): RulesLine | null =>\n rulesOf(lines).find((line) => line.node === node && line.t >= after && line.b.length === 0) ?? null;\n\n/** This function gives when an EndpointSlice of the Service first had no ready endpoint, after a time. */\nexport const sliceEmptyOf = (lines: readonly Line[], svc: string, after: number): number | null =>\n slicesOf(lines, svc).find((slice) => slice.t >= after && !slice.eps.some((endpoint) => endpoint.r === true))?.t ?? null;\n\n/** This function gives when the endpoint of an address was first not ready in the EndpointSlice of the Service, after a time. */\nexport const sliceDropOf = (lines: readonly Line[], svc: string, ip: string, after: number): number | null =>\n slicesOf(lines, svc).find((slice) => slice.t >= after && !slice.eps.some((endpoint) => endpoint.ip === ip && endpoint.r === true))?.t ?? null;\n\n/** This function gives the latest state of each pod at a time, by its name. A deleted pod is not in it. */\nexport const podsAt = (lines: readonly Line[], at: number): Map<string, PodLine> => {\n const out = new Map<string, PodLine>();\n for (const pod of podsOf(lines)) {\n if (pod.t > at) break;\n if (pod.type === \"DELETED\") out.delete(pod.name);\n else out.set(pod.name, pod);\n }\n return out;\n};\n\n/** This function gives the latest backends of each node at a time, by node. */\nexport const backendsAt = (lines: readonly Line[], at: number): Map<string, readonly string[]> => {\n const out = new Map<string, readonly string[]>();\n for (const line of rulesOf(lines)) {\n if (line.t > at) break;\n out.set(line.node, line.b);\n }\n return out;\n};\n\n/** This function gives the kernel records of the kinds that the lab keeps, counted by kind. */\nexport const kernelCounts = (lines: readonly Line[]): Record<string, number> => {\n const out: Record<string, number> = {};\n for (const line of lines) if (line.ev.startsWith(\"kernel.\")) out[line.ev.slice(7)] = (out[line.ev.slice(7)] ?? 0) + 1;\n return out;\n};\n\n/** This function gives the SIGTERM of each pod in a set after a time, by pod. A pod without one is not in it. */\nexport const signalsOf = (lines: readonly Line[], pods: readonly string[], after: number): Map<string, number> => {\n const out = new Map<string, number>();\n for (const pod of pods) {\n const at = signalOf(lines, pod, after);\n if (at !== null) out.set(pod, at);\n }\n return out;\n};\n\n/** This function gives the restart count of each container of each pod at a time, summed by pod. */\nexport const restartsAt = (lines: readonly Line[], at: number): Map<string, number> => {\n const out = new Map<string, number>();\n for (const [name, pod] of podsAt(lines, at)) out.set(name, pod.cs.reduce((sum, status) => sum + status.rc, 0));\n return out;\n};\n","// The statistics of a kind verdict: the median, the interval of the median and a quantile. They are\n// the statistics of the verdict of the harness, and a test holds them to it. The judge reads a\n// record without the harness, because the harness loads its Docker lab.\n\n/** This fraction, δ_rel, is how far the median of a cell can be outside its band and stay equivalent. */\nexport const RELATIVE = 0.05;\n\n/** This function gives the median of sorted values: the middle value, or the mean of the two middle values. */\nexport const middle = (sorted: readonly number[]): number => {\n const half = Math.floor(sorted.length / 2);\n return sorted.length % 2 === 1 ? sorted[half]! : (sorted[half - 1]! + sorted[half]!) / 2;\n};\n\n/** This function gives the value at quantile p of sorted values, by nearest rank: x_(⌈p·n⌉). */\nexport const quantileOf = (sorted: readonly number[], p: number): number =>\n sorted[Math.min(sorted.length, Math.max(1, Math.ceil(p * sorted.length))) - 1]!;\n\n/** This function gives P(X ≤ j) for X ~ Binomial(n, 1/2), exactly. */\nconst below = (n: number, j: number): number => {\n let term = 1;\n let sum = 0;\n for (let i = 0; i <= j; i += 1) {\n sum += term;\n term = (term * (n - i)) / (i + 1);\n }\n return sum / 2 ** n;\n};\n\n/**\n * This function gives the distribution-free interval of a median: [x_(k), x_(n+1−k)], for the\n * largest k whose two tails each hold 2.5 % or less. For eleven runs, it gives [x_(2), x_(10)],\n * at 98.8 %.\n */\nexport const medianInterval = (sorted: readonly number[]): [number, number] => {\n const n = sorted.length;\n let k = 0;\n while (k + 1 <= n / 2 && below(n, k) <= 0.025) k += 1;\n return k === 0 ? [sorted[0]!, sorted[n - 1]!] : [sorted[k - 1]!, sorted[n - k]!];\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { valueIn } from \"@mark1russell7/quantity\";\nimport { seconds, secondsOf } from \"./bands.ts\";\nimport type { KindCell, KindRun, Prediction, Reference, ResetReuse, WindowPrediction } from \"./cell.ts\";\nimport { PORT, SERVER } from \"./names.ts\";\nimport type { Line, PropagationSource, Request } from \"./observe.ts\";\nimport {\n HBONE_PORT,\n TCP_STATE,\n byNode,\n deletionOf,\n dropOf,\n emptyOf,\n failuresOf,\n intakeOf,\n outcomesOf,\n podsOf,\n requestsOf,\n restartOf,\n signalsOf,\n sliceDropOf,\n sliceEmptyOf,\n socketsOf,\n tunnelsOf,\n} from \"./observe.ts\";\nimport { RELATIVE, medianInterval, middle } from \"./stats.ts\";\n\n/**\n * This time is δ for kind: each time of a run lands in its band ± δ. Its parts are the interval of\n * the poll of the rules (50 ms) and the delay of the watcher. The watcher receives each change after\n * the API server writes it.\n */\nexport const KIND_NOISE: Quantity = { value: 100, unit: \"ms\" };\n/**\n * This time is how much earlier than the end of its window the last failed request can start. A\n * request goes to the closed pod by the choice of the rules, thus the last ones before the end can\n * go to another pod. At 50 requests a second and two pods, 12 requests in sequence miss the closed\n * pod with a chance of 1 in 4096.\n */\nexport const LAST_SLACK: Quantity = { value: 250, unit: \"ms\" };\n\n/** These are δ and the slack in milliseconds, the unit of the stamps. */\nconst NOISE = valueIn(KIND_NOISE, \"ms\");\nconst SLACK = valueIn(LAST_SLACK, \"ms\");\n\n/** A propagated change is when the rules of a node first had it: after the poll `after`, and by the poll `by`. */\nexport interface Propagated<A = Quantity> {\n readonly after: A | null;\n readonly by: A;\n}\n\n/**\n * The facts of a run are what each table reads: its failures by outcome and node, and the times of\n * its target. A count stays a number, and so does a stamp: `first`, `last` and `deletion` are\n * readings of CLOCK_MONOTONIC in milliseconds. Each other time is an amount after a reference. The\n * parameter `A` is the form of an amount: a quantity in the format `/2`, seconds in the format `/1`.\n */\nexport interface RunFacts<A = Quantity> {\n readonly failures: number;\n readonly outcomes: Readonly<Record<string, number>>;\n readonly byNode: Readonly<Record<string, number>>;\n readonly first: number | null;\n readonly last: number | null;\n readonly deletion: number | null;\n readonly intakeAfterDeletion: A | null;\n readonly sliceAfter: A | null;\n /** This record is the propagation of the target to the rules of each node, by node. */\n readonly propagation: Readonly<Record<string, Propagated<A> | null>>;\n /** This time is when the EndpointSlice had no ready endpoint, after the fault (`removal`). */\n readonly sliceEmpty?: A | undefined;\n /** These times are when the rules of each node had no backend, after the fault (`removal`). */\n readonly rules?: Readonly<Record<string, A | null>> | undefined;\n /** This time is when the target left the EndpointSlice, after the fault (`leaves`). */\n readonly left?: A | undefined;\n /** These times are the SIGTERM of each replica, after the fault (`restarts`). */\n readonly signals?: ReadonlyArray<A | null> | undefined;\n /**\n * These are the replicas of a window for each deleted replica (`each`). Each one is a replica of the\n * run with a deletion after its start, with the stamps of its intake and of its deletion.\n */\n readonly deletions?: readonly Deleted[] | undefined;\n /** These are the first LDS updates of the sidecar of each server pod after the fault, by pod (`updatesOf`). */\n readonly updates?: Readonly<Record<string, Propagated<A> | null>> | undefined;\n /** These are the first LDS updates of the sidecar of each server pod after the heal, by pod. */\n readonly healUpdates?: Readonly<Record<string, Propagated<A> | null>> | undefined;\n /** These are the first close of the socket of each client after the reference (`ends`), by client, or null for none. */\n readonly closes?: Readonly<Record<string, A | null>> | undefined;\n}\n\n/** A deleted replica is a replica of a run that got a deletion. It gives its pod, and the stamps of its intake (or null) and of its deletion. */\nexport interface Deleted {\n readonly pod: string;\n readonly intake: number | null;\n readonly deletion: number;\n}\n\n/**\n * A run check is the judgement of one run: if it agrees with the prediction, why, its main value,\n * and its facts. The main value is a time, or a count of requests or of replicas (`unitOf`).\n */\nexport interface RunCheck<A = Quantity> {\n readonly ok: boolean;\n readonly why: string;\n readonly value: A | null;\n readonly facts: RunFacts<A>;\n /**\n * This text tells why a run that agrees with the law is past its calibrated band. A request failed\n * after the window, but before the rules of its node dropped the target. Such a run makes its cell\n * `extend`, and the cell does not hold (D-EXTEND).\n */\n readonly tail?: string | undefined;\n}\n\n/** A kind decision is the result of a kind cell. */\nexport type KindDecision = \"holds\" | \"fails\" | \"extend\" | \"measured\" | \"calibration\" | \"void\";\n\n/** A kind verdict is the judgement of a cell on its counted runs. */\nexport interface KindVerdict<A = Quantity> {\n readonly decision: KindDecision;\n readonly counted: number;\n readonly voided: number;\n readonly failed: number;\n /** This amount is the median of the main value of the counted runs, or null. */\n readonly median: A | null;\n readonly why: string;\n readonly checks: ReadonlyArray<RunCheck<A>>;\n}\n\n/**\n * This function gives the unit of the main value of a cell, from its prediction:\n * - `s` for a time: the removal, the departure or the restart of a band, the end of a stall, or a close.\n * - `{request}` for the failed requests: no failure, a window, a fleet that stays, and a measurement.\n * - `{replica}` for the replicas that received SIGTERM, when no replica must restart.\n * - `{socket}` for the sockets of the clients that ended, when no socket must end.\n */\nexport const unitOf = (prediction: { readonly kind: Prediction[\"kind\"]; readonly band?: unknown }): string => {\n switch (prediction.kind) {\n case \"removal\":\n case \"leaves\":\n case \"stalls\":\n return \"s\";\n case \"restarts\":\n return prediction.band === null ? \"{replica}\" : \"s\";\n case \"ends\":\n return prediction.band === null ? \"{socket}\" : \"s\";\n default:\n return \"{request}\";\n }\n};\n\nconst sec = (ms: number): number => Math.round(ms) / 1000;\nconst inBand = (value: number, band: { readonly lo: number; readonly hi: number }): boolean =>\n value >= band.lo - NOISE / 1000 && value <= band.hi + NOISE / 1000;\nconst time = (value: number | null): Quantity | null => (value === null ? null : seconds(value));\n\n/**\n * This function tells if a failed request is the reuse of a port that a reset closed. The same\n * client had a reset on the same port, up to `life` before the request. The request ends with\n * `outcome`.\n */\nexport const reusesReset = (request: Request, requests: readonly Request[], reuse: ResetReuse): boolean => {\n if (request.o !== reuse.outcome || request.lp === undefined || request.lp === null) return false;\n const life = valueIn(reuse.life, \"ms\") + NOISE;\n return requests.some(\n (earlier) =>\n earlier.o === \"reset\" &&\n earlier.p === request.p &&\n earlier.lp === request.lp &&\n earlier.t + earlier.d <= request.t &&\n request.t - (earlier.t + earlier.d) <= life,\n );\n};\n\n/**\n * This function gives a reference event of a run, as a stamp, or null when the run does not have it.\n * The references `deletion` and `intake` are those of the target, or of the replica `pod`.\n */\nexport const referenceOf = (run: Pick<KindRun, \"start\" | \"acts\" | \"target\" | \"lines\">, from: Reference, pod: string | undefined = run.target?.pod): number | null => {\n const lines = run.lines as readonly Line[];\n if (from === \"fault\") return run.acts.fault;\n if (from === \"resume\") return run.acts.resume;\n if (from === \"heal\") return run.acts.heal;\n if (from === \"restart\") return restartOf(lines, run.start);\n if (pod === undefined) return null;\n if (from === \"deletion\") return deletionOf(lines, [pod], run.start);\n return intakeOf(lines, pod, run.start);\n};\n\n/**\n * This function gives the source of the propagation of a cell. In a sidecar mesh, the client sidecar\n * picks the backend of each call from its endpoints (EDS), thus the source is `eds`. Each other cell\n * goes through the rules of kube-proxy (`rules`).\n */\nexport const propagationSource = (cell: Pick<KindCell, \"mesh\">): PropagationSource => (cell.mesh?.mode === \"sidecar\" ? \"eds\" : \"rules\");\n\n/**\n * This function gives the propagation of each node for the target of a run, or for the replica of\n * the address `ip`. It is the time from its deletion (or its crash) to the first poll of the rules\n * of the node without it. The change came between the poll before (`after`) and that poll (`by`).\n * The source `eds` gives the poll of the client sidecar of each node.\n */\nexport const propagationOf = (\n run: KindRun,\n from: number | null,\n ip: string | undefined = run.target?.ip,\n source: PropagationSource = \"rules\",\n): Record<string, Propagated | null> => {\n const out: Record<string, Propagated | null> = {};\n if (ip === undefined || from === null) return out;\n const nodes = [...new Set((run.lines as readonly Line[]).filter((line) => line.ev === source).map((line) => String(line[\"node\"])))].sort();\n for (const node of nodes) {\n const drop = dropOf(run.lines as readonly Line[], node, `${ip}:${PORT}`, from, source);\n out[node] = drop === null ? null : { after: drop.prev === null ? null : seconds(sec(Math.max(0, drop.prev - from))), by: seconds(sec(drop.t - from)) };\n }\n return out;\n};\n\n/**\n * This function gives the first LDS update of the sidecar of each server pod after the stamp `from`.\n * The update came between the poll before (`after`) and the poll that saw it (`by`), after `from`.\n * A poller gives a line at each change of its counters. Thus a line after `from` with a poll before\n * it is an update, when its count `mod` is above the count before `from`. The first line of a poller\n * has no poll before it (`prev` is null), and it is no update.\n */\nexport const updatesOf = (run: Pick<KindRun, \"lines\">, from: number | null): Record<string, Propagated | null> => {\n const out: Record<string, Propagated | null> = {};\n if (from === null) return out;\n const lines = (run.lines as readonly Line[]).filter((line) => line.ev === \"lds\");\n for (const pod of [...new Set(lines.map((line) => String(line[\"pod\"])))].sort()) {\n const own = lines.filter((line) => String(line[\"pod\"]) === pod);\n const before = own.filter((line) => line.t <= from).at(-1);\n const base = before === undefined ? null : Number(before[\"mod\"]);\n const update = own.find((line) => line.t > from && typeof line[\"prev\"] === \"number\" && (base === null || Number(line[\"mod\"]) > base));\n const prev = update === undefined ? null : (update[\"prev\"] as number);\n out[pod] = update === undefined ? null : { after: seconds(sec(Math.max(0, prev! - from))), by: seconds(sec(update.t - from)) };\n }\n return out;\n};\n\n/** This function tells if the judge reads the LDS updates of a cell: the trigger is a policy of Istio. */\nconst listens = (cell: Pick<KindCell, \"trigger\">): boolean => cell.trigger.kind === \"authorization-policy\";\n\n/**\n * This function gives each replica of a run that got a deletion after the start of the run, in the\n * sequence of the deletions. A rolling update deletes each old replica in turn.\n */\nexport const deletionsOf = (run: KindRun): Deleted[] =>\n run.replicas\n .flatMap((replica) => {\n const deletion = referenceOf(run, \"deletion\", replica.pod);\n return deletion === null ? [] : [{ pod: replica.pod, intake: referenceOf(run, \"intake\", replica.pod), deletion }];\n })\n .sort((a, b) => a.deletion - b.deletion);\n\n/** This function tells if a prediction is a window for each deleted replica. */\nconst eachOf = (prediction: Prediction): boolean => prediction.kind === \"window\" && prediction.each === true;\n\n/**\n * A span is one window of a run, as stamps. It gives the replica of its references (or none), and its\n * two references. It also gives its ends with δ, and the deletion of its replica (`origin`). Then it\n * gives the propagation of that deletion to each node, and when the rules of a node dropped its replica.\n */\ninterface Span {\n readonly pod: string | undefined;\n readonly start: number;\n readonly end: number | null;\n readonly lo: number;\n readonly hi: number;\n readonly origin: number | null;\n readonly propagation: RunFacts[\"propagation\"];\n readonly dropped: (node: string) => number | null;\n}\n\n/** This function gives the window of the failed requests of a prediction: a window, the window of `ends`, or null. */\nconst windowOf = (prediction: Prediction): WindowPrediction | null =>\n prediction.kind === \"window\" ? prediction : prediction.kind === \"ends\" || prediction.kind === \"leaves\" ? (prediction.window ?? null) : null;\n\n/**\n * This function gives how long a run observes after the end reference of its last window, or null\n * when its prediction sets no such time. The judge closes a window `end.band.hi` + δ after its end\n * reference. A request that starts by then ends at most the timeout of the workload later: the\n * client cancels it then. A prediction with no window, or a window with no end, sets none.\n */\nexport const observationAfter = (cell: Pick<KindCell, \"prediction\" | \"workload\">): Quantity | null => {\n const window = windowOf(cell.prediction);\n if (window === null || window.end === null) return null;\n return seconds(sec(valueIn(window.end.band.hi, \"ms\") + valueIn(cell.workload.timeout, \"ms\") + NOISE));\n};\n\n/**\n * This function gives the earliest end of the observation of a run, as a stamp, or null when its\n * prediction sets none (`observationAfter`). It is that time after the latest end reference of a\n * window: of the target, or with `each`, of each replica that got a deletion. A run that ends before\n * it can miss its own failures. In a rolling update of gRPC, a call waits in the queue of its channel\n * for a stalled connect. It fails only at its timeout (kind run 40128267098). A reference that is not\n * in the lines yet does not count.\n *\n * The band of `ends` also sets an end: its reference, the end of the band and δ.\n */\nexport const observationEnd = (cell: KindCell, run: Pick<KindRun, \"start\" | \"acts\" | \"target\" | \"replicas\" | \"lines\">): number | null => {\n const ends: number[] = [];\n const prediction = cell.prediction;\n if (prediction.kind === \"ends\" && prediction.band !== null) {\n const at = referenceOf(run, prediction.from);\n if (at !== null) ends.push(at + valueIn(prediction.band.hi, \"ms\") + NOISE);\n }\n const after = observationAfter(cell);\n const window = windowOf(prediction);\n if (after !== null && window !== null && window.end !== null) {\n const from = window.end.from;\n const pods: ReadonlyArray<string | undefined> = window.each === true ? run.replicas.map((replica) => replica.pod) : [run.target?.pod];\n const references = pods.flatMap((pod) => {\n const at = referenceOf(run, from, pod);\n return at === null ? [] : [at];\n });\n if (references.length > 0) ends.push(Math.max(...references) + valueIn(after, \"ms\"));\n }\n return ends.length === 0 ? null : Math.max(...ends);\n};\n\n/** This function gives the facts of a run that each table reads: its failures by outcome and node, and the times of its target. */\nexport const factsOf = (cell: KindCell, run: KindRun): RunFacts => {\n const lines = run.lines as readonly Line[];\n const failures = failuresOf(lines).filter((request) => request.t >= run.start && request.t <= run.end);\n const deletion = referenceOf(run, \"deletion\");\n const intake = referenceOf(run, \"intake\");\n const crash = cell.trigger.kind === \"crash\" ? run.acts.fault : null;\n const from = deletion ?? crash;\n return {\n failures: failures.length,\n outcomes: outcomesOf(failures),\n byNode: Object.fromEntries([...byNode(failures)].map(([node, list]) => [node, list.length])),\n first: failures.length === 0 ? null : failures[0]!.t,\n last: failures.length === 0 ? null : failures.at(-1)!.t,\n deletion,\n intakeAfterDeletion: deletion === null || intake === null ? null : seconds(sec(intake - deletion)),\n sliceAfter: run.target === null || from === null ? null : time((() => {\n const at = sliceDropOf(lines, SERVER, run.target!.ip, from);\n return at === null ? null : sec(at - from);\n })()),\n propagation: propagationOf(run, from, undefined, propagationSource(cell)),\n ...(eachOf(cell.prediction) ? { deletions: deletionsOf(run) } : {}),\n ...(listens(cell) ? { updates: updatesOf(run, run.acts.fault), healUpdates: updatesOf(run, run.acts.heal) } : {}),\n };\n};\n\n/** This function judges one run against the prediction of its cell. */\nexport const checkRun = (cell: KindCell, run: KindRun): RunCheck => {\n const lines = run.lines as readonly Line[];\n const facts = factsOf(cell, run);\n const failures = failuresOf(lines).filter((request) => request.t >= run.start && request.t <= run.end);\n const prediction = cell.prediction;\n const unit = unitOf(prediction);\n const done = (ok: boolean, why: string, value: number | null, more: Partial<RunFacts> = {}): RunCheck => ({\n ok,\n why,\n value: value === null ? null : { value, unit },\n facts: { ...facts, ...more },\n });\n switch (prediction.kind) {\n case \"none\": {\n const excluded = prediction.outcomes;\n const counted = excluded === undefined ? failures : failures.filter((request) => excluded.includes(request.o));\n const what = excluded === undefined ? \"requests failed\" : `requests ended ${excluded.join(\", \")}`;\n return done(counted.length === 0, counted.length === 0 ? `no ${excluded === undefined ? \"request failed\" : `request ended ${excluded.join(\", \")}`}` : `${counted.length} ${what}: ${JSON.stringify(facts.outcomes)}`, counted.length);\n }\n case \"window\": {\n const each = prediction.each === true;\n const opens = secondsOf(prediction.start.band);\n const closes = prediction.end === null ? null : secondsOf(prediction.end.band);\n // a request after a window that started before the rules of its node dropped the replica of that\n // window agrees with the law: only the calibrated band is short (D-EXTEND). A request after the drop is still late\n const droppedAfter = (origin: number | null, propagation: RunFacts[\"propagation\"]) => (node: string): number | null => {\n const propagated = propagation[node];\n return origin === null || propagated === undefined || propagated === null ? null : origin + valueIn(propagated.by, \"ms\");\n };\n // the window of the target, or with `each` the window of each replica that got a deletion\n const pods: ReadonlyArray<string | undefined> = each ? (facts.deletions ?? []).map((deleted) => deleted.pod) : [run.target?.pod];\n if (pods.length === 0) return done(false, \"no replica of the run got a deletion\", null);\n const windows: Span[] = [];\n for (const pod of pods) {\n const start = referenceOf(run, prediction.start.from, pod);\n const end = prediction.end === null ? null : referenceOf(run, prediction.end.from, pod);\n if (start === null || (prediction.end !== null && end === null))\n return done(false, `the run has no ${start === null ? prediction.start.from : prediction.end!.from} reference${each ? ` for ${pod}` : \"\"}`, null);\n const origin = each ? referenceOf(run, \"deletion\", pod) : (facts.deletion ?? (cell.trigger.kind === \"crash\" ? run.acts.fault : null));\n const ip = run.replicas.find((replica) => replica.pod === pod)?.ip;\n const propagation = each ? propagationOf(run, origin, ip, propagationSource(cell)) : facts.propagation;\n windows.push({\n pod,\n start,\n end,\n lo: start + opens.lo * 1000 - NOISE,\n hi: end === null ? Number.POSITIVE_INFINITY : end + closes!.hi * 1000 + NOISE,\n origin,\n propagation,\n dropped: droppedAfter(origin, propagation),\n });\n }\n // a node that dropped the replica of a window after the propagation of the prediction, or kept it\n // past that bound to the end of the run: the run agrees with the law, but the band is short (D-EXTEND)\n const bound = prediction.propagation === undefined ? null : secondsOf(prediction.propagation).hi * 1000 + NOISE;\n const lateOf = (origin: number, propagated: { readonly by: Quantity } | null) => {\n const by = propagated === null ? null : valueIn(propagated.by, \"ms\");\n return { by, late: bound !== null && (by === null ? run.end - origin > bound : by > bound) };\n };\n // for a policy, the propagation is the LDS update of each server sidecar after the fault and after the heal\n const listened = listens(cell);\n const updates = (facts.updates ?? {}) as Readonly<Record<string, Propagated | null>>;\n const healUpdates = (facts.healUpdates ?? {}) as Readonly<Record<string, Propagated | null>>;\n const slow =\n bound === null\n ? []\n : listened\n ? ([[run.acts.fault, updates, \"the policy\"], [run.acts.heal, healUpdates, \"the delete of the policy\"]] as const).flatMap(([origin, by, what]) =>\n origin === null\n ? []\n : Object.entries(by).flatMap(([pod, propagated]) => {\n const late = lateOf(origin, propagated);\n return late.late ? [{ pod: what, node: pod, by: late.by }] : [];\n }),\n )\n : windows.flatMap(({ pod, origin, propagation }) =>\n origin === null\n ? []\n : Object.entries(propagation).flatMap(([node, propagated]) => {\n const late = lateOf(origin, propagated);\n return late.late ? [{ pod, node, by: late.by }] : [];\n }),\n );\n // the last LDS update after the heal: a call to its replica can fail until the next call to it after the update\n const lastHeal =\n !listened || run.acts.heal === null\n ? null\n : Object.values(healUpdates).reduce<number | null>((max, propagated) => (propagated === null ? max : Math.max(max ?? 0, valueIn(propagated.by, \"ms\"))), null);\n const relevant: Request[] = prediction.nodes === \"paused\" ? failures.filter((request) => request.n === run.paused) : failures;\n const others = prediction.nodes === \"paused\" ? failures.filter((request) => request.n !== run.paused) : [];\n const reuse = prediction.afterReset;\n const late = relevant.filter((request) => windows.every((window) => request.t < window.lo || request.t > window.hi));\n // a request outside the window that reuses the port of a reset is the CLOSE entry of that reset\n const reused = reuse === undefined ? [] : late.filter((request) => reusesReset(request, failures, reuse));\n const tailOf = (request: Request): Span | undefined =>\n reused.includes(request)\n ? undefined\n : windows.find((window) => {\n const drop = request.t > window.hi ? window.dropped(request.n) : null;\n return drop !== null && request.t <= drop + NOISE;\n });\n // a denial after the window, before the last LDS update after the heal and the next call to its replica\n const healTail = (request: Request): boolean =>\n lastHeal !== null && request.t > windows[0]!.hi && request.t <= run.acts.heal! + lastHeal + SLACK + NOISE;\n const tail = late.filter((request) => tailOf(request) !== undefined || healTail(request));\n const outside = late.filter((request) => !reused.includes(request) && !tail.includes(request));\n // a window that names its outcomes allows no other failure in it\n const allowed = prediction.outcomes;\n const wrong = allowed === undefined ? [] : relevant.filter((request) => !late.includes(request) && !allowed.includes(request.o));\n const bounds = (window: Span): string => `[${sec(window.lo - window.start)}, ${sec(window.hi - window.start)}] s`;\n const problems: string[] = [];\n if (outside.length > 0)\n problems.push(\n each\n ? `${outside.length} failed requests outside the window of each deleted replica: ${windows.map((window) => `${window.pod} ${bounds(window)}`).join(\", \")} after its ${prediction.start.from}`\n : `${outside.length} failed requests outside ${bounds(windows[0]!)} after ${prediction.start.from}`,\n );\n if (others.length > 0) problems.push(`${others.length} failed requests on nodes whose kube-proxy did not pause`);\n if (wrong.length > 0) problems.push(`${wrong.length} failed requests in the window ended ${JSON.stringify(outcomesOf(wrong))}, not ${allowed!.join(\", \")}`);\n if (prediction.certain && relevant.length === 0) problems.push(\"no request failed in a window that the law opens\");\n // the window that ends last: the last failed request comes near its end\n const final = windows.reduce((a, b) => ((b.end ?? Number.NEGATIVE_INFINITY) > (a.end ?? Number.NEGATIVE_INFINITY) ? b : a));\n if (prediction.certain && final.end !== null && relevant.length > 0) {\n const last = relevant.at(-1)!.t;\n const earliest = final.end + closes!.lo * 1000 - NOISE - SLACK;\n if (last < earliest) problems.push(`the last failed request started ${sec(earliest - last)} s before the window can end`);\n }\n const inside = relevant.filter((request) => !late.includes(request));\n const span = inside.length === 0 ? 0 : sec(inside.at(-1)!.t - inside[0]!.t);\n const where = each ? `the windows of ${windows.length} deleted replicas` : \"the window\";\n const agrees =\n reused.length === 0\n ? `${relevant.length} failed requests, all in ${where} (span ${span} s)`\n : `${inside.length} failed requests in ${where} (span ${span} s), and ${reused.length} on a port that a reset closed`;\n const checked = done(problems.length === 0, problems.length === 0 ? agrees : problems.join(\"; \"), relevant.length);\n if (problems.length > 0) return checked;\n const notes: string[] = [];\n if (tail.length > 0) {\n const last = tail.at(-1)!;\n const after = tailOf(last);\n notes.push(\n after === undefined\n ? `${tail.length} failed requests after the window, the last ${sec(last.t - windows[0]!.hi + NOISE)} s after it, before the last LDS update after the heal and the next call to its replica`\n : each\n ? `${tail.length} failed requests after a window, the last ${sec(last.t - after.hi + NOISE)} s after the window of ${after.pod} on ${last.n}, before the rules of ${last.n} dropped ${after.pod}`\n : `${tail.length} failed requests after the window, the last ${sec(last.t - after.hi + NOISE)} s after it on ${last.n}, before the rules of ${last.n} dropped the target`,\n );\n }\n if (slow.length > 0) {\n // a node that kept its replica to the end of the run is the latest\n const latest = slow.find((late) => late.by === null) ?? slow.reduce((a, b) => (b.by! > a.by! ? b : a));\n const bandHi = secondsOf(prediction.propagation!).hi;\n if (listened) {\n const update = latest.by === null ? `had no LDS update after ${latest.pod}` : `had its LDS update ${sec(latest.by)} s after ${latest.pod}`;\n notes.push(`${slow.length} LDS updates after the propagation of ${bandHi} s at the most, the latest: the sidecar of ${latest.node} ${update}`);\n } else {\n const what = each ? latest.pod : \"the target\";\n const drop = latest.by === null ? `kept ${what} to the end of the run` : `dropped ${what} ${sec(latest.by)} s after its deletion`;\n notes.push(`${slow.length} drops after the propagation of ${bandHi} s at the most, the latest: the rules of ${latest.node} ${drop}`);\n }\n }\n return notes.length === 0 ? checked : { ...checked, tail: notes.join(\"; \") };\n }\n case \"removal\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const empty = sliceEmptyOf(lines, SERVER, fault);\n if (empty === null) return done(false, \"the Service kept a ready endpoint\", null);\n const value = sec(empty - fault);\n const band = secondsOf(prediction.band);\n const problems: string[] = [];\n if (!inBand(value, band)) problems.push(`the EndpointSlice had no ready endpoint at ${value} s`);\n const nodes = [...new Set(lines.filter((line) => line.ev === \"rules\").map((line) => String(line[\"node\"])))].sort();\n const rules: Record<string, Quantity | null> = {};\n for (const node of nodes) {\n const drop = emptyOf(lines, node, fault);\n rules[node] = drop === null ? null : seconds(sec(drop.t - fault));\n if (drop === null) problems.push(`the rules of ${node} kept a backend`);\n else if (!inBand(sec(drop.t - fault), { lo: band.lo, hi: band.hi + 0.05 }))\n problems.push(`the rules of ${node} had no backend at ${sec(drop.t - fault)} s`);\n }\n return done(problems.length === 0, problems.length === 0 ? `the Service was empty at ${value} s` : problems.join(\"; \"), value, { sliceEmpty: seconds(value), rules });\n }\n case \"leaves\": {\n const fault = run.acts.fault;\n if (fault === null || run.target === null) return done(false, \"the run has no fault stamp or no target\", null);\n const at = sliceDropOf(lines, SERVER, run.target.ip, fault);\n if (at === null) return done(false, `${run.target.pod} stayed ready in the EndpointSlice`, null);\n const value = sec(at - fault);\n const band = secondsOf(prediction.band);\n const problems: string[] = [];\n if (!inBand(value, band)) problems.push(`${run.target.pod} left the EndpointSlice at ${value} s`);\n const propagation = propagationOf(run, fault, undefined, propagationSource(cell));\n for (const [node, drop] of Object.entries(propagation)) {\n const by = drop === null ? null : valueIn(drop.by, \"s\");\n if (by === null) problems.push(`the rules of ${node} kept ${run.target.pod}`);\n else if (!inBand(by, { lo: band.lo, hi: band.hi + 0.05 })) problems.push(`the rules of ${node} dropped it at ${by} s`);\n }\n // with a window, the failed requests of the run must also agree with it, as with `ends`\n const inner = prediction.window === undefined ? null : checkRun({ ...cell, prediction: prediction.window }, run);\n if (inner !== null && !inner.ok) problems.push(inner.why);\n const left = inner === null ? `${run.target.pod} left at ${value} s` : `${run.target.pod} left at ${value} s; ${inner.why}`;\n const checked = done(problems.length === 0, problems.length === 0 ? left : problems.join(\"; \"), value, { ...(inner === null ? {} : inner.facts), left: seconds(value), propagation });\n return inner?.tail === undefined ? checked : { ...checked, tail: inner.tail };\n }\n case \"restarts\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const until = run.acts.heal ?? run.end;\n const pods = run.replicas.map((replica) => replica.pod);\n const signals = signalsOf(lines, pods, fault);\n const inside = [...signals].filter(([, at]) => at <= until);\n if (prediction.band === null)\n return done(inside.length === 0, inside.length === 0 ? \"no replica received SIGTERM\" : `${inside.length} replicas received SIGTERM`, inside.length);\n const band = secondsOf(prediction.band);\n const times = pods.map((pod) => {\n const at = signals.get(pod);\n return at === undefined ? null : sec(at - fault);\n });\n const missing = times.filter((each) => each === null).length;\n const off = times.filter((each): each is number => each !== null && !inBand(each, band));\n const known = times.filter((each): each is number => each !== null).sort((a, b) => a - b);\n const ok = missing === 0 && off.length === 0;\n return done(ok, ok ? `each replica received SIGTERM, at ${known.join(\", \")} s` : `${missing} replicas without SIGTERM, ${off.length} outside the band (${known.join(\", \")} s)`, known.length === 0 ? null : middle(known), { signals: times.map(time) });\n }\n case \"stays\": {\n const fault = run.acts.fault;\n if (fault === null) return done(false, \"the run has no fault stamp\", null);\n const until = run.end;\n const dropped = run.replicas.filter((replica) => {\n const at = sliceDropOf(lines, SERVER, replica.ip, fault);\n return at !== null && at <= until;\n });\n const refused = failures.filter((request) => request.o === \"refused\" && request.t >= fault);\n const problems: string[] = [];\n if (dropped.length > 0) problems.push(`${dropped.length} replicas left the EndpointSlice`);\n if (refused.length > 0) problems.push(`${refused.length} requests were refused`);\n return done(problems.length === 0, problems.length === 0 ? `the replicas stayed ready, ${failures.length} requests failed by their dependency` : problems.join(\"; \"), failures.length);\n }\n case \"stalls\": {\n const fault = run.acts.fault;\n const heal = run.acts.heal;\n if (fault === null || heal === null) return done(false, \"the run has no fault or heal stamp\", null);\n const old = new Set(run.replicas.map((replica) => replica.pod));\n // only the replicas of the service: the pod of Redis is not a part of the rollout\n const servers = podsOf(lines).filter((pod) => pod.labels[\"app\"] === SERVER);\n const pods = servers.filter((pod) => pod.t >= fault && pod.t <= heal);\n const deleted = pods.filter((pod) => old.has(pod.name) && pod.del);\n const newReady = pods.filter((pod) => !old.has(pod.name) && pod.ready);\n const after = servers.filter((pod) => pod.t > heal);\n const firstReady = after.find((pod) => !old.has(pod.name) && pod.ready);\n const finished = firstReady !== undefined && after.some((pod) => old.has(pod.name) && pod.type === \"DELETED\");\n const problems: string[] = [];\n if (deleted.length > 0) problems.push(`${new Set(deleted.map((pod) => pod.name)).size} old pods were deleted while Redis was down`);\n if (newReady.length > 0) problems.push(\"a new pod became ready while Redis was down\");\n if (!finished) problems.push(\"the rollout did not continue after Redis came back\");\n if (problems.length === 0)\n return done(true, `the rollout waited for Redis, and its first new pod was ready ${sec(firstReady!.t - heal)} s after Redis came back`, sec(firstReady!.t - heal));\n return done(false, problems.join(\"; \"), null);\n }\n case \"ends\":\n return checkEnds(cell, run, prediction, done);\n case \"measured\":\n return done(true, \"measured\", facts.failures);\n }\n};\n\n/**\n * This function judges a run against a prediction `ends`. Each client with an answer before the\n * reference is a client of the run. Its socket is the port of that answer (`lp`).\n * - With a band, the first close of a socket of each client after the reference must be in the band\n * ± δ. It must be the close of that socket. The main value is the middle of these times.\n * - With no band, no socket of a client can close after the reference. The first request of each client\n * after the heal must be `ok` on that socket. The main value is the count of the closes.\n *\n * With a window, the failed requests of the run must also agree with that window (`checkRun`). A\n * prediction of the tunnels (`of: \"tunnel\"`) has its own judge (`checkTunnels`).\n */\nconst checkEnds = (\n cell: KindCell,\n run: KindRun,\n prediction: Extract<Prediction, { readonly kind: \"ends\" }>,\n done: (ok: boolean, why: string, value: number | null, more?: Partial<RunFacts>) => RunCheck,\n): RunCheck => {\n const from = referenceOf(run, prediction.from);\n if (from === null) return done(false, `the run has no ${prediction.from} reference`, null);\n if (prediction.of === \"tunnel\") return checkTunnels(run, prediction, from, done);\n const lines = run.lines as readonly Line[];\n const calls = requestsOf(lines)\n .filter((request) => request.t >= run.start && request.t <= run.end)\n .sort((a, b) => a.t - b.t);\n // each client of the run, with its last answer before the reference\n const last = new Map<string, Request>();\n for (const request of calls) if (request.t < from && request.o === \"ok\") last.set(request.p, request);\n if (last.size === 0) return done(false, `no client had an answer before the ${prediction.from}`, null);\n const clients = [...last.keys()].sort();\n const shut = socketsOf(lines).filter((line) => line.what === \"close\" && line.t >= from && line.t <= run.end);\n const closes: Record<string, Quantity | null> = {};\n const times: number[] = [];\n const problems: string[] = [];\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n closes[client] = close === undefined ? null : seconds(sec(close.t - from));\n if (close !== undefined) times.push(sec(close.t - from));\n }\n let agrees: string;\n let value: number | null;\n if (prediction.band !== null) {\n const band = secondsOf(prediction.band);\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n const port = last.get(client)!.lp ?? null;\n if (close === undefined) problems.push(`the socket of ${client} did not end`);\n else if (port !== null && close.lp !== null && close.lp !== port) problems.push(`the first socket of ${client} to end had the port ${close.lp}, not the port ${port} of its last answer`);\n else if (!inBand(sec(close.t - from), band)) problems.push(`the socket of ${client} ended at ${sec(close.t - from)} s`);\n }\n const sorted = [...times].sort((a, b) => a - b);\n value = sorted.length === 0 ? null : middle(sorted);\n agrees = `the socket of each of ${clients.length} clients ended, at ${sorted.join(\", \")} s`;\n } else {\n for (const client of clients) {\n const close = shut.find((line) => line.p === client);\n if (close !== undefined) problems.push(`the socket of ${client} ended ${sec(close.t - from)} s after the ${prediction.from}`);\n }\n // the first call after the heal goes on the socket of the last answer before the reference\n const resumed = run.acts.heal ?? from;\n for (const client of clients) {\n const port = last.get(client)!.lp ?? null;\n const next = calls.find((request) => request.p === client && request.t >= resumed);\n if (next === undefined) problems.push(`${client} sent no call after the heal`);\n else if (next.o !== \"ok\") problems.push(`the first call of ${client} after the heal ended ${next.o}`);\n else if ((next.lp ?? null) !== port) problems.push(`the first call of ${client} after the heal went on the port ${next.lp ?? \"none\"}, not ${port ?? \"none\"}`);\n }\n value = times.length;\n agrees = `no socket of ${clients.length} clients ended, and the first call of each one after the heal went on its socket`;\n }\n const inner = prediction.window === undefined ? null : checkRun({ ...cell, prediction: prediction.window }, run);\n if (inner !== null && !inner.ok) problems.push(inner.why);\n const why = problems.length > 0 ? problems.join(\"; \") : inner === null ? agrees : `${agrees}; ${inner.why}`;\n const checked = done(problems.length === 0, why, value, { ...(inner === null ? {} : inner.facts), closes });\n return inner?.tail === undefined ? checked : { ...checked, tail: inner.tail };\n};\n\n/**\n * This function judges a run against a prediction `ends` of the tunnels (`of: \"tunnel\"`). Each client\n * with an answer before the reference is a client of the run. Its tunnel is the HBONE connection of\n * its ztunnel. The tunnel goes from the address of its pod to the HBONE port of the replica of its\n * last answer before the heal. The address of the pod is the local address of a socket of the client\n * in the run (`la`).\n * - The first change of the tunnel out of ESTABLISHED after the reference must be in the band ± δ.\n * It must be to FIN_WAIT1: the side of the client closes the tunnel, and the peer does not close first.\n * - With `answer`, a change to CLOSE_WAIT in that band ± δ also agrees. The peer closed first, but as\n * an answer to the close of the client.\n * - The first request of each client after the heal must succeed. The main value is the middle of the ends.\n */\nconst checkTunnels = (\n run: KindRun,\n prediction: Extract<Prediction, { readonly kind: \"ends\" }>,\n from: number,\n done: (ok: boolean, why: string, value: number | null, more?: Partial<RunFacts>) => RunCheck,\n): RunCheck => {\n if (prediction.band === null) return done(false, \"a prediction of the tunnels needs a band\", null);\n const heal = run.acts.heal;\n if (heal === null) return done(false, \"the run has no heal\", null);\n const lines = run.lines as readonly Line[];\n const calls = requestsOf(lines)\n .filter((request) => request.t >= run.start && request.t <= run.end)\n .sort((a, b) => a.t - b.t);\n const clients = [...new Set(calls.filter((request) => request.t < from && request.o === \"ok\").map((request) => request.p))].sort();\n if (clients.length === 0) return done(false, `no client had an answer before the ${prediction.from}`, null);\n const band = secondsOf(prediction.band);\n const reply = prediction.answer === undefined ? null : secondsOf(prediction.answer);\n const tunnels = tunnelsOf(lines).filter((line) => line.t >= from && line.t <= run.end);\n const sockets = socketsOf(lines);\n const closes: Record<string, Quantity | null> = {};\n const times: number[] = [];\n const problems: string[] = [];\n for (const client of clients) {\n closes[client] = null;\n const answer = calls.filter((request) => request.p === client && request.t < heal && request.o === \"ok\").at(-1);\n const replica = run.replicas.find((each) => answer !== undefined && each.pod === answer.b);\n const address = sockets.find((line) => line.p === client && typeof line.la === \"string\" && line.la !== \"\")?.la;\n if (replica === undefined) {\n problems.push(`no replica of the run answered ${client} before the heal`);\n continue;\n }\n if (address === undefined || address === null) {\n problems.push(`no socket of ${client} gave the address of its pod`);\n continue;\n }\n const end = tunnels.find((line) => line.src.startsWith(`${address}:`) && line.dst === `${replica.ip}:${HBONE_PORT}` && line.old === TCP_STATE.established);\n if (end === undefined) {\n problems.push(`the tunnel of ${client} to ${replica.pod} did not end`);\n continue;\n }\n const at = sec(end.t - from);\n closes[client] = seconds(at);\n times.push(at);\n if (end.new === TCP_STATE.closeWait && reply !== null) {\n if (!inBand(at, reply)) problems.push(`the peer closed the tunnel of ${client} at ${at} s, outside the band of its answer`);\n } else if (end.new !== TCP_STATE.finWait1) problems.push(`the tunnel of ${client} went from ESTABLISHED to the state ${end.new}, not FIN_WAIT1: the peer closed first`);\n else if (!inBand(at, band)) problems.push(`the tunnel of ${client} ended at ${at} s`);\n const next = calls.find((request) => request.p === client && request.t >= heal);\n if (next === undefined) problems.push(`${client} sent no call after the heal`);\n else if (next.o !== \"ok\") problems.push(`the first call of ${client} after the heal ended ${next.o}`);\n }\n const sorted = [...times].sort((a, b) => a - b);\n const why =\n problems.length > 0\n ? problems.join(\"; \")\n : `the side of the client ended the tunnel of each of ${clients.length} clients, at ${sorted.join(\", \")} s, and the first call of each one after the heal succeeded`;\n return done(problems.length === 0, why, sorted.length === 0 ? null : middle(sorted), { closes });\n};\n\n/** This function judges a cell on its runs: each counted run must agree, and a median in a band must be equivalent to it. */\nexport const judgeKind = (cell: KindCell, runs: readonly KindRun[]): KindVerdict => {\n const counted = runs.filter((run) => !run.warmup && run.void === null);\n const voided = runs.filter((run) => !run.warmup && run.void !== null).length;\n const checks = counted.map((run) => checkRun(cell, run));\n // the main values of one cell share the unit of its prediction\n const values = checks.flatMap((check) => (check.value === null ? [] : [check.value.value])).sort((a, b) => a - b);\n const median: Quantity | null = values.length === 0 ? null : { value: middle(values), unit: unitOf(cell.prediction) };\n const failed = checks.filter((check) => !check.ok).length;\n if (counted.length === 0) return { decision: \"void\", counted: 0, voided, failed: 0, median: null, why: \"no counted run\", checks };\n if (cell.calibrates) return { decision: \"calibration\", counted: counted.length, voided, failed, median, why: \"a calibration of the propagation\", checks };\n if (cell.prediction.kind === \"measured\") return { decision: \"measured\", counted: counted.length, voided, failed: 0, median, why: cell.prediction.why, checks };\n const prediction = cell.prediction;\n const band = prediction.kind === \"removal\" || prediction.kind === \"leaves\" || prediction.kind === \"restarts\" || prediction.kind === \"ends\" ? prediction.band : null;\n if (failed > 0) {\n const first = checks.find((check) => !check.ok)!;\n return { decision: \"fails\", counted: counted.length, voided, failed, median, why: `${failed} of ${counted.length} runs disagree, the first: ${first.why}`, checks };\n }\n // a run past its calibrated band agrees with the law, but the band is short: the cell needs a longer one\n const tails = checks.filter((check) => check.tail !== undefined);\n if (tails.length > 0)\n return { decision: \"extend\", counted: counted.length, voided, failed, median, why: `${tails.length} of ${counted.length} runs are past the calibrated band, the first: ${tails[0]!.tail}`, checks };\n if (band !== null && values.length > 0) {\n const ends = secondsOf(band);\n const [from, to] = medianInterval(values);\n const wide = { lo: ends.lo * (1 - RELATIVE), hi: ends.hi * (1 + RELATIVE) };\n if (to < wide.lo || from > wide.hi)\n return { decision: \"fails\", counted: counted.length, voided, failed, median, why: `the median interval [${from}, ${to}] s is outside the band`, checks };\n if (from < wide.lo || to > wide.hi)\n return { decision: \"extend\", counted: counted.length, voided, failed, median, why: `the median interval [${from}, ${to}] s crosses the edge of the band`, checks };\n }\n return { decision: \"holds\", counted: counted.length, voided, failed, median, why: `${counted.length} of ${counted.length} runs agree`, checks };\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { seconds } from \"./bands.ts\";\nimport type { Band, KindCell, KindRun, Prediction, Trigger, WindowPrediction } from \"./cell.ts\";\nimport type { KindScenario } from \"./scenario.ts\";\nimport type { KindVerdict, Propagated, RunCheck, RunFacts } from \"./verdict.ts\";\nimport { judgeKind, unitOf } from \"./verdict.ts\";\n\n/**\n * This module is the raw record of a kind cell: its formats, and the upgrade from the format `/1`\n * to the format `/2`. The lab writes `/2`, and it does not write `/1` again. A reader reads a record\n * of `/1` through `upgrade`, and the meaning of each value stays the same.\n */\n\n/** This format is the format that the lab writes. Each amount in it is a quantity. */\nexport const FORMAT = \"systems.kind-cell-record/2\";\n/** This format is the first format. Its bands, its medians and its times are numbers. */\nexport const FORMAT_V1 = \"systems.kind-cell-record/1\";\n\n/** A load sample is what the VM did in 4 s before a run: when (a stamp of the wall clock in milliseconds), its idle share, and its busiest processes. */\nexport interface LoadSample {\n readonly t: number;\n readonly idle: number;\n readonly top: readonly string[];\n readonly foreign: readonly string[];\n}\n\n/** A cluster manifest is what a run records about its cluster: the versions, the images, the nodes and the mode as read back. */\nexport interface ClusterManifest {\n readonly kind: string;\n readonly nodeImage: string;\n readonly server: string;\n readonly mode: string;\n readonly docker: string;\n readonly nodes: ReadonlyArray<{\n readonly name: string;\n readonly kubelet: string;\n readonly kernel: string;\n readonly runtime: string;\n readonly os: string;\n }>;\n}\n\n/** An environment manifest is one cluster of a cell: its scenario, what the cluster was, and the images of the lab. */\nexport interface EnvironmentManifest {\n readonly env: number;\n readonly scenario: KindScenario;\n readonly cluster: ClusterManifest;\n readonly images: Readonly<Record<string, string>>;\n}\n\n/**\n * A kind cell result is a cell, its runs over its environments, the manifest of each environment,\n * and its verdict. The parameter `A` is the form of an amount.\n */\nexport interface KindCellResult<A = Quantity> {\n readonly cell: KindCell<A>;\n readonly runs: readonly KindRun[];\n readonly manifests: readonly EnvironmentManifest[];\n readonly loads: readonly LoadSample[];\n readonly verdict: KindVerdict<A>;\n /** This text is the time of the verdict, in ISO 8601. */\n readonly at: string;\n}\n\n/** A kind cell record is the raw record of a cell in the format `/2`: a result with its format. */\nexport interface KindCellRecord extends KindCellResult {\n readonly format: typeof FORMAT;\n}\n\n/** A kind cell record of the format `/1` gives each band, median, main value and time of a fact as a number. */\nexport interface KindCellRecordV1 extends KindCellResult<number> {\n readonly format: typeof FORMAT_V1;\n}\n\n/** These are the parts of the format `/1`, with numbers for amounts. */\nexport type BandV1 = Band<number>;\nexport type PredictionV1 = Prediction<number>;\nexport type TriggerV1 = Trigger<number>;\nexport type KindCellV1 = KindCell<number>;\nexport type KindVerdictV1 = KindVerdict<number>;\nexport type RunCheckV1 = RunCheck<number>;\nexport type RunFactsV1 = RunFacts<number>;\n\nconst time = (value: number | null): Quantity | null => (value === null ? null : seconds(value));\nconst band = (old: BandV1): Band => ({ lo: seconds(old.lo), hi: seconds(old.hi) });\n/** The format `/1` gives each part of `cpu.max` in microseconds. */\nconst microseconds = (value: number): Quantity => ({ value, unit: \"us\" });\n\nconst upgradeTrigger = (trigger: TriggerV1): Trigger => {\n const { cpuMax, ...rest } = trigger;\n return cpuMax === undefined ? rest : { ...rest, cpuMax: { quota: microseconds(cpuMax.quota), period: microseconds(cpuMax.period) } };\n};\n\nconst upgradeWindow = (window: WindowPrediction<number>): WindowPrediction => {\n const { afterReset, propagation, ...rest } = window;\n return {\n ...rest,\n start: { from: window.start.from, band: band(window.start.band) },\n end: window.end === null ? null : { from: window.end.from, band: band(window.end.band) },\n ...(afterReset === undefined ? {} : { afterReset: { life: seconds(afterReset.life), outcome: afterReset.outcome } }),\n ...(propagation === undefined ? {} : { propagation: band(propagation) }),\n };\n};\n\nconst upgradePrediction = (prediction: PredictionV1): Prediction => {\n switch (prediction.kind) {\n case \"window\":\n return upgradeWindow(prediction);\n // the format /1 has no prediction `ends`, but its type does\n case \"ends\": {\n const { window, answer, ...rest } = prediction;\n return {\n ...rest,\n band: prediction.band === null ? null : band(prediction.band),\n ...(window === undefined ? {} : { window: upgradeWindow(window) }),\n ...(answer === undefined ? {} : { answer: band(answer) }),\n };\n }\n case \"removal\":\n return { ...prediction, band: band(prediction.band) };\n // the format /1 has no window on `leaves`, but its type does\n case \"leaves\": {\n const { window, ...rest } = prediction;\n return { ...rest, band: band(prediction.band), ...(window === undefined ? {} : { window: upgradeWindow(window) }) };\n }\n case \"restarts\":\n return { ...prediction, band: prediction.band === null ? null : band(prediction.band) };\n default:\n return prediction;\n }\n};\n\n/** This function gives a cell of the format `/1` in the format `/2`: its bands in seconds, and its `cpu.max` in microseconds. */\nexport const upgradeCell = (cell: KindCellV1): KindCell => ({\n ...cell,\n trigger: upgradeTrigger(cell.trigger),\n prediction: upgradePrediction(cell.prediction),\n});\n\nconst upgradeFacts = (facts: RunFactsV1): RunFacts => {\n const propagated = (old: Propagated<number> | null): Propagated | null => (old === null ? null : { after: time(old.after), by: seconds(old.by) });\n const byKey = (record: Readonly<Record<string, Propagated<number> | null>>) => Object.fromEntries(Object.entries(record).map(([key, old]) => [key, propagated(old)]));\n const { sliceEmpty, rules, left, signals, updates, healUpdates, closes, ...rest } = facts;\n return {\n ...rest,\n intakeAfterDeletion: time(facts.intakeAfterDeletion),\n sliceAfter: time(facts.sliceAfter),\n propagation: byKey(facts.propagation),\n ...(updates === undefined ? {} : { updates: byKey(updates) }),\n ...(healUpdates === undefined ? {} : { healUpdates: byKey(healUpdates) }),\n ...(sliceEmpty === undefined ? {} : { sliceEmpty: seconds(sliceEmpty) }),\n ...(rules === undefined ? {} : { rules: Object.fromEntries(Object.entries(rules).map(([node, old]) => [node, time(old)])) }),\n ...(left === undefined ? {} : { left: seconds(left) }),\n ...(signals === undefined ? {} : { signals: signals.map((old) => time(old)) }),\n ...(closes === undefined ? {} : { closes: Object.fromEntries(Object.entries(closes).map(([client, old]) => [client, time(old)])) }),\n };\n};\n\n/**\n * This function gives a record in the format `/2`. A record of `/2` comes back as it is. A record\n * of `/1` gets each amount as a quantity, and each value stays the same:\n * - Each band and each time of a fact is in seconds, as `/1` gives it.\n * - The `cpu.max` of a throttle is in microseconds, as `/1` gives it.\n * - The median and the main value of each run get the unit of the prediction (`unitOf`): seconds,\n * failed requests (`{request}`) or replicas (`{replica}`).\n */\nexport const upgrade = (record: KindCellRecordV1 | KindCellRecord): KindCellRecord => {\n if (record.format === FORMAT) return record;\n const unit = unitOf(record.cell.prediction);\n const amount = (value: number | null): Quantity | null => (value === null ? null : { value, unit });\n const verdict = record.verdict;\n return {\n format: FORMAT,\n cell: upgradeCell(record.cell),\n runs: record.runs,\n manifests: record.manifests,\n loads: record.loads,\n verdict: {\n ...verdict,\n median: amount(verdict.median),\n checks: verdict.checks.map((check) => ({ ...check, value: amount(check.value), facts: upgradeFacts(check.facts) })),\n },\n at: record.at,\n };\n};\n\n/**\n * This function judges a record again, from its cell and its runs, with the judge of this version.\n * It reads a record of `/1` through `upgrade`. The verdict is in the format `/2`.\n */\nexport const judge = (record: KindCellRecordV1 | KindCellRecord): KindVerdict => {\n const current = upgrade(record);\n return judgeKind(current.cell, current.runs);\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { format, valueIn } from \"@mark1russell7/quantity\";\nimport { seconds, secondsOf, showBand } from \"./bands.ts\";\nimport type { Band, KindCell, KindRun, Prediction } from \"./cell.ts\";\nimport { quantileOf } from \"./stats.ts\";\nimport type { KindVerdict } from \"./verdict.ts\";\nimport { factsOf, propagationOf, propagationSource, referenceOf, updatesOf } from \"./verdict.ts\";\n\n/** A judged cell is a cell, its runs and its verdict: the part of a result that a report reads. */\nexport interface Judged {\n readonly cell: KindCell;\n readonly runs: readonly KindRun[];\n readonly verdict: KindVerdict;\n}\n\n/** A spread is the count, the extremes, the median and the 99th percentile of a set of times. */\nexport interface TimeSpread {\n readonly count: number;\n readonly min: Quantity;\n readonly median: Quantity;\n readonly p99: Quantity;\n readonly max: Quantity;\n}\n\n/** This function gives the spread of a set of times, or null for none. The percentile is by nearest rank. */\nexport const timeSpread = (times: readonly Quantity[]): TimeSpread | null => {\n if (times.length === 0) return null;\n const sorted = times.map((each) => valueIn(each, \"s\")).sort((a, b) => a - b);\n const half = Math.floor(sorted.length / 2);\n const median = sorted.length % 2 === 1 ? sorted[half]! : (sorted[half - 1]! + sorted[half]!) / 2;\n return {\n count: sorted.length,\n min: seconds(sorted[0]!),\n median: seconds(Math.round(median * 1000) / 1000),\n p99: seconds(quantileOf(sorted, 0.99)),\n max: seconds(sorted.at(-1)!),\n };\n};\n\n/** This function gives a reference with its band, and only the reference when the band is [0, 0] s. */\nconst atBand = (from: string, band: Band): string => {\n const { lo, hi } = secondsOf(band);\n return lo === 0 && hi === 0 ? `the ${from}` : `the ${from} + ${showBand(band)}`;\n};\n\n/** This function gives the prediction of a cell in a short form for a table. A prediction `ends` gives its window after its band. */\nexport const predictionText = (prediction: Prediction): string => {\n switch (prediction.kind) {\n case \"none\":\n return prediction.outcomes === undefined ? \"no failure\" : `no ${prediction.outcomes.join(\", \")}`;\n case \"window\":\n // a window with `each` is a window for each replica that got a deletion, from the references of that replica.\n // A window can open before its reference: a stale SYN_SENT entry fails the paused node up to its life before the intake\n return `failures only from ${atBand(prediction.start.from, prediction.start.band)}${prediction.end === null ? \"\" : ` to ${atBand(prediction.end.from, prediction.end.band)}`}${prediction.each === true ? \", of each deleted replica\" : \"\"}${prediction.nodes === \"paused\" ? \", on the paused node\" : \"\"}${prediction.certain ? \", at least one\" : \"\"}${prediction.outcomes === undefined ? \"\" : `, each one ${prediction.outcomes.join(\" or \")}`}${prediction.afterReset === undefined ? \"\" : `, or a ${prediction.afterReset.outcome} up to ${format(prediction.afterReset.life)} after a reset on its port`}${prediction.propagation === undefined ? \"\" : `, the rules drop the replica in ${showBand(prediction.propagation)}`}`;\n case \"removal\":\n return `Service empty in ${showBand(prediction.band)}`;\n case \"leaves\":\n return `the replica leaves in ${showBand(prediction.band)}${prediction.window === undefined ? \"\" : `; ${predictionText(prediction.window)}`}`;\n case \"restarts\":\n return prediction.band === null ? \"no restart\" : `each replica SIGTERM in ${showBand(prediction.band)}`;\n case \"stays\":\n return \"stays ready, no refusal\";\n case \"stalls\":\n return \"the rollout waits for Redis\";\n case \"ends\": {\n const closes =\n prediction.band === null\n ? \"no socket of a client ends, and each one calls again on its socket\"\n : prediction.of === \"tunnel\"\n ? `the side of the client ends the tunnel of each client in ${atBand(prediction.from, prediction.band)}${prediction.answer === undefined ? \"\" : `, or the peer answers in ${atBand(prediction.from, prediction.answer)}`}, and each one calls again`\n : `the socket of each client ends in ${atBand(prediction.from, prediction.band)}`;\n return prediction.window === undefined ? closes : `${closes}; ${predictionText(prediction.window)}`;\n }\n case \"measured\":\n return \"measured\";\n }\n};\n\n/**\n * This function gives the main measurement of a cell in a short form: its median and what it\n * counts. For failed requests, it is the middle count of the counted runs.\n */\nexport const medianText = (judged: Judged): string => {\n const { cell, verdict } = judged;\n if (verdict.median === null) return \"\";\n if (verdict.median.unit === \"{request}\") {\n const counted = judged.runs.filter((run) => !run.warmup && run.void === null);\n const failures = counted.map((run) => factsOf(cell, run).failures).sort((a, b) => a - b);\n return `${failures.length === 0 ? 0 : failures[Math.floor(failures.length / 2)]} failed requests`;\n }\n return format(verdict.median, { digits: 4 });\n};\n\n/** This function gives the table of the cells in Markdown. Each row has the cell, its plan cell, its mode, its trigger, the prediction, the verdict, its runs and its median. */\nexport const cellsTable = (judged: readonly Judged[]): string =>\n [\n \"| Cell | Plan id | Mode | Trigger | Prediction | Verdict | Runs | Median |\",\n \"| --- | --- | --- | --- | --- | --- | --- | --- |\",\n ...judged.map((each) => {\n const { cell, verdict } = each;\n const runs = verdict.voided === 0 ? `${verdict.counted}` : `${verdict.counted} (+${verdict.voided} void)`;\n return `| ${cell.name} | ${cell.id} | ${cell.mode} | ${cell.trigger.kind} | ${predictionText(cell.prediction)} | ${verdict.decision} | ${runs} | ${medianText(each)} |`;\n }),\n ].join(\"\\n\");\n\n/**\n * This function gives the propagation of each calibration, by node. It is the time from the\n * deletion to the poll of the rules of each node without the pod. It also gives the time to the\n * EndpointSlice and to the stop of the intake.\n *\n * For a policy of Istio, the propagation is the LDS update of each server sidecar after the apply,\n * by node (`updatesOf`). Then `heal` is the update after the delete of the policy. `slice` and\n * `intake` are null.\n */\nexport const calibrationOf = (judged: Judged): {\n readonly nodes: Readonly<Record<string, TimeSpread | null>>;\n readonly all: TimeSpread | null;\n readonly slice: TimeSpread | null;\n readonly intake: TimeSpread | null;\n readonly heal?: TimeSpread | null | undefined;\n} => {\n const byNode: Record<string, Quantity[]> = {};\n const slice: Quantity[] = [];\n const intake: Quantity[] = [];\n const counted = judged.runs.filter((each) => !each.warmup && each.void === null);\n if (judged.cell.trigger.kind === \"authorization-policy\") {\n const heal: Quantity[] = [];\n for (const run of counted) {\n const nodeOf = (pod: string): string => run.replicas.find((replica) => replica.pod === pod)?.node ?? pod;\n for (const [pod, update] of Object.entries(updatesOf(run, run.acts.fault))) if (update !== null) (byNode[nodeOf(pod)] ??= []).push(update.by);\n for (const update of Object.values(updatesOf(run, run.acts.heal))) if (update !== null) heal.push(update.by);\n }\n const nodes = Object.fromEntries(Object.entries(byNode).map(([node, values]) => [node, timeSpread(values)]));\n return { nodes, all: timeSpread(Object.values(byNode).flat()), slice: null, intake: null, heal: timeSpread(heal) };\n }\n for (const run of counted) {\n const deletion = referenceOf(run, \"deletion\");\n for (const [node, drop] of Object.entries(propagationOf(run, deletion, undefined, propagationSource(judged.cell)))) if (drop !== null) (byNode[node] ??= []).push(drop.by);\n const facts = factsOf(judged.cell, run);\n if (facts.sliceAfter !== null) slice.push(facts.sliceAfter);\n if (facts.intakeAfterDeletion !== null) intake.push(facts.intakeAfterDeletion);\n }\n const nodes = Object.fromEntries(Object.entries(byNode).map(([node, values]) => [node, timeSpread(values)]));\n return { nodes, all: timeSpread(Object.values(byNode).flat()), slice: timeSpread(slice), intake: timeSpread(intake) };\n};\n","import type { Quantity } from \"@mark1russell7/quantity\";\nimport { extentSchema, quantitySchema } from \"@mark1russell7/quantity/schema\";\nimport type { Stage } from \"@mark1russell7/service\";\nimport { z } from \"zod\";\nimport type { EdgeProtocol, KindRun, TriggerKind } from \"./cell.ts\";\nimport type { KindCellRecord, KindCellRecordV1 } from \"./record.ts\";\nimport { FORMAT, FORMAT_V1, upgrade } from \"./record.ts\";\nimport type { KubeProxyMode } from \"./scenario.ts\";\nimport { unitOf } from \"./verdict.ts\";\n\n/**\n * This module holds the zod schemas of a kind cell record, in the formats `/1` and `/2`. It names\n * the stages of the shutdown itself, thus it does not load the service. A test holds the names to\n * the service.\n */\n\n/** These are the stages of the shutdown of the service, in their sequence. */\nexport const STAGES: readonly [Stage, ...Stage[]] = [\n \"fail readiness\",\n \"stop intake\",\n \"drain\",\n \"close transports\",\n \"stop the poller\",\n \"tear down dependencies\",\n \"close the health server\",\n \"flush the output\",\n];\n\nconst TRIGGERS = [\n \"pod-deletion\",\n \"rolling-update\",\n \"node-drain\",\n \"scale-in\",\n \"crash\",\n \"liveness-restart\",\n \"freeze-process\",\n \"rst\",\n \"blackhole\",\n \"peer-gone-without-close\",\n \"app-stall\",\n \"rollout\",\n \"cpu-throttle\",\n \"authorization-policy\",\n \"idle\",\n \"ztunnel-restart\",\n \"certificate-expiry\",\n \"cannot-serve\",\n] as const satisfies readonly TriggerKind[];\nconst MODES = [\"iptables\", \"ipvs\", \"nftables\"] as const satisfies readonly KubeProxyMode[];\n\nconst time = quantitySchema(\"time\");\nconst extent = extentSchema(\"time\");\nconst count = z.number().int().nonnegative();\nconst gate = z.enum([\"readiness\", \"liveness\"]);\nconst reference = z.enum([\"deletion\", \"intake\", \"fault\", \"resume\", \"heal\", \"restart\"]);\n\nconst probe = z.object({ period: time, threshold: count, timeout: time });\nconst timing = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"debounce\"), interval: time, failAfter: count, recoverAfter: count }),\n z.object({ type: z.literal(\"window\"), failAfter: time, recoverAfter: time.optional() }),\n]);\nconst knobs = z.object({\n connect_bound: time,\n request_timeout: time,\n driver_writeoff_time: extent,\n keepalive_idle: extent,\n heartbeat_interval: extent,\n heartbeat_timeout: time,\n client_retry_window: extent,\n retry_base: time,\n retry_cap: time,\n close_bound: time,\n max_connection_age: extent,\n retrans_giveup_time: extent,\n});\nconst declaration = z.object({\n poll: z.object({ interval: time, jitter: z.number().min(0).lt(1), timeout: time }),\n readiness: timing,\n liveness: timing,\n startup: time,\n phases: z.array(z.tuple([z.enum(STAGES), time])),\n cooperativeWindow: extent,\n couplings: z.array(z.object({ from: gate, to: gate, effect: z.literal(\"fails\") })),\n redis: z.object({ gates: gate.nullable(), knobs, misses: count }).nullable(),\n flag: gate.nullable(),\n watchdog: z.object({ tick: time, threshold: time }).nullable(),\n lameDuck: z.boolean().optional(),\n protocol: z.enum([\"http/1.1\", \"h2c\"] as const satisfies readonly EdgeProtocol[]).optional(),\n});\n\nconst replica = z.object({ pod: z.string(), node: z.string(), ip: z.string(), version: z.string() });\n/** A line keeps each field that its source wrote. The judge reads `ev`, `t` and the fields of its kind. */\nconst line = z.object({ ev: z.string(), t: z.number() }).catchall(z.unknown());\nconst run: z.ZodType<KindRun> = z.object({\n env: count,\n index: z.number().int(),\n warmup: z.boolean(),\n start: z.number(),\n end: z.number(),\n acts: z.object({ fault: z.number().nullable(), heal: z.number().nullable(), resume: z.number().nullable() }),\n target: replica.nullable(),\n paused: z.string().nullable(),\n replicas: z.array(replica),\n void: z.string().nullable(),\n lines: z.array(line),\n dropped: z.record(z.string(), count),\n notes: z.array(z.string()).optional(),\n});\nconst manifest = z.object({\n env: count,\n scenario: z.object({\n name: z.string(),\n kubernetes: z.string(),\n workers: count,\n kubeProxy: z.object({ mode: z.enum(MODES), minSyncPeriod: time, syncPeriod: time }),\n cni: z.literal(\"kindnet\"),\n podSubnet: z.string(),\n serviceSubnet: z.string(),\n }),\n cluster: z.object({\n kind: z.string(),\n nodeImage: z.string(),\n server: z.string(),\n mode: z.string(),\n docker: z.string(),\n nodes: z.array(z.object({ name: z.string(), kubelet: z.string(), kernel: z.string(), runtime: z.string(), os: z.string() })),\n }),\n images: z.record(z.string(), z.string()),\n});\nconst load = z.object({ t: z.number(), idle: z.number(), top: z.array(z.string()), foreign: z.array(z.string()) });\n\n/**\n * This function gives the schema of a record whose amounts have one form. The schema `a` is for a\n * time. The schema `main` is for the main value of a run: a time or a count.\n */\nconst recordOf = <A>(a: z.ZodType<A>, main: z.ZodType<A>) => {\n const band = z.object({ lo: a, hi: a });\n const window = z.object({\n kind: z.literal(\"window\"),\n nodes: z.enum([\"all\", \"paused\"]),\n start: z.object({ from: reference, band }),\n end: z.object({ from: reference, band }).nullable(),\n certain: z.boolean(),\n afterReset: z.object({ life: a, outcome: z.string() }).optional(),\n each: z.boolean().optional(),\n propagation: band.optional(),\n outcomes: z.array(z.string()).optional(),\n why: z.string(),\n });\n const prediction = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"none\"), outcomes: z.array(z.string()).optional(), why: z.string() }),\n window,\n z.object({ kind: z.literal(\"removal\"), band, why: z.string() }),\n z.object({ kind: z.literal(\"leaves\"), band, window: window.optional(), why: z.string() }),\n z.object({ kind: z.literal(\"restarts\"), band: band.nullable(), why: z.string() }),\n z.object({ kind: z.literal(\"stays\"), why: z.string() }),\n z.object({ kind: z.literal(\"stalls\"), why: z.string() }),\n z.object({ kind: z.literal(\"ends\"), from: reference, band: band.nullable(), window: window.optional(), of: z.enum([\"socket\", \"tunnel\"]).optional(), answer: band.optional(), why: z.string() }),\n z.object({ kind: z.literal(\"measured\"), why: z.string() }),\n ]);\n const cell = z.object({\n id: z.string(),\n name: z.string(),\n template: z.enum([\"T07\", \"T15\", \"T18\"]),\n stack: z.enum([\"service\", \"grpc\"]).optional(),\n mesh: z\n .object({ flavor: z.enum([\"sidecar\", \"ambient\"]), mode: z.enum([\"sidecar\", \"ambient\"]), ztunnel: z.record(z.string(), z.string()).optional() })\n .optional(),\n substitutes: z.string().nullable(),\n mode: z.enum(MODES),\n workers: count,\n trigger: z.object({\n kind: z.enum(TRIGGERS),\n hold: time.optional(),\n lead: time.optional(),\n cpuMax: z.object({ quota: a, period: a }).optional(),\n account: z.string().optional(),\n middlebox: time.optional(),\n retries: count.optional(),\n quiet: z.boolean().optional(),\n close: z.boolean().optional(),\n partition: z.boolean().optional(),\n serves: z.boolean().optional(),\n }),\n pod: z.object({ replicas: count, grace: time, preStop: time, readiness: probe, liveness: probe, startup: probe.nullable() }),\n declaration: declaration.nullable(),\n workload: z.object({\n every: time,\n timeout: time,\n connections: count.optional(),\n sessionCheck: z.object({ keepalive_time: extent, keepalive_timeout: time }).optional(),\n }),\n prediction,\n calibrates: z.boolean(),\n runs: count,\n });\n const facts = z.object({\n failures: count,\n outcomes: z.record(z.string(), count),\n byNode: z.record(z.string(), count),\n first: z.number().nullable(),\n last: z.number().nullable(),\n deletion: z.number().nullable(),\n intakeAfterDeletion: a.nullable(),\n sliceAfter: a.nullable(),\n propagation: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()),\n sliceEmpty: a.optional(),\n rules: z.record(z.string(), a.nullable()).optional(),\n left: a.optional(),\n signals: z.array(a.nullable()).optional(),\n deletions: z.array(z.object({ pod: z.string(), intake: z.number().nullable(), deletion: z.number() })).optional(),\n updates: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()).optional(),\n healUpdates: z.record(z.string(), z.object({ after: a.nullable(), by: a }).nullable()).optional(),\n closes: z.record(z.string(), a.nullable()).optional(),\n });\n const verdict = z.object({\n decision: z.enum([\"holds\", \"fails\", \"extend\", \"measured\", \"calibration\", \"void\"]),\n counted: count,\n voided: count,\n failed: count,\n median: main.nullable(),\n why: z.string(),\n checks: z.array(z.object({ ok: z.boolean(), why: z.string(), value: main.nullable(), facts, tail: z.string().optional() })),\n });\n return { cell, verdict, runs: z.array(run), manifests: z.array(manifest), loads: z.array(load), at: z.string() };\n};\n\nconst v2 = recordOf<Quantity>(time, quantitySchema([\"time\", \"count\"]));\nconst v1 = recordOf<number>(z.number(), z.number());\n\n/**\n * This schema accepts a record in the format `/2`. The median and the main value of each run must\n * have the unit of the prediction of the cell (`unitOf`).\n */\nexport const kindCellRecordSchema: z.ZodType<KindCellRecord> = z\n .object({ format: z.literal(FORMAT), ...v2 })\n .superRefine((record, ctx) => {\n const unit = unitOf(record.cell.prediction);\n const values = [record.verdict.median, ...record.verdict.checks.map((check) => check.value)];\n for (const value of values) {\n if (value !== null && value.unit !== unit)\n ctx.addIssue({ code: \"custom\", message: `the main value is in ${value.unit}, and the prediction ${record.cell.prediction.kind} gives ${unit}` });\n }\n });\n\n/** This schema accepts a record in the format `/1`. */\nexport const kindCellRecordV1Schema: z.ZodType<KindCellRecordV1> = z.object({ format: z.literal(FORMAT_V1), ...v1 });\n\n/** This function reads a record of either format from parsed JSON, and gives it in the format `/2`. */\nexport const readRecord = (data: unknown): KindCellRecord => {\n const format = typeof data === \"object\" && data !== null ? (data as { format?: unknown }).format : undefined;\n if (format === FORMAT_V1) return upgrade(kindCellRecordV1Schema.parse(data));\n if (format === FORMAT) return kindCellRecordSchema.parse(data);\n throw new Error(`a kind cell record has the format ${FORMAT} or ${FORMAT_V1}, not ${String(format)}`);\n};\n"],"mappings":";;;;;;AAOA,MAAa,WAAW,WAA6B;CAAE;CAAO,MAAM;AAAI;;AAGxE,MAAa,UAAU,IAAY,QAAsB;CAAE,IAAI,QAAQ,EAAE;CAAG,IAAI,QAAQ,EAAE;AAAE;;AAG5F,MAAa,aAAa,UAA8D;CACtF,IAAI,QAAQ,KAAK,IAAI,GAAG;CACxB,IAAI,QAAQ,KAAK,IAAI,GAAG;AAC1B;;AAGA,MAAa,YAAY,SAAuB;CAC9C,MAAM,EAAE,IAAI,OAAO,UAAU,IAAI;CACjC,OAAO,IAAI,GAAG,IAAI,GAAG;AACvB;;;;AClBA,MAAa,OAAO;AACpB,MAAa,cAAc;;AAE3B,MAAa,YAAY;;AAEzB,MAAa,SAAS;AACtB,MAAa,SAAS;AACtB,MAAa,QAAQ;;;;AC0GrB,MAAa,aAAa;;AAG1B,MAAa,YAAY;CAAE,aAAa;CAAG,UAAU;CAAG,WAAW;AAAE;;AAgBrE,MAAa,iBAAiB,WAC5B,OAAO,UAAU,WAAW,CAAC,OAAO,QAAQ,OAAO,MAAM,CAA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