@feigi/fleet-ctl 3.23.33 → 3.23.35
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
package/scripts/cell-readout.mjs
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Inputs default to docs/metrics/ under the working directory. A Pull is a
|
|
8
8
|
// ticket-features.tsv row; what it ran is the member-outcomes.tsv row with the
|
|
9
|
-
// same `session` + `agent`.
|
|
9
|
+
// same `session` + `agent`. Rows of one `session` + `agent` that name one
|
|
10
|
+
// `chosen_cell` are one Pull; the readout refuses rows naming different cells,
|
|
11
|
+
// naming the file, the session, the agent and both cells, since which cell ran
|
|
12
|
+
// is then unknown.
|
|
10
13
|
//
|
|
11
14
|
// ADMISSIBLE ROW. A Pull counts only when its member row exists, was
|
|
12
15
|
// dispatched as the drawn cell's own definition (`subagent_type` =
|
|
@@ -34,8 +37,10 @@
|
|
|
34
37
|
// model by name, or `mixed (<model-a> n=…, <model-b> n=…)` when they span more
|
|
35
38
|
// than one, because a role's target is operator config that can move under a
|
|
36
39
|
// cell's history. A cell below the gate prints nothing on stdout and one
|
|
37
|
-
// `below the gate` count on stderr.
|
|
38
|
-
// ticket or member: the gate forbids reading a comparison early.
|
|
40
|
+
// `below the gate` count on stderr. Neither the gate line nor that count names
|
|
41
|
+
// a session, ticket or member: the gate forbids reading a comparison early.
|
|
42
|
+
// Only the refusal of conflicting ticket-features rows names a session and an
|
|
43
|
+
// agent, and it prints nothing on stdout.
|
|
39
44
|
//
|
|
40
45
|
// STOPPING RULE (exported as `stoppingRule`, not printed by this CLI). For a
|
|
41
46
|
// cell X other than slow-high whose definition is live, a VERDICT is a ticket
|
|
@@ -74,6 +79,21 @@ export const STOP = Object.freeze({ verdicts: 10, failRate: 0.8 });
|
|
|
74
79
|
const key = (session, agent) => `${session}\0${agent}`;
|
|
75
80
|
const levelOf = (cell) => CELL.exec(cell)?.[2] ?? null;
|
|
76
81
|
|
|
82
|
+
/**
|
|
83
|
+
* `features` keyed by session+agent. A repeat naming the same `chosen_cell`
|
|
84
|
+
* collapses into the first row; one naming another cell throws.
|
|
85
|
+
*/
|
|
86
|
+
function pullsOf(features) {
|
|
87
|
+
const pulls = new Map();
|
|
88
|
+
for (const p of features) {
|
|
89
|
+
const k = key(p.session, p.agent);
|
|
90
|
+
const prev = pulls.get(k);
|
|
91
|
+
if (!prev) pulls.set(k, p);
|
|
92
|
+
else if (prev.chosen_cell !== p.chosen_cell) throw new Error(`session ${p.session} agent ${p.agent} has two rows, chosen_cell '${prev.chosen_cell}' and '${p.chosen_cell}'`);
|
|
93
|
+
}
|
|
94
|
+
return pulls;
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
/** The join's member row for a Pull when the Pull is admissible, else null. */
|
|
78
98
|
function admissibleMember(pull, members) {
|
|
79
99
|
const m = members.get(key(pull.session, pull.agent));
|
|
@@ -88,13 +108,12 @@ function admissibleMember(pull, members) {
|
|
|
88
108
|
* ticket-features row, `{ cell, comparisons, runDates, dates, models, gated }`,
|
|
89
109
|
* sorted by cell. `dates` is the comparisons' distinct run_dates, sorted;
|
|
90
110
|
* `models` maps each resolved model of the cell's admissible rows to its row
|
|
91
|
-
* count, largest first. `unjoined` counts Pulls with no member row.
|
|
111
|
+
* count, largest first. `unjoined` counts Pulls with no member row. Throws on
|
|
112
|
+
* two ticket-features rows of one session+agent naming different cells.
|
|
92
113
|
*/
|
|
93
114
|
export function readout({ features, members }) {
|
|
94
115
|
const byKey = new Map(members.map((m) => [key(m.session, m.agent), m]));
|
|
95
|
-
|
|
96
|
-
// same member row.
|
|
97
|
-
const pulls = new Map(features.map((p) => [key(p.session, p.agent), p]));
|
|
116
|
+
const pulls = pullsOf(features);
|
|
98
117
|
const sessions = new Map();
|
|
99
118
|
const cells = new Map();
|
|
100
119
|
let unjoined = 0;
|
|
@@ -201,7 +220,9 @@ function main() {
|
|
|
201
220
|
const features = load(featuresPath, parseFeatures);
|
|
202
221
|
const members = load(membersPath, parseMemberTsv);
|
|
203
222
|
|
|
204
|
-
|
|
223
|
+
let cells, unjoined;
|
|
224
|
+
try { ({ cells, unjoined } = readout({ features, members })); }
|
|
225
|
+
catch (e) { die(`${featuresPath}: ${e.message}`); }
|
|
205
226
|
const lines = [];
|
|
206
227
|
const notes = [];
|
|
207
228
|
if (unjoined > 0) {
|
|
@@ -196,6 +196,41 @@ test("a re-dispatched Pull is one Pull: two ticket-features rows for one session
|
|
|
196
196
|
assert.equal(unjoined, 1, "a re-dispatched Pull with no member row is one unjoined Pull");
|
|
197
197
|
});
|
|
198
198
|
|
|
199
|
+
test("two ticket-features rows for one session+agent naming different cells are refused, naming the session, agent and both cells", () => {
|
|
200
|
+
const w = world();
|
|
201
|
+
addRow(w, { session: "sTorn", date: "2026-10-01", cell: "task-high" });
|
|
202
|
+
addRow(w, { session: "sTorn", date: "2026-10-01", cell: "slow-high" });
|
|
203
|
+
// The same Pull's row again, drawn at another cell: which cell ran is unknown.
|
|
204
|
+
w.features.push({ ...w.features[0], chosen_cell: "smol-high" });
|
|
205
|
+
const f = files(w);
|
|
206
|
+
const r = spawnSync(process.execPath, [SCRIPT, "--ticket-features", f.features, "--member-outcomes", f.members], { encoding: "utf8", cwd: f.dir });
|
|
207
|
+
assert.equal(r.status, 2, r.stderr);
|
|
208
|
+
assert.equal(r.stdout, "");
|
|
209
|
+
assert.equal(r.stderr, `\ncell-readout: ${f.features}: session sTorn agent impl-100 has two rows, chosen_cell 'task-high' and 'smol-high'\n`);
|
|
210
|
+
assert.throws(() => readout(parsed(w)), /session sTorn agent impl-100 has two rows, chosen_cell 'task-high' and 'smol-high'/);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// What the refusal must ACCEPT: a repeat that agrees on the cell, whatever else
|
|
214
|
+
// it differs on, and one agent name reused in another session.
|
|
215
|
+
test("a repeated session+agent on the same cell is one Pull even when its other columns differ, and the key is the session+agent pair", () => {
|
|
216
|
+
const w = world();
|
|
217
|
+
addRow(w, { session: "sSame", date: "2026-10-01", cell: "task-high" });
|
|
218
|
+
addRow(w, { session: "sSame", date: "2026-10-01", cell: "slow-high" });
|
|
219
|
+
w.features.push({ ...w.features[0], run_date: "2026-10-02", brief_chars: "200" });
|
|
220
|
+
// impl-100 again, in another session and at another cell: a different Pull.
|
|
221
|
+
addRow(w, { session: "sOther", date: "2026-10-02", cell: "smol-high" });
|
|
222
|
+
w.features.at(-1).agent = "impl-100";
|
|
223
|
+
w.members.at(-1).agent = "impl-100";
|
|
224
|
+
w.members.at(-1).member = "impl-100";
|
|
225
|
+
addRow(w, { session: "sOther", date: "2026-10-02", cell: "slow-high" });
|
|
226
|
+
const r = cli(w);
|
|
227
|
+
assert.equal(r.status, 0, r.stderr);
|
|
228
|
+
const { cells } = readout(parsed(w));
|
|
229
|
+
const of = (cell) => cells.find((c) => c.cell === cell);
|
|
230
|
+
assert.deepEqual([of("task-high").comparisons, [...of("task-high").models]], [1, [["claude-sonnet-5", 1]]]);
|
|
231
|
+
assert.equal(of("smol-high").comparisons, 1);
|
|
232
|
+
});
|
|
233
|
+
|
|
199
234
|
test("a blank member-outcomes run_date is no date: its session is a comparison but adds nothing to the distinct-date count", () => {
|
|
200
235
|
const w = world();
|
|
201
236
|
addComparisons(w, "task-high", 4, 4);
|
|
@@ -3,6 +3,7 @@ import assert from "node:assert/strict";
|
|
|
3
3
|
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
+
import { stripComments } from "./strip-comments.mjs";
|
|
6
7
|
|
|
7
8
|
// #516. A scan over every tracked `.mjs`/`.sh`/`.js`/`.yml` file for
|
|
8
9
|
// `path.ext:NNN` found 22 line-numbered citations (plus two bare `(:NNN)`
|
|
@@ -41,7 +42,8 @@ import { join } from "node:path";
|
|
|
41
42
|
// construct the citation names must still be named. Neither reads the cited
|
|
42
43
|
// file, so nothing in this table notices the TARGET losing the construct — the
|
|
43
44
|
// direction #870 closes for probe 3's citation, in
|
|
44
|
-
// inflight-citation-prose.test.mjs, and leaves open for every entry below
|
|
45
|
+
// inflight-citation-prose.test.mjs, and leaves open for every entry below
|
|
46
|
+
// except where the next two paragraphs say otherwise.
|
|
45
47
|
//
|
|
46
48
|
// One target-side check runs here, for one citation shape only (#1757): a
|
|
47
49
|
// `live` needle that names an ADR by number (`ADR 0010`) is a pointer, and the
|
|
@@ -51,8 +53,14 @@ import { join } from "node:path";
|
|
|
51
53
|
// WTROOT gives: renumber or move the ADR and this reds; repoint the needle
|
|
52
54
|
// alone and the needle reds against the citing file's unchanged prose. The
|
|
53
55
|
// pointer names the ADR by number, so a retitle that keeps the number keeps
|
|
54
|
-
// the pointer true and stays green.
|
|
55
|
-
//
|
|
56
|
+
// the pointer true and stays green.
|
|
57
|
+
//
|
|
58
|
+
// One construct needle is checked against its target too: ledger.mjs's
|
|
59
|
+
// "runDispatch's `keyNum` check", a pointer that names a function and a
|
|
60
|
+
// variable inside it. Rename either in the code and the comment points at
|
|
61
|
+
// nothing while its needle stays satisfied by the comment's own words, so
|
|
62
|
+
// runDispatchKeyNumFault reads comment-stripped ledger.mjs for both. Every
|
|
63
|
+
// other construct needle is still never checked against its target.
|
|
56
64
|
//
|
|
57
65
|
// And two claims are held by what they say, not by how they were spelled:
|
|
58
66
|
// ADR 0010's security release (#1928) and its count of releases in the 43
|
|
@@ -529,7 +537,8 @@ const FILES = [
|
|
|
529
537
|
// #2516. The `filed` subcommand's isDigits() comment pointed at
|
|
530
538
|
// "(line ~1527)" for the `keyNum` check it mirrors — a line that had
|
|
531
539
|
// already drifted into an unrelated comment. It names the check by its
|
|
532
|
-
// enclosing function now.
|
|
540
|
+
// enclosing function now. runDispatchKeyNumFault below holds the cited
|
|
541
|
+
// side: the function and the check still exist under those names.
|
|
533
542
|
stale: [/fleet-plugin-design\.md:200/, /candidates\.mjs:279/, /\blines?\s+~?\d+/],
|
|
534
543
|
live: ["refuseIfCapped", "runDispatch's `keyNum` check"],
|
|
535
544
|
},
|
|
@@ -846,6 +855,58 @@ for (const { path, stale, live } of FILES) {
|
|
|
846
855
|
}
|
|
847
856
|
}
|
|
848
857
|
|
|
858
|
+
// The cited side of ledger.mjs's "runDispatch's `keyNum` check" pointer: a
|
|
859
|
+
// top-level `function runDispatch(` (`async` or not) whose body, up to the
|
|
860
|
+
// first line that starts with `}`, still calls `isDigits(keyNum)`. Comments
|
|
861
|
+
// are stripped first, so the pointer's own comment, or the check left behind
|
|
862
|
+
// as a whole-line `//` or `/* */` comment, cannot stand in for the code, and
|
|
863
|
+
// KEYNUM_CHECK refuses a check that follows a `//` on its line. Two forms
|
|
864
|
+
// still can, because strip-comments.mjs blanks whole-line comments only and
|
|
865
|
+
// nothing here tokenizes: the check's text inside a string literal, and
|
|
866
|
+
// inside a block comment opened after code on the same line. Null when the
|
|
867
|
+
// function and the call both hold, else the reason.
|
|
868
|
+
const RUN_DISPATCH = /^(?:async\s+)?function\s+runDispatch\s*\(/m;
|
|
869
|
+
const KEYNUM_CHECK = /^(?:(?!\/\/).)*\bisDigits\(\s*keyNum\s*\)/m;
|
|
870
|
+
|
|
871
|
+
function runDispatchKeyNumFault(source) {
|
|
872
|
+
const code = stripComments(source);
|
|
873
|
+
const start = code.search(RUN_DISPATCH);
|
|
874
|
+
if (start === -1) return "no `function runDispatch(` outside comments";
|
|
875
|
+
const end = code.indexOf("\n}", start);
|
|
876
|
+
const body = code.slice(start, end === -1 ? undefined : end);
|
|
877
|
+
return KEYNUM_CHECK.test(body) ? null : "runDispatch() no longer calls `isDigits(keyNum)` outside comments";
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
test("ledger.mjs's pointer to runDispatch's `keyNum` check still lands on code", () => {
|
|
881
|
+
const fault = runDispatchKeyNumFault(read("scripts", "ledger.mjs"));
|
|
882
|
+
assert.equal(fault, null, `ledger.mjs's \`filed\` comment points at "runDispatch's \`keyNum\` check", but ${fault} — rename the pointer with its target, and RUN_DISPATCH and KEYNUM_CHECK in citation-sweep-prose.test.mjs with it`);
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
test("the runDispatch pointer reds once the function, the variable or the check's place changes", () => {
|
|
886
|
+
const check = " const keyNum = key;\n if (!isDigits(keyNum)) die();\n";
|
|
887
|
+
for (const source of [
|
|
888
|
+
`function runDispatchRow() {\n${check}}\n`,
|
|
889
|
+
"function runDispatch() {\n const keyDigits = key;\n if (!isDigits(keyDigits)) die();\n}\n",
|
|
890
|
+
`function runDispatch() {\n}\n\nfunction validate() {\n${check}}\n`,
|
|
891
|
+
"function runDispatch() {\n const keyNum = key;\n // if (!isDigits(keyNum)) die();\n}\n",
|
|
892
|
+
"function runDispatch() {\n const keyNum = key;\n void 0; // if (!isDigits(keyNum)) die();\n}\n",
|
|
893
|
+
`/*\nfunction runDispatch() {\n${check}}\n*/\n`,
|
|
894
|
+
`function wrapper() {\n function runDispatch() {\n${check} }\n}\n`,
|
|
895
|
+
`const x = 1; function runDispatch() {\n${check}}\n`,
|
|
896
|
+
]) {
|
|
897
|
+
assert.notEqual(runDispatchKeyNumFault(source), null, source);
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
test("the runDispatch pointer accepts a reflowed check and ignores the comment that cites it", () => {
|
|
902
|
+
for (const source of [
|
|
903
|
+
"// isDigits() gates id the same way runDispatch's `keyNum` check gates\nasync function runDispatch() {\n if (keyNum !== null && !isDigits( keyNum )) die();\n}\n",
|
|
904
|
+
"function runDispatch() {\n const keyNum = key;\n if (!isDigits(keyNum)) die();\n}\n",
|
|
905
|
+
]) {
|
|
906
|
+
assert.equal(runDispatchKeyNumFault(source), null, source);
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
|
|
849
910
|
test("an ADR pointer resolves by number alone, so a retitled ADR still answers to it", () => {
|
|
850
911
|
assert.equal(adrFault("0010", ["0009-supported-platforms-are-macos-linux-wsl.md", "0010-a-retitled-ruling.md"]), null);
|
|
851
912
|
});
|