@feigi/fleet-ctl 3.24.19 → 3.24.21
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/json.sh +7 -6
- package/scripts/pr-cost.mjs +3 -3
- package/scripts/ticket-router.mjs +6 -6
- package/scripts/tier-outcomes.mjs +19 -7
package/package.json
CHANGED
package/scripts/json.sh
CHANGED
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
# non-interactive shell outright, so `||` never runs. Measured on a missing
|
|
17
17
|
# file with `set -e`: /bin/sh (macOS bash 3.2) and bash 3.2/`--posix` exit **1**
|
|
18
18
|
# with the guard unfired, dash exits 2 unfired, and only Homebrew bash 5.3
|
|
19
|
-
# reaches the `|| die`. Exit 1 is a VERDICT in
|
|
19
|
+
# reaches the `|| die`. Exit 1 is a VERDICT in every caller that defines one —
|
|
20
20
|
# inflight.sh reads it as "ticket taken", verify-sha.sh as "not reachable",
|
|
21
21
|
# prove-merge.sh as "not proved", no-undo-audit.sh as "REFUSED, the worktree is
|
|
22
|
-
# dirty", release-ticket.sh as "NOT released, blocked"
|
|
23
|
-
#
|
|
24
|
-
# worktree-audit.sh define no exit 1
|
|
25
|
-
#
|
|
26
|
-
#
|
|
22
|
+
# dirty", release-ticket.sh as "NOT released, blocked", delete-merged-branch.sh
|
|
23
|
+
# as "the branch is STILL on origin" — so a lib that merely went missing would
|
|
24
|
+
# fabricate one. claim-ticket.sh, reap.sh and worktree-audit.sh define no exit 1
|
|
25
|
+
# at all, which is not safety: a bare 1 out of them is a code their caller has
|
|
26
|
+
# no reading for. The `[ -r ]` catches that before `.` can kill the shell; the
|
|
27
|
+
# `|| die` stays for the case `[ -r ]`
|
|
27
28
|
# cannot see, and that case is live rather than theoretical — a DIRECTORY at
|
|
28
29
|
# this path passes `[ -r ]` and `.` returns 1 with the arm firing (measured,
|
|
29
30
|
# /bin/sh and bash 5.3; dash sources a directory at exit 0 instead). A lib that
|
package/scripts/pr-cost.mjs
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
// is counted as unpriced, and a Pull with no member row at all books 0 and is
|
|
38
38
|
// listed as unbooked.
|
|
39
39
|
//
|
|
40
|
-
// A ticket's RULING is its last tier-outcomes.tsv row dated on or
|
|
41
|
-
// first Pull in the window; that row names the PR and carries the quality
|
|
40
|
+
// A ticket's RULING is its last tier-outcomes.tsv row in file order dated on or
|
|
41
|
+
// after its first Pull in the window; that row names the PR and carries the quality
|
|
42
42
|
// verdict. The PR's CELL is the `chosen_cell` of the last Pull dated on or
|
|
43
43
|
// before the ruling, cross-checked against that Pull's member row: a
|
|
44
44
|
// `subagent_type` other than `fleet-implementer-<cell>`, or an `effort` other
|
|
@@ -203,7 +203,7 @@ export function computeReport({ members, tiers, features, prs, routerTable = nul
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// Rulings: per ticket, the last tier-outcomes row on or after its first Pull.
|
|
206
|
+
// Rulings: per ticket, the last tier-outcomes row in file order on or after its first Pull.
|
|
207
207
|
const pullsByTicket = new Map();
|
|
208
208
|
for (const p of pulls) {
|
|
209
209
|
if (!pullsByTicket.has(p.ticket)) pullsByTicket.set(p.ticket, []);
|
|
@@ -36,7 +36,7 @@ import { isCLI } from "./is-cli.mjs";
|
|
|
36
36
|
import { makeDie, defineFlags } from "./arg.mjs";
|
|
37
37
|
import { CELL, POLICY_CELL, drawCell, parseMember } from "./ledger-grammar.mjs";
|
|
38
38
|
import { parseTsv as parseMemberTsv } from "./member-outcomes.mjs";
|
|
39
|
-
import { DATE, parseTierOutcomes, rulingFor, rulingsByTicket } from "./tier-outcomes.mjs";
|
|
39
|
+
import { DATE, lastPullByTicket, parseTierOutcomes, rulingFor, rulingsByTicket } from "./tier-outcomes.mjs";
|
|
40
40
|
|
|
41
41
|
const NAME = "ticket-router";
|
|
42
42
|
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -292,7 +292,7 @@ function verdictOf(rulings, ticket, pullDate) {
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
294
|
* Per-ticket input rows: the ticket's features rows inside [window, cutoff],
|
|
295
|
-
* attributed to its LAST row's cell and stratum, restricted to rows the
|
|
295
|
+
* attributed to its LAST row's (in file order) cell and stratum, restricted to rows the
|
|
296
296
|
* free classifier routed plus exploration rows — a row a live B classifier
|
|
297
297
|
* routed is the A/B's test set, not the fit's. Its verdict rules its last
|
|
298
298
|
* input row. A fit over everything cuts at its latest features row's date;
|
|
@@ -316,9 +316,10 @@ function fitTickets({ features, members, verdicts, window, cutoff }) {
|
|
|
316
316
|
// a string `<=` would drop 'abc' or '2027' unseen: it is left in, so `rulingFor`
|
|
317
317
|
// refuses it when its ticket is an input, as `fit --due` does.
|
|
318
318
|
const rulings = rulingsByTicket(verdicts.filter((r) => !DATE.test(r.run_date) || upToThrough(r)));
|
|
319
|
+
const lastPulls = lastPullByTicket(inRange);
|
|
319
320
|
const out = [];
|
|
320
321
|
for (const [ticket, rows] of byTicket) {
|
|
321
|
-
const last =
|
|
322
|
+
const last = lastPulls.get(ticket);
|
|
322
323
|
if (last.exploration_draw === "" && last.sizing_src !== "rule") continue;
|
|
323
324
|
const verdict = verdictOf(rulings, ticket, last.run_date);
|
|
324
325
|
const keys = new Set(rows.map((r) => `${r.session}\0${r.agent}`));
|
|
@@ -437,12 +438,11 @@ export function fitTable({ prior, features, members, verdicts, guard, cutoff })
|
|
|
437
438
|
};
|
|
438
439
|
}
|
|
439
440
|
|
|
440
|
-
/** Merged PRs (tickets with a verdict on their last such row) among the features rows dated after `fitted_through`. */
|
|
441
|
+
/** Merged PRs (tickets with a verdict on their last such row in file order) among the features rows dated after `fitted_through`. */
|
|
441
442
|
export function mergedSince({ table, features, verdicts }) {
|
|
442
443
|
const rulings = rulingsByTicket(verdicts);
|
|
443
444
|
const after = features.filter((r) => (!table.window_start || r.run_date >= table.window_start) && (!table.fitted_through || r.run_date > table.fitted_through));
|
|
444
|
-
|
|
445
|
-
return [...pullDates].filter(([ticket, date]) => verdictOf(rulings, ticket, date)).length;
|
|
445
|
+
return [...lastPullByTicket(after)].filter(([ticket, p]) => verdictOf(rulings, ticket, p.run_date)).length;
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
// ---------------------------------------------------------------------------
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
// `opus`/`sonnet` spelling and are never checked; the header records the
|
|
44
44
|
// switch and how the old values map.
|
|
45
45
|
//
|
|
46
|
+
// A row's position in the file is its order: rows are appended, never inserted
|
|
47
|
+
// mid-file or reordered. An in-place edit (a re-judged `class`, a backfilled
|
|
48
|
+
// verdict) keeps the row's position; a ruling meant to supersede an earlier one
|
|
49
|
+
// is appended. Readers pick a ticket's ruling by file order, not by `run_date`.
|
|
50
|
+
//
|
|
46
51
|
// Exit codes: 0 ok, 1 `check` found a mismatch or checked nothing from the latest
|
|
47
52
|
// run_date (see `check`), 2 usage or unreadable input.
|
|
48
53
|
|
|
@@ -63,8 +68,8 @@ const LEDGER_SCRIPT = join(SCRIPT_DIR, "ledger.mjs");
|
|
|
63
68
|
|
|
64
69
|
// ---------------------------------------------------------------------------
|
|
65
70
|
// pure core — exercised through the CLI by tier-outcomes.test.mjs; only
|
|
66
|
-
// COLUMNS, LEGACY_WIDTH
|
|
67
|
-
// through argv
|
|
71
|
+
// COLUMNS, LEGACY_WIDTH, TIER_SWITCH_DATE, parseTierOutcomes, rulingsByTicket,
|
|
72
|
+
// rulingFor and lastPullByTicket are imported directly, the rest through argv
|
|
68
73
|
// ---------------------------------------------------------------------------
|
|
69
74
|
|
|
70
75
|
// APPENDED TO, never inserted into: every awk read-out in the file's header
|
|
@@ -144,12 +149,19 @@ export function rulingsByTicket(rows) {
|
|
|
144
149
|
return by;
|
|
145
150
|
}
|
|
146
151
|
|
|
152
|
+
// Each ticket's last Pull of `pulls` (ticket-features.tsv rows), the whole row,
|
|
153
|
+
// in file order: its `run_date` is the floor its ruling must clear.
|
|
154
|
+
export function lastPullByTicket(pulls) {
|
|
155
|
+
return new Map(pulls.map((p) => [p.ticket, p]));
|
|
156
|
+
}
|
|
157
|
+
|
|
147
158
|
// The row ruling `ticket`'s Pull dated `pullDate`, from `rulingsByTicket`: its
|
|
148
|
-
// last ruling dated on or after the Pull, since a ruling never
|
|
149
|
-
// Pull it rules — or null. Throws on a ruling of the ticket whose
|
|
150
|
-
// is not YYYY-MM-DD, which cannot be placed against the Pull and
|
|
151
|
-
// would uncount the ticket, and on the ruling it picks holding
|
|
152
|
-
// `yes` or `no` in a verdict column, which would otherwise read
|
|
159
|
+
// last ruling in file order dated on or after the Pull, since a ruling never
|
|
160
|
+
// predates the Pull it rules — or null. Throws on a ruling of the ticket whose
|
|
161
|
+
// `run_date` is not YYYY-MM-DD, which cannot be placed against the Pull and
|
|
162
|
+
// whose drop would uncount the ticket, and on the ruling it picks holding
|
|
163
|
+
// anything but `yes` or `no` in a verdict column, which would otherwise read
|
|
164
|
+
// as a pass.
|
|
153
165
|
export function rulingFor(rulings, ticket, pullDate) {
|
|
154
166
|
const own = rulings.get(String(ticket)) ?? [];
|
|
155
167
|
for (const r of own) {
|