@feigi/fleet-ctl 3.24.22 → 3.24.24
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/ticket-router.mjs +27 -8
package/package.json
CHANGED
|
@@ -290,21 +290,40 @@ function verdictOf(rulings, ticket, pullDate) {
|
|
|
290
290
|
return r && { pr: String(r.pr ?? ""), fail: r.minted_false_claim === "yes" || r.closed_own_ticket === "no" };
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
/**
|
|
294
|
+
* The features rows with a YYYY-MM-DD `run_date`, the rows that can be placed
|
|
295
|
+
* against the window, the cut and a ruling. A blank `run_date` (route writes one
|
|
296
|
+
* for a session id with no date) is no input row and is left out. Any other
|
|
297
|
+
* date is a hand-edit that cannot be placed and is refused, as `rulingFor`
|
|
298
|
+
* refuses a ruling's: dropping it would shrink the fit unseen.
|
|
299
|
+
*/
|
|
300
|
+
function datedRows(features) {
|
|
301
|
+
return features.filter((r) => {
|
|
302
|
+
if (DATE.test(r.run_date)) return true;
|
|
303
|
+
if (r.run_date !== "") throw new Error(`ticket #${r.ticket}: a ticket-features row's run_date is '${r.run_date}', expected YYYY-MM-DD or blank`);
|
|
304
|
+
return false;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
293
308
|
/**
|
|
294
309
|
* Per-ticket input rows: the ticket's features rows inside [window, cutoff],
|
|
295
310
|
* attributed to its LAST row's (in file order) cell and stratum, restricted to rows the
|
|
296
311
|
* free classifier routed plus exploration rows — a row a live B classifier
|
|
297
312
|
* routed is the A/B's test set, not the fit's. Its verdict rules its last
|
|
298
|
-
* input row. A
|
|
313
|
+
* input row. A row with a blank `run_date` (route writes one for a session id
|
|
314
|
+
* with no date) is no input row: it cannot be placed against the window, the
|
|
315
|
+
* cut or its ruling, and a window bound drops it anyway. A `run_date` that is
|
|
316
|
+
* neither blank nor YYYY-MM-DD is refused (see `datedRows`).
|
|
317
|
+
* A fit over everything cuts at its latest features row's date;
|
|
299
318
|
* the verdict and member rows are cut at that same date, so `--check`'s
|
|
300
319
|
* re-fit at the recorded `fitted_through` reads the rows the fit read and a
|
|
301
320
|
* verdict or member row that lands later waits for the next fit instead of
|
|
302
321
|
* failing CI.
|
|
303
322
|
*/
|
|
304
323
|
function fitTickets({ features, members, verdicts, window, cutoff }) {
|
|
305
|
-
const inRange = features.filter((r) => (!window || r.run_date >= window)
|
|
324
|
+
const inRange = datedRows(features).filter((r) => (!window || r.run_date >= window)
|
|
306
325
|
&& (cutoff === undefined || (cutoff !== null && r.run_date <= cutoff)));
|
|
307
|
-
const through = cutoff === undefined ? inRange.map((r) => r.run_date).
|
|
326
|
+
const through = cutoff === undefined ? inRange.map((r) => r.run_date).sort().at(-1) ?? null : cutoff;
|
|
308
327
|
const upToThrough = (r) => through === null || !r.run_date || r.run_date <= through;
|
|
309
328
|
members = members.filter(upToThrough);
|
|
310
329
|
const byTicket = new Map();
|
|
@@ -423,7 +442,7 @@ export function fitTable({ prior, features, members, verdicts, guard, cutoff })
|
|
|
423
442
|
if (!cells.includes(cell) && cells.includes(survives) && !tripped.has(survives)) cells.push(cell);
|
|
424
443
|
}
|
|
425
444
|
}
|
|
426
|
-
const dates = used.map((r) => r.run_date).
|
|
445
|
+
const dates = used.map((r) => r.run_date).sort();
|
|
427
446
|
return {
|
|
428
447
|
window_start: window,
|
|
429
448
|
fitted_through: dates.length ? dates[dates.length - 1] : prior.fitted_through ?? null,
|
|
@@ -438,10 +457,10 @@ export function fitTable({ prior, features, members, verdicts, guard, cutoff })
|
|
|
438
457
|
};
|
|
439
458
|
}
|
|
440
459
|
|
|
441
|
-
/** Merged PRs (tickets with a verdict on their last such row in file order) among the features rows dated after `fitted_through`. */
|
|
460
|
+
/** Merged PRs (tickets with a verdict on their last such row in file order) among the YYYY-MM-DD-dated features rows dated after `fitted_through`. */
|
|
442
461
|
export function mergedSince({ table, features, verdicts }) {
|
|
443
462
|
const rulings = rulingsByTicket(verdicts);
|
|
444
|
-
const after = features.filter((r) => (!table.window_start || r.run_date >= table.window_start) && (!table.fitted_through || r.run_date > table.fitted_through));
|
|
463
|
+
const after = datedRows(features).filter((r) => (!table.window_start || r.run_date >= table.window_start) && (!table.fitted_through || r.run_date > table.fitted_through));
|
|
445
464
|
return [...lastPullByTicket(after)].filter(([ticket, p]) => verdictOf(rulings, ticket, p.run_date)).length;
|
|
446
465
|
}
|
|
447
466
|
|
|
@@ -516,9 +535,9 @@ function main() {
|
|
|
516
535
|
const features = read("features", parseFeatures);
|
|
517
536
|
const members = read("members", parseMemberTsv);
|
|
518
537
|
const verdicts = read("verdicts", parseTierOutcomes);
|
|
519
|
-
// The
|
|
538
|
+
// The join throws on a features row it cannot place and on a ruling of an input ticket it cannot place.
|
|
520
539
|
const joined = (fit) => {
|
|
521
|
-
try { return fit(); } catch (e) { die(`cannot
|
|
540
|
+
try { return fit(); } catch (e) { die(`cannot join --features ${need("features")} with --verdicts ${need("verdicts")}: ${e.message}`); }
|
|
522
541
|
};
|
|
523
542
|
|
|
524
543
|
if (mode === "check") {
|