@feigi/fleet-ctl 3.158.39 → 3.160.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.158.39",
3
+ "version": "3.160.0",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -461,8 +461,8 @@ function ceEntry(e) {
461
461
 
462
462
  // The heading of the view of the Fit: its failed-Fit flag first, then its
463
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.
464
+ // labels and model-change notices, burn-in progress, the tripped Cells, the
465
+ // Cells the install does not run and the model-name line, where each is set.
466
466
  function ceFitHeading(p) {
467
467
  const box = el("div");
468
468
  if (p.flag) { const flag = el("div", "ce-alert"); flag.append(el("div", "ce-verdict", p.flag)); box.append(flag); }
@@ -476,6 +476,10 @@ function ceFitHeading(p) {
476
476
  for (const c of p.burnIn.cells) box.append(el("div", "ce-cand", `${c.cell} · ${c.n} of ${c.of} merged PRs`));
477
477
  }
478
478
  if (p.tripped) box.append(el("div", "ce-note", p.tripped));
479
+ if (p.unrunnable) {
480
+ box.append(el("div", "ce-note", p.unrunnable.heading));
481
+ for (const c of p.unrunnable.cells) box.append(el("div", "ce-cand", c.text));
482
+ }
479
483
  if (p.modelLine) box.append(el("div", "ce-note ce-amber", p.modelLine));
480
484
  return box;
481
485
  }
@@ -366,6 +366,15 @@ function reasonWords(r, table) {
366
366
  const named = r.tripped.length === 1 ? `${row}'s ${r.tripped[0]}` : `${row}'s Cell (one of ${r.tripped.join(", ")})`;
367
367
  return [part(`${named} tripped${drawn ? "" : ": default Cell"}`, { href: rowHref(r, table) })];
368
368
  }
369
+ case "table-cell-unrunnable": {
370
+ // The Routing keeps the Cells the install does not run, not which of them the row named: the installed table's
371
+ // row for the group says, when it names one of them. A row Cell with no definition is in no list, which can
372
+ // then be empty.
373
+ const rowCell = table === null ? undefined : (table.rows[r.objective][r.stratum] ?? table.rows[r.objective]["*"]);
374
+ const cell = r.unrunnable.includes(rowCell) ? rowCell : r.unrunnable.length === 1 ? r.unrunnable[0] : null;
375
+ const named = cell !== null ? `${row}'s ${cell}` : r.unrunnable.length === 0 ? `${row}'s Cell` : `${row}'s Cell (one of ${r.unrunnable.join(", ")})`;
376
+ return [part(`${named} unrunnable here${drawn ? "" : ": default Cell"}`, { href: rowHref(r, table) })];
377
+ }
369
378
  case "guard-tripped":
370
379
  return [part(drawn ? `left out as tripped: ${r.tripped.join(", ")}` : "every other Cell tripped: no draw")];
371
380
  case "guard-missing": return [part("no cost guard yet: default Cell only")];
@@ -17,7 +17,9 @@
17
17
  // lays out the Cell the table plus the workspace's guard route to and why
18
18
  // (ticket-router.mjs's rowDispatch, the function `route` itself calls), with
19
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
20
+ // over; above them, burn-in progress, the Cells the guard has tripped and,
21
+ // apart from them, the Cells the install does not run (each with its role, the
22
+ // model the role resolves to and the levels that model runs), a notice
21
23
  // for each starting Cell whose model changed and restarted burn-in, and a flag
22
24
  // while the newest refit failed and an older Fit, or the starting table, routes.
23
25
  // The receipts' newest `metrics` step is what the guard section quotes when there
@@ -35,7 +37,7 @@
35
37
  import { isDeepStrictEqual } from "node:util";
36
38
  import { CELL, OBJECTIVES, POLICY_CELL, STARTING_CELLS } from "./ledger-grammar.mjs";
37
39
  import { costGuardFault } from "./fleet-tick.mjs";
38
- import { MIN_N, installOf, parseGuard, readGuard, rowDispatch } from "./ticket-router.mjs";
40
+ import { MIN_N, defaultCellOf, installOf, parseGuard, readGuard, rowDispatch, startingCellsOf, unrunnableCells } from "./ticket-router.mjs";
39
41
  import { implementerCell, modelsEqual, parseModelRoute, resolveRole } from "./tier-roles.mjs";
40
42
 
41
43
  // The implementer Cells, in the order the guard section draws them: one per
@@ -487,29 +489,38 @@ function failedFitFlag(step, p) {
487
489
  return `this run's Fit failed at ${when(step.at)}: ${why}; ${routes}`;
488
490
  }
489
491
 
490
- // How a Pull is dispatched, for every group alike: what `route` does under the guard.
491
- function dispatchHeading(table, guard) {
492
- if (guard === null) return `no cost guard: every Pull runs at ${POLICY_CELL}, the default Cell`;
492
+ // How a Pull is dispatched, for every group alike: what `route` does under the guard and the install
493
+ // (installOf's, or null where it was not read).
494
+ function dispatchHeading(table, guard, install) {
495
+ if (guard === null) return `no cost guard: every Pull runs at ${defaultCellOf(install)}, the default Cell`;
493
496
  if (table === null) return null;
494
497
  if (table.burn_in) return "burn-in: every Pull is drawn over the starting Cells the guard has not tripped";
495
498
  return "every 5th Pull that is no chain head is drawn over its group's exploration Cells; the rest run the group's Cell";
496
499
  }
497
500
 
498
- // Merged PRs per starting Cell, against MIN_N: the counts burn-in is judged on —
501
+ // Merged PRs per counted starting Cell, against MIN_N: the counts burn-in is judged on —
499
502
  // the Fit's own guard counts while the Fit routes, the cost guard's while the
500
- // starting table does. Null with neither to count from. The heading follows the
503
+ // starting table does. Null with neither to count from. The Cells counted are
504
+ // the ones the Fit recorded, or the install this cockpit reads runs while the
505
+ // starting table routes (countedStartingCells); the heading says which set it
506
+ // counted and which starting Cells it left out as unrunnable. It follows the
501
507
  // routing table's `burn_in`, and says "ended" only of counts that all reach
502
508
  // MIN_N: a Fit sets its flag off its own counts, but the starting table's flag
503
509
  // is its own, whatever the cost guard counts since.
504
- function burnInProgress(p, guard, table) {
510
+ function burnInProgress(p, guard, table, inst) {
505
511
  const n = p !== null ? p.table.guard.n : guard?.n;
506
512
  if (!isRecord(n)) return null;
507
- const cells = STARTING_CELLS.map((cell) => ({ cell, n: count(n[cell]) ?? 0, of: MIN_N }));
513
+ const counted = countedStartingCells(p, inst);
514
+ const left = STARTING_CELLS.filter((c) => !counted.includes(c));
515
+ const subset = left.length > 0;
516
+ const cells = counted.map((cell) => ({ cell, n: count(n[cell]) ?? 0, of: MIN_N }));
508
517
  const done = cells.filter((c) => c.n >= MIN_N).length;
509
- const tally = `${done} of ${cells.length} starting Cells ${done === 1 ? "has" : "have"} the ${MIN_N} merged PRs each needs`;
518
+ const kind = subset ? "runnable starting" : "starting";
519
+ const out = subset ? `; ${list(left)} unrunnable` : "";
520
+ const tally = `${done} of ${cells.length} ${kind} Cells ${done === 1 ? "has" : "have"} the ${MIN_N} merged PRs each needs${out}`;
510
521
  if (table === null || table.burn_in) return { heading: `burn-in: ${tally}`, cells };
511
522
  const heading = done === cells.length
512
- ? `burn-in ended: every starting Cell has its ${MIN_N} merged PRs`
523
+ ? `burn-in ended: every ${kind} Cell has its ${MIN_N} merged PRs${out}`
513
524
  : `no burn-in: the starting table routes without it, though only ${tally}`;
514
525
  return { heading, cells };
515
526
  }
@@ -520,14 +531,29 @@ function trippedWords(guard) {
520
531
  return guard.tripped.length === 0 ? "the cost guard has tripped no Cell" : `tripped by the cost guard: ${list(guard.tripped)}`;
521
532
  }
522
533
 
523
- // A notice for each starting Cell whose role's model changed and so restarted
534
+ // The starting Cells burn-in counts, in their order: the set the Fit recorded
535
+ // while a Fit routes — every starting Cell for a Fit that records none, as
536
+ // every Fit did — else those the cockpit's own install read runs, all three
537
+ // while it has none.
538
+ function countedStartingCells(p, inst) {
539
+ return p === null ? startingCellsOf(inst.install) : fitStartingCells(p.table);
540
+ }
541
+
542
+ // The starting Cells a Fit's table records, in their order: all three for a table that records none, or none usable.
543
+ function fitStartingCells(table) {
544
+ const recorded = table.starting_cells;
545
+ const valid = Array.isArray(recorded) && recorded.length > 0 && recorded.every((c) => STARTING_CELLS.includes(c));
546
+ return valid ? STARTING_CELLS.filter((c) => recorded.includes(c)) : [...STARTING_CELLS];
547
+ }
548
+
549
+ // A notice for each counted starting Cell whose role's model changed and so restarted
524
550
  // burn-in: the Fit holds an older generation of it in the root group, and its
525
551
  // newest generation is short of MIN_N merged PRs in the counts the Fit judged
526
552
  // burn-in on. None while the starting table routes, which holds no estimates.
527
553
  function modelChanges(p) {
528
554
  if (p === null || !p.table.burn_in) return [];
529
555
  const root = isRecord(p.table.estimates?.["*"]) ? p.table.estimates["*"] : {};
530
- return STARTING_CELLS.flatMap((cell) => {
556
+ return fitStartingCells(p.table).flatMap((cell) => {
531
557
  const e = root[cell];
532
558
  const older = isRecord(e?.older) ? Object.keys(e.older) : [];
533
559
  const k = count(p.table.guard.n[cell]) ?? 0;
@@ -550,6 +576,21 @@ function installFrom(modelRoles, catalog, agents) {
550
576
  return { install: installOf({ modelRoles: modelRoles.value, catalog: catalog.value, definitions: agents.list.map((a) => a.file) }), why: null, note };
551
577
  }
552
578
 
579
+ // The Cells this install does not run, apart from the tripped ones, each with its role, the model the role resolves
580
+ // to and the levels that model runs: `{ heading, cells: [{ cell, role, model, levels, text }] }`. While the install
581
+ // has not been read the heading says so, and no Cell is named.
582
+ function unrunnableView(inst) {
583
+ if (inst.install === null) return { heading: `unrunnable Cells: not checked: ${inst.why}`, cells: [] };
584
+ const cells = unrunnableCells(inst.install).map((cell) => {
585
+ const role = CELL.exec(cell)[1];
586
+ const model = inst.install.models[role];
587
+ const levels = inst.install.ladders[role];
588
+ return { cell, role, model, levels, text: `${cell} · modelRoles.${role} → ${model ?? "no model"} runs ${levels.join(", ") || "none"}` };
589
+ });
590
+ const heading = cells.length === 0 ? "the install runs every Cell it has a definition for" : `not run by this install: ${list(cells.map((c) => c.cell))}`;
591
+ return { heading, cells };
592
+ }
593
+
553
594
  // The Cells a group draws over, in words: rowDispatch's draw, which is centred on
554
595
  // the group's `cost` row Cell whichever Objective routes the Pull. Null with no
555
596
  // guard, when nothing is drawn.
@@ -557,7 +598,11 @@ function exploringWords(table, guard, stratum, inst) {
557
598
  if (guard === null) return null;
558
599
  if (!table.burn_in && inst.install === null) return `exploring: not checked: ${inst.why}`;
559
600
  const rd = rowDispatch({ table, guard, objective: "cost", stratum, install: inst.install });
560
- if (table.burn_in) return rd.draw === null ? "draws nothing: every starting Cell is tripped" : `drawn over ${list(rd.draw.cells)}`;
601
+ if (table.burn_in) {
602
+ if (rd.draw !== null) return `drawn over ${list(rd.draw.cells)}`;
603
+ const orUnrunnable = unrunnableCells(inst.install).some((c) => STARTING_CELLS.includes(c)) ? " or unrunnable" : "";
604
+ return `draws nothing: every starting Cell is tripped${orUnrunnable}`;
605
+ }
561
606
  const words = rd.draw === null ? "exploring nothing: no exploration Cell this install runs is left untripped" : `exploring ${list(rd.draw.cells)}`;
562
607
  return inst.note === null ? words : `${words}; ${inst.note}`;
563
608
  }
@@ -584,16 +629,19 @@ function intervalWords(range, objective) {
584
629
  return `95% interval [${one(range[0])}, ${one(range[1])}]`;
585
630
  }
586
631
 
587
- // One row of the routing table under the guard: the Cell it routes to and why,
588
- // the row's own Cell where the guard holds it back, and each candidate's n (null
589
- // where the table carries no count), verdict and interval.
590
- function rowEntry(table, guard, modelRoles, objective, stratum) {
591
- const rd = rowDispatch({ table, guard, objective, stratum });
632
+ // One row of the routing table under the guard and the install: the Cell it
633
+ // routes to and why, the row's own Cell where the guard holds it back or the
634
+ // install does not run it (`install` is installOf's answer, null where the
635
+ // cockpit has not read one), and each candidate's n (null where the table
636
+ // carries no count), verdict and interval.
637
+ function rowEntry(table, guard, modelRoles, objective, stratum, install) {
638
+ const rd = rowDispatch({ table, guard, objective, stratum, install });
592
639
  const row = table.rows[objective][stratum];
593
640
  const record = isRecord(table.reasons?.[objective]?.[stratum]) ? table.reasons[objective][stratum] : null;
594
641
  const estimates = isRecord(table.estimates?.[stratum]) ? table.estimates[stratum] : {};
595
- const held = row === rd.policy ? null
596
- : rd.reason === "guard-missing" ? `${row} held: no cost guard` : `${row} tripped`;
642
+ const held = rd.reason === "table-cell-unrunnable" ? `${row} unrunnable here`
643
+ : row === rd.policy ? null
644
+ : rd.reason === "guard-missing" ? `${row} held: no cost guard` : `${row} tripped`;
597
645
  return {
598
646
  cell: rd.policy,
599
647
  held,
@@ -647,7 +695,9 @@ function groupOf(stratum) {
647
695
  * readCostGuard's answer and `routed` readGuard's for the same file, null when
648
696
  * the router reads none; `step` the receipts' newest `metrics` step that tried
649
697
  * a refit; `agents`, `modelRoles` and `catalog` the cockpit's own reads, which
650
- * say what this install runs for each group's exploration Cells; `objective`
698
+ * say what this install runs: each group's exploration Cells, the Cells it
699
+ * does not run, and the starting Cells burn-in counts while the starting table
700
+ * routes; `objective`
651
701
  * the live run's, or null. Each Objective's lines are the table's groups in
652
702
  * the table's order, the tree's root first; every line has an anchor the
653
703
  * `#cells/row/<objective>/<stratum>` link lands on. A candidate's generation
@@ -668,7 +718,7 @@ function fitView({ fit, starting, guard, routed, modelRoles, catalog, agents, st
668
718
  const mark = "¹";
669
719
  const inst = installFrom(modelRoles, catalog, agents);
670
720
  const entry = (o, s) => {
671
- const e = rowEntry(table, routed, modelRoles, o, s);
721
+ const e = rowEntry(table, routed, modelRoles, o, s, inst.install);
672
722
  return { ...e, candidates: e.candidates.map((c) => ({ ...c, nMark: s === "*" && differ.includes(c.cell) ? mark : null })) };
673
723
  };
674
724
  // A group's exploration Cells are centred on its `cost` row whichever
@@ -698,11 +748,12 @@ function fitView({ fit, starting, guard, routed, modelRoles, catalog, agents, st
698
748
  title: "The Fit that routes this run",
699
749
  flag: failedFitFlag(step, p),
700
750
  source,
701
- heading: dispatchHeading(table, routed),
751
+ heading: dispatchHeading(table, routed, inst.install),
702
752
  labels,
703
753
  notices: modelChanges(p),
704
- burnIn: burnInProgress(p, routed, table),
754
+ burnIn: burnInProgress(p, routed, table, inst),
705
755
  tripped: trippedWords(routed),
756
+ unrunnable: unrunnableView(inst),
706
757
  modelLine,
707
758
  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` }],
708
759
  objectives,
@@ -45,17 +45,21 @@
45
45
  // member's stamp does not outlive it. Carried, never written, by
46
46
  // the heartbeat and by ledger.mjs.
47
47
  // applied fleet-tick only, and only under --apply. {run, reapAfter,
48
- // sweptAfter}: the merge-bot numbers whose `merge-bot-<n>=done` the
49
- // tick has already run reap.sh, reclaim-scratch.mjs and evict.mjs
50
- // after (`reapAfter`), the fix-applier, finisher and failed review
51
- // launch names whose settle it has already run reclaim-scratch.mjs
52
- // after (`sweptAfter`, left out while empty), and the controller
53
- // record's `at` they belong to. Written only under a record: with none, nothing tells
54
- // one run from the next. Merge-bot numbering restarts at 1 in a run
55
- // that carries no bot forward, and this file outlives the rotation,
56
- // so a list whose `run` is not the current record's `at` is the
57
- // previous run's and names nothing in this one. Carried, never
58
- // written, by the heartbeat and by ledger.mjs.
48
+ // reapAfterPrs, sweptAfter}: the merge-bot numbers whose
49
+ // `merge-bot-<n>=done` the tick has already run reap.sh,
50
+ // reclaim-scratch.mjs and evict.mjs after (`reapAfter`); in a run
51
+ // whose merge bot is off, the PR numbers it read MERGED and has
52
+ // already run them after (`reapAfterPrs`, left out while empty);
53
+ // the fix-applier, finisher and failed review launch names whose
54
+ // settle it has already run reclaim-scratch.mjs after
55
+ // (`sweptAfter`, left out while empty); and the controller record's
56
+ // `at` they belong to. Written only under a record: with none,
57
+ // nothing tells one run from the next. Merge-bot numbering
58
+ // restarts at 1 in a run that carries no bot forward, and this
59
+ // file outlives the rotation, so a list whose `run` is not the
60
+ // current record's `at` is the previous run's and names nothing in
61
+ // this one. Carried, never written, by the heartbeat and by
62
+ // ledger.mjs.
59
63
  //
60
64
  // One writer per key. A key two scripts wrote would need locking to be
61
65
  // correct, and none of them is in a position to hold one. That holds per key,
@@ -259,7 +263,11 @@ export function readState(path, name, warn = console.error) {
259
263
  if (!isRecord(v) || !Array.isArray(v.reapAfter)) return null;
260
264
  if (!(Number.isInteger(v.run) && v.run > 0)) return null;
261
265
  const swept = Array.isArray(v.sweptAfter) ? v.sweptAfter.filter((m) => typeof m === "string" && m !== "") : [];
262
- return { run: v.run, reapAfter: v.reapAfter.filter((n) => Number.isInteger(n) && n > 0), ...(swept.length > 0 ? { sweptAfter: swept } : {}) };
266
+ const prs = Array.isArray(v.reapAfterPrs) ? v.reapAfterPrs.filter((n) => Number.isInteger(n) && n > 0) : [];
267
+ return {
268
+ run: v.run, reapAfter: v.reapAfter.filter((n) => Number.isInteger(n) && n > 0),
269
+ ...(prs.length > 0 ? { reapAfterPrs: prs } : {}), ...(swept.length > 0 ? { sweptAfter: swept } : {}),
270
+ };
263
271
  };
264
272
  const { quiet, digest, beat, ticked, acted, controller, seen, applied, ...rest } = parsed;
265
273
  // A controller key that ctl() rejects is a record someone wrote and nobody