@feigi/fleet-ctl 3.149.0 → 3.151.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.
@@ -77,11 +77,10 @@
77
77
  // those records: the TSVs at the recorded blob ids, the guard and the prior
78
78
  // fit to the same table again. With no records it is the starting table's
79
79
  // fit, as any other. It is called in-process because a fit has no verdict
80
- // for an exit status to carry, and the `fit` CLI reads the TSVs only as
81
- // committed. It never fails the run: an error prints `metrics-refresh: fit:
82
- // failed — <why>`, leaves the old file in place, so the run routes by the
83
- // last Fit that computed, and leaves the exit status as the other duties set
84
- // it. That line stays on stdout: the cockpit reads it off the receipts'
80
+ // for an exit status to carry. It never fails the run: an error prints
81
+ // `metrics-refresh: fit: failed — <why>`, leaves the old file in place, so the
82
+ // run routes by the last Fit that computed, and leaves the exit status as the
83
+ // other duties set it. That line stays on stdout: the cockpit reads it off the receipts'
85
84
  // `metrics` step, and close-out's receipt keeps only stdout from a run that
86
85
  // exits 0.
87
86
  //
@@ -1,184 +1,47 @@
1
1
  {
2
- "window_start": "2026-10-03",
3
- "fitted_commit": "e5040b9a96d304b3ce8a40c2b2d35b143f66d450",
4
- "n_rows": 268,
2
+ "window_start": null,
3
+ "fitted_commit": null,
4
+ "n_rows": 0,
5
5
  "cells": [
6
6
  "slow-high",
7
7
  "task-high",
8
- "smol-high",
9
- "slow-medium",
10
- "task-max"
8
+ "smol-high"
11
9
  ],
12
- "burn_in": false,
10
+ "burn_in": true,
13
11
  "splits": {},
14
12
  "rows": {
15
13
  "cost": {
16
- "*": "task-high"
14
+ "*": "slow-high"
17
15
  },
18
16
  "speed": {
19
- "*": "task-high"
17
+ "*": "slow-high"
20
18
  }
21
19
  },
22
20
  "classifier": {
23
21
  "b": null,
24
22
  "tau": null
25
23
  },
26
- "estimates": {
27
- "*": {
28
- "slow-high": {
29
- "generation": "claude-opus-5-5",
30
- "n": 104,
31
- "merged": 104,
32
- "by_hand": 0,
33
- "claims": 104,
34
- "failed": 20,
35
- "usd_per_merged": 14.5057,
36
- "minutes_per_merged": 121.3343,
37
- "fail_rate": 0.1923,
38
- "fix_rounds": 1.2019,
39
- "review_findings": null,
40
- "left_out": 0,
41
- "unpriced": 0,
42
- "untimed": 0,
43
- "excluded": 0,
44
- "older": {}
45
- },
46
- "smol-high": {
47
- "generation": "claude-haiku-5-5",
48
- "n": 32,
49
- "merged": 32,
50
- "by_hand": 1,
51
- "claims": 32,
52
- "failed": 18,
53
- "usd_per_merged": 11.0567,
54
- "minutes_per_merged": 110.2854,
55
- "fail_rate": 0.5625,
56
- "fix_rounds": 1.4063,
57
- "review_findings": null,
58
- "left_out": 0,
59
- "unpriced": 1,
60
- "untimed": 0,
61
- "excluded": 5,
62
- "older": {
63
- "claude-haiku-4-5": {
64
- "n": 21,
65
- "merged": 21,
66
- "by_hand": 0,
67
- "claims": 21,
68
- "failed": 17,
69
- "usd_per_merged": 11.7687,
70
- "minutes_per_merged": 116.2341,
71
- "fail_rate": 0.8095,
72
- "fix_rounds": 1.5238,
73
- "review_findings": null,
74
- "left_out": 0,
75
- "unpriced": 0,
76
- "untimed": 0
77
- }
78
- }
79
- },
80
- "task-high": {
81
- "generation": "claude-sonnet-5-5",
82
- "n": 104,
83
- "merged": 104,
84
- "by_hand": 1,
85
- "claims": 104,
86
- "failed": 28,
87
- "usd_per_merged": 10.2778,
88
- "minutes_per_merged": 102.8827,
89
- "fail_rate": 0.2692,
90
- "fix_rounds": 1.2019,
91
- "review_findings": null,
92
- "left_out": 0,
93
- "unpriced": 0,
94
- "untimed": 0,
95
- "excluded": 1,
96
- "older": {}
97
- }
98
- }
99
- },
24
+ "estimates": {},
100
25
  "reasons": {
101
26
  "cost": {
102
27
  "*": {
103
- "cell": "task-high",
104
- "reason": "sole-qualifier",
105
- "cells": {
106
- "task-high": {
107
- "verdict": "qualifies",
108
- "under_floor": false,
109
- "bar": 0.3423,
110
- "range": [
111
- -6.51,
112
- -2.04
113
- ]
114
- },
115
- "smol-high": {
116
- "verdict": "tripped",
117
- "under_floor": null,
118
- "bar": null,
119
- "range": null
120
- },
121
- "slow-medium": {
122
- "verdict": "too-few",
123
- "under_floor": null,
124
- "bar": null,
125
- "range": null
126
- },
127
- "task-max": {
128
- "verdict": "too-few",
129
- "under_floor": null,
130
- "bar": null,
131
- "range": null
132
- }
133
- },
28
+ "cell": "slow-high",
29
+ "reason": "unjudged",
30
+ "cells": {},
134
31
  "pairs": []
135
32
  }
136
33
  },
137
34
  "speed": {
138
35
  "*": {
139
- "cell": "task-high",
140
- "reason": "no-qualifier",
141
- "cells": {
142
- "slow-high": {
143
- "verdict": "too-slow",
144
- "under_floor": false,
145
- "bar": 0.3423,
146
- "range": [
147
- 3.17,
148
- 35.03
149
- ]
150
- },
151
- "smol-high": {
152
- "verdict": "tripped",
153
- "under_floor": null,
154
- "bar": null,
155
- "range": null
156
- },
157
- "slow-medium": {
158
- "verdict": "too-few",
159
- "under_floor": null,
160
- "bar": null,
161
- "range": null
162
- },
163
- "task-max": {
164
- "verdict": "too-few",
165
- "under_floor": null,
166
- "bar": null,
167
- "range": null
168
- }
169
- },
36
+ "cell": "slow-high",
37
+ "reason": "unjudged",
38
+ "cells": {},
170
39
  "pairs": []
171
40
  }
172
41
  }
173
42
  },
174
43
  "guard": {
175
- "tripped": [
176
- "smol-high"
177
- ],
178
- "n": {
179
- "slow-high": 104,
180
- "smol-high": 32,
181
- "task-high": 104
182
- }
44
+ "tripped": [],
45
+ "n": {}
183
46
  }
184
47
  }
@@ -40,17 +40,6 @@
40
40
  // within OMP_READ_TIMEOUT_MS, warns and leaves the Pull no Cell to draw;
41
41
  // a read that leaves a role no level to run at, or finds no implementer
42
42
  // definition, warns too.
43
- // fit --table <json> --features <tsv> --members <tsv> --verdicts <tsv>
44
- // --guard <cost-guard.json> --commit <rev> [--due]
45
- // Re-fits the table from the three TSVs as committed at `--commit` (read
46
- // with `git show`, never from the working tree) and the guard, and
47
- // rewrites `--table`, recording the commit's sha as `fitted_commit`, then
48
- // prints the fit and one line per row of each objective's set: its cell
49
- // and the reason, then each candidate's verdict and range. The TSV flags name paths inside the
50
- // repository that holds them. With
51
- // `--due`, writes nothing and prints `DUE=yes|no MERGED=<n>/<N>`: whether
52
- // N merged PRs have landed since `fitted_commit`, counting the features
53
- // rows at `--commit` that the fitted commit's features file does not hold.
54
43
  // --check --table <json> --features <tsv> --members <tsv> --verdicts <tsv>
55
44
  // Re-fits from the commit the table records as `fitted_commit` (an empty
56
45
  // corpus while it is null), against the guard snapshot the table itself
@@ -62,7 +51,7 @@
62
51
  // the guard are files the caller wrote, a fitted commit is fetched by the
63
52
  // caller, and the install reads ask the local `omp`.
64
53
 
65
- import { readFileSync, readdirSync, writeFileSync, renameSync, appendFileSync, mkdirSync, statSync, realpathSync } from "node:fs";
54
+ import { readFileSync, readdirSync, appendFileSync, mkdirSync, statSync, realpathSync } from "node:fs";
66
55
  import { spawnSync } from "node:child_process";
67
56
  import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
68
57
  import { fileURLToPath } from "node:url";
@@ -91,14 +80,13 @@ const EXPLORE_EVERY = 5;
91
80
  // An `omp` install read that has not answered in this many milliseconds is killed and warns as a failed read: the
92
81
  // Pull runs `route` with no timeout of its own, so a hung `omp` would otherwise hang the Pull.
93
82
  const OMP_READ_TIMEOUT_MS = 10_000;
94
- // The fit's adoption floor (merged PRs per side), margin, and cadence.
83
+ // The fit's adoption floor (merged PRs per side) and margin.
95
84
  export const MIN_N = 20;
96
85
  const ADOPT_RATIO = 0.75;
97
- export const FIT_EVERY_MERGED = 50;
98
86
  // The starting Cells short of MIN_N merged PRs in a guard's `n`, each with its
99
87
  // count, in their order: burn-in holds while any is. A Cell the guard has no
100
88
  // count for has 0.
101
- export const shortStartingCells = (n) => STARTING_CELLS.map((c) => [c, n[c] ?? 0]).filter(([, k]) => k < MIN_N);
89
+ const shortStartingCells = (n) => STARTING_CELLS.map((c) => [c, n[c] ?? 0]).filter(([, k]) => k < MIN_N);
102
90
  const KINDS = new Set(["bug", "enhancement", "documentation"]);
103
91
  const DAY_MS = 86_400_000;
104
92
 
@@ -921,41 +909,6 @@ export function fitTable({ prior, features, members, verdicts, guard, commit = n
921
909
  };
922
910
  }
923
911
 
924
- /**
925
- * Merged PRs since the fit: pull-attribution.mjs's counted, merged Pulls on or
926
- * after `window_start` whose features row the fitted commit's features file
927
- * (`fitted`, parsed rows; empty before any fit) does not hold, matched by
928
- * `session` and `agent`.
929
- */
930
- export function mergedSince({ table, features, members, verdicts, fitted }) {
931
- const read = new Set(fitted.map((r) => `${r.session}\0${r.agent}`));
932
- return attribute({ features, members, tiers: verdicts, windowStart: table.window_start || null })
933
- .filter((u) => u.status === "counted" && u.merged && !read.has(`${u.pull.session}\0${u.pull.agent}`)).length;
934
- }
935
-
936
- // Each cell's Pull counts over every Pull, the root's, as the fit prints them: its
937
- // newest generation, then each older one.
938
- function cellCounts(estimates) {
939
- const two = (x) => (x === null ? "-" : x.toFixed(2));
940
- const counts = (e) => `n=${e.n} merged=${e.merged} failed=${e.failed} usd_per_merged=${two(e.usd_per_merged)} minutes_per_merged=${two(e.minutes_per_merged)}`;
941
- return Object.entries(estimates["*"] ?? {})
942
- .map(([c, e]) => [
943
- `${c} ${e.generation ?? "-"} ${counts(e)} excluded=${e.excluded} left_out=${e.left_out} unpriced=${e.unpriced} untimed=${e.untimed}`,
944
- ...Object.entries(e.older).map(([g, o]) => `${c} ${g} (older) ${counts(o)}`),
945
- ].join(", "))
946
- .join(", ") || "none";
947
- }
948
-
949
- // One line per row the fit judged, per objective: its cell and its reason,
950
- // then each candidate's verdict and range.
951
- function rowLines(reasons) {
952
- const range = (r) => (r === null ? "" : ` [${r.map((x) => x.toFixed(2)).join(", ")}]`);
953
- return Object.entries(reasons).flatMap(([o, set]) => Object.entries(set).map(([s, r]) => {
954
- const cells = Object.entries(r.cells).map(([c, x]) => `${c} ${x.verdict}${range(x.range)}`).join(", ");
955
- return `${NAME}: row ${o} ${s} ${r.cell} ${r.reason}${cells ? ` (${cells})` : ""}\n`;
956
- })).join("");
957
- }
958
-
959
912
  // ---------------------------------------------------------------------------
960
913
  // the commit a fit reads
961
914
  // ---------------------------------------------------------------------------
@@ -1000,20 +953,19 @@ function main() {
1000
953
  flags: {
1001
954
  session: "value", objective: "value", ticket: "value", arm: "value", "impl-row": "value", issue: "value",
1002
955
  sizing: "value", guard: "value", table: "value", pending: "value", "chain-head": "bool", "model-roles": "value", catalog: "value", agents: "value",
1003
- features: "value", members: "value", verdicts: "value", commit: "value", check: "bool", due: "bool",
956
+ features: "value", members: "value", verdicts: "value", check: "bool",
1004
957
  },
1005
- positionals: ["route", "fit"],
958
+ positionals: ["route"],
1006
959
  });
1007
960
  F.sweep();
1008
961
  F.stray();
1009
962
  const argv = process.argv.slice(2);
1010
- const mode = F.has("check") ? "check" : argv.find((a) => a === "route" || a === "fit");
1011
- if (!mode || (F.has("check") && argv.some((a) => a === "route" || a === "fit"))) {
1012
- die("usage: ticket-router.mjs route … | fit … | --check … — exactly one mode");
963
+ const mode = F.has("check") ? "check" : argv.find((a) => a === "route");
964
+ if (!mode || (F.has("check") && argv.includes("route"))) {
965
+ die("usage: ticket-router.mjs route … | --check … — exactly one mode");
1013
966
  }
1014
967
  const allowed = {
1015
968
  route: ["session", "objective", "ticket", "arm", "impl-row", "issue", "sizing", "guard", "table", "pending", "chain-head", "model-roles", "catalog", "agents"],
1016
- fit: ["table", "features", "members", "verdicts", "guard", "commit", "due"],
1017
969
  check: ["check", "table", "features", "members", "verdicts"],
1018
970
  }[mode];
1019
971
  const given = argv.filter((a) => a.startsWith("--")).map((a) => a.slice(2).split("=")[0]);
@@ -1157,7 +1109,7 @@ function main() {
1157
1109
  };
1158
1110
  // The join throws on a features row it cannot date or whose column a split reads holds no plain count, a booked
1159
1111
  // member row whose `cost` or `work_s` is not a number, and a ruling of a windowed Pull's ticket it cannot place —
1160
- // for `fit` and `--check` too on a Pull the fit then skips as a live B classifier's, since every windowed Pull is
1112
+ // for `--check` too on a Pull the fit then skips as a live B classifier's, since every windowed Pull is
1161
1113
  // booked before that skip. Anything else it throws is a bug, never bad input, so it surfaces with its stack.
1162
1114
  const joined = (fit) => {
1163
1115
  try { return fit(); } catch (e) {
@@ -1166,40 +1118,18 @@ function main() {
1166
1118
  }
1167
1119
  };
1168
1120
 
1169
- if (mode === "check") {
1170
- for (const flag of ["features", "members", "verdicts"]) need(flag);
1171
- const fitted = fittedCommit();
1172
- const { features, members, verdicts } = fitted === null ? { features: [], members: [], verdicts: [] } : corpusAt(fitted);
1173
- const refit = joined(() => fitTable({ prior: table, features, members, verdicts, guard: { ...table.guard, window_start: table.window_start }, commit: fitted }));
1174
- const differ = Object.keys({ ...refit, ...table }).filter((k) => !isDeepStrictEqual(refit[k], table[k]));
1175
- if (differ.length) {
1176
- process.stderr.write(`${NAME}: ${tablePath} is not a re-fit of its own rows — differs in ${differ.map((k) => `\`${k}\``).join(", ")}; re-fitted:\n${JSON.stringify(refit, null, 2)}\n`);
1177
- // exitCode, not exit(): a piped stderr is written asynchronously and exit() can cut the payload off.
1178
- process.exitCode = 1;
1179
- return;
1180
- }
1181
- process.stdout.write(`${NAME}: ${tablePath} matches a re-fit of ${refit.n_rows} Pulls at ${short(fitted)}\n`);
1182
- return;
1183
- }
1184
-
1185
- const commitArg = need("commit");
1186
- const sha = commitOf(commitArg);
1187
- if (sha === null) die(`--commit ${commitArg} is not a commit of the repository holding --features ${need("features")}`);
1188
- const { features, members, verdicts } = corpusAt(sha);
1189
- const guardPath = need("guard");
1190
- const guard = readGuard(readJson(guardPath));
1191
- if (guard === null) die(`cannot read --guard ${guardPath} as a cost guard — the fit needs its tripped cells and per-cell n`);
1192
- if (F.has("due")) {
1193
- const fitted = fittedCommit();
1194
- const read = fitted === null ? [] : fileAt(fitted, "features", parseFeatures);
1195
- const n = joined(() => mergedSince({ table, features, members, verdicts, fitted: read }));
1196
- process.stdout.write(`DUE=${n >= FIT_EVERY_MERGED ? "yes" : "no"} MERGED=${n}/${FIT_EVERY_MERGED}\n`);
1121
+ for (const flag of ["features", "members", "verdicts"]) need(flag);
1122
+ const fitted = fittedCommit();
1123
+ const { features, members, verdicts } = fitted === null ? { features: [], members: [], verdicts: [] } : corpusAt(fitted);
1124
+ const refit = joined(() => fitTable({ prior: table, features, members, verdicts, guard: { ...table.guard, window_start: table.window_start }, commit: fitted }));
1125
+ const differ = Object.keys({ ...refit, ...table }).filter((k) => !isDeepStrictEqual(refit[k], table[k]));
1126
+ if (differ.length) {
1127
+ process.stderr.write(`${NAME}: ${tablePath} is not a re-fit of its own rows — differs in ${differ.map((k) => `\`${k}\``).join(", ")}; re-fitted:\n${JSON.stringify(refit, null, 2)}\n`);
1128
+ // exitCode, not exit(): a piped stderr is written asynchronously and exit() can cut the payload off.
1129
+ process.exitCode = 1;
1197
1130
  return;
1198
1131
  }
1199
- const next = joined(() => fitTable({ prior: table, features, members, verdicts, guard, commit: sha }));
1200
- writeFileSync(`${tablePath}.tmp`, `${JSON.stringify(next, null, 2)}\n`);
1201
- renameSync(`${tablePath}.tmp`, tablePath);
1202
- process.stdout.write(`${NAME}: fitted ${next.n_rows} Pulls at ${short(sha)}; rows ${JSON.stringify(next.rows)}; burn_in ${next.burn_in}; cells ${cellCounts(next.estimates)}\n${rowLines(next.reasons)}`);
1132
+ process.stdout.write(`${NAME}: ${tablePath} matches a re-fit of ${refit.n_rows} Pulls at ${short(fitted)}\n`);
1203
1133
  }
1204
1134
 
1205
1135
  if (isCLI(import.meta.url)) main();