@feigi/fleet-ctl 3.24.12 → 3.24.14
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 +63 -40
- package/scripts/fleet-state.mjs +3 -3
package/package.json
CHANGED
package/scripts/cell-readout.mjs
CHANGED
|
@@ -42,23 +42,31 @@
|
|
|
42
42
|
// Only the refusal of conflicting ticket-features rows names a session and an
|
|
43
43
|
// agent, and it prints nothing on stdout.
|
|
44
44
|
//
|
|
45
|
-
// STOPPING RULE (exported as `stoppingRule`, not printed by this CLI).
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// last
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
// the
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
45
|
+
// STOPPING RULE (exported as `stoppingRule`, not printed by this CLI). A
|
|
46
|
+
// ticket's RULING is its last tier-outcomes.tsv row in file order (a
|
|
47
|
+
// `+`-joined `ticket` field rules each ticket it names); a row with both
|
|
48
|
+
// verdict columns blank was never ruled, so it is skipped. Its CARRIER is
|
|
49
|
+
// the ticket's last Pull in file order, at any cell, slow-high included,
|
|
50
|
+
// dated on or before the ruling. Dates only set that floor: a ruling counts
|
|
51
|
+
// for a Pull only when dated on or after it, and neither pick is the
|
|
52
|
+
// latest-dated row. A Pull at X is
|
|
53
|
+
// COUNTABLE when X is a cell other than slow-high whose definition is live
|
|
54
|
+
// and the Pull is admissible and dated on or after the day X's
|
|
55
|
+
// `fleet-implementer-<cell>` definition was most recently added. The ruling
|
|
56
|
+
// is a VERDICT for the carrier's cell only, and only when the carrier is
|
|
57
|
+
// countable. Otherwise it is no verdict for any cell, never one for an
|
|
58
|
+
// earlier Pull of the ticket. A ticket with no ruling, or no Pull dated on or
|
|
59
|
+
// before it, is no verdict. A ticket counts once however many Pulls it took,
|
|
60
|
+
// at however many cells. A verdict FAILS the quality floor on
|
|
61
|
+
// `minted_false_claim=yes` or `closed_own_ticket=no`. For a ticket with a
|
|
62
|
+
// countable Pull, a ruling holding anything but `yes` or `no` in either
|
|
63
|
+
// column, one blank included, is refused rather than read as a pass. So is a
|
|
64
|
+
// non-blank ruling row of such a ticket whose `run_date` is not `YYYY-MM-DD`,
|
|
65
|
+
// and, once it is ruled, a Pull of it at any cell whose `run_date` is not
|
|
66
|
+
// `YYYY-MM-DD`: either cannot be placed to find the carrier, and dropping it
|
|
67
|
+
// could move the verdict to another cell or uncount it. So is an admissible
|
|
68
|
+
// Pull at X whose `run_date` is not `YYYY-MM-DD`: it cannot be placed against
|
|
69
|
+
// the day X's definition was added, and dropping it would uncount its ruling.
|
|
62
70
|
// X is to be withdrawn once it has at least STOP.verdicts verdicts and
|
|
63
71
|
// floor failures ÷ verdicts is at least STOP.failRate.
|
|
64
72
|
//
|
|
@@ -169,35 +177,50 @@ export function readout({ features, members }) {
|
|
|
169
177
|
* `[{ ticket, pr, run_date, closed_own_ticket, minted_false_claim, failed }]`
|
|
170
178
|
* sorted by ticket, `run_date` the ruling's; `stop` is whether the stopping
|
|
171
179
|
* rule withdraws the cell. `verdicts` are parsed tier-outcomes.tsv rows.
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
180
|
+
* A ticket's ruling is its last ruling row in file order, charged to the cell
|
|
181
|
+
* of its carrier, the ticket's last Pull in file order at any cell dated on or
|
|
182
|
+
* before the ruling, and only when that Pull is
|
|
183
|
+
* countable: admissible, at a cell named in `added` other than the policy
|
|
184
|
+
* cell, and dated on or after the day that cell's definition was added.
|
|
185
|
+
* Throws on the ruling of a ticket with a countable Pull whose
|
|
186
|
+
* `closed_own_ticket` or `minted_false_claim` is not `yes` or `no`, on a
|
|
187
|
+
* non-blank ruling row of such a ticket whose `run_date` is not `YYYY-MM-DD`,
|
|
188
|
+
* on an admissible Pull at a cell named in `added` whose `run_date` is not
|
|
189
|
+
* `YYYY-MM-DD`, on any Pull of a ruled ticket with a countable Pull whose
|
|
190
|
+
* `run_date` is not `YYYY-MM-DD`, and on a member-outcomes session+agent
|
|
191
|
+
* repeated with different fields.
|
|
177
192
|
*/
|
|
178
193
|
export function stoppingRule({ features, members, verdicts, added }) {
|
|
179
194
|
const byKey = indexMembers(members);
|
|
180
195
|
const rulings = rulingsByTicket(verdicts);
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
for (const p of features) {
|
|
184
|
-
const pulls = charged.get(p.chosen_cell);
|
|
185
|
-
if (!pulls || !admissibleMember(p, byKey)) continue;
|
|
196
|
+
const charged = new Map(Object.keys(added).filter((c) => c !== POLICY_CELL).map((c) => [c, []]));
|
|
197
|
+
const dated = (p) => {
|
|
186
198
|
if (!DATE.test(p.run_date)) throw new Error(`ticket #${p.ticket} (Pull ${p.agent} at ${p.chosen_cell}): run_date is '${p.run_date}', expected YYYY-MM-DD`);
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
return p.run_date;
|
|
200
|
+
};
|
|
201
|
+
const countable = new Set();
|
|
202
|
+
const pullsByTicket = new Map();
|
|
203
|
+
for (const p of features) {
|
|
204
|
+
(pullsByTicket.get(p.ticket) ?? pullsByTicket.set(p.ticket, []).get(p.ticket)).push(p);
|
|
205
|
+
if (!charged.has(p.chosen_cell) || !admissibleMember(p, byKey)) continue;
|
|
206
|
+
if (dated(p) >= added[p.chosen_cell]) countable.add(p);
|
|
189
207
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
208
|
+
for (const [ticket, pulls] of pullsByTicket) {
|
|
209
|
+
if (!pulls.some((p) => countable.has(p))) continue;
|
|
210
|
+
// The ticket's ruling: its last ruling row in file order (every date clears a "" floor).
|
|
211
|
+
const v = rulingFor(rulings, ticket, "");
|
|
212
|
+
if (!v) continue;
|
|
213
|
+
// Its carrier: the ticket's last Pull in file order dated on or before the ruling.
|
|
214
|
+
let carrier = null;
|
|
215
|
+
for (const p of pulls) if (dated(p) <= v.run_date) carrier = p;
|
|
216
|
+
if (!carrier || !countable.has(carrier)) continue;
|
|
217
|
+
charged.get(carrier.chosen_cell).push({
|
|
218
|
+
ticket: carrier.ticket, pr: v.pr, run_date: v.run_date,
|
|
219
|
+
closed_own_ticket: v.closed_own_ticket, minted_false_claim: v.minted_false_claim,
|
|
220
|
+
failed: v.minted_false_claim === "yes" || v.closed_own_ticket === "no",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return [...charged].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([cell, list]) => {
|
|
201
224
|
list.sort((a, b) => Number(a.ticket) - Number(b.ticket));
|
|
202
225
|
const failures = list.filter((v) => v.failed).length;
|
|
203
226
|
const stop = list.length >= STOP.verdicts && failures / list.length >= STOP.failRate;
|
package/scripts/fleet-state.mjs
CHANGED
|
@@ -284,9 +284,9 @@ export function writeState(path, name, prev, patch) {
|
|
|
284
284
|
// reading two "stale" verdicts on one page should not have to learn two rules.
|
|
285
285
|
export const BEAT_GRACE = 2;
|
|
286
286
|
|
|
287
|
-
// fleet-heartbeat.mjs's
|
|
288
|
-
// here
|
|
289
|
-
//
|
|
287
|
+
// fleet-heartbeat.mjs's --ceiling default (1200s = 20 minutes), defined once
|
|
288
|
+
// here and imported there: every script that reads or writes the heartbeat
|
|
289
|
+
// file already imports this module, and a magic "1200" typed twice is exactly
|
|
290
290
|
// the drift the module header's "never a copy of it" rule exists to close.
|
|
291
291
|
// It doubles as the freshness window for `ticked` below: fleet-tick's own
|
|
292
292
|
// invocations carry no promised interval, so they are judged against the
|