@feigi/fleet-ctl 3.148.2 → 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/commands/run-merge-bot.md +4 -4
- 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/fleet-event.mjs +173 -15
- package/scripts/fleet-tick.mjs +5 -4
- package/scripts/ledger.mjs +31 -22
- package/scripts/ticket-router.mjs +1 -1
- package/skills/run-team/SKILL.md +5 -5
- package/skills/run-team/references/finisher.md +9 -4
- package/skills/run-team/references/ledger.md +1 -1
- package/skills/run-team/references/member-lifecycle.md +1 -1
|
@@ -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
|
};
|