@feigi/fleet-ctl 3.149.0 → 3.150.0
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/package.json +1 -1
- package/scripts/board-gather.mjs +91 -76
- package/scripts/board.html +46 -44
- package/scripts/compute-board.mjs +6 -5
- package/scripts/compute-cell-evidence.mjs +222 -316
- package/scripts/ticket-router.mjs +1 -1
package/package.json
CHANGED
package/scripts/board-gather.mjs
CHANGED
|
@@ -36,7 +36,6 @@ import { RECEIPT, RECEIPT_HELD, CLOSEOUT_RECEIPT, OBJECTIVES, isOmpSessionDirNam
|
|
|
36
36
|
import { lastSegment } from "./pull-attribution.mjs";
|
|
37
37
|
import { NAME, warnOnce, execRead } from "./board-common.mjs";
|
|
38
38
|
import { mergedReadPrs, issuesOfPrs } from "./compute-board.mjs";
|
|
39
|
-
import { repoIdentity } from "./compute-cell-evidence.mjs";
|
|
40
39
|
import { readCostGuard } from "./fleet-tick.mjs";
|
|
41
40
|
import { parseFrontmatter } from "./tier-roles.mjs";
|
|
42
41
|
import { isImplementer } from "./member-outcomes.mjs";
|
|
@@ -841,30 +840,15 @@ export function readCloseoutPr(stateDir) {
|
|
|
841
840
|
return { number: Number(number), at: typeof at === "string" ? at : null };
|
|
842
841
|
}
|
|
843
842
|
|
|
844
|
-
// The checkout's own router table, `plugin/scripts/router-table.json` under the
|
|
845
|
-
// workspace (the directory `stateDir` is in), as the installed one is read:
|
|
846
|
-
// `{ status: "ok", table }`, `{ status: "missing" }` (no such file: a consumer's
|
|
847
|
-
// checkout) or `{ status: "unreadable", why }`. Never warns: the installed
|
|
848
|
-
// table's read does, and a consumer is not at fault for lacking this file.
|
|
849
|
-
export function readCheckoutTable(stateDir) {
|
|
850
|
-
let text;
|
|
851
|
-
try {
|
|
852
|
-
text = readFileSync(join(dirname(stateDir), "plugin", "scripts", "router-table.json"), "utf8");
|
|
853
|
-
} catch (e) {
|
|
854
|
-
return e.code === "ENOENT" ? { status: "missing" } : { status: "unreadable", why: e.code ?? e.message };
|
|
855
|
-
}
|
|
856
|
-
let table;
|
|
857
|
-
try { table = validateTable(JSON.parse(text)); } catch { return { status: "unreadable", why: "not JSON" }; }
|
|
858
|
-
return table instanceof Error ? { status: "unreadable", why: table.message } : { status: "ok", table };
|
|
859
|
-
}
|
|
860
|
-
|
|
861
843
|
// The Fit metrics-refresh.mjs writes beside the guard,
|
|
862
844
|
// `.fleet/router-fit.json`: `{ status: "ok", fit }`, `{ status: "missing" }`
|
|
863
|
-
// or `{ status: "unreadable", why }`.
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
//
|
|
867
|
-
//
|
|
845
|
+
// or `{ status: "unreadable", why }`. It is read as `route` reads it
|
|
846
|
+
// (ticket-router.mjs's readFitBeside): the Fit is read whenever its `table`
|
|
847
|
+
// passes `validateTable`, so the tab never says the starting table routes while
|
|
848
|
+
// `route` routes by the Fit. The fields only the tab reads decide nothing:
|
|
849
|
+
// `computed_at` and `guard_computed_at` are null where they are no string and
|
|
850
|
+
// `tsv_blobs` null where it is no object, and the tab says each is not checked,
|
|
851
|
+
// as it says of an `n_rows` that is no count.
|
|
868
852
|
export function readFitFile(stateDir) {
|
|
869
853
|
let text;
|
|
870
854
|
try {
|
|
@@ -875,16 +859,10 @@ export function readFitFile(stateDir) {
|
|
|
875
859
|
let p;
|
|
876
860
|
try { p = JSON.parse(text); } catch { return { status: "unreadable", why: "not JSON" }; }
|
|
877
861
|
if (!isJsonObject(p)) return { status: "unreadable", why: "not a JSON object" };
|
|
878
|
-
for (const key of ["computed_at", "guard_computed_at"]) {
|
|
879
|
-
if (typeof p[key] !== "string") return { status: "unreadable", why: `\`${key}\` is not a string` };
|
|
880
|
-
}
|
|
881
|
-
for (const key of ["tsv_blobs", "prior"]) {
|
|
882
|
-
if (!isJsonObject(p[key])) return { status: "unreadable", why: `\`${key}\` is not an object` };
|
|
883
|
-
}
|
|
884
862
|
const table = validateTable(p.table);
|
|
885
863
|
if (table instanceof Error) return { status: "unreadable", why: table.message };
|
|
886
|
-
|
|
887
|
-
return { status: "ok", fit: { computed_at: p.computed_at, guard_computed_at: p.guard_computed_at, tsv_blobs: p.tsv_blobs
|
|
864
|
+
const stringOrNull = (v) => (typeof v === "string" ? v : null);
|
|
865
|
+
return { status: "ok", fit: { computed_at: stringOrNull(p.computed_at), guard_computed_at: stringOrNull(p.guard_computed_at), tsv_blobs: isJsonObject(p.tsv_blobs) ? p.tsv_blobs : null, table } };
|
|
888
866
|
}
|
|
889
867
|
|
|
890
868
|
// A receipt's `metrics` step, `{ status, at, output }`, or null: no receipt, one
|
|
@@ -923,29 +901,6 @@ export function readAgents(scriptDir) {
|
|
|
923
901
|
return { list, error: null };
|
|
924
902
|
}
|
|
925
903
|
|
|
926
|
-
// The install's own `package.json`, `../package.json` from the script's
|
|
927
|
-
// directory: `{ name, version, repository, error }`, `repository` the url its
|
|
928
|
-
// field names (the field is a string or `{ url }`), null where it names none.
|
|
929
|
-
// A file that cannot be read or parsed is `error`, with the rest null: the tab
|
|
930
|
-
// words an install it cannot name, never a guess.
|
|
931
|
-
export function readInstall(scriptDir) {
|
|
932
|
-
const file = join(scriptDir, "..", "package.json");
|
|
933
|
-
let pkg;
|
|
934
|
-
try {
|
|
935
|
-
pkg = JSON.parse(readFileSync(file, "utf8"));
|
|
936
|
-
} catch (e) {
|
|
937
|
-
return { name: null, version: null, repository: null, error: `${file}: ${e instanceof SyntaxError ? "not JSON" : (e.code ?? e.message)}` };
|
|
938
|
-
}
|
|
939
|
-
if (!isJsonObject(pkg)) return { name: null, version: null, repository: null, error: `${file}: not a JSON object` };
|
|
940
|
-
const repo = isJsonObject(pkg.repository) ? pkg.repository.url : pkg.repository;
|
|
941
|
-
return {
|
|
942
|
-
name: typeof pkg.name === "string" ? pkg.name : null,
|
|
943
|
-
version: typeof pkg.version === "string" ? pkg.version : null,
|
|
944
|
-
repository: typeof repo === "string" ? repo : null,
|
|
945
|
-
error: null,
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
|
|
949
904
|
// The live run's Objective, off the phase-0 receipt in the workspace's `.fleet`
|
|
950
905
|
// (the file readReceipt owns), or null: no receipt, as between runs, one that
|
|
951
906
|
// will not read, or one that records none.
|
|
@@ -999,19 +954,27 @@ export const MODEL_ROLES_EVERY_MS = 60_000;
|
|
|
999
954
|
// `omp` would otherwise hold every tick after it, not just this tab's.
|
|
1000
955
|
export const MODEL_ROLES_TIMEOUT_MS = 10_000;
|
|
1001
956
|
|
|
1002
|
-
// `omp
|
|
1003
|
-
//
|
|
1004
|
-
// `{ ok: false, why }`.
|
|
1005
|
-
|
|
1006
|
-
const
|
|
957
|
+
// One `omp <argv>` whose stdout is JSON, in the cockpit's own environment:
|
|
958
|
+
// `{ ok: true, cmd, json }` with the command in words and what it printed, or
|
|
959
|
+
// `{ ok: false, why }`. Each reader adds only its own shape check.
|
|
960
|
+
async function readOmpJson(argv, timeout) {
|
|
961
|
+
const cmd = `omp ${argv.join(" ")}`;
|
|
1007
962
|
const r = await execRead("omp", argv, { timeout });
|
|
1008
963
|
if (r.error) {
|
|
1009
964
|
const how = r.code ?? (r.signal ? `killed by ${r.signal}` : `exit ${r.status}`);
|
|
1010
|
-
return { ok: false, why:
|
|
965
|
+
return { ok: false, why: `${cmd} failed (${how})` };
|
|
1011
966
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
967
|
+
try { return { ok: true, cmd, json: JSON.parse(r.stdout) }; } catch { return { ok: false, why: `${cmd} printed non-JSON` }; }
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// `omp config get modelRoles --json`, in the cockpit's own environment, which can
|
|
971
|
+
// differ from the controller's. `{ ok: true, value }` with the record, or
|
|
972
|
+
// `{ ok: false, why }`.
|
|
973
|
+
export async function readModelRoles(timeout = MODEL_ROLES_TIMEOUT_MS) {
|
|
974
|
+
const r = await readOmpJson(["config", "get", "modelRoles", "--json"], timeout);
|
|
975
|
+
if (!r.ok) return r;
|
|
976
|
+
const value = r.json?.value;
|
|
977
|
+
if (!isJsonObject(value)) return { ok: false, why: `${r.cmd} printed no modelRoles record` };
|
|
1015
978
|
return { ok: true, value };
|
|
1016
979
|
}
|
|
1017
980
|
|
|
@@ -1046,6 +1009,59 @@ export async function carryModelRoles(carried, now, read = readModelRoles) {
|
|
|
1046
1009
|
return carry(heldRead(carried) ?? NO_READ, now, read, MODEL_ROLES_EVERY_MS);
|
|
1047
1010
|
}
|
|
1048
1011
|
|
|
1012
|
+
// `omp models --json`, omp's model catalog, in the cockpit's own environment:
|
|
1013
|
+
// `{ ok: true, value }` with `{ models: [{ selector, thinking }] }` — every
|
|
1014
|
+
// listed model that has a selector, in the catalog's order, so a role's model
|
|
1015
|
+
// matches the entry route's own catalog read matches it to; `thinking` the
|
|
1016
|
+
// efforts it runs at, what a role's ladder is read off for the exploration
|
|
1017
|
+
// Cells, or null where it names none, and nothing else, so the carried read
|
|
1018
|
+
// stays small — or `{ ok: false, why }`, also for a list in which no model names
|
|
1019
|
+
// its efforts: a catalog with no ladder in it is a read that failed, never an
|
|
1020
|
+
// install whose exploration Cells are all tripped.
|
|
1021
|
+
export async function readCatalog(timeout = MODEL_ROLES_TIMEOUT_MS) {
|
|
1022
|
+
const r = await readOmpJson(["models", "--json"], timeout);
|
|
1023
|
+
if (!r.ok) return r;
|
|
1024
|
+
if (!isJsonObject(r.json) || !Array.isArray(r.json.models)) return { ok: false, why: `${r.cmd} printed no model list` };
|
|
1025
|
+
const models = r.json.models
|
|
1026
|
+
.filter((m) => isJsonObject(m) && typeof m.selector === "string")
|
|
1027
|
+
.map((m) => ({ selector: m.selector, thinking: Array.isArray(m.thinking) ? m.thinking.filter((t) => typeof t === "string") : null }));
|
|
1028
|
+
if (r.json.models.length > 0 && !models.some((m) => m.thinking !== null)) return { ok: false, why: `${r.cmd} printed no model with a thinking list` };
|
|
1029
|
+
return { ok: true, value: { models } };
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// The carried model catalog read, the same way as `modelRoles`.
|
|
1033
|
+
export async function carryCatalog(carried, now, read = readCatalog) {
|
|
1034
|
+
return carry(heldRead(carried) ?? NO_READ, now, read, MODEL_ROLES_EVERY_MS);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// A repository's host and `owner/name` off its url — `gh repo view`'s, or any
|
|
1038
|
+
// shape a `package.json` `repository` takes: an npm shorthand, a scp-style
|
|
1039
|
+
// address or a URL — or null when it names none. A `#ref` pin and a `www.` host
|
|
1040
|
+
// name the same repository; a segment of dots only names none.
|
|
1041
|
+
export function repoIdentity(url) {
|
|
1042
|
+
if (typeof url !== "string") return null;
|
|
1043
|
+
const s = url.trim().replace(/^git\+/, "").replace(/#.*$/, "");
|
|
1044
|
+
let host;
|
|
1045
|
+
let path;
|
|
1046
|
+
const short = /^(github|gitlab|bitbucket):([^/\s]+\/[^/\s]+)$/.exec(s);
|
|
1047
|
+
const scp = /^[^@/\s]+@([^:/\s]+):(.+)$/.exec(s);
|
|
1048
|
+
if (short) {
|
|
1049
|
+
host = `${short[1]}.${short[1] === "bitbucket" ? "org" : "com"}`;
|
|
1050
|
+
path = short[2];
|
|
1051
|
+
} else if (scp) {
|
|
1052
|
+
[, host, path] = scp;
|
|
1053
|
+
} else if (/^[\w.-]+\/[\w.-]+$/.test(s)) {
|
|
1054
|
+
host = "github.com";
|
|
1055
|
+
path = s;
|
|
1056
|
+
} else {
|
|
1057
|
+
try { ({ hostname: host, pathname: path } = new URL(s)); } catch { return null; }
|
|
1058
|
+
}
|
|
1059
|
+
const [owner, rest] = path.split("/").filter(Boolean);
|
|
1060
|
+
const name = rest?.replace(/\.git$/, "");
|
|
1061
|
+
if (!host || !owner || !name || /^\.+$/.test(owner) || /^\.+$/.test(name)) return null;
|
|
1062
|
+
return { host: host.toLowerCase().replace(/^www\./, ""), name: `${owner}/${name}` };
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1049
1065
|
// The carried `docs/metrics` contents call, the same way: `value` is `{ blobs }`,
|
|
1050
1066
|
// `blobs` null for a 404 and otherwise main's blob id by path. A workspace whose
|
|
1051
1067
|
// repository the cockpit cannot name has nothing to ask `gh api` about, and says
|
|
@@ -1089,7 +1105,7 @@ export async function carryMainMetrics(carried, now, repoUrl, read = readMainMet
|
|
|
1089
1105
|
// `stateDir` is the workspace's `.fleet` directory, where the cost guard and the
|
|
1090
1106
|
// receipts the Cell evidence tab reads live. Null, as with `stateFile`, says no
|
|
1091
1107
|
// caller named one: that tab is then built from no guard and no receipt, and the
|
|
1092
|
-
// cockpit's `omp` is not asked for `modelRoles
|
|
1108
|
+
// cockpit's `omp` is not asked for `modelRoles` or its model catalog.
|
|
1093
1109
|
//
|
|
1094
1110
|
// `cwd` is the checkout whose Label map is read, once per gather, through
|
|
1095
1111
|
// label-map.mjs's reader; it defaults to this process's cwd, where every `gh`
|
|
@@ -1335,29 +1351,28 @@ export async function gather({ ledgerFile, prevFile, stateFile = null, stateDir
|
|
|
1335
1351
|
const now = Date.now();
|
|
1336
1352
|
const stallOwnerOf = isStalled(assessBeat({ beat, ticked, acted, controller, now })) ? stallOwner(controller, NAME) : null;
|
|
1337
1353
|
// The Cell evidence tab's inputs. Every file again on every tick, nothing
|
|
1338
|
-
// cached, the rule of every read here; the
|
|
1339
|
-
// child spawn, carried from the previous board and read
|
|
1340
|
-
// minute. `stateDir` is the workspace's `.fleet`: a caller
|
|
1341
|
-
// no workspace, so it reads none of the workspace's
|
|
1342
|
-
// either (a guard that reads as missing, no
|
|
1354
|
+
// cached, the rule of every read here; the exceptions are `modelRoles` and the
|
|
1355
|
+
// model catalog, one child spawn each, carried from the previous board and read
|
|
1356
|
+
// again at most once a minute. `stateDir` is the workspace's `.fleet`: a caller
|
|
1357
|
+
// that names none names no workspace, so it reads none of the workspace's
|
|
1358
|
+
// records and spawns no `omp` either (a guard that reads as missing, no
|
|
1359
|
+
// receipts, the reads carried as they were).
|
|
1343
1360
|
const guard = stateDir === null ? { status: "missing" } : readGuardFile(stateDir);
|
|
1344
1361
|
const guardJson = stateDir === null ? null : readGuardJson(stateDir);
|
|
1345
1362
|
const fit = stateDir === null ? { status: "missing" } : readFitFile(stateDir);
|
|
1346
1363
|
const closeoutPr = stateDir === null ? null : readCloseoutPr(stateDir);
|
|
1347
|
-
const checkoutTable = stateDir === null ? { status: "missing" } : readCheckoutTable(stateDir);
|
|
1348
1364
|
const receipts = stateDir === null
|
|
1349
1365
|
? { phase0: null, closeout: null }
|
|
1350
1366
|
: { phase0: readMetricsStep(join(stateDir, RECEIPT)), closeout: readMetricsStep(join(stateDir, CLOSEOUT_RECEIPT)) };
|
|
1351
1367
|
const agents = readAgents(scriptDir);
|
|
1352
|
-
const install = readInstall(scriptDir);
|
|
1353
1368
|
const objective = stateDir === null ? null : readObjective(stateDir);
|
|
1354
1369
|
// Read side by side: each has its own 10 s timeout, and one after the other a
|
|
1355
|
-
// tick on which
|
|
1356
|
-
const [modelRoles, mainMetrics] = stateDir === null
|
|
1357
|
-
? [heldRead(prev?.modelRoles), null]
|
|
1358
|
-
: await Promise.all([carryModelRoles(prev?.modelRoles, now), carryMainMetrics(prev?.mainMetrics, now, repoUrl)]);
|
|
1370
|
+
// tick on which every one hangs would stall once for each.
|
|
1371
|
+
const [modelRoles, catalog, mainMetrics] = stateDir === null
|
|
1372
|
+
? [heldRead(prev?.modelRoles), heldRead(prev?.catalog), null]
|
|
1373
|
+
: await Promise.all([carryModelRoles(prev?.modelRoles, now), carryCatalog(prev?.catalog, now), carryMainMetrics(prev?.mainMetrics, now, repoUrl)]);
|
|
1359
1374
|
return { ledger, issues, prs, merged, closed, closedIssues, ci, prev, repo, repoUrl, workspace, port, spend, beat, ticked, acted, controller, stallOwner: stallOwnerOf, poolOk,
|
|
1360
1375
|
roles, labelMapError,
|
|
1361
|
-
poolCapped, prsOk, prsCapped, guard, guardJson, fit, receipts, closeoutPr, agents, modelRoles,
|
|
1376
|
+
poolCapped, prsOk, prsCapped, guard, guardJson, fit, receipts, closeoutPr, agents, modelRoles, catalog, mainMetrics, objective, implementers: [...implementers.values()], routerTable,
|
|
1362
1377
|
now, interval };
|
|
1363
1378
|
}
|
package/scripts/board.html
CHANGED
|
@@ -106,9 +106,7 @@
|
|
|
106
106
|
.ce-foot { margin-top:8px; }
|
|
107
107
|
#cells-declared summary { cursor:pointer; color:var(--dim); }
|
|
108
108
|
.ce-member { display:flex; gap:10px; flex-wrap:wrap; font-size:12px; margin:2px 0 0 18px; }
|
|
109
|
-
.ce-
|
|
110
|
-
.ce-side { flex:1 1 20em; }
|
|
111
|
-
.ce-row { display:grid; gap:12px; border-top:1px solid var(--line); padding:6px 0; font-size:12px; }
|
|
109
|
+
.ce-row { display:grid; grid-template-columns:10em minmax(0, 1fr); gap:12px; border-top:1px solid var(--line); padding:6px 0; font-size:12px; }
|
|
112
110
|
.ce-row a { color:var(--blue); text-decoration:none; }
|
|
113
111
|
.ce-cand { color:var(--dim); margin-left:10px; }
|
|
114
112
|
.ce-stratum { font-weight:600; overflow-wrap:anywhere; }
|
|
@@ -461,70 +459,74 @@ function ceEntry(e) {
|
|
|
461
459
|
return box;
|
|
462
460
|
}
|
|
463
461
|
|
|
464
|
-
//
|
|
465
|
-
// could not make,
|
|
466
|
-
//
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
box
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
462
|
+
// The heading of the view of the Fit: its failed-Fit flag first, then its
|
|
463
|
+
// source line, the check it could not make, how a Pull is dispatched, its
|
|
464
|
+
// labels and model-change notices, burn-in progress, the tripped Cells and the
|
|
465
|
+
// model-name line, where each is set.
|
|
466
|
+
function ceFitHeading(p) {
|
|
467
|
+
const box = el("div");
|
|
468
|
+
if (p.flag) { const flag = el("div", "ce-alert"); flag.append(el("div", "ce-verdict", p.flag)); box.append(flag); }
|
|
469
|
+
box.append(el("div", "ce-source", p.source.text));
|
|
470
|
+
if (p.source.check) box.append(el("div", "ce-note", p.source.check));
|
|
471
|
+
if (p.heading) box.append(el("div", "ce-note", p.heading));
|
|
472
|
+
for (const label of p.labels || []) box.append(el("div", "ce-note ce-amber", label));
|
|
473
|
+
for (const notice of p.notices || []) box.append(el("div", "ce-note ce-amber", notice));
|
|
474
|
+
if (p.burnIn) {
|
|
475
|
+
box.append(el("div", "ce-note", p.burnIn.heading));
|
|
476
|
+
for (const c of p.burnIn.cells) box.append(el("div", "ce-cand", `${c.cell} · ${c.n} of ${c.of} merged PRs`));
|
|
477
|
+
}
|
|
478
|
+
if (p.tripped) box.append(el("div", "ce-note", p.tripped));
|
|
479
|
+
if (p.modelLine) box.append(el("div", "ce-note ce-amber", p.modelLine));
|
|
475
480
|
return box;
|
|
476
481
|
}
|
|
477
482
|
|
|
478
|
-
// One
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
function
|
|
483
|
+
// One group's row: the Cell it routes to and why, its own Cell where the guard
|
|
484
|
+
// holds it back, each candidate's n, verdict and interval, and the Cells the
|
|
485
|
+
// group draws over.
|
|
486
|
+
function ceFitEntry(line) {
|
|
482
487
|
const box = el("div", "ce-polcell");
|
|
483
|
-
if (
|
|
484
|
-
|
|
488
|
+
if (line.unread) { box.append(el("span", "ce-dim", line.unread)); return box; }
|
|
489
|
+
const e = line.entry;
|
|
485
490
|
const hd = el("div", "ce-hd");
|
|
486
|
-
hd.append(el("span", "ce-cell",
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
reason.href = href;
|
|
491
|
+
hd.append(el("span", "ce-cell", e.cell));
|
|
492
|
+
const reason = el("a", "ce-dim", e.reason);
|
|
493
|
+
reason.href = line.href;
|
|
490
494
|
hd.append(reason);
|
|
491
|
-
if (
|
|
495
|
+
if (e.held) hd.append(el("span", "ce-amber", e.held));
|
|
492
496
|
box.append(hd);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
box.append(line);
|
|
497
|
+
for (const c of e.candidates) {
|
|
498
|
+
const row = el("div", "ce-cand", `${c.cell} · n ${c.n ?? "not checked"}${c.nMark || ""} · ${c.verdict} · ${c.interval}`);
|
|
499
|
+
if (c.model && c.model.text) row.append(el("span", "ce-amber", " · " + c.model.text));
|
|
500
|
+
box.append(row);
|
|
498
501
|
}
|
|
502
|
+
if (line.exploring) box.append(el("div", "ce-note", line.exploring));
|
|
499
503
|
return box;
|
|
500
504
|
}
|
|
501
505
|
|
|
502
|
-
// One
|
|
506
|
+
// One group of the tree, its rule indented by its depth. It is a place
|
|
503
507
|
// `#cells/row/<objective>/<stratum>` lands on.
|
|
504
|
-
function
|
|
508
|
+
function ceFitLine(line) {
|
|
505
509
|
const box = ceBox("div", "ce-row", line.anchor);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
510
|
+
const rule = el("span", "ce-stratum", line.rule);
|
|
511
|
+
rule.style.paddingLeft = `${line.depth}em`;
|
|
512
|
+
rule.title = line.stratum;
|
|
513
|
+
box.append(rule, ceFitEntry(line));
|
|
509
514
|
return box;
|
|
510
515
|
}
|
|
511
516
|
|
|
512
|
-
// The
|
|
513
|
-
//
|
|
517
|
+
// The view of the Fit that routes this run: its heading, then each Objective's
|
|
518
|
+
// tree of groups, with the live run's Objective marked.
|
|
514
519
|
function cePolicy(p) {
|
|
515
520
|
const sec = ceBox("section", "ce-sec", "cells-rows");
|
|
516
|
-
sec.append(el("h2", null,
|
|
517
|
-
const sides = el("div", "ce-sides");
|
|
518
|
-
for (const s of p.sides) sides.append(cePolicySide(s));
|
|
519
|
-
sec.append(sides);
|
|
521
|
+
sec.append(el("h2", null, p.title), ceFitHeading(p));
|
|
520
522
|
for (const o of p.objectives) {
|
|
521
523
|
const hd = el("div", "ce-hd ce-obj");
|
|
522
524
|
hd.append(el("span", "ce-cell", o.objective));
|
|
523
525
|
if (o.live) hd.append(el("span", "badge", "this run's Objective"));
|
|
524
526
|
sec.append(hd);
|
|
525
|
-
for (const line of o.lines) sec.append(
|
|
527
|
+
for (const line of o.lines) sec.append(ceFitLine(line));
|
|
526
528
|
}
|
|
527
|
-
for (const
|
|
529
|
+
for (const f of p.footnotes) sec.append(el("div", "ce-foot", `${f.mark} ${f.text}`));
|
|
528
530
|
return sec;
|
|
529
531
|
}
|
|
530
532
|
|
|
@@ -554,7 +556,7 @@ function renderCells(ce) {
|
|
|
554
556
|
const g = ce.guard;
|
|
555
557
|
|
|
556
558
|
const links = el("div", "ce-links");
|
|
557
|
-
for (const [href, text] of [["#cells/rows", "
|
|
559
|
+
for (const [href, text] of [["#cells/rows", "the Fit"], ["#cells/guard", "the guard"], ["#cells/declared", "declared, not measured"]]) {
|
|
558
560
|
if (!ce.policy && href === "#cells/rows") continue;
|
|
559
561
|
if (links.children.length) links.append(document.createTextNode(" · "));
|
|
560
562
|
const a = el("a", null, text);
|
|
@@ -858,8 +858,8 @@ export function computeBoard(inputs) {
|
|
|
858
858
|
// The Cell evidence tab's model (compute-cell-evidence.mjs), built from the
|
|
859
859
|
// guard (through the tick's reader, and as parsed, for the readers alert),
|
|
860
860
|
// the receipts' metrics steps and the close-out's PR beside the open PRs, the
|
|
861
|
-
// definitions, the
|
|
862
|
-
//
|
|
861
|
+
// definitions, the Fit, the starting router table, the live run's Objective
|
|
862
|
+
// and the carried `modelRoles`, model catalog and `docs/metrics` reads
|
|
863
863
|
// gather() answered, and this run's Pulls: each card's
|
|
864
864
|
// Cell line, booked As-routed to its Cell. A caller that read none of them
|
|
865
865
|
// (every hand-built input in this suite) gets the tab's no-guard state:
|
|
@@ -876,17 +876,18 @@ export function computeBoard(inputs) {
|
|
|
876
876
|
openPrs: inputs.prsOk === false ? null : { numbers: (inputs.prs ?? []).map((p) => p.number), capped: inputs.prsCapped === true },
|
|
877
877
|
agents: inputs.agents,
|
|
878
878
|
modelRoles: inputs.modelRoles,
|
|
879
|
+
catalog: inputs.catalog,
|
|
879
880
|
mainMetrics: inputs.mainMetrics,
|
|
880
881
|
table: inputs.routerTable,
|
|
881
|
-
checkoutTable: inputs.checkoutTable,
|
|
882
|
-
install: inputs.install,
|
|
883
|
-
repoUrl: inputs.repoUrl,
|
|
884
882
|
objective: inputs.objective,
|
|
885
883
|
pulls: tickets.filter((t) => t.cellLine).map((t) => ({ issue: t.issue, cell: t.cellLine.cell, mark: t.cellLine.mark, targets: t.cellLine.targets })),
|
|
886
884
|
}),
|
|
887
885
|
// The `omp config get modelRoles` read, carried tick to tick the way `ci`
|
|
888
886
|
// and `repo` are: `{ value, readAt, error }`, read at most once a minute.
|
|
889
887
|
modelRoles: inputs.modelRoles ?? null,
|
|
888
|
+
// The `omp models` catalog read, carried the same way: `{ value: { models },
|
|
889
|
+
// readAt, error }`, read at most once a minute.
|
|
890
|
+
catalog: inputs.catalog ?? null,
|
|
890
891
|
// The `docs/metrics` contents call, carried the same way: `{ value: { blobs },
|
|
891
892
|
// readAt, error }`, main's blob id by path, read at most once a minute.
|
|
892
893
|
mainMetrics: inputs.mainMetrics ?? null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The cockpit's Cell evidence tab, as a value: computeCellEvidence() turns what
|
|
2
2
|
// gather() read (the cost guard, the receipts' `metrics` steps, the installed
|
|
3
|
-
// definitions, the
|
|
4
|
-
//
|
|
3
|
+
// definitions, the starting router table, the carried `modelRoles` and model
|
|
4
|
+
// catalog reads, the Fit) into the model the page lays out.
|
|
5
5
|
// Pure, like compute-board.mjs, which calls it and puts the answer in
|
|
6
6
|
// `board.json` as `cellEvidence`: no file, no process, no clock. Every word the
|
|
7
7
|
// tab shows is built here, so a test pins it where it is made and the page only
|
|
@@ -10,20 +10,18 @@
|
|
|
10
10
|
// What this holds is the guard section — what the cost guard holds each
|
|
11
11
|
// implementer Cell to, from the guard file and nothing recomputed, with this
|
|
12
12
|
// run's Pulls booked to each Cell off the board's cards — "Declared, not
|
|
13
|
-
// measured", and
|
|
14
|
-
// routes
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
13
|
+
// measured", and one view of the Fit that routes this run: the table `route`
|
|
14
|
+
// routes by, which is the Fit beside the guard (`.fleet/router-fit.json`, which
|
|
15
|
+
// metrics-refresh.mjs writes at phase 0), or the starting table while that Fit
|
|
16
|
+
// is missing, unreadable or invalid. For each Objective × group of its tree it
|
|
17
|
+
// lays out the Cell the table plus the workspace's guard route to and why
|
|
18
|
+
// (ticket-router.mjs's rowDispatch, the function `route` itself calls), with
|
|
19
|
+
// every candidate's verdict and range, and for each group the Cells it draws
|
|
20
|
+
// over; above them, burn-in progress, the Cells the guard has tripped, a notice
|
|
21
|
+
// for each starting Cell whose model changed and restarted burn-in, and a flag
|
|
22
|
+
// while the newest refit failed and an older Fit, or the starting table, routes.
|
|
23
23
|
// The receipts' newest `metrics` step is what the guard section quotes when there
|
|
24
|
-
// is no guard; the newest one that tried a refit
|
|
25
|
-
// a refit that step says failed, with no fit written after it, is said in that
|
|
26
|
-
// side's heading.
|
|
24
|
+
// is no guard; the newest one that tried a refit is where that flag is read.
|
|
27
25
|
// Figures show only from a guard `readCostGuard` (fleet-tick.mjs, the reader
|
|
28
26
|
// the tick judges the file by) accepts; `guard` here is that reader's own
|
|
29
27
|
// answer, `{ status: "ok", guard }` or
|
|
@@ -35,9 +33,9 @@
|
|
|
35
33
|
// checked where its figure would show.
|
|
36
34
|
|
|
37
35
|
import { isDeepStrictEqual } from "node:util";
|
|
38
|
-
import { CELL, OBJECTIVES, POLICY_CELL } from "./ledger-grammar.mjs";
|
|
36
|
+
import { CELL, OBJECTIVES, POLICY_CELL, STARTING_CELLS } from "./ledger-grammar.mjs";
|
|
39
37
|
import { costGuardFault } from "./fleet-tick.mjs";
|
|
40
|
-
import { MIN_N, parseGuard, readGuard, rowDispatch
|
|
38
|
+
import { MIN_N, installOf, parseGuard, readGuard, rowDispatch } from "./ticket-router.mjs";
|
|
41
39
|
import { implementerCell, modelsEqual, parseModelRoute, resolveRole } from "./tier-roles.mjs";
|
|
42
40
|
|
|
43
41
|
// The implementer Cells, in the order the guard section draws them: one per
|
|
@@ -124,7 +122,7 @@ function tierRoute(role, level, generation, modelRoles) {
|
|
|
124
122
|
|
|
125
123
|
// ---------------------------------------------------------------------------
|
|
126
124
|
// The newest `metrics` step of the phase 0 and close-out receipts: the guard
|
|
127
|
-
// section quotes it when there is no guard.
|
|
125
|
+
// section quotes it when there is no guard. The view of the Fit reads a failed
|
|
128
126
|
// refit off the newest one that tried a refit instead.
|
|
129
127
|
// ---------------------------------------------------------------------------
|
|
130
128
|
|
|
@@ -438,114 +436,123 @@ function guardSection(read, receipts, step, modelRoles, pulls, recordsNote = nul
|
|
|
438
436
|
return { state, heading, source, notes, cells, footnotes };
|
|
439
437
|
}
|
|
440
438
|
|
|
439
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
440
|
+
const list = (xs) => (xs.length < 2 ? xs.join("") : `${xs.slice(0, -1).join(", ")} and ${xs.at(-1)}`);
|
|
441
|
+
|
|
441
442
|
// ---------------------------------------------------------------------------
|
|
442
|
-
//
|
|
443
|
+
// The Fit that routes this run, `.fleet/router-fit.json`.
|
|
443
444
|
// ---------------------------------------------------------------------------
|
|
444
445
|
|
|
445
|
-
//
|
|
446
|
-
//
|
|
447
|
-
//
|
|
448
|
-
//
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
host = `${short[1]}.${short[1] === "bitbucket" ? "org" : "com"}`;
|
|
458
|
-
path = short[2];
|
|
459
|
-
} else if (scp) {
|
|
460
|
-
[, host, path] = scp;
|
|
461
|
-
} else if (/^[\w.-]+\/[\w.-]+$/.test(s)) {
|
|
462
|
-
host = "github.com";
|
|
463
|
-
path = s;
|
|
464
|
-
} else {
|
|
465
|
-
try { ({ hostname: host, pathname: path } = new URL(s)); } catch { return null; }
|
|
446
|
+
// The table `route` routes by, and where it comes from: the Fit gather read
|
|
447
|
+
// beside the guard, else the starting table — as `route` falls back to it when
|
|
448
|
+
// the Fit is missing, unreadable or invalid. `fit` is gather's read, `{ status:
|
|
449
|
+
// "ok", fit } | { status: "missing" } | { status: "unreadable", why }`;
|
|
450
|
+
// `starting` the starting table validateTable accepted, or null. `fit` in the
|
|
451
|
+
// answer is the Fit read, null when the starting table routes.
|
|
452
|
+
function routingTable(fit, starting) {
|
|
453
|
+
if (fit?.status === "ok") {
|
|
454
|
+
const p = fit.fit;
|
|
455
|
+
const n = p.table.n_rows;
|
|
456
|
+
const rows = Number.isInteger(n) && n >= 0 ? plural(n, "Pull") : "Pulls: not checked: `n_rows` is not a count";
|
|
457
|
+
return { fit: p, table: p.table, source: { text: ["Fit", computedWords(p), rows].join(" · "), check: null } };
|
|
466
458
|
}
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
if (!host || !owner || !name || /^\.+$/.test(owner) || /^\.+$/.test(name)) return null;
|
|
470
|
-
return { host: host.toLowerCase().replace(/^www\./, ""), name: `${owner}/${name}` };
|
|
459
|
+
const why = fit?.status === "unreadable" ? `the Fit is not read: ${fit.why}` : "no Fit yet: the next phase 0 writes one";
|
|
460
|
+
return { fit: null, table: starting, source: { text: `starting table · ${why}`, check: starting === null ? "not checked: no starting table read" : null } };
|
|
471
461
|
}
|
|
472
462
|
|
|
473
|
-
|
|
474
|
-
|
|
463
|
+
// When the Fit read was computed, in words: its `computed_at` is null when the
|
|
464
|
+
// file holds no string there, which leaves the table it routes by unchanged.
|
|
465
|
+
const computedWords = (p) => (p.computed_at === null ? "computed: not checked: `computed_at` is not a string" : `computed ${when(p.computed_at)}`);
|
|
475
466
|
|
|
476
|
-
//
|
|
477
|
-
//
|
|
478
|
-
//
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if (
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
let installed;
|
|
492
|
-
if (install == null || install.error) installed = `install not read${install?.error ? `: ${install.error}` : ""}`;
|
|
493
|
-
else installed = `${install.name ?? "unnamed package"} ${install.version === "0.0.0" ? "linked checkout" : (install.version ?? "no version")}`;
|
|
494
|
-
const check = install == null || install.error
|
|
495
|
-
? "not checked: the install was not read"
|
|
496
|
-
: named === null
|
|
497
|
-
? "not checked: the install names no repository"
|
|
498
|
-
: here === null ? "not checked: this workspace's repository is not known" : null;
|
|
499
|
-
return { same, owner: named === null ? "another repository" : named.name, runs, text: [runs, fitted, installed].join(" · "), check };
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// The starting Cells short of `MIN_N` merged PRs in the table's `guard.n` — the
|
|
503
|
-
// Cells burn-in waits for, and no others — in their order, as one phrase: past
|
|
504
|
-
// tense for an installed table, whose counts are what its fit saw ("had"),
|
|
505
|
-
// present for the Fit, whose counts are the workspace's own now ("has",
|
|
506
|
-
// "have").
|
|
507
|
-
function shortWords(table, tense = "past") {
|
|
508
|
-
const short = shortStartingCells(table.guard.n);
|
|
509
|
-
if (short.length === 0) return null;
|
|
510
|
-
const each = short.length === 1 ? "it needs" : "each needs";
|
|
511
|
-
const one = tense === "past" ? "had" : "has";
|
|
512
|
-
const counts = new Set(short.map(([, n]) => n));
|
|
513
|
-
if (counts.size === 1) {
|
|
514
|
-
const verb = tense === "past" ? "had" : short.length === 1 ? "has" : "have";
|
|
515
|
-
return `${list(short.map(([c]) => c))} ${verb} ${short[0][1]} of the ${MIN_N} merged PRs ${each}`;
|
|
516
|
-
}
|
|
517
|
-
return `${list(short.map(([c, n]) => `${c} ${one} ${n}`))} of the ${MIN_N} merged PRs ${each}`;
|
|
467
|
+
// The flag while this run's Fit failed: `step` is the receipts' newest `metrics`
|
|
468
|
+
// step that tried a refit, newestRefit's pick, `p` the Fit read, null when none
|
|
469
|
+
// was. Raised while that step's output holds the failed line and no Fit was
|
|
470
|
+
// written after it — a `computed_at` before the step's `at`, or one that is no
|
|
471
|
+
// time. A later step that tried a refit, a Fit written after this one, or the
|
|
472
|
+
// receipt no longer read clears it; a close-out step, which tries none, does not.
|
|
473
|
+
function failedFitFlag(step, p) {
|
|
474
|
+
if (step === null) return null;
|
|
475
|
+
const why = refitFailure(step.output);
|
|
476
|
+
if (why === null) return null;
|
|
477
|
+
const computed = p === null ? NaN : Date.parse(p.computed_at);
|
|
478
|
+
if (Number.isFinite(computed) && computed >= Date.parse(step.at)) return null;
|
|
479
|
+
const routes = p === null ? "no Fit is read, so the starting table routes" : `the last good Fit, ${computedWords(p)}, routes`;
|
|
480
|
+
return `this run's Fit failed at ${when(step.at)}: ${why}; ${routes}`;
|
|
518
481
|
}
|
|
519
482
|
|
|
520
|
-
//
|
|
521
|
-
|
|
522
|
-
function routesHeading(table, guard, source) {
|
|
523
|
-
if (table === null) return "no router table read: the rows are not known";
|
|
483
|
+
// How a Pull is dispatched, for every group alike: what `route` does under the guard.
|
|
484
|
+
function dispatchHeading(table, guard) {
|
|
524
485
|
if (guard === null) return `no cost guard: every Pull runs at ${POLICY_CELL}, the default Cell`;
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
//
|
|
535
|
-
//
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
486
|
+
if (table === null) return null;
|
|
487
|
+
if (table.burn_in) return "burn-in: every Pull is drawn over the starting Cells the guard has not tripped";
|
|
488
|
+
return "every 5th Pull that is no chain head is drawn over its group's exploration Cells; the rest run the group's Cell";
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Merged PRs per starting Cell, against MIN_N: the counts burn-in is judged on —
|
|
492
|
+
// the Fit's own guard counts while the Fit routes, the cost guard's while the
|
|
493
|
+
// starting table does. Null with neither to count from. The heading follows the
|
|
494
|
+
// routing table's `burn_in`, and says "ended" only of counts that all reach
|
|
495
|
+
// MIN_N: a Fit sets its flag off its own counts, but the starting table's flag
|
|
496
|
+
// is its own, whatever the cost guard counts since.
|
|
497
|
+
function burnInProgress(p, guard, table) {
|
|
498
|
+
const n = p !== null ? p.table.guard.n : guard?.n;
|
|
499
|
+
if (!isRecord(n)) return null;
|
|
500
|
+
const cells = STARTING_CELLS.map((cell) => ({ cell, n: count(n[cell]) ?? 0, of: MIN_N }));
|
|
501
|
+
const done = cells.filter((c) => c.n >= MIN_N).length;
|
|
502
|
+
const tally = `${done} of ${cells.length} starting Cells ${done === 1 ? "has" : "have"} the ${MIN_N} merged PRs each needs`;
|
|
503
|
+
if (table === null || table.burn_in) return { heading: `burn-in: ${tally}`, cells };
|
|
504
|
+
const heading = done === cells.length
|
|
505
|
+
? `burn-in ended: every starting Cell has its ${MIN_N} merged PRs`
|
|
506
|
+
: `no burn-in: the starting table routes without it, though only ${tally}`;
|
|
507
|
+
return { heading, cells };
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// The Cells the cost guard has tripped, in words, or null with no guard.
|
|
511
|
+
function trippedWords(guard) {
|
|
512
|
+
if (guard === null) return null;
|
|
513
|
+
return guard.tripped.length === 0 ? "the cost guard has tripped no Cell" : `tripped by the cost guard: ${list(guard.tripped)}`;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// A notice for each starting Cell whose role's model changed and so restarted
|
|
517
|
+
// burn-in: the Fit holds an older generation of it in the root group, and its
|
|
518
|
+
// newest generation is short of MIN_N merged PRs in the counts the Fit judged
|
|
519
|
+
// burn-in on. None while the starting table routes, which holds no estimates.
|
|
520
|
+
function modelChanges(p) {
|
|
521
|
+
if (p === null || !p.table.burn_in) return [];
|
|
522
|
+
const root = isRecord(p.table.estimates?.["*"]) ? p.table.estimates["*"] : {};
|
|
523
|
+
return STARTING_CELLS.flatMap((cell) => {
|
|
524
|
+
const e = root[cell];
|
|
525
|
+
const older = isRecord(e?.older) ? Object.keys(e.older) : [];
|
|
526
|
+
const k = count(p.table.guard.n[cell]) ?? 0;
|
|
527
|
+
if (older.length === 0 || typeof e.generation !== "string" || k >= MIN_N) return [];
|
|
528
|
+
return [`${cell}'s model changed to ${e.generation}, after ${list(older)}: burn-in restarted, at ${k} of the ${MIN_N} merged PRs it needs`];
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// What this install runs, for the exploration Cells, off the cockpit's own reads:
|
|
533
|
+
// `{ install, note }`, installOf's answer, or `{ install: null, why }` while one
|
|
534
|
+
// of the reads it needs has no value. A catalog read that fails is worded the
|
|
535
|
+
// way readLabel words modelRoles': beside the unread catalog in `why`, and in
|
|
536
|
+
// `note`, while the last read stands, beside the Cells it names.
|
|
537
|
+
function installFrom(modelRoles, catalog, agents) {
|
|
538
|
+
if (!isRecord(modelRoles?.value)) return { install: null, why: "modelRoles not read yet", note: null };
|
|
539
|
+
const failing = catalog?.error == null ? "" : `; reading fails: ${catalog.error.message}`;
|
|
540
|
+
if (!isRecord(catalog?.value)) return { install: null, why: `omp's model catalog not read yet${failing}`, note: null };
|
|
541
|
+
if (agents == null || agents.error) return { install: null, why: "the definitions could not be read", note: null };
|
|
542
|
+
const note = failing === "" ? null : `omp's model catalog as read at ${when(catalog.readAt)}${failing}`;
|
|
543
|
+
return { install: installOf({ modelRoles: modelRoles.value, catalog: catalog.value, definitions: agents.list.map((a) => a.file) }), why: null, note };
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// The Cells a group draws over, in words: rowDispatch's draw, which is centred on
|
|
547
|
+
// the group's `cost` row Cell whichever Objective routes the Pull. Null with no
|
|
548
|
+
// guard, when nothing is drawn.
|
|
549
|
+
function exploringWords(table, guard, stratum, inst) {
|
|
550
|
+
if (guard === null) return null;
|
|
551
|
+
if (!table.burn_in && inst.install === null) return `exploring: not checked: ${inst.why}`;
|
|
552
|
+
const rd = rowDispatch({ table, guard, objective: "cost", stratum, install: inst.install });
|
|
553
|
+
if (table.burn_in) return rd.draw === null ? "draws nothing: every starting Cell is tripped" : `drawn over ${list(rd.draw.cells)}`;
|
|
554
|
+
const words = rd.draw === null ? "exploring nothing: no exploration Cell this install runs is left untripped" : `exploring ${list(rd.draw.cells)}`;
|
|
555
|
+
return inst.note === null ? words : `${words}; ${inst.note}`;
|
|
549
556
|
}
|
|
550
557
|
|
|
551
558
|
// A candidate's judged generation against the Tier route model of its Cell:
|
|
@@ -570,10 +577,9 @@ function intervalWords(range, objective) {
|
|
|
570
577
|
return `95% interval [${one(range[0])}, ${one(range[1])}]`;
|
|
571
578
|
}
|
|
572
579
|
|
|
573
|
-
// One row of
|
|
574
|
-
//
|
|
575
|
-
//
|
|
576
|
-
// verdict and interval.
|
|
580
|
+
// One row of the routing table under the guard: the Cell it routes to and why,
|
|
581
|
+
// the row's own Cell where the guard holds it back, and each candidate's n (null
|
|
582
|
+
// where the table carries no count), verdict and interval.
|
|
577
583
|
function rowEntry(table, guard, modelRoles, objective, stratum) {
|
|
578
584
|
const rd = rowDispatch({ table, guard, objective, stratum });
|
|
579
585
|
const row = table.rows[objective][stratum];
|
|
@@ -585,7 +591,6 @@ function rowEntry(table, guard, modelRoles, objective, stratum) {
|
|
|
585
591
|
cell: rd.policy,
|
|
586
592
|
held,
|
|
587
593
|
reason: record !== null && typeof record.reason === "string" ? record.reason : "not checked",
|
|
588
|
-
dispatch: dispatchWords(table, rd, row),
|
|
589
594
|
candidates: Object.entries(isRecord(record?.cells) ? record.cells : {}).map(([cell, x]) => ({
|
|
590
595
|
cell,
|
|
591
596
|
n: count(estimates[cell]?.merged),
|
|
@@ -596,108 +601,21 @@ function rowEntry(table, guard, modelRoles, objective, stratum) {
|
|
|
596
601
|
};
|
|
597
602
|
}
|
|
598
603
|
|
|
599
|
-
//
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
|
|
603
|
-
// gather's read of the checkout's `plugin/scripts/router-table.json`, `{ status:
|
|
604
|
-
// "ok", table } | { status: "missing" } | { status: "unreadable", why }`, or
|
|
605
|
-
// null where nothing read it. A consumer, whose install names another repository,
|
|
606
|
-
// is never compared.
|
|
607
|
-
function behindMain(source, table, checkout) {
|
|
608
|
-
const none = { label: null, check: null };
|
|
609
|
-
if (!source.same || table === null || checkout == null) return none;
|
|
610
|
-
if (checkout.status === "missing") return { label: null, check: "not checked: this checkout holds no plugin/scripts/router-table.json" };
|
|
611
|
-
if (checkout.status !== "ok") return { label: null, check: `not checked: this checkout's router table was not read: ${checkout.why}` };
|
|
612
|
-
const main = checkout.table;
|
|
613
|
-
const commit = (t) => (t.fitted_commit ? String(t.fitted_commit) : null);
|
|
614
|
-
const mainAt = commit(main);
|
|
615
|
-
const installedAt = commit(table);
|
|
616
|
-
if (mainAt === installedAt && main.n_rows === table.n_rows) return none;
|
|
617
|
-
const on = Number.isInteger(main.n_rows) ? `on ${plural(main.n_rows, "Pull")}` : "on a number of Pulls not checked";
|
|
618
|
-
const fitted = mainAt === null ? "never fitted" : `fitted at ${mainAt.slice(0, 7)} ${on}`;
|
|
619
|
-
const routes = installedAt === null ? "a table never fitted" : installedAt.slice(0, 7);
|
|
620
|
-
return { label: `main's table is ${fitted}; this install routes by ${routes} until the plugin is updated`, check: null };
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// The routes-now side of the policy rows: its heading words and every row the
|
|
624
|
-
// installed table holds, `rows[objective][stratum]` — one for each group of its
|
|
625
|
-
// tree, the root `*` and any below it. `rows` is null when no table could be
|
|
626
|
-
// read, and each of its rows then reads `unread`.
|
|
627
|
-
function routesNow({ table, guard, modelRoles, install, repoUrl, checkout }) {
|
|
628
|
-
const source = routesSource(table, install, repoUrl);
|
|
629
|
-
const behind = behindMain(source, table, checkout);
|
|
630
|
-
const foot = source.same ? [] : [{ mark: "¹", text: "this repository's runs reach routing only through its cost guard, which can hold a Cell back but never picks one" }];
|
|
631
|
-
return {
|
|
632
|
-
title: "routes now",
|
|
633
|
-
source: { text: source.text + (foot.length ? " ¹" : ""), check: source.check ?? behind.check },
|
|
634
|
-
heading: routesHeading(table, guard, source),
|
|
635
|
-
labels: behind.label === null ? [] : [behind.label],
|
|
636
|
-
footnotes: foot,
|
|
637
|
-
rows: table === null ? null : Object.fromEntries(OBJECTIVES.map((o) => [o,
|
|
638
|
-
Object.fromEntries(Object.keys(table.rows[o]).map((s) => [s, rowEntry(table, guard, modelRoles, o, s)])),
|
|
639
|
-
])),
|
|
640
|
-
unread: "router table not read",
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// ---------------------------------------------------------------------------
|
|
645
|
-
// Policy rows: what the evidence favours — the Fit, `.fleet/router-fit.json`.
|
|
646
|
-
// ---------------------------------------------------------------------------
|
|
647
|
-
|
|
648
|
-
const FAVOURS = "evidence favours";
|
|
649
|
-
|
|
650
|
-
// The evidence-favours side with no Fit to lay out: its heading says
|
|
651
|
-
// why, and its column is empty — nothing is unknown there, there is nothing to show.
|
|
652
|
-
const noFit = (heading, labels = []) => ({
|
|
653
|
-
title: FAVOURS, source: { text: "Fit", check: null }, heading, labels, footnotes: [], rows: null, unread: null,
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
// The newest refit failed: `step` is the receipts' newest `metrics` step that
|
|
657
|
-
// tried a refit, newestRefit's pick, `p` the Fit read, null when none was. Said
|
|
658
|
-
// while that step's output holds the failed line and no fit was written after
|
|
659
|
-
// it — a `computed_at` before the step's `at`, or one that is no time. A later
|
|
660
|
-
// step that tried a refit, a fit written after this one, or the receipt no
|
|
661
|
-
// longer read clears it; a close-out step, which tries none, does not.
|
|
662
|
-
function refitLabel(step, p) {
|
|
663
|
-
if (step === null) return [];
|
|
664
|
-
const why = refitFailure(step.output);
|
|
665
|
-
if (why === null) return [];
|
|
666
|
-
const computed = p === null ? NaN : Date.parse(p.computed_at);
|
|
667
|
-
if (Number.isFinite(computed) && computed >= Date.parse(step.at)) return [];
|
|
668
|
-
return [`the newest refit failed at ${when(step.at)}: ${why}`];
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
// The Fit's heading labels, against `raw`, the guard on disk, `routed`,
|
|
672
|
-
// readGuard's answer for it, `table`, the installed one, and `records`, whether
|
|
673
|
-
// the fit read the guard's files: fitted beside another guard, on other records,
|
|
674
|
-
// or against another prior. The prior is
|
|
675
|
-
// compared only on what the fit takes from it — `cells`, `classifier`,
|
|
676
|
-
// `splits`, and `window_start` when the guard gives none — so a release that changes only
|
|
677
|
-
// what the fit recomputes, or `fitted_commit` and `version`, raises nothing: the
|
|
678
|
-
// next phase 0's refit would come out the same.
|
|
679
|
-
function fitLabels(p, raw, routed, table, records) {
|
|
604
|
+
// The Fit's labels against `raw`, the guard on disk, and `records`, whether the
|
|
605
|
+
// Fit read the guard's files: fitted beside another guard, or on other records.
|
|
606
|
+
// A Fit that names no guard time or no blob ids leaves its own check unchecked.
|
|
607
|
+
function fitLabels(p, raw, records) {
|
|
680
608
|
const labels = [];
|
|
681
|
-
if (p.guard_computed_at
|
|
682
|
-
if (
|
|
609
|
+
if (p.guard_computed_at === null) labels.push("fitted beside this guard: not checked: `guard_computed_at` is not a string");
|
|
610
|
+
else if (p.guard_computed_at !== raw.computed_at) labels.push(`fitted beside the guard of ${when(p.guard_computed_at)}, not this one`);
|
|
611
|
+
if (records === null) labels.push(`fitted on the guard's records: not checked: ${isRecord(raw.tsv_blobs) ? "the Fit names no blob ids" : "this guard predates the blob ids it needs"}`);
|
|
683
612
|
else if (!records) labels.push("fitted on other records than the guard's");
|
|
684
|
-
if (table === null) {
|
|
685
|
-
labels.push("fitted against the installed table: not checked: no router table read");
|
|
686
|
-
return labels;
|
|
687
|
-
}
|
|
688
|
-
const read = ["cells", "classifier", "splits", ...(routed.window_start === null ? ["window_start"] : [])];
|
|
689
|
-
const prior = isRecord(p.prior) ? p.prior : {};
|
|
690
|
-
if (read.some((k) => !isDeepStrictEqual(prior[k], table[k]))) {
|
|
691
|
-
const version = prior.version === "0.0.0" ? "linked checkout" : (typeof prior.version === "string" ? prior.version : "no version");
|
|
692
|
-
const fitted = typeof prior.fitted_commit === "string" && prior.fitted_commit !== "" ? `fitted at ${prior.fitted_commit.slice(0, 7)}` : "never fitted";
|
|
693
|
-
labels.push(`fitted against ${version} · ${fitted}; the next phase 0 refits`);
|
|
694
|
-
}
|
|
695
613
|
return labels;
|
|
696
614
|
}
|
|
697
615
|
|
|
698
|
-
// The Cells whose newest generation's merged n the guard and the
|
|
616
|
+
// The Cells whose newest generation's merged n the guard and the Fit count
|
|
699
617
|
// differently although both read the same files, `records` true: the guard
|
|
700
|
-
// counts merges by GitHub's state, the
|
|
618
|
+
// counts merges by GitHub's state, the Fit by Rulings. Files the guard names no
|
|
701
619
|
// blob ids for, or other files, compare nothing.
|
|
702
620
|
function nDiffers(p, raw, records) {
|
|
703
621
|
if (records !== true) return [];
|
|
@@ -708,89 +626,79 @@ function nDiffers(p, raw, records) {
|
|
|
708
626
|
}).map((e) => e.cell);
|
|
709
627
|
}
|
|
710
628
|
|
|
711
|
-
//
|
|
712
|
-
//
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
// receipts' newest `metrics` step that tried a refit, newestRefit's pick; `mark` the footnote mark
|
|
718
|
-
// its n footnote takes.
|
|
719
|
-
function evidenceFavours({ fit: read, guard, routed, table, modelRoles, step, mark }) {
|
|
720
|
-
if (routed === null) return noFit("no Fit: it is written only beside a cost guard");
|
|
721
|
-
if (read?.status === "unreadable") return noFit(`no Fit read: ${read.why}`, refitLabel(step, null));
|
|
722
|
-
if (read?.status !== "ok") return noFit("no Fit yet: the next phase 0 writes one", refitLabel(step, null));
|
|
723
|
-
const p = read.fit;
|
|
724
|
-
const fit = p.table;
|
|
725
|
-
const raw = guard.guard;
|
|
726
|
-
// Whether the fit read the guard's files: null when the guard names no blob
|
|
727
|
-
// ids to compare, else whether the two name the same ones.
|
|
728
|
-
const records = isRecord(raw.tsv_blobs) ? isDeepStrictEqual(p.tsv_blobs, raw.tsv_blobs) : null;
|
|
729
|
-
const differ = nDiffers(p, raw, records);
|
|
730
|
-
const entry = (o, s) => {
|
|
731
|
-
const e = rowEntry(fit, routed, modelRoles, o, s);
|
|
732
|
-
const now = table === null ? null : rowDispatch({ table, guard: routed, objective: o, stratum: s }).policy;
|
|
733
|
-
return {
|
|
734
|
-
...e,
|
|
735
|
-
differs: now !== null && now !== e.cell ? "≠ routes now" : null,
|
|
736
|
-
candidates: e.candidates.map((c) => ({ ...c, nMark: s === "*" && differ.includes(c.cell) ? mark : null })),
|
|
737
|
-
};
|
|
738
|
-
};
|
|
739
|
-
return {
|
|
740
|
-
title: FAVOURS,
|
|
741
|
-
source: { text: ["Fit", "this repository's runs", `computed ${when(p.computed_at)}`, plural(fit.n_rows, "Pull")].join(" · "), check: null },
|
|
742
|
-
heading: fit.burn_in ? `burn-in: ${shortWords(fit, "present") ?? "every starting Cell has its merged PRs"}` : null,
|
|
743
|
-
labels: [...refitLabel(step, p), ...fitLabels(p, raw, routed, table, records)],
|
|
744
|
-
footnotes: differ.length === 0 ? [] : [{ mark, text: `${list(differ)}: the guard counts merges by GitHub's state, the fit by Rulings, and the fit admits only drawn or rule-sized Pulls` }],
|
|
745
|
-
rows: Object.fromEntries(OBJECTIVES.map((o) => [o,
|
|
746
|
-
Object.fromEntries(Object.keys(fit.rows[o]).map((s) => [s, entry(o, s)])),
|
|
747
|
-
])),
|
|
748
|
-
unread: null,
|
|
749
|
-
};
|
|
629
|
+
// A group's depth in the tree and its own rule, off its rule path: `*` is the
|
|
630
|
+
// root, and each test joined by `&` is one level below it.
|
|
631
|
+
function groupOf(stratum) {
|
|
632
|
+
if (stratum === "*") return { depth: 0, rule: "*" };
|
|
633
|
+
const tests = stratum.split("&");
|
|
634
|
+
return { depth: tests.length, rule: tests.at(-1) };
|
|
750
635
|
}
|
|
751
636
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
637
|
+
/**
|
|
638
|
+
* The view of the Fit that routes this run. `fit` is gather's read of the Fit
|
|
639
|
+
* and `starting` the starting table (see routingTable); `guard`
|
|
640
|
+
* readCostGuard's answer and `routed` readGuard's for the same file, null when
|
|
641
|
+
* the router reads none; `step` the receipts' newest `metrics` step that tried
|
|
642
|
+
* a refit; `agents`, `modelRoles` and `catalog` the cockpit's own reads, which
|
|
643
|
+
* say what this install runs for each group's exploration Cells; `objective`
|
|
644
|
+
* the live run's, or null. Each Objective's lines are the table's groups in
|
|
645
|
+
* the table's order, the tree's root first; every line has an anchor the
|
|
646
|
+
* `#cells/row/<objective>/<stratum>` link lands on. A candidate's generation
|
|
647
|
+
* check moves to one model-name line when every candidate named differs.
|
|
648
|
+
*/
|
|
649
|
+
function fitView({ fit, starting, guard, routed, modelRoles, catalog, agents, step, objective }) {
|
|
650
|
+
const { fit: p, table, source } = routingTable(fit, starting);
|
|
651
|
+
const raw = guard?.status === "ok" ? guard.guard : null;
|
|
652
|
+
let labels = [];
|
|
653
|
+
let differ = [];
|
|
654
|
+
if (p !== null && raw !== null) {
|
|
655
|
+
// Whether the Fit read the guard's files: null when the guard or the Fit
|
|
656
|
+
// names no blob ids to compare, else whether the two name the same ones.
|
|
657
|
+
const records = isRecord(raw.tsv_blobs) && p.tsv_blobs !== null ? isDeepStrictEqual(p.tsv_blobs, raw.tsv_blobs) : null;
|
|
658
|
+
labels = fitLabels(p, raw, records);
|
|
659
|
+
differ = nDiffers(p, raw, records);
|
|
660
|
+
}
|
|
661
|
+
const mark = "¹";
|
|
662
|
+
const inst = installFrom(modelRoles, catalog, agents);
|
|
663
|
+
const entry = (o, s) => {
|
|
664
|
+
const e = rowEntry(table, routed, modelRoles, o, s);
|
|
665
|
+
return { ...e, candidates: e.candidates.map((c) => ({ ...c, nMark: s === "*" && differ.includes(c.cell) ? mark : null })) };
|
|
666
|
+
};
|
|
667
|
+
// A group's exploration Cells are centred on its `cost` row whichever
|
|
668
|
+
// Objective routes the Pull, so each group's words are worked out once.
|
|
669
|
+
const exploring = new Map();
|
|
670
|
+
const exploringOf = (s) => {
|
|
671
|
+
if (!exploring.has(s)) exploring.set(s, exploringWords(table, routed, s, inst));
|
|
672
|
+
return exploring.get(s);
|
|
782
673
|
};
|
|
783
|
-
const
|
|
674
|
+
const line = (o, s, rest) => ({ stratum: s, ...groupOf(s), ...rest, anchor: `cells-row-${o}-${s}`, href: `#cells/row/${o}/${s}` });
|
|
675
|
+
const objectives = OBJECTIVES.map((o) => ({
|
|
676
|
+
objective: o,
|
|
677
|
+
live: o === objective,
|
|
678
|
+
lines: table === null
|
|
679
|
+
? [line(o, "*", { entry: null, exploring: null, unread: "no starting table read: the rows are not known" })]
|
|
680
|
+
: Object.keys(table.rows[o]).map((s) => line(o, s, { entry: entry(o, s), exploring: exploringOf(s), unread: null })),
|
|
681
|
+
}));
|
|
682
|
+
|
|
683
|
+
const checks = objectives.flatMap((o) => o.lines.flatMap((l) => (l.entry === null ? [] : l.entry.candidates.map((c) => c.model)))).filter((m) => m !== null);
|
|
684
|
+
const modelLine = checks.length > 0 && checks.every((m) => m.state === "differs") ? [...new Set(checks.map((m) => m.text))].join("; ") : null;
|
|
685
|
+
if (modelLine !== null) {
|
|
686
|
+
for (const l of objectives.flatMap((o) => o.lines)) {
|
|
687
|
+
if (l.entry !== null) l.entry.candidates = l.entry.candidates.map((c) => (c.model === null ? c : { ...c, model: { ...c.model, text: null } }));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
784
690
|
return {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
691
|
+
title: "The Fit that routes this run",
|
|
692
|
+
flag: failedFitFlag(step, p),
|
|
693
|
+
source,
|
|
694
|
+
heading: dispatchHeading(table, routed),
|
|
695
|
+
labels,
|
|
696
|
+
notices: modelChanges(p),
|
|
697
|
+
burnIn: burnInProgress(p, routed, table),
|
|
698
|
+
tripped: trippedWords(routed),
|
|
699
|
+
modelLine,
|
|
700
|
+
footnotes: differ.length === 0 ? [] : [{ mark, text: `${list(differ)}: the guard counts merges by GitHub's state, the Fit by Rulings, and the Fit admits only drawn or rule-sized Pulls` }],
|
|
701
|
+
objectives,
|
|
794
702
|
};
|
|
795
703
|
}
|
|
796
704
|
|
|
@@ -850,10 +758,10 @@ function prIsOpen(pr, openPrs) {
|
|
|
850
758
|
// `docs/metrics`, `{ value: { blobs }, readAt, error }`, `blobs` null for a 404.
|
|
851
759
|
// A guard that names no blob ids has nothing to compare, and neither has one
|
|
852
760
|
// whose cockpit read nothing (`main` null). The Fit is compared only while it
|
|
853
|
-
// was fitted beside this guard
|
|
854
|
-
// which computes no Fit, or one whose refit failed —
|
|
855
|
-
//
|
|
856
|
-
// guard.
|
|
761
|
+
// was fitted beside this guard and names blob ids of its own: a guard written
|
|
762
|
+
// after it — a close-out's, which computes no Fit, or one whose refit failed —
|
|
763
|
+
// moves on alone, and the view of the Fit already says it was fitted beside
|
|
764
|
+
// another guard, or that its blob ids are not checked.
|
|
857
765
|
function recordsAgainstMain({ read, fit, main, closeoutPr, openPrs }) {
|
|
858
766
|
const none = { alert: null, note: null };
|
|
859
767
|
if (main == null || read?.status !== "ok") return none;
|
|
@@ -867,7 +775,7 @@ function recordsAgainstMain({ read, fit, main, closeoutPr, openPrs }) {
|
|
|
867
775
|
if (blobs === null) return { alert: null, note: "records against main: main holds no metrics yet" };
|
|
868
776
|
if (!isRecord(blobs)) return unchecked("main's docs/metrics not read yet");
|
|
869
777
|
|
|
870
|
-
const mine = fit?.status === "ok" && fit.fit.guard_computed_at === g.computed_at ? fit.fit : null;
|
|
778
|
+
const mine = fit?.status === "ok" && fit.fit.guard_computed_at === g.computed_at && fit.fit.tsv_blobs !== null ? fit.fit : null;
|
|
871
779
|
const held = (ids, path) => (isRecord(ids) && Object.hasOwn(ids, path) ? ids[path] : undefined);
|
|
872
780
|
const paths = [...new Set([...Object.keys(g.tsv_blobs), ...(mine === null ? [] : Object.keys(mine.tsv_blobs))])].sort();
|
|
873
781
|
const lines = [];
|
|
@@ -949,29 +857,27 @@ function readersAlert(json) {
|
|
|
949
857
|
* The Cell evidence tab's model. `guard` is `readCostGuard`'s answer, `receipts`
|
|
950
858
|
* is `{ phase0, closeout }`, each the receipt's `metrics` step `{ status, at,
|
|
951
859
|
* output }` or null, `agents` is `{ list: [{ file, model }], error }`, and
|
|
952
|
-
* `modelRoles` the carried `{ value, readAt, error }`
|
|
860
|
+
* `modelRoles` and `catalog` the carried `{ value, readAt, error }` reads of
|
|
861
|
+
* `omp config get modelRoles` and `omp models`, or null — `error` being
|
|
953
862
|
* `{ at, message }`, and `pulls` this run's Pulls, one per card with a Cell line:
|
|
954
863
|
* `{ issue, cell, mark, targets: [{ cell, generation }] }` (compute-board.mjs's
|
|
955
|
-
* cellLine). `table` is the
|
|
956
|
-
* null, `
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
961
|
-
*
|
|
962
|
-
* read
|
|
963
|
-
* Pull, no table, no install, no Objective, no Fit.
|
|
864
|
+
* cellLine). `table` is the starting router table `validateTable` accepted or
|
|
865
|
+
* null, `objective` the live run's Objective or null between runs, and `fit`
|
|
866
|
+
* the Fit as gather read `.fleet/router-fit.json`: `{ status: "ok", fit: {
|
|
867
|
+
* computed_at, guard_computed_at, tsv_blobs, table } }`, the first three null
|
|
868
|
+
* where the file holds no string or object, `{ status: "missing" }`
|
|
869
|
+
* or `{ status: "unreadable", why }`. An input left out reads as nothing
|
|
870
|
+
* read: a missing guard, no receipt, no definitions, no `modelRoles` or catalog
|
|
871
|
+
* read, no Pull, no table, no Objective, no Fit.
|
|
964
872
|
*/
|
|
965
|
-
export function computeCellEvidence({ guard, receipts, agents, modelRoles = null,
|
|
966
|
-
guardJson = null, mainMetrics = null, closeoutPr = null, openPrs = null
|
|
873
|
+
export function computeCellEvidence({ guard, receipts, agents, modelRoles = null, catalog = null, pulls = [], table = null, objective = null, fit = null,
|
|
874
|
+
guardJson = null, mainMetrics = null, closeoutPr = null, openPrs = null }) {
|
|
967
875
|
const routed = guard?.status === "ok" ? readGuard(guard.guard) : null;
|
|
968
|
-
const routes = routesNow({ table, guard: routed, modelRoles, install, repoUrl, checkout: checkoutTable });
|
|
969
876
|
const step = newestStep(receipts);
|
|
970
|
-
const favours = evidenceFavours({ fit, guard, routed, table, modelRoles, step: newestRefit(receipts), mark: superscript(routes.footnotes.length + 1) });
|
|
971
877
|
const records = recordsAgainstMain({ read: guard, fit, main: mainMetrics, closeoutPr, openPrs });
|
|
972
878
|
return {
|
|
973
879
|
alerts: [records.alert, noRulingAlert(guard), readersAlert(guardJson)].filter((a) => a !== null),
|
|
974
|
-
policy:
|
|
880
|
+
policy: fitView({ fit, starting: table, guard, routed, modelRoles, catalog, agents, step: newestRefit(receipts), objective }),
|
|
975
881
|
guard: guardSection(guard, receipts, step, modelRoles, pulls, records.note),
|
|
976
882
|
declared: declaredSection(agents, modelRoles),
|
|
977
883
|
};
|
|
@@ -98,7 +98,7 @@ export const FIT_EVERY_MERGED = 50;
|
|
|
98
98
|
// The starting Cells short of MIN_N merged PRs in a guard's `n`, each with its
|
|
99
99
|
// count, in their order: burn-in holds while any is. A Cell the guard has no
|
|
100
100
|
// count for has 0.
|
|
101
|
-
|
|
101
|
+
const shortStartingCells = (n) => STARTING_CELLS.map((c) => [c, n[c] ?? 0]).filter(([, k]) => k < MIN_N);
|
|
102
102
|
const KINDS = new Set(["bug", "enhancement", "documentation"]);
|
|
103
103
|
const DAY_MS = 86_400_000;
|
|
104
104
|
|