@feigi/fleet-ctl 3.69.0 → 3.69.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
CHANGED
package/scripts/fleet-event.mjs
CHANGED
|
@@ -145,7 +145,7 @@ import { makeDie, defineFlags, isDigits, writeAll } from "./arg.mjs";
|
|
|
145
145
|
import { FleetDirUnresolvable, fleetFile } from "./fleet-dir.mjs";
|
|
146
146
|
import { gitEnv } from "./git-env.mjs";
|
|
147
147
|
import { isCLI } from "./is-cli.mjs";
|
|
148
|
-
import { BRIEFS, REVIEW, REVIEWED, memberTokens, nextReviewerName, parseDispatchedEntry, parseMember, parseToken, rowNums } from "./ledger-grammar.mjs";
|
|
148
|
+
import { BRIEFS, REVIEW, REVIEWED, memberTokens, nextReviewerName, parseDispatchedEntry, parseMember, parseToken, readRetired, rowNums } from "./ledger-grammar.mjs";
|
|
149
149
|
import { dispositionsToken, foldLedger } from "./fleet-tick.mjs";
|
|
150
150
|
import { readRunReceipt, tickCaps } from "./phase0-receipt.mjs";
|
|
151
151
|
import { defaultScratch, readReportIn, reportsDir } from "./report-files.mjs";
|
|
@@ -538,7 +538,15 @@ function reviewFailed(ev, pr, launch) {
|
|
|
538
538
|
let next;
|
|
539
539
|
if (prWords(ev.ledger, pr).includes(tok)) {
|
|
540
540
|
ev.note(`PR #${pr} already ${tok}`);
|
|
541
|
-
|
|
541
|
+
// `## Retired` read as `ledger.mjs review` reads it, refusing a line that
|
|
542
|
+
// names no member or reviewer as `review` does.
|
|
543
|
+
const { names, malformed } = readRetired(ev.ledger.retired);
|
|
544
|
+
if (malformed.length > 0) {
|
|
545
|
+
ev.refuse(`next free runner for PR #${pr}`, { status: 2, how: "exit 2",
|
|
546
|
+
stderr: `${NAME}: ## Retired has a line '${malformed[0]}' that names no member or reviewer — fix the ledger by hand before review can trust it\n` });
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
next = nextReviewerName(ev.ledger.rows, pr, names);
|
|
542
550
|
} else {
|
|
543
551
|
const r = node("ledger.mjs", ["review", String(pr), tok]);
|
|
544
552
|
if (r.status !== 0) {
|
package/scripts/fleet-tick.mjs
CHANGED
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
// the ledger; main() does the I/O. Split so the guard table and the reading are
|
|
133
133
|
// both unit-testable without a network.
|
|
134
134
|
|
|
135
|
-
import { parseMember, parseToken, premisesOf, rowNums, nextRetry, REVIEW, REVIEWED } from "./ledger-grammar.mjs";
|
|
135
|
+
import { parseMember, parseToken, premisesOf, rowNums, nextRetry, readRetired, REVIEW, REVIEWED } from "./ledger-grammar.mjs";
|
|
136
136
|
|
|
137
137
|
// The implementer and reviewer rows' TARGET is the In-flight bound; the merge
|
|
138
138
|
// bot's is 1. Availability of work belongs in the ACTION, not the target: a
|
|
@@ -909,6 +909,14 @@ export const pastPinDue = (st, head) => st !== undefined && st.pastPinHalt && !s
|
|
|
909
909
|
export function deriveRun({ rows, dispatched, drain, retired = [] }, prs, closed = new Set(), finished = new Set()) {
|
|
910
910
|
const open = new Set(prs.map((p) => p.number));
|
|
911
911
|
const { members, byPr, verdicts, claimed, excluded } = foldLedger({ rows, dispatched }, open);
|
|
912
|
+
// `## Retired` lines as every reader reads them: a line's name before its
|
|
913
|
+
// first `=`. One naming no member or reviewer would leave the name it was
|
|
914
|
+
// meant to hold unaccounted for, so it is refused, as a `## Dispatched`
|
|
915
|
+
// entry that is no member token is.
|
|
916
|
+
const { names: retiredNames, malformed: badRetired } = readRetired(retired);
|
|
917
|
+
if (badRetired.length > 0) {
|
|
918
|
+
throw new LedgerError(`## Retired line '${badRetired[0]}' names no member or reviewer — fix the ledger by hand before the tick can count from it`);
|
|
919
|
+
}
|
|
912
920
|
|
|
913
921
|
const all = [...members.values()];
|
|
914
922
|
const live = (family) => all.filter((m) => m.family === family && m.outcome === null).length;
|
|
@@ -1088,9 +1096,9 @@ export function deriveRun({ rows, dispatched, drain, retired = [] }, prs, closed
|
|
|
1088
1096
|
// `review=wf:` run no member, so neither files one.
|
|
1089
1097
|
reporters: unsettled,
|
|
1090
1098
|
// Every member name the ledger records, settled or live: each row's
|
|
1091
|
-
// member tokens, each `## Dispatched` entry and each `## Retired` line
|
|
1092
|
-
// the names a transcript in the session directory is accounted for by.
|
|
1093
|
-
recorded: new Set([...members.keys(), ...
|
|
1099
|
+
// member tokens, each `## Dispatched` entry and each `## Retired` line's
|
|
1100
|
+
// name — the names a transcript in the session directory is accounted for by.
|
|
1101
|
+
recorded: new Set([...members.keys(), ...retiredNames]),
|
|
1094
1102
|
};
|
|
1095
1103
|
}
|
|
1096
1104
|
|
|
@@ -505,6 +505,33 @@ export const REVIEWER = /^review-pr-([1-9][0-9]*)(-[b-z])?$/;
|
|
|
505
505
|
* reviewer's, bare. */
|
|
506
506
|
export const isRetirable = (name) => parseMember(name) !== null || REVIEWER.test(name);
|
|
507
507
|
|
|
508
|
+
/** The name a `## Retired` line retires, read the one way every reader reads
|
|
509
|
+
* the section: the line's text before its first `=` — the whole line when it
|
|
510
|
+
* has none — whatever outcome follows it, so a name written with an outcome
|
|
511
|
+
* stays taken. Null when that name is not retirable: the line names no
|
|
512
|
+
* member or reviewer and is malformed, and read as no name it would release
|
|
513
|
+
* the name it was meant to hold, so `dispatch`, `review`, the tick and
|
|
514
|
+
* `review-failed` refuse it and `rotate` skips it aloud; `token` reads the
|
|
515
|
+
* names and leaves a malformed line to them. */
|
|
516
|
+
export function retiredName(line) {
|
|
517
|
+
const eq = line.indexOf("=");
|
|
518
|
+
const name = eq === -1 ? line : line.slice(0, eq);
|
|
519
|
+
return isRetirable(name) ? name : null;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** `## Retired` lines read through retiredName(): `names`, the names they
|
|
523
|
+
* retire in line order, and `malformed`, the lines that name none. */
|
|
524
|
+
export function readRetired(lines) {
|
|
525
|
+
const names = [];
|
|
526
|
+
const malformed = [];
|
|
527
|
+
for (const line of lines) {
|
|
528
|
+
const name = retiredName(line);
|
|
529
|
+
if (name === null) malformed.push(line);
|
|
530
|
+
else names.push(name);
|
|
531
|
+
}
|
|
532
|
+
return { names, malformed };
|
|
533
|
+
}
|
|
534
|
+
|
|
508
535
|
// The reviewer runner names a row's `review=member:<name>` launches took,
|
|
509
536
|
// `=failed` or answered or open. A workflow launch is named by its runId,
|
|
510
537
|
// which no hub member holds.
|
|
@@ -522,8 +549,8 @@ function launchedRunners(text) {
|
|
|
522
549
|
* in `## Dispatched` or on any row, the same two places `ledger.mjs dispatch`
|
|
523
550
|
* refuses a repeat from within a run — and every reviewer runner a row
|
|
524
551
|
* launched, that `liveOnLedger` does not carry, plus every name the archive's
|
|
525
|
-
* own `## Retired` already held (`retired`,
|
|
526
|
-
*
|
|
552
|
+
* own `## Retired` already held (`retired`, the names the caller read off its
|
|
553
|
+
* lines with retiredName()), once each: the `## Retired` names first, then the
|
|
527
554
|
* `## Dispatched` entries' in order, then the rows' in the order given, a
|
|
528
555
|
* row's member tokens before the reviewer runners it launched. A retired
|
|
529
556
|
* name stays taken for the rest of the omp session: the process that ran
|
package/scripts/ledger.mjs
CHANGED
|
@@ -51,7 +51,7 @@ import { fileURLToPath } from "node:url";
|
|
|
51
51
|
import { spawnSync, execFileSync } from "node:child_process";
|
|
52
52
|
import { makeDie, isFlagLike, hasEqualsForm, isDigits, writeAll } from "./arg.mjs";
|
|
53
53
|
import { fleetFile, FleetDirUnresolvable } from "./fleet-dir.mjs";
|
|
54
|
-
import { parseMember, parseToken, memberTokens, nextMergeBot, nextRetry, liveOnLedger, retiredOnLedger,
|
|
54
|
+
import { parseMember, parseToken, memberTokens, nextMergeBot, nextRetry, liveOnLedger, retiredOnLedger, retiredName, readRetired, agentDefinition, CELL, tierValues, rowPr, rowWriteRefusal, isReviewToken, addedReviewToken, newSplitRow, splitRowClause, added, premisesOf, MEMBER_FAMILIES, HALT_CAUSES, ROWS, DISPATCHED, FILED, RULED, DRAIN, RETIRED, RECEIPT, archiveStamp, receiptArchiveName, CLOSEOUT_RECEIPT, closeoutArchiveName, BRIEFS, briefsArchiveName, memberRole, parseDispatchedEntry, dispatchedEntry, headerRe, escapeText, unescapeText, nextReviewerName } from "./ledger-grammar.mjs";
|
|
55
55
|
import { deriveRun, LedgerError, labelOffMember, HELD, CONFLICT_HOLD } from "./fleet-tick.mjs";
|
|
56
56
|
import { stateFileIn, readState, writeState, assessBeat, stallsAt } from "./fleet-state.mjs";
|
|
57
57
|
import { processSource, ancestry, controllerOf, judgeController, ProcUnreadable } from "./proc.mjs";
|
|
@@ -1673,9 +1673,8 @@ function runRotate() {
|
|
|
1673
1673
|
// or one whose outcome is outside its family's vocabulary, which skips the
|
|
1674
1674
|
// line but not the name — and every reviewer runner a row launched, read off
|
|
1675
1675
|
// the parsed rows, the skipped ones and every `## Dispatched` entry alike — a
|
|
1676
|
-
// line the tick refuses still names members this session ran — and the
|
|
1677
|
-
// archive's own `## Retired
|
|
1678
|
-
// reviewer name.
|
|
1676
|
+
// line the tick refuses still names members this session ran — and the names
|
|
1677
|
+
// the archive's own `## Retired` lines hold.
|
|
1679
1678
|
function carryOf(text) {
|
|
1680
1679
|
const skipped = [];
|
|
1681
1680
|
const skippedRows = [];
|
|
@@ -1700,11 +1699,19 @@ function carryOf(text) {
|
|
|
1700
1699
|
skipped.push({ line: e, why: t === null ? "not a member token" : `${t.name}: ${t.error}` });
|
|
1701
1700
|
return false;
|
|
1702
1701
|
});
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1702
|
+
// A `## Retired` line is read through retiredName(), as every reader reads
|
|
1703
|
+
// it: one that carries an outcome is skipped — the new ledger holds names
|
|
1704
|
+
// bare — but its name retires, and one naming no member or reviewer is
|
|
1705
|
+
// skipped and retires nothing.
|
|
1706
|
+
const archivedRetired = [];
|
|
1707
|
+
for (const line of sectionOf(text, RETIRED)) {
|
|
1708
|
+
const name = retiredName(line);
|
|
1709
|
+
if (name === null) skipped.push({ line, why: "names no member or reviewer" });
|
|
1710
|
+
else {
|
|
1711
|
+
if (name !== line) skipped.push({ line, why: `${name} is retired bare` });
|
|
1712
|
+
archivedRetired.push(name);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1708
1715
|
const live = liveOnLedger(rows, dispatched);
|
|
1709
1716
|
const carried = { rows: live.rows.map((i) => rows[i]), dispatched: live.dispatched };
|
|
1710
1717
|
const retired = retiredOnLedger([...rows, ...skippedRows], allDispatched, archivedRetired, carried);
|
|
@@ -1766,6 +1773,20 @@ function refuseMalformedDispatched() {
|
|
|
1766
1773
|
}
|
|
1767
1774
|
}
|
|
1768
1775
|
|
|
1776
|
+
// The names `## Retired` holds, for `cmd` (dispatch or review) to refuse a
|
|
1777
|
+
// repeat from: each line's name read through readRetired(), the grammar's
|
|
1778
|
+
// one reading of the section, so a line that carries an outcome still holds
|
|
1779
|
+
// its name. A line naming no member or reviewer would release the name it
|
|
1780
|
+
// was meant to hold; refuse it, naming it, as refuseMalformedDispatched()
|
|
1781
|
+
// refuses an entry.
|
|
1782
|
+
function retiredNames(cmd) {
|
|
1783
|
+
const { names, malformed } = readRetired(data.retired);
|
|
1784
|
+
if (malformed.length > 0) {
|
|
1785
|
+
die(`## Retired has a line '${malformed[0]}' that names no member or reviewer — fix the ledger by hand before ${cmd} can trust it`);
|
|
1786
|
+
}
|
|
1787
|
+
return names;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1769
1790
|
// Why a finisher on PR `pr` may not be recorded yet, or null when it may.
|
|
1770
1791
|
// `review` is the tick fold's `reviewed` entry for the PR, undefined when the
|
|
1771
1792
|
// PR has no returned review.
|
|
@@ -1810,13 +1831,14 @@ function runDispatch() {
|
|
|
1810
1831
|
// Read ahead of every lookup below that trusts `## Dispatched` by name,
|
|
1811
1832
|
// including `nextMergeBot()`'s own read of it.
|
|
1812
1833
|
refuseMalformedDispatched();
|
|
1834
|
+
const retired = retiredNames("dispatch");
|
|
1813
1835
|
|
|
1814
1836
|
// `merge-bot` bare is the merge-bot case of this command: the ledger names
|
|
1815
1837
|
// the bot, 1 + the highest merge-bot name this session holds — in
|
|
1816
1838
|
// `## Dispatched`, on a row or in `## Retired` — so the controller never
|
|
1817
1839
|
// counts. An explicit `merge-bot-<n>` is accepted only when it is that one.
|
|
1818
1840
|
// `sessionNames` is every name beyond `## Dispatched` the session has used.
|
|
1819
|
-
const sessionNames = [...data.rows.flatMap(memberTokens).map((t) => t.name), ...
|
|
1841
|
+
const sessionNames = [...data.rows.flatMap(memberTokens).map((t) => t.name), ...retired];
|
|
1820
1842
|
const member = parseMember(name === "merge-bot" ? nextMergeBot(data.dispatched, sessionNames) : name);
|
|
1821
1843
|
if (!member) die(unknownMember(name));
|
|
1822
1844
|
if (member.bound === null) {
|
|
@@ -1847,7 +1869,7 @@ function runDispatch() {
|
|
|
1847
1869
|
const prior =
|
|
1848
1870
|
data.dispatched.find((e) => parseToken(e).name === member.name) ??
|
|
1849
1871
|
(settledOnRow && `${settledOnRow.name}=${settledOnRow.outcome}`) ??
|
|
1850
|
-
(
|
|
1872
|
+
(retired.includes(member.name) ? "retired by rotate" : undefined);
|
|
1851
1873
|
if (prior !== undefined) {
|
|
1852
1874
|
// Never a merge bot: it is accepted only as the number past every name
|
|
1853
1875
|
// the session holds, so none of the three places above can name it.
|
|
@@ -2460,6 +2482,7 @@ function runReview() {
|
|
|
2460
2482
|
if (other !== undefined) {
|
|
2461
2483
|
die(`review #${prNum}: '${other}' is not a review token — review writes only review=… and reviewed=…; every other token goes through row, dispatch or settle`);
|
|
2462
2484
|
}
|
|
2485
|
+
const retired = retiredNames("review");
|
|
2463
2486
|
const i = prRowIndex(prNum);
|
|
2464
2487
|
const created = i === -1;
|
|
2465
2488
|
const oldLine = created ? null : data.rows[i];
|
|
@@ -2475,13 +2498,13 @@ function runReview() {
|
|
|
2475
2498
|
: created ? `${head} ${appended.join(" · ")}`
|
|
2476
2499
|
: `${head} · ${appended.join(" · ")}`;
|
|
2477
2500
|
const after = created ? [...data.rows, line] : data.rows.with(i, line);
|
|
2478
|
-
const refusal = rowWriteRefusal(data.rows, after, oldLine, line,
|
|
2501
|
+
const refusal = rowWriteRefusal(data.rows, after, oldLine, line, retired);
|
|
2479
2502
|
if (refusal !== null) die(`review #${prNum}: ${refusal}`);
|
|
2480
2503
|
data.rows = after;
|
|
2481
2504
|
save(data);
|
|
2482
2505
|
const key = rowKey(line);
|
|
2483
2506
|
console.error(` review on row ${key}`);
|
|
2484
|
-
console.log(JSON.stringify({ pr: prNum, row: key, line, created, next: nextReviewerName(data.rows, prNum,
|
|
2507
|
+
console.log(JSON.stringify({ pr: prNum, row: key, line, created, next: nextReviewerName(data.rows, prNum, retired) }));
|
|
2485
2508
|
}
|
|
2486
2509
|
|
|
2487
2510
|
// A row's tokens: its words after the key, bar the ` · ` separators between
|
|
@@ -2595,7 +2618,11 @@ function runToken() {
|
|
|
2595
2618
|
// on a row with no implementer), or split one PR across two rows.
|
|
2596
2619
|
const split = newSplitRow(data.rows, after);
|
|
2597
2620
|
if (split !== null) die(`token ${key}: ${splitRowClause(split)}`);
|
|
2598
|
-
|
|
2621
|
+
// The names only: `token` adds no launch of its own, but a `PR#<n>` mention
|
|
2622
|
+
// can move a row that already holds one onto another PR, and that launch is
|
|
2623
|
+
// then judged against the retired names. A malformed `## Retired` line is
|
|
2624
|
+
// left to the readers that refuse it.
|
|
2625
|
+
const refusal = rowWriteRefusal(data.rows, after, oldLine, line, readRetired(data.retired).names);
|
|
2599
2626
|
if (refusal !== null) die(`token ${key}: ${refusal}`);
|
|
2600
2627
|
data.rows = after;
|
|
2601
2628
|
save(data);
|
|
@@ -187,7 +187,11 @@ retry letter past the highest the session has used on that number,
|
|
|
187
187
|
name, and `dispatch merge-bot` numbers past retired bots. The tick reads
|
|
188
188
|
`## Retired` only to account for a transcript in the session directory: a
|
|
189
189
|
ticket an earlier run worked is not claimed by it and can be shortlisted
|
|
190
|
-
again.
|
|
190
|
+
again. Every reader takes a `## Retired` line's name as its text before
|
|
191
|
+
the first `=` — the whole line when there is none — so a name written
|
|
192
|
+
with an outcome stays retired; a line whose name is no member or reviewer
|
|
193
|
+
name makes `dispatch`, `review` and the tick refuse, naming the line, until
|
|
194
|
+
it is fixed by hand.
|
|
191
195
|
A line it cannot parse is skipped with a warning naming it, and the
|
|
192
196
|
rotation still succeeds; a member name on a skipped line that carries an
|
|
193
197
|
outcome is retired all the same, and a bare member token on a skipped row
|