@feigi/fleet-ctl 3.66.0 → 3.66.2
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/closeout.mjs +3 -3
- package/scripts/fleet-event.mjs +2 -2
- package/scripts/fleet-tick.mjs +53 -31
- package/scripts/phase0-receipt.mjs +12 -14
- package/scripts/phase0.mjs +16 -9
- package/skills/run-team/SKILL.md +3 -2
package/package.json
CHANGED
package/scripts/closeout.mjs
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
//
|
|
23
23
|
// `finish` steps, in order, because the order is the point:
|
|
24
24
|
//
|
|
25
|
-
// tick `fleet-tick.mjs`, with the In-flight bound
|
|
26
|
-
// `.fleet/phase0.json` records
|
|
25
|
+
// tick `fleet-tick.mjs`, with the In-flight bound
|
|
26
|
+
// `.fleet/phase0.json` records, when it records one.
|
|
27
27
|
// Failed unless its last line is `ACTION: run over`.
|
|
28
28
|
// scrape `member-outcomes.mjs <dir>` for every session directory
|
|
29
29
|
// omp keeps for this cwd, each scraper's own yield line as the
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
// so a run that ended here leaves no phase-0 receipt for the
|
|
51
51
|
// next run in this session to resume, and that run's rotation
|
|
52
52
|
// files it as `phase0.<UTC stamp>.json` beside the ledger
|
|
53
|
-
// archive. After the tick, which reads the
|
|
53
|
+
// archive. After the tick, which reads the bound from it, and
|
|
54
54
|
// before the stop. No `phase0.json` is nothing to move and is
|
|
55
55
|
// `ok`; a held receipt already there that is not this one is
|
|
56
56
|
// a failed step.
|
package/scripts/fleet-event.mjs
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Reached through the Resolver and run from the main checkout. Every kind
|
|
8
8
|
// performs its writes, then runs `fleet-tick.mjs --apply` with the In-flight
|
|
9
|
-
// bound — `--in-flight` as given, else the one `.fleet/phase0.json`
|
|
10
|
-
//
|
|
9
|
+
// bound — `--in-flight` as given, else the one `.fleet/phase0.json` records,
|
|
10
|
+
// else the tick's own default — and prints one
|
|
11
11
|
// `event: <kind>: <summary>` line with the tick's output verbatim after it.
|
|
12
12
|
// Every kind is idempotent: a second run finds its writes made and only ticks
|
|
13
13
|
// again.
|
package/scripts/fleet-tick.mjs
CHANGED
|
@@ -90,13 +90,17 @@
|
|
|
90
90
|
// writes beside the message it sends, for every live member
|
|
91
91
|
// token. `<scratch>` is the phase-0 receipt's `scratch`, else
|
|
92
92
|
// `--scratch`; with neither the check is skipped with one stderr
|
|
93
|
-
// line. A file on disk
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
93
|
+
// line. A file on disk that validates against its member family's
|
|
94
|
+
// report schema prints one `SETTLE <member>` line naming the
|
|
95
|
+
// `ledger.mjs settle <member> --from-report` it is for. One whose
|
|
96
|
+
// `member` is not its filename's prints REPORT-MISMATCH instead;
|
|
97
|
+
// one that is there but cannot be read prints REPORT-UNREADABLE;
|
|
98
|
+
// one that names its own member and fails its family's schema
|
|
99
|
+
// prints REPORT-INVALID with the first violation, because
|
|
100
|
+
// `settle --from-report` refuses such a file. Advice, like
|
|
101
|
+
// CHECK-LIVENESS: the tick settles nothing. A review runner has no
|
|
102
|
+
// report schema and files none, so no `review=` token is looked
|
|
103
|
+
// up; a member with no schema is never checked against one.
|
|
100
104
|
// session The listing of the session directory omp writes one
|
|
101
105
|
// `<member>.jsonl` transcript into per dispatched member: this
|
|
102
106
|
// run's phase-0 receipt's `session`, else `--session`; with
|
|
@@ -1135,18 +1139,22 @@ export function livenessLines({ live, seen, thresholds, now }) {
|
|
|
1135
1139
|
}
|
|
1136
1140
|
|
|
1137
1141
|
// The report lines: one per name in `reporters` with a report file on disk, as
|
|
1138
|
-
// `{member, settle, line, key}
|
|
1139
|
-
// its file — `{path, since,
|
|
1140
|
-
//
|
|
1141
|
-
//
|
|
1142
|
-
//
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1145
|
-
//
|
|
1146
|
-
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1142
|
+
// `{member, settle, line, key}`, and `invalid: true` on a REPORT-INVALID one.
|
|
1143
|
+
// `reports` maps a name to what main() read off its file — `{path, since,
|
|
1144
|
+
// member, violation}`, `since` the file's mtime in ms, `member` the file's own
|
|
1145
|
+
// `member` field (undefined when it has none or is not JSON) and `violation`
|
|
1146
|
+
// the first violation of the schema of the name's family (undefined when the
|
|
1147
|
+
// file validates, or when no schema covers the name) — or `{path, unreadable}`,
|
|
1148
|
+
// `unreadable` the error code of a file that is there and cannot be read — and
|
|
1149
|
+
// has no entry for a name with no file. A file that names a member other than
|
|
1150
|
+
// the one it is filed under prints REPORT-MISMATCH instead, once, an
|
|
1151
|
+
// unreadable one REPORT-UNREADABLE, and one that names its member and fails
|
|
1152
|
+
// its schema REPORT-INVALID; for all three `settle` is false. `reportsFrom`,
|
|
1153
|
+
// when set, is the directory the printed settle reads its file from:
|
|
1154
|
+
// ledger.mjs reads the default scratch root's `reports/` unless told
|
|
1155
|
+
// otherwise. `key` is the line without its age, what the digest
|
|
1156
|
+
// `--fold-unchanged` compares takes, so a report waiting on disk folds rather
|
|
1157
|
+
// than moving the digest every minute.
|
|
1150
1158
|
export function reportLines({ reporters, reports, now, reportsFrom = null }) {
|
|
1151
1159
|
const out = [];
|
|
1152
1160
|
const from = reportsFrom === null ? "" : ` --reports ${/^[\w./@%+=:,-]+$/.test(reportsFrom) ? reportsFrom : `'${reportsFrom.replaceAll("'", "'\\''")}'`}`;
|
|
@@ -1164,6 +1172,11 @@ export function reportLines({ reporters, reports, now, reportsFrom = null }) {
|
|
|
1164
1172
|
out.push({ member, settle: false, line, key: line });
|
|
1165
1173
|
continue;
|
|
1166
1174
|
}
|
|
1175
|
+
if (r.violation !== undefined) {
|
|
1176
|
+
const line = `REPORT-INVALID ${r.path} (${r.violation})`;
|
|
1177
|
+
out.push({ member, settle: false, invalid: true, line, key: line });
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1167
1180
|
const age = Math.floor(Math.max(0, now - r.since) / 60_000);
|
|
1168
1181
|
out.push({
|
|
1169
1182
|
member, settle: true, key: `SETTLE ${member}`,
|
|
@@ -1285,9 +1298,9 @@ import { gitEnv } from "./git-env.mjs";
|
|
|
1285
1298
|
import { fleetFile, FleetDirUnresolvable, scratchRoot } from "./fleet-dir.mjs";
|
|
1286
1299
|
import { statePath, readState, writeState, assessBeat, isStalled, isReported, stallReport, stallOwner } from "./fleet-state.mjs";
|
|
1287
1300
|
import { checkMainCheckout, describe } from "./main-checkout.mjs";
|
|
1288
|
-
import { readRunReceipt, phase0Gate } from "./phase0-receipt.mjs";
|
|
1301
|
+
import { readRunReceipt, phase0Gate, IN_FLIGHT_DEFAULT } from "./phase0-receipt.mjs";
|
|
1289
1302
|
import { judgeRecord, ProcUnreadable } from "./proc.mjs";
|
|
1290
|
-
import { reportPath, reportsDir } from "./report-files.mjs";
|
|
1303
|
+
import { reportFamily, readReport, reportPath, reportsDir } from "./report-files.mjs";
|
|
1291
1304
|
|
|
1292
1305
|
const NAME = "fleet-tick";
|
|
1293
1306
|
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -1334,9 +1347,10 @@ const die = makeDie(NAME);
|
|
|
1334
1347
|
// is left is configuration, and all of it defaults.
|
|
1335
1348
|
const OPTIONS = {
|
|
1336
1349
|
// The In-flight bound: the most tickets between Claim and merge at once. The
|
|
1337
|
-
// default
|
|
1338
|
-
// goes through the guard below, where a hand-passed default
|
|
1339
|
-
|
|
1350
|
+
// default is phase0-receipt.mjs's, the one phase 0 also takes, declared this
|
|
1351
|
+
// way so it still goes through the guard below, where a hand-passed default
|
|
1352
|
+
// went round it.
|
|
1353
|
+
"in-flight": { type: "string", default: String(IN_FLIGHT_DEFAULT) },
|
|
1340
1354
|
// `--fold-unchanged` prints ONE line instead of the rows when this tick asks
|
|
1341
1355
|
// for nothing and says exactly what the last one said — what makes an
|
|
1342
1356
|
// unattended night affordable. Opt-in because folding is wrong on an edge:
|
|
@@ -1786,10 +1800,12 @@ function reportsScratch(receipt, flag) {
|
|
|
1786
1800
|
}
|
|
1787
1801
|
|
|
1788
1802
|
// The report file of each name in `reporters`, as reportLines() takes them:
|
|
1789
|
-
// `{path, since, member}` per file on disk, `{path, unreadable}` for
|
|
1790
|
-
// cannot be read, nothing for a name with none.
|
|
1791
|
-
//
|
|
1792
|
-
|
|
1803
|
+
// `{path, since, member, violation}` per file on disk, `{path, unreadable}` for
|
|
1804
|
+
// one that cannot be read, nothing for a name with none. `member` is the file's
|
|
1805
|
+
// own, and a file that is not JSON carries none. `violation` is report-files's
|
|
1806
|
+
// verdict on a file that is there for a name a schema covers, set only when
|
|
1807
|
+
// that verdict is invalid; a name no schema covers is never looked up.
|
|
1808
|
+
export function readReports(scratch, reporters) {
|
|
1793
1809
|
const out = new Map();
|
|
1794
1810
|
for (const member of reporters) {
|
|
1795
1811
|
const path = reportPath(scratch, member);
|
|
@@ -1809,7 +1825,12 @@ function readReports(scratch, reporters) {
|
|
|
1809
1825
|
} catch {
|
|
1810
1826
|
named = undefined;
|
|
1811
1827
|
}
|
|
1812
|
-
|
|
1828
|
+
const entry = { path, since, member: named };
|
|
1829
|
+
if (reportFamily(member) !== null) {
|
|
1830
|
+
const checked = readReport(scratch, member);
|
|
1831
|
+
if (checked.state === "invalid") entry.violation = checked.violation;
|
|
1832
|
+
}
|
|
1833
|
+
out.set(member, entry);
|
|
1813
1834
|
}
|
|
1814
1835
|
return out;
|
|
1815
1836
|
}
|
|
@@ -2026,8 +2047,9 @@ function main() {
|
|
|
2026
2047
|
// past its threshold. The digest already moves when its bucket does.
|
|
2027
2048
|
const aged = stale.map((s) => `; CHECK-LIVENESS ${s.member} persists`).join("");
|
|
2028
2049
|
// A report waiting on disk persists the same way, for as long as its
|
|
2029
|
-
// member stays live
|
|
2030
|
-
|
|
2050
|
+
// member stays live: the settle it is for, or REPORT-INVALID where that
|
|
2051
|
+
// settle would be refused.
|
|
2052
|
+
const settle = reported.filter((r) => r.settle || r.invalid).map((r) => `; ${r.settle ? "SETTLE" : "REPORT-INVALID"} ${r.member} persists`).join("");
|
|
2031
2053
|
// A transcript the ledger lacks, or a live token lacking one, the same
|
|
2032
2054
|
// way, for as long as it holds.
|
|
2033
2055
|
const unmatched = transcribed.map((t) => `; ${t.kind} ${t.name} persists`).join("");
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// after every step (its header gives the shape); this module is its readers'
|
|
3
3
|
// half: the tick's dispatch gate, the session directory tier-check.mjs
|
|
4
4
|
// and ticket-router.mjs take when their own flag is omitted, and the In-flight
|
|
5
|
-
// bound the drivers hand the tick. One reading of the file,
|
|
6
|
-
// the session readers cannot disagree about what a receipt is.
|
|
5
|
+
// bound the drivers hand the tick, with its default. One reading of the file,
|
|
6
|
+
// so the gate and the session readers cannot disagree about what a receipt is.
|
|
7
7
|
//
|
|
8
8
|
// Zero deps: node builtins and sibling modules only.
|
|
9
9
|
|
|
@@ -145,18 +145,17 @@ export function sessionFromReceipt(opts) {
|
|
|
145
145
|
throw new Error(`no session given and none in the phase-0 receipt ${path} (${why}) — give one, or run ${phase0Command(null)} first`);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
const
|
|
148
|
+
// The In-flight bound a run takes when nobody gives one: the most tickets
|
|
149
|
+
// between Claim and merge at once. Its one definition — phase0.mjs and the
|
|
150
|
+
// tick's own flag default both read it from here.
|
|
151
|
+
export const IN_FLIGHT_DEFAULT = 5;
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* The bound the receipt in `fleetDir` records, as the tick's own flag:
|
|
155
|
-
* `{ args }
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* defaulted to.
|
|
155
|
+
* `{ args }` — `--in-flight <B>` for the `inFlight` phase 0 ran with, none
|
|
156
|
+
* when there is no receipt or it records no bound — or `{ error }` for a
|
|
157
|
+
* receipt that is there and cannot be read. The caps the receipt records
|
|
158
|
+
* play no part: the bound counts tickets, not members.
|
|
160
159
|
*/
|
|
161
160
|
export function tickCaps(fleetDir) {
|
|
162
161
|
let phase0;
|
|
@@ -166,7 +165,6 @@ export function tickCaps(fleetDir) {
|
|
|
166
165
|
if (e.code === "ENOENT") return { args: [] };
|
|
167
166
|
return { error: `cannot read ${join(fleetDir, RECEIPT)}: ${e.message}` };
|
|
168
167
|
}
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
return { args: ["--in-flight", String((impl ?? RETIRED_IMPL_CAP) + (review ?? RETIRED_REVIEW_CAP))] };
|
|
168
|
+
const bound = phase0?.inFlight;
|
|
169
|
+
return { args: bound == null ? [] : ["--in-flight", String(bound)] };
|
|
172
170
|
}
|
package/scripts/phase0.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Phase 0 as one command: the run's start sequence, in order, with a receipt.
|
|
3
3
|
//
|
|
4
4
|
// phase0.mjs --session <dir> [--implementer-cap n] [--reviewer-cap n]
|
|
5
|
-
// [--plugin-checkout <dir>] [--spend-dir <dir>]
|
|
5
|
+
// [--in-flight n] [--plugin-checkout <dir>] [--spend-dir <dir>]
|
|
6
6
|
// [--workflow <name> | --declare-no-ci]
|
|
7
7
|
//
|
|
8
8
|
// Reached through the Resolver and run from the MAIN checkout (a linked
|
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
// output), exit 2 or anything else `unanswered`; neither stops
|
|
32
32
|
// the run — reconciling is a write to the gate and the
|
|
33
33
|
// maintainer's.
|
|
34
|
-
// tier-roles `tier-roles.mjs --check
|
|
34
|
+
// tier-roles `tier-roles.mjs --check --in-flight <B>`. <B> is `--in-flight`
|
|
35
|
+
// when given, else the In-flight bound's default
|
|
36
|
+
// (IN_FLIGHT_DEFAULT in phase0-receipt.mjs); the caps play no
|
|
37
|
+
// part in it. A notice tier-roles prints on a pass is part of
|
|
38
|
+
// the step's output.
|
|
35
39
|
// metrics `metrics-refresh.mjs`. A non-zero exit fails the step.
|
|
36
40
|
// cockpit `board.mjs serve --open` launched detached, `--spend-dir`
|
|
37
41
|
// passed through. Recorded; never fails the run.
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
// THE RECEIPT is `.fleet/phase0.json` (resolved through fleet-dir.mjs, so a
|
|
56
60
|
// worktree and the main checkout name one file):
|
|
57
61
|
//
|
|
58
|
-
// { run, session, scratch, caps: {impl, review},
|
|
62
|
+
// { run, session, scratch, caps: {impl, review}, inFlight,
|
|
59
63
|
// steps: { <name>: { status, at, output } } }
|
|
60
64
|
//
|
|
61
65
|
// `status` is ok, pending, failed, drift or unanswered; `at` an ISO time;
|
|
@@ -66,7 +70,8 @@
|
|
|
66
70
|
// run. `session` is `--session`, the one place the controller states its
|
|
67
71
|
// session directory. `scratch` is what `scratch-root.mjs` prints. `caps` are
|
|
68
72
|
// the flags as given, null for one not given: the tick's own defaults apply to
|
|
69
|
-
// a cap nobody set, and a number here would pretend somebody had.
|
|
73
|
+
// a cap nobody set, and a number here would pretend somebody had. `inFlight`
|
|
74
|
+
// is the In-flight bound this run used — `--in-flight`, or its default.
|
|
70
75
|
//
|
|
71
76
|
// RESUMABLE. A re-run reads the receipt. It continues it — skipping every `ok`
|
|
72
77
|
// step and re-running the rest — only when its `run` equals the `at` the
|
|
@@ -124,6 +129,7 @@ import { readState, stateFileIn } from "./fleet-state.mjs";
|
|
|
124
129
|
import { gitEnv } from "./git-env.mjs";
|
|
125
130
|
import { isCLI } from "./is-cli.mjs";
|
|
126
131
|
import { RECEIPT, RECEIPT_HELD, archiveStamp, receiptArchiveName, rowNums } from "./ledger-grammar.mjs";
|
|
132
|
+
import { IN_FLIGHT_DEFAULT } from "./phase0-receipt.mjs";
|
|
127
133
|
|
|
128
134
|
const NAME = "phase0";
|
|
129
135
|
const SCRIPTS = dirname(fileURLToPath(import.meta.url));
|
|
@@ -222,10 +228,10 @@ function ruleset({ cwd }) {
|
|
|
222
228
|
return { status: "unanswered", output: withText(`apply-ruleset.sh --check could not answer (${r.how})`, r) };
|
|
223
229
|
}
|
|
224
230
|
|
|
225
|
-
function tierRoles({ cwd }) {
|
|
226
|
-
const r = node("tier-roles.mjs", ["--check"], { cwd });
|
|
231
|
+
function tierRoles({ cwd, receipt }) {
|
|
232
|
+
const r = node("tier-roles.mjs", ["--check", "--in-flight", String(receipt.inFlight)], { cwd });
|
|
227
233
|
if (r.status !== 0) return refusal("tier-roles.mjs --check failed:", r);
|
|
228
|
-
return ok(
|
|
234
|
+
return ok(withText(`every tier route resolves (in-flight bound ${receipt.inFlight})`, r));
|
|
229
235
|
}
|
|
230
236
|
|
|
231
237
|
function metrics({ cwd }) {
|
|
@@ -430,7 +436,7 @@ function main() {
|
|
|
430
436
|
const die = makeDie(NAME);
|
|
431
437
|
const F = defineFlags(die, {
|
|
432
438
|
flags: {
|
|
433
|
-
session: "value", "implementer-cap": "value", "reviewer-cap": "value", "plugin-checkout": "value",
|
|
439
|
+
session: "value", "implementer-cap": "value", "reviewer-cap": "value", "in-flight": "value", "plugin-checkout": "value",
|
|
434
440
|
"spend-dir": "value", workflow: "value", "declare-no-ci": "bool",
|
|
435
441
|
},
|
|
436
442
|
});
|
|
@@ -451,6 +457,7 @@ function main() {
|
|
|
451
457
|
return n;
|
|
452
458
|
};
|
|
453
459
|
const caps = { impl: positive("implementer-cap"), review: positive("reviewer-cap") };
|
|
460
|
+
const inFlight = positive("in-flight") ?? IN_FLIGHT_DEFAULT;
|
|
454
461
|
if (F.has("declare-no-ci") && !absent("workflow")) die("--workflow and --declare-no-ci are alternatives, not a pair");
|
|
455
462
|
const ci = F.has("declare-no-ci") ? "CI: declared absent (--declare-no-ci)" : absent("workflow") ? null : `CI: workflow ${F.arg("workflow")} (--workflow)`;
|
|
456
463
|
const pathOf = (name) => (absent(name) ? null : resolve(F.arg(name)));
|
|
@@ -514,7 +521,7 @@ function main() {
|
|
|
514
521
|
renameSync(receiptPath, held);
|
|
515
522
|
}
|
|
516
523
|
|
|
517
|
-
const receipt = { run: resumed ? previous.run : null, session, scratch, caps, steps: {} };
|
|
524
|
+
const receipt = { run: resumed ? previous.run : null, session, scratch, caps, inFlight, steps: {} };
|
|
518
525
|
for (const name of STEP_NAMES) {
|
|
519
526
|
const was = resumed ? previous.steps[name] : undefined;
|
|
520
527
|
receipt.steps[name] = was?.status === "ok" ? was : { status: "pending", at: now, output: "not run" };
|
package/skills/run-team/SKILL.md
CHANGED
|
@@ -55,8 +55,9 @@ named request should state the original's msg_id and that it is a re-send, which
|
|
|
55
55
|
is what distinguishes a lost message from a member that never sent one; a
|
|
56
56
|
controller that skips the ask cannot tell those apart and will guess wrong in
|
|
57
57
|
whichever direction its expectations point. The tick prints `SETTLE <member>`
|
|
58
|
-
for a report file on disk
|
|
59
|
-
anyone is
|
|
58
|
+
for a report file on disk that passes its schema and `REPORT-INVALID` for one
|
|
59
|
+
that fails it, so a missing message is read off those lines before anyone is
|
|
60
|
+
pinged.
|
|
60
61
|
|
|
61
62
|
Note this cuts against the paragraph above only in appearance: the default stays
|
|
62
63
|
*send once*, because unprompted re-sends were measured 2-to-1 false. The ask is
|