@feigi/fleet-ctl 3.23.37 → 3.23.38
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/cell-readout.mjs +38 -11
package/package.json
CHANGED
package/scripts/cell-readout.mjs
CHANGED
|
@@ -66,7 +66,7 @@ import { readFileSync } from "node:fs";
|
|
|
66
66
|
import { makeDie, defineFlags } from "./arg.mjs";
|
|
67
67
|
import { isCLI } from "./is-cli.mjs";
|
|
68
68
|
import { CELL, POLICY_CELL } from "./ledger-grammar.mjs";
|
|
69
|
-
import { parseTsv as parseMemberTsv } from "./member-outcomes.mjs";
|
|
69
|
+
import { formatTsv as formatMemberTsv, parseTsv as parseMemberTsv } from "./member-outcomes.mjs";
|
|
70
70
|
import { parseFeatures } from "./pr-cost.mjs";
|
|
71
71
|
import { VERDICT, VERDICT_COLUMNS } from "./tier-outcomes.mjs";
|
|
72
72
|
|
|
@@ -103,16 +103,33 @@ function admissibleMember(pull, members) {
|
|
|
103
103
|
return m;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
// One member row per session+agent. A key repeated with different fields is
|
|
107
|
+
// refused rather than collapsed to whichever row came last; an identical
|
|
108
|
+
// repeat is one row.
|
|
109
|
+
function indexMembers(members) {
|
|
110
|
+
const byKey = new Map();
|
|
111
|
+
for (const m of members) {
|
|
112
|
+
const k = key(m.session, m.agent);
|
|
113
|
+
const held = byKey.get(k);
|
|
114
|
+
if (held && formatMemberTsv([held]) !== formatMemberTsv([m])) {
|
|
115
|
+
throw new Error(`member-outcomes session ${m.session} agent ${m.agent} has two rows with different fields`);
|
|
116
|
+
}
|
|
117
|
+
if (!held) byKey.set(k, m);
|
|
118
|
+
}
|
|
119
|
+
return byKey;
|
|
120
|
+
}
|
|
121
|
+
|
|
106
122
|
/**
|
|
107
123
|
* `cells`: one entry per cell other than the policy cell that has a
|
|
108
124
|
* ticket-features row, `{ cell, comparisons, runDates, dates, models, gated }`,
|
|
109
125
|
* sorted by cell. `dates` is the comparisons' distinct run_dates, sorted;
|
|
110
126
|
* `models` maps each resolved model of the cell's admissible rows to its row
|
|
111
127
|
* count, largest first. `unjoined` counts Pulls with no member row. Throws on
|
|
112
|
-
* two ticket-features rows of one session+agent naming different cells
|
|
128
|
+
* two ticket-features rows of one session+agent naming different cells, and on
|
|
129
|
+
* a member-outcomes session+agent repeated with different fields.
|
|
113
130
|
*/
|
|
114
131
|
export function readout({ features, members }) {
|
|
115
|
-
const byKey =
|
|
132
|
+
const byKey = indexMembers(members);
|
|
116
133
|
const pulls = pullsOf(features);
|
|
117
134
|
const sessions = new Map();
|
|
118
135
|
const cells = new Map();
|
|
@@ -152,11 +169,12 @@ export function readout({ features, members }) {
|
|
|
152
169
|
* sorted by ticket, `run_date` the ruling's; `stop` is whether the stopping
|
|
153
170
|
* rule withdraws the cell. `verdicts` are parsed tier-outcomes.tsv rows.
|
|
154
171
|
* Throws on a counted ruling whose `closed_own_ticket` or `minted_false_claim`
|
|
155
|
-
* is not `yes` or `no`,
|
|
156
|
-
* `run_date` is not `YYYY-MM-DD
|
|
172
|
+
* is not `yes` or `no`, on a non-blank ruling row of a Pulled ticket whose
|
|
173
|
+
* `run_date` is not `YYYY-MM-DD`, and on a member-outcomes session+agent
|
|
174
|
+
* repeated with different fields.
|
|
157
175
|
*/
|
|
158
176
|
export function stoppingRule({ features, members, verdicts, added }) {
|
|
159
|
-
const byKey =
|
|
177
|
+
const byKey = indexMembers(members);
|
|
160
178
|
const rulings = new Map();
|
|
161
179
|
for (const v of verdicts) {
|
|
162
180
|
if (VERDICT_COLUMNS.every((c) => v[c] === "")) continue;
|
|
@@ -217,12 +235,21 @@ function main() {
|
|
|
217
235
|
try { return parse(text); }
|
|
218
236
|
catch (e) { die(`${path}: ${e.message}`); }
|
|
219
237
|
};
|
|
220
|
-
|
|
221
|
-
|
|
238
|
+
// A repeated session+agent naming different cells, or a member-outcomes one
|
|
239
|
+
// repeated with different fields, is refused while its file is loaded, so the
|
|
240
|
+
// refusal names the path that was read.
|
|
241
|
+
const features = load(featuresPath, (text) => {
|
|
242
|
+
const rows = parseFeatures(text);
|
|
243
|
+
pullsOf(rows);
|
|
244
|
+
return rows;
|
|
245
|
+
});
|
|
246
|
+
const members = load(membersPath, (text) => {
|
|
247
|
+
const rows = parseMemberTsv(text);
|
|
248
|
+
indexMembers(rows);
|
|
249
|
+
return rows;
|
|
250
|
+
});
|
|
222
251
|
|
|
223
|
-
|
|
224
|
-
try { ({ cells, unjoined } = readout({ features, members })); }
|
|
225
|
-
catch (e) { die(`${featuresPath}: ${e.message}`); }
|
|
252
|
+
const { cells, unjoined } = readout({ features, members });
|
|
226
253
|
const lines = [];
|
|
227
254
|
const notes = [];
|
|
228
255
|
if (unjoined > 0) {
|