@feigi/fleet-ctl 0.0.0 → 3.16.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/agents/{fleet-implementer.agent.md → fleet-implementer-slow-high.agent.md} +23 -2
- package/agents/fleet-implementer-slow-medium.agent.md +231 -0
- package/agents/fleet-implementer-smol-high.agent.md +231 -0
- package/agents/{fleet-implementer-alt.agent.md → fleet-implementer-task-high.agent.md} +23 -2
- package/agents/fleet-implementer-task-max.agent.md +231 -0
- package/agents/fleet-review-comments.agent.md +4 -2
- package/agents/fleet-review-correctness.agent.md +2 -1
- package/agents/fleet-review-runner.agent.md +14 -10
- package/agents/fleet-review-silent-failure.agent.md +4 -3
- package/agents/fleet-review-simplify.agent.md +2 -1
- package/agents/fleet-review-snapshot.agent.md +2 -1
- package/agents/fleet-review-test-run.agent.md +29 -0
- package/agents/fleet-review-tests.agent.md +10 -5
- package/agents/fleet-review-types.agent.md +4 -2
- package/agents/fleet-review-verifier.agent.md +4 -3
- package/commands/review-and-fix.md +7 -6
- package/commands/run-merge-bot.md +14 -4
- package/package.json +4 -2
- package/scripts/agent-test.test.mjs +36 -32
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +23 -13
- package/scripts/apply-ruleset.test.mjs +4 -3
- package/scripts/arg-header-probes-prose.test.mjs +1 -0
- package/scripts/arg.test.mjs +18 -18
- package/scripts/board-cli.test.mjs +18 -21
- package/scripts/board-identity.test.mjs +9 -9
- package/scripts/board-liveness-banner.test.mjs +6 -6
- package/scripts/board-prev-shape.test.mjs +12 -13
- package/scripts/board-tryparse-null.test.mjs +7 -7
- package/scripts/board.mjs +4 -7
- package/scripts/board.test.mjs +57 -61
- package/scripts/candidates.test.mjs +228 -17
- package/scripts/ci-completes-premise-prose.test.mjs +1 -1
- package/scripts/ci-state-prose.test.mjs +2 -2
- package/scripts/ci-state.mjs +389 -187
- package/scripts/ci-state.test.mjs +458 -165
- package/scripts/claim-lifecycle.test.mjs +2 -1
- package/scripts/claim-ticket.test.mjs +35 -34
- package/scripts/closing-keyword-prose.test.mjs +1 -1
- package/scripts/cockpit-tick-nonblocking.test.mjs +8 -8
- package/scripts/compute-board.mjs +13 -3
- package/scripts/compute-board.test.mjs +64 -1
- package/scripts/compute-spend.mjs +46 -8
- package/scripts/compute-spend.test.mjs +64 -10
- package/scripts/cross-repo-citation-prose.test.mjs +18 -19
- package/scripts/delete-merged-branch.sh +218 -0
- package/scripts/delete-merged-branch.test.mjs +576 -0
- package/scripts/derive-testcmd.sh +18 -7
- package/scripts/derive-testcmd.test.mjs +9 -8
- package/scripts/diff-stats.mjs +2 -2
- package/scripts/diff-stats.test.mjs +7 -11
- package/scripts/dispatch-block-golden-prose.test.mjs +111 -6
- package/scripts/dispatch-block-pins-prose.test.mjs +5 -5
- package/scripts/dispositions-check.mjs +507 -0
- package/scripts/dispositions-check.test.mjs +843 -0
- package/scripts/dispositions-gate-prose.test.mjs +114 -0
- package/scripts/drop-merged-label.test.mjs +3 -4
- package/scripts/exec-stub.mjs +93 -0
- package/scripts/exec-stub.test.mjs +69 -0
- package/scripts/filing-bar-seat-prose.test.mjs +1 -1
- package/scripts/finisher-test-verdict-prose.test.mjs +102 -0
- package/scripts/fix-applier-correction-rules-prose.test.mjs +11 -10
- package/scripts/fleet-bootstrap +5 -20
- package/scripts/fleet-bootstrap.test.mjs +75 -0
- package/scripts/fleet-heartbeat.mjs +2 -2
- package/scripts/fleet-provenance +15 -24
- package/scripts/fleet-provenance.test.mjs +86 -12
- package/scripts/fleet-run.test.mjs +5 -5
- package/scripts/fleet-state.mjs +33 -11
- package/scripts/fleet-state.test.mjs +90 -3
- package/scripts/fleet-tick.mjs +346 -70
- package/scripts/fleet-tick.test.mjs +566 -16
- package/scripts/force-with-lease-reason-prose.test.mjs +1 -1
- package/scripts/frontmatter-check.mjs +3 -2
- package/scripts/frontmatter-check.test.mjs +6 -6
- package/scripts/immutable-body-claim-prose.test.mjs +53 -262
- package/scripts/implementer-model-tier.test.mjs +98 -506
- package/scripts/inflight.test.mjs +18 -127
- package/scripts/is-cli.mjs +26 -0
- package/scripts/is-cli.test.mjs +99 -0
- package/scripts/json.test.mjs +3 -3
- package/scripts/ledger-dispatch.test.mjs +368 -7
- package/scripts/ledger-grammar.mjs +85 -1
- package/scripts/ledger-grammar.test.mjs +86 -1
- package/scripts/ledger-read-require-file.test.mjs +7 -7
- package/scripts/ledger-rotate.test.mjs +142 -0
- package/scripts/ledger.mjs +181 -17
- package/scripts/ledger.test.mjs +12 -130
- package/scripts/main-checkout.mjs +312 -0
- package/scripts/main-checkout.test.mjs +332 -0
- package/scripts/member-outcomes-header.test.mjs +3 -3
- package/scripts/member-outcomes.mjs +4 -5
- package/scripts/member-outcomes.test.mjs +92 -18
- package/scripts/member-prompt-prose.test.mjs +17 -13
- package/scripts/member-record.mjs +8 -3
- package/scripts/member-record.test.mjs +5 -5
- package/scripts/member-write-guard.mjs +5 -5
- package/scripts/member-write-guard.test.mjs +6 -3
- package/scripts/no-undo-audit.sh +24 -21
- package/scripts/no-undo-audit.test.mjs +9 -13
- package/scripts/pointer-target-prose.test.mjs +1 -1
- package/scripts/pr-overlap.test.mjs +6 -9
- package/scripts/prompt-renderer.mjs +10 -9
- package/scripts/prose-pin.mjs +10 -11
- package/scripts/prove-merge.test.mjs +3 -3
- package/scripts/quiet-payload-prose.test.mjs +1 -1
- package/scripts/reap.test.mjs +3 -4
- package/scripts/release-label-split-prose.test.mjs +17 -2
- package/scripts/release-ticket.test.mjs +35 -44
- package/scripts/review-core-cwd-isolation.test.mjs +7 -6
- package/scripts/review-core-reads.test.mjs +1 -1
- package/scripts/review-core-scratch-refusal.test.mjs +64 -0
- package/scripts/review-core-shared-test-run.test.mjs +238 -0
- package/scripts/review-core-snapshot-path.test.mjs +59 -12
- package/scripts/review-core-specialist-scratch.test.mjs +12 -10
- package/scripts/review-core-testcmd.test.mjs +76 -45
- package/scripts/review-core-unrun.test.mjs +154 -168
- package/scripts/review-core.mjs +250 -56
- package/scripts/review-eval.mjs +11 -4
- package/scripts/review-host-fixture.mjs +12 -3
- package/scripts/review-in-run-retry.test.mjs +27 -3
- package/scripts/review-runner-spawns.test.mjs +5 -3
- package/scripts/review-runner.test.mjs +14 -3
- package/scripts/review-tier-audit.test.mjs +1 -1
- package/scripts/run-merge-bot-prose.test.mjs +29 -6
- package/scripts/scratch-partition-invariant-prose.test.mjs +1 -1
- package/scripts/section-between-guard-prose.test.mjs +4 -3
- package/scripts/select-dimensions.test.mjs +1 -1
- package/scripts/shell-traps-prose.test.mjs +6 -9
- package/scripts/shortlist.mjs +4 -1
- package/scripts/shortlist.test.mjs +30 -16
- package/scripts/snapshot-repo.test.mjs +177 -4
- package/scripts/stash-prohibition-prose.test.mjs +1 -1
- package/scripts/temp-dir.mjs +47 -0
- package/scripts/tier-check.mjs +95 -28
- package/scripts/tier-check.test.mjs +131 -29
- package/scripts/tier-outcomes-header.test.mjs +11 -54
- package/scripts/tier-outcomes.mjs +34 -12
- package/scripts/tier-outcomes.test.mjs +157 -4
- package/scripts/tier-roles.mjs +118 -29
- package/scripts/tier-roles.test.mjs +226 -61
- package/scripts/tracker-block-copy-prose.test.mjs +3 -3
- package/scripts/verify-sha.test.mjs +4 -5
- package/scripts/watcher-degraded-block.test.mjs +5 -8
- package/scripts/within-run-pair-prose.test.mjs +43 -75
- package/scripts/worktree-audit.test.mjs +2 -1
- package/skills/next-ticket/SKILL.md +2 -2
- package/skills/run-team/SKILL.md +433 -303
- package/skills/run-team/references/ci-and-staleness.md +7 -6
- package/skills/run-team/references/correction-tickets.md +3 -3
- package/skills/run-team/references/isolation.md +1 -1
- package/skills/sizing-a-ticket/SKILL.md +8 -8
- package/scripts/tier-guard-gate-prose.test.mjs +0 -216
package/scripts/fleet-tick.mjs
CHANGED
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
// downward.
|
|
38
38
|
// gh The open PRs, by label and by whether they close an issue — the
|
|
39
39
|
// merge queue, and which PRs are owed a review.
|
|
40
|
+
// main The main checkout against the run-start baseline
|
|
41
|
+
// `.fleet/main-checkout.sha`, through main-checkout.mjs (#2210).
|
|
42
|
+
// Anything but `clean` — dirty, unknown, no baseline — prints one
|
|
43
|
+
// MAIN-CHECKOUT-* line and holds every dispatching row until the
|
|
44
|
+
// maintainer clears it; it never refuses the tick.
|
|
40
45
|
//
|
|
41
46
|
// The pure half below is `reconcile()` over the counts `deriveRun()` reads off
|
|
42
47
|
// the ledger; main() does the I/O. Split so the guard table and the reading are
|
|
@@ -53,7 +58,36 @@ import { parseMember, parseToken } from "./ledger-grammar.mjs";
|
|
|
53
58
|
// reads what they leave: the slots this tick's own dispatches fill.
|
|
54
59
|
export function reconcile(s) {
|
|
55
60
|
const rev = reviewers(s);
|
|
56
|
-
return [implementers(s, rev.left), ...rev.rows, mergeBot(s), ...shortlistRows(s)];
|
|
61
|
+
return [...mainCheckoutHold(s, [implementers(s, rev.left), ...rev.rows, mergeBot(s)]), ...shortlistRows(s)];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// #2210: a main checkout changed since the run's baseline — or one the tick
|
|
65
|
+
// could not compare — holds every DISPATCHING row: one HOLD per role,
|
|
66
|
+
// keeping its counts, in place of whatever it would have dispatched. Placed
|
|
67
|
+
// over the computed rows rather than inside each role, so no role's own
|
|
68
|
+
// guards can outrank it. Anything but an explicit `clean` holds: a missing
|
|
69
|
+
// answer is not a clean one. Dirty and unknown are the maintainer's to clear
|
|
70
|
+
// (main-checkout.mjs's header), so they are not actionable — the same reason
|
|
71
|
+
// `SUGGEST /triage` is not. A missing baseline is the controller's own
|
|
72
|
+
// Phase 0 step, so that one asks it to act.
|
|
73
|
+
const MAIN_CHECKOUT_HOLD = { dirty: "main checkout dirty", absent: "main checkout no baseline" };
|
|
74
|
+
// The reason a main-checkout answer holds dispatch on, or null for `clean` —
|
|
75
|
+
// the one wording the HOLD rows and the folded line (#2307) both carry.
|
|
76
|
+
function mainCheckoutHoldReason(mainCheckout) {
|
|
77
|
+
const state = mainCheckout?.state ?? "unknown";
|
|
78
|
+
if (state === "clean") return null;
|
|
79
|
+
return MAIN_CHECKOUT_HOLD[state] ?? "main checkout unknown";
|
|
80
|
+
}
|
|
81
|
+
function mainCheckoutHold(s, rows) {
|
|
82
|
+
const why = mainCheckoutHoldReason(s.mainCheckout);
|
|
83
|
+
if (why === null) return rows;
|
|
84
|
+
const acts = s.mainCheckout?.state === "absent";
|
|
85
|
+
const held = [];
|
|
86
|
+
for (const r of rows) {
|
|
87
|
+
if (held.some((h) => h.role === r.role)) continue;
|
|
88
|
+
held.push({ ...r, action: `HOLD (${why})`, acts });
|
|
89
|
+
}
|
|
90
|
+
return held;
|
|
57
91
|
}
|
|
58
92
|
|
|
59
93
|
// `acts` is on the row, set where the ACTION is chosen: the heartbeat backs off
|
|
@@ -158,12 +192,29 @@ function reviewers(s) {
|
|
|
158
192
|
const rows = [];
|
|
159
193
|
if (fixes.length) rows.push(row(`DISPATCH fix-pr ${prs(fixes)}`, { acts: true }));
|
|
160
194
|
if (reviews.length) rows.push(row(`DISPATCH review ${prs(reviews)}`, { acts: true }));
|
|
195
|
+
// #2331: a finisher settled `labelled` on a PR the open list shows without
|
|
196
|
+
// `ready-to-merge`. One such attempt since the controller's last deliberate
|
|
197
|
+
// removal gets one fresh finisher; a second one escalates, never a third
|
|
198
|
+
// dispatch. Finishers take no reviewer slot, so neither waits on the cap.
|
|
199
|
+
const names = (us) => us.flatMap((u) => u.labelled).join(", ");
|
|
200
|
+
const repair = s.unlabelled.filter((u) => u.labelled.length === 1);
|
|
201
|
+
const stuck = s.unlabelled.filter((u) => u.labelled.length > 1);
|
|
202
|
+
const unlabelledRows = [];
|
|
203
|
+
if (repair.length) {
|
|
204
|
+
unlabelledRows.push(row(`DISPATCH finisher ${prs(repair.map((u) => u.pr))}`,
|
|
205
|
+
{ acts: true, extra: `${names(repair)} settled labelled; no ready-to-merge on the PR` }));
|
|
206
|
+
}
|
|
207
|
+
if (stuck.length) {
|
|
208
|
+
unlabelledRows.push(row(`ESCALATE unlabelled ${prs(stuck.map((u) => u.pr))}`,
|
|
209
|
+
{ extra: `${names(stuck)} settled labelled since the last label-off; still no ready-to-merge` }));
|
|
210
|
+
}
|
|
161
211
|
if (!rows.length) {
|
|
162
212
|
const owed = s.fixDue.length + s.reviewDue.length;
|
|
163
213
|
if (owed && free <= 0) rows.push(row("AT CAP"));
|
|
164
214
|
else if (s.reviewDue.length) rows.push(row(`HOLD (max-reviews ${s.maxReviews} in flight)`));
|
|
165
|
-
else rows.push(row("IDLE OK"));
|
|
215
|
+
else if (!unlabelledRows.length) rows.push(row("IDLE OK"));
|
|
166
216
|
}
|
|
217
|
+
rows.push(...unlabelledRows);
|
|
167
218
|
return { rows, left: { unreviewed: s.reviewDue.length - reviews.length, free } };
|
|
168
219
|
}
|
|
169
220
|
|
|
@@ -251,18 +302,140 @@ const HELD = /^held-behind[:-]#?(\d+)$/;
|
|
|
251
302
|
// gates a ticket's claim; this gates a reviewed PR's merge.
|
|
252
303
|
const CONFLICT_HOLD = /^conflict-hold[:-]#?(\d+)$/;
|
|
253
304
|
// #1398: tier-check.mjs's verdict on an implementer, `tier-ok=<member>:<def>`
|
|
254
|
-
// or `tier-mismatch=<member>:<def
|
|
255
|
-
|
|
305
|
+
// or `tier-mismatch=<member>:<def>` — or `tier-unverifiable=<member>:no-transcript`
|
|
306
|
+
// for a settled member whose transcript was never written.
|
|
307
|
+
const TIER_VERDICT = /^tier-(ok|mismatch|unverifiable)=([^:\s]+):\S+$/;
|
|
308
|
+
// dispositions-check.mjs's verdict on a review fix-applier's disposition
|
|
309
|
+
// record: `dispositions-ok=fix-pr-<M>[-x]:<head>`,
|
|
310
|
+
// `dispositions-mismatch=…` or `dispositions-escalate=…` (a critical or
|
|
311
|
+
// important deferral that a human rules on), `<head>` the head of the review
|
|
312
|
+
// the record answers. `ledger.mjs dispatch` refuses a finisher on any verdict
|
|
313
|
+
// but ok; the tick holds nothing on one, having no finisher role. A token
|
|
314
|
+
// outside this shape is no verdict at all, which the gate reads as
|
|
315
|
+
// unchecked: fail closed.
|
|
316
|
+
export function dispositionsToken(tok) {
|
|
317
|
+
const m = /^dispositions-(ok|mismatch|escalate)=([^:\s]+):([0-9a-f]{7,40})$/i.exec(tok);
|
|
318
|
+
if (!m) return null;
|
|
319
|
+
const member = parseMember(m[2]);
|
|
320
|
+
if (member === null || member.family !== "fix-pr") return null;
|
|
321
|
+
return { verdict: m[1].toLowerCase(), member, head: m[3].toLowerCase() };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Two spellings of one commit: either head a prefix of the other, the way a
|
|
325
|
+
// `reviewed=` head (7-40 hex) is matched against gh's full headRefOid.
|
|
326
|
+
export const sameHead = (a, b) => a.startsWith(b) || b.startsWith(a);
|
|
327
|
+
|
|
328
|
+
// A PR's current dispositions verdict against its latest review head: among
|
|
329
|
+
// the tokens answering that head, the one from the fix-applier with the
|
|
330
|
+
// highest retry suffix ("" < "b" < "c" …) — never row-text position, which a
|
|
331
|
+
// `row` rewrite can reorder. One fix-applier carrying two verdicts for one
|
|
332
|
+
// head reads as the stricter: ok < mismatch < escalate. null when no token
|
|
333
|
+
// answers the head.
|
|
334
|
+
/** @returns {{verdict: "ok"|"mismatch"|"escalate", member: string}|null} */
|
|
335
|
+
export function currentDispositions(tokens, head) {
|
|
336
|
+
const strictness = { ok: 0, mismatch: 1, escalate: 2 };
|
|
337
|
+
let best = null;
|
|
338
|
+
for (const t of tokens) {
|
|
339
|
+
if (!sameHead(t.head, head)) continue;
|
|
340
|
+
const retry = t.member.retry ?? "";
|
|
341
|
+
const bestRetry = best?.member.retry ?? "";
|
|
342
|
+
if (best === null || retry > bestRetry || (retry === bestRetry && strictness[t.verdict] > strictness[best.verdict])) best = t;
|
|
343
|
+
}
|
|
344
|
+
return best === null ? null : { verdict: best.verdict, member: best.member.name };
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// #2331: `label-off=<finisher-pr-M[-x]>` — written by the controller BEFORE it
|
|
348
|
+
// takes `ready-to-merge` off PR M on purpose (before approving a push; clearing
|
|
349
|
+
// a label left on a moved head), naming the latest finisher attempt. A missing
|
|
350
|
+
// label is a finisher's miss only when no such removal accounts for it.
|
|
351
|
+
// `undefined` for a token that is not a label-off at all, null for one naming
|
|
352
|
+
// no finisher-pr member — `ledger.mjs row` refuses that one at write time, and
|
|
353
|
+
// deriveRun refuses a hand-written one.
|
|
354
|
+
export function labelOffMember(tok) {
|
|
355
|
+
if (!tok.startsWith("label-off=")) return undefined;
|
|
356
|
+
const m = parseMember(tok.slice("label-off=".length));
|
|
357
|
+
return m !== null && m.family === "finisher-pr" ? m : null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// A row's key number and its PR, per the comment above PR_MENTION: the PR
|
|
361
|
+
// every PR-bound token on the row speaks for.
|
|
362
|
+
export function rowNums(text) {
|
|
363
|
+
const key = text.split(/\s/)[0];
|
|
364
|
+
const keyNum = /^#[0-9]+$/.test(key) ? Number(key.slice(1)) : null;
|
|
365
|
+
const mention = PR_MENTION.exec(text);
|
|
366
|
+
return { keyNum, pr: mention ? Number(mention[1]) : keyNum };
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// #2331: PRs whose finisher settled `labelled` while the open list shows no
|
|
370
|
+
// `ready-to-merge` on them — `unqueued` is the set of open PR numbers without
|
|
371
|
+
// it, so the label shape stays the caller's (gh's `{name}` here, plain names in
|
|
372
|
+
// compute-board.mjs). A PR's attempts are its `finisher-pr-M` tokens in
|
|
373
|
+
// `## Dispatched` and on PR M's own rows; a copy on another PR's row is a
|
|
374
|
+
// stray (#2329) that neither makes nor masks a miss. Settled anywhere among
|
|
375
|
+
// those is settled. The STRETCH is the attempts whose retry suffix sorts after
|
|
376
|
+
// the highest one a `label-off=` names — suffix order ("" < "b" < …), never
|
|
377
|
+
// row position (#2083). A miss is the stretch's latest attempt settled
|
|
378
|
+
// `labelled`; `labelled` lists every attempt in the stretch that settled so,
|
|
379
|
+
// the count the tick splits one repair from an escalation on.
|
|
380
|
+
//
|
|
381
|
+
// Lenient on purpose — a malformed token is skipped, never thrown — because
|
|
382
|
+
// the cockpit reads the same ledger and flags rather than refuses; deriveRun
|
|
383
|
+
// has already refused anything malformed before it calls this.
|
|
384
|
+
/** @returns {{pr: number, labelled: string[]}[]} ascending by PR */
|
|
385
|
+
export function unlabelledFinishers({ rows, dispatched }, unqueued) {
|
|
386
|
+
const attempts = new Map();
|
|
387
|
+
const offs = new Map();
|
|
388
|
+
const add = (t) => {
|
|
389
|
+
if (!t || t.error || t.family !== "finisher-pr") return;
|
|
390
|
+
if (!attempts.has(t.number)) attempts.set(t.number, new Map());
|
|
391
|
+
const byName = attempts.get(t.number);
|
|
392
|
+
const a = byName.get(t.name) ?? { name: t.name, retry: t.retry ?? "", outcome: null };
|
|
393
|
+
if (t.outcome !== null) a.outcome = t.outcome;
|
|
394
|
+
byName.set(t.name, a);
|
|
395
|
+
};
|
|
396
|
+
for (const e of dispatched) add(parseToken(e));
|
|
397
|
+
for (const text of rows) {
|
|
398
|
+
const { pr } = rowNums(text);
|
|
399
|
+
for (const tok of text.split(/\s+/).filter(Boolean)) {
|
|
400
|
+
const off = labelOffMember(tok);
|
|
401
|
+
if (off) {
|
|
402
|
+
const r = off.retry ?? "";
|
|
403
|
+
if (!offs.has(off.number) || r > offs.get(off.number)) offs.set(off.number, r);
|
|
404
|
+
} else {
|
|
405
|
+
const t = parseToken(tok);
|
|
406
|
+
if (t && t.number === pr) add(t);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const out = [];
|
|
411
|
+
for (const [n, byName] of attempts) {
|
|
412
|
+
if (!unqueued.has(n)) continue;
|
|
413
|
+
const stretch = [...byName.values()]
|
|
414
|
+
.filter((a) => !offs.has(n) || a.retry > offs.get(n))
|
|
415
|
+
.sort((a, b) => (a.retry < b.retry ? -1 : a.retry > b.retry ? 1 : 0));
|
|
416
|
+
if (stretch.at(-1)?.outcome !== "labelled") continue;
|
|
417
|
+
out.push({ pr: n, labelled: stretch.filter((a) => a.outcome === "labelled").map((a) => a.name) });
|
|
418
|
+
}
|
|
419
|
+
return out.sort((a, b) => a.pr - b.pr);
|
|
420
|
+
}
|
|
256
421
|
|
|
257
422
|
export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
258
423
|
// One entry per member name across `## Dispatched` and every row. A member
|
|
259
424
|
// settled ANYWHERE is settled: `settle` is the only writer of an outcome, and
|
|
260
425
|
// a bare copy beside it is what a whole-line `row` rewrite leaves behind.
|
|
426
|
+
// The one narrowing (#2391): a PR-bound member (`fix-pr-M`, `finisher-pr-M`)
|
|
427
|
+
// speaks for PR #M alone, so its outcome counts off `## Dispatched` or off
|
|
428
|
+
// PR #M's own row, never off another PR's — `dispatch` and `settle` write it
|
|
429
|
+
// onto PR #M's row only, so a settled copy elsewhere is a hand-written stray
|
|
430
|
+
// that must not mark PR #M's own live member settled. `rowPr` is the row's
|
|
431
|
+
// PR (`undefined` for `## Dispatched`, which is no PR's row; `null` for a
|
|
432
|
+
// row naming no PR, which settles no PR-bound member); a stray's token
|
|
433
|
+
// still creates the member, live, as before.
|
|
261
434
|
const members = new Map();
|
|
262
|
-
const note = (t, where) => {
|
|
435
|
+
const note = (t, where, rowPr) => {
|
|
263
436
|
if (t.error) throw new LedgerError(`${where}: ${t.name}: ${t.error}`);
|
|
264
437
|
const m = members.get(t.name) ?? { name: t.name, family: t.family, number: t.number, outcome: null };
|
|
265
|
-
if (t.outcome !== null) m.outcome = t.outcome;
|
|
438
|
+
if (t.outcome !== null && (t.bound !== "pr" || rowPr === undefined || t.number === rowPr)) m.outcome = t.outcome;
|
|
266
439
|
members.set(t.name, m);
|
|
267
440
|
};
|
|
268
441
|
for (const e of dispatched) {
|
|
@@ -282,24 +455,59 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
282
455
|
// token nor as `review=`/`reviewed=`, so both always reach this loop's own
|
|
283
456
|
// `else` branch below, alongside HELD/CONFLICT_HOLD — one pass over every
|
|
284
457
|
// row's tokens covers all four.
|
|
285
|
-
|
|
458
|
+
// `tier-unverifiable=<member>:no-transcript` is the third: a settled member
|
|
459
|
+
// with nothing to check, which clears the unchecked hold and nothing else.
|
|
460
|
+
const verdicts = { ok: new Set(), mismatch: new Set(), unverifiable: new Set() };
|
|
461
|
+
// fix-pr members some row carries settled IN PLACE (`<member>=<outcome>`).
|
|
462
|
+
// `settle` rewrites a token where it stands, so that copy sits where the
|
|
463
|
+
// member was dispatched; a bare copy beside it is what a whole-line `row`
|
|
464
|
+
// rewrite put back, wherever that rewrite chose. Its landing is read off
|
|
465
|
+
// the in-place copy (below), and off a bare one only when no row carries
|
|
466
|
+
// one — settled in `## Dispatched` alone. Only a copy on its own PR's row
|
|
467
|
+
// counts, as in the fold (#2329): a settled stray on another PR's row must
|
|
468
|
+
// not keep the owner's bare copy from landing. A malformed token is skipped
|
|
469
|
+
// here and refused by the fold below, in row order, as before.
|
|
470
|
+
const settledInRow = new Set();
|
|
471
|
+
for (const text of rows) {
|
|
472
|
+
const { pr } = rowNums(text);
|
|
473
|
+
for (const tok of text.split(/\s+/)) {
|
|
474
|
+
const t = parseToken(tok);
|
|
475
|
+
if (t && !t.error && t.family === "fix-pr" && t.number === pr && t.outcome !== null) settledInRow.add(t.name);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
286
478
|
for (const text of rows) {
|
|
287
|
-
const
|
|
288
|
-
const keyNum = /^#[0-9]+$/.test(key) ? Number(key.slice(1)) : null;
|
|
479
|
+
const { keyNum, pr } = rowNums(text);
|
|
289
480
|
const where = `row '${text}'`;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
481
|
+
// One state per PR, shared by every row that resolves to it (#2283): a
|
|
482
|
+
// ticket row settled `impl-658=PR#724` sorts above PR 724's own `#724` row
|
|
483
|
+
// whenever both exist, and either may carry that PR's tokens — ledger.mjs's
|
|
484
|
+
// memberRowIndex() writes a PR-bound member onto the first row mentioning
|
|
485
|
+
// its PR and onto `#<pr>` only when none does — so the second row continues
|
|
486
|
+
// the first's state rather than losing to it.
|
|
487
|
+
// `conflictOpen`: the row carries a conflict hold no fix-applier has
|
|
488
|
+
// SETTLED (`applied:`/`no-op`) after — never merely dispatched: a live
|
|
489
|
+
// fix-applier is still working the conflict.
|
|
490
|
+
// `reviewFixed`: a REVIEW fix-applier landed after the latest
|
|
491
|
+
// `reviewed=` — one read while no hold stood unresolved. The one read
|
|
492
|
+
// while a hold did is the conflict fix-applier `ledger.mjs dispatch` named
|
|
493
|
+
// a `fleet-implementer-<cell>` (#2299): it rebases and never sees the review file,
|
|
494
|
+
// so it clears the hold and answers no survivor (#2328). Each fix-applier
|
|
495
|
+
// does one of those jobs once, so its landing folds once per PR
|
|
496
|
+
// (`fixLanded`), however many copies of its token the rows carry.
|
|
497
|
+
// `fixMembers`: every fix-applier on this PR, wherever its token sits —
|
|
498
|
+
// one still unsettled anywhere holds the PR off fixDue, since `dispatch`
|
|
499
|
+
// refuses a second live one on the PR.
|
|
296
500
|
// `reviewedHead`: the latest `reviewed=<head>`. `pastPinHalt`: the latest
|
|
297
501
|
// finisher since that review settled `halted:past-pin` (#2083) — any
|
|
298
502
|
// later finisher attempt, live or settled, replaces it, and a later
|
|
299
|
-
// returned review answers it.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
503
|
+
// returned review answers it. `unverified`: the latest `reviewed=`'s
|
|
504
|
+
// unverified count. `dispositions`: every dispositions verdict a fix-pr
|
|
505
|
+
// member of this PR carries, whatever head it answers — the gate picks
|
|
506
|
+
// by head and retry suffix, never by where a token sits.
|
|
507
|
+
const st = (pr !== null && byPr.get(pr)) || {
|
|
508
|
+
inFlight: false, reviewedAny: false, survived: 0, unverified: 0, reviewFixed: false,
|
|
509
|
+
fixMembers: new Set(), fixLanded: new Set(), held: [],
|
|
510
|
+
conflictOpen: false, reviewedHead: null, pastPinHalt: false, dispositions: [],
|
|
303
511
|
};
|
|
304
512
|
// The finisher-pr token currently deciding `pastPinHalt`, picked by
|
|
305
513
|
// retry suffix ("" < "b" < "c" …) the same way compute-board.mjs's
|
|
@@ -312,27 +520,47 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
312
520
|
for (const tok of text.split(/\s+/).filter(Boolean)) {
|
|
313
521
|
const t = parseToken(tok);
|
|
314
522
|
if (t) {
|
|
315
|
-
note(t, where);
|
|
316
|
-
// A settled `failed`/`killed` fix-applier leaves survivors
|
|
317
|
-
// no successor dispatched — the PR stays fix-due
|
|
318
|
-
// replacement. Only a live attempt, or one that actually
|
|
319
|
-
// (`applied:`/`no-op`),
|
|
320
|
-
// member record (`members`,
|
|
321
|
-
// copy of the token:
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
// the
|
|
331
|
-
|
|
523
|
+
note(t, where, pr);
|
|
524
|
+
// A settled `failed`/`killed` fix-applier leaves survivors or a
|
|
525
|
+
// conflict unfixed and no successor dispatched — the PR stays fix-due
|
|
526
|
+
// for a `-b` replacement. Only a live attempt, or one that actually
|
|
527
|
+
// landed (`applied:`/`no-op`), holds it off. Read the outcome off the
|
|
528
|
+
// member's merged record (`members`, narrowed above) rather than this
|
|
529
|
+
// row's own copy of the token: "a member settled ANYWHERE is settled",
|
|
530
|
+
// the rule `members` implements for `implLive`/`fixLive`/etc. below,
|
|
531
|
+
// narrowed to the places it speaks for — a later, unrelated `row`
|
|
532
|
+
// rewrite that drops the `=outcome` suffix and puts back a bare copy
|
|
533
|
+
// must not un-settle what actually landed. Which job a landed one did
|
|
534
|
+
// is read off where its token sits:
|
|
535
|
+
// after an unresolved hold it was the conflict fix-applier and clears
|
|
536
|
+
// that hold; otherwise it answered the latest review's survivors. A
|
|
537
|
+
// hold reopens `conflictOpen` below and a `reviewed=` resets
|
|
538
|
+
// `reviewFixed`, so only a fix-applier after the latest of each ever
|
|
539
|
+
// counts. Only ONE copy says where: the first in-place settled one,
|
|
540
|
+
// or — none on any row — the first that reads landed. Any other copy
|
|
541
|
+
// folding again would land the one member twice: a stale bare copy
|
|
542
|
+
// after the hold its member's in-place copy preceded clearing that
|
|
543
|
+
// hold, or a second copy after the first cleared the hold answering
|
|
544
|
+
// survivors the conflict fix-applier never read. Liveness is not read
|
|
545
|
+
// here at all: a bare copy read before a later row settles its member
|
|
546
|
+
// reads unsettled at that point, so `fixMembers` is judged once every
|
|
547
|
+
// row has been read. A copy reaching this branch has just been
|
|
548
|
+
// recorded into `members` by the `note` above, so its outcome is this
|
|
549
|
+
// token's own unless `## Dispatched` or an earlier row already settled
|
|
550
|
+
// it — never a reason to fall back to the row's own copy. A
|
|
551
|
+
// `fix-pr-<M>` speaks for PR #M alone, as a `finisher-pr` does below
|
|
552
|
+
// (#2329): `dispatch` and `settle` write it onto PR #M's row only, so a
|
|
553
|
+
// copy on another PR's row is a hand-written stray this PR reads as
|
|
554
|
+
// absent, and which lends PR #M's own copies no outcome.
|
|
555
|
+
if (t.family === "fix-pr" && t.number === pr) {
|
|
556
|
+
st.fixMembers.add(t.name);
|
|
332
557
|
const o = members.get(t.name).outcome;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
558
|
+
if ((o === "no-op" || /^applied:/.test(o)) && !st.fixLanded.has(t.name)
|
|
559
|
+
&& (t.outcome !== null || !settledInRow.has(t.name))) {
|
|
560
|
+
st.fixLanded.add(t.name);
|
|
561
|
+
if (st.conflictOpen) st.conflictOpen = false;
|
|
562
|
+
else st.reviewFixed = true;
|
|
563
|
+
}
|
|
336
564
|
}
|
|
337
565
|
if (t.family === "finisher-pr" && t.number === pr
|
|
338
566
|
&& (!latestFinisher || (t.retry ?? "") > (latestFinisher.retry ?? ""))) {
|
|
@@ -351,9 +579,11 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
351
579
|
if (!m) throw new LedgerError(`${where}: '${tok}' is not reviewed=<head>:<survived>/<refuted>/<unverified>`);
|
|
352
580
|
latestFinisher = null;
|
|
353
581
|
Object.assign(st, {
|
|
354
|
-
inFlight: false, reviewedAny: true, survived: Number(m[2]),
|
|
582
|
+
inFlight: false, reviewedAny: true, survived: Number(m[2]), unverified: Number(m[4]), reviewFixed: false,
|
|
355
583
|
reviewedHead: m[1].toLowerCase(), pastPinHalt: false,
|
|
356
584
|
});
|
|
585
|
+
} else if (labelOffMember(tok) === null) {
|
|
586
|
+
throw new LedgerError(`${where}: '${tok}' is not label-off=<finisher-pr member> — fix the row with \`ledger.mjs row\``);
|
|
357
587
|
} else {
|
|
358
588
|
const h = HELD.exec(tok);
|
|
359
589
|
if (h) st.held.push(Number(h[1]));
|
|
@@ -365,20 +595,17 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
365
595
|
if (Number(c[1]) !== pr) {
|
|
366
596
|
throw new LedgerError(`${where}: '${tok}' names PR #${c[1]}, but this row is ${pr === null ? "no PR's" : `PR #${pr}'s`} — a conflict hold goes on the held PR's own row`);
|
|
367
597
|
}
|
|
368
|
-
// A fresh hold is unresolved whatever settled before it, the way
|
|
369
|
-
//
|
|
370
|
-
//
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
const alreadyUnresolved = st.conflictHold && !st.conflictCleared;
|
|
375
|
-
Object.assign(st, {
|
|
376
|
-
conflictHold: true, conflictCleared: false,
|
|
377
|
-
...(alreadyUnresolved ? null : { fixSince: false }),
|
|
378
|
-
});
|
|
598
|
+
// A fresh hold is unresolved whatever settled before it, the way a
|
|
599
|
+
// fresh `reviewed=` resets `reviewFixed` above. A redundant re-hold
|
|
600
|
+
// (merge-bot retrying a PR it has already held, #2064) changes
|
|
601
|
+
// nothing a live fix-applier holds off: liveness is not read off
|
|
602
|
+
// token order.
|
|
603
|
+
st.conflictOpen = true;
|
|
379
604
|
}
|
|
380
605
|
const v = TIER_VERDICT.exec(tok);
|
|
381
606
|
if (v) verdicts[v[1]].add(v[2]);
|
|
607
|
+
const d = dispositionsToken(tok);
|
|
608
|
+
if (d && d.member.number === pr) st.dispositions.push(d);
|
|
382
609
|
}
|
|
383
610
|
}
|
|
384
611
|
const ex = EXCLUDED_ROW.exec(text);
|
|
@@ -396,7 +623,7 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
396
623
|
if (!prLifted) claimed.add(keyNum);
|
|
397
624
|
excluded.push({ n: keyNum, premises });
|
|
398
625
|
}
|
|
399
|
-
if (pr !== null
|
|
626
|
+
if (pr !== null) byPr.set(pr, st);
|
|
400
627
|
}
|
|
401
628
|
|
|
402
629
|
const all = [...members.values()];
|
|
@@ -408,18 +635,21 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
408
635
|
// replacement's own check passes, the row holds — a replacement that is
|
|
409
636
|
// ALSO mismatched keeps holding, and one not yet checked holds as
|
|
410
637
|
// unchecked. A member with no verdict at all holds whether it is live or
|
|
411
|
-
// settled
|
|
412
|
-
//
|
|
638
|
+
// settled — the tick never reads a transcript, so only tier-check.mjs can
|
|
639
|
+
// say whether one exists; a settled member whose transcript was never
|
|
640
|
+
// written gets `tier-unverifiable=` from it, which clears the hold here.
|
|
413
641
|
const newest = impls.filter((m, i) => !impls.some((o, j) => j > i && o.number === m.number));
|
|
414
642
|
const mismatched = (m) => m.outcome === "tier-mismatch" || verdicts.mismatch.has(m.name);
|
|
415
643
|
const tierMismatch = newest.filter(mismatched).map((m) => m.name);
|
|
416
|
-
const
|
|
644
|
+
const cleared = (m) => verdicts.ok.has(m.name) || verdicts.unverifiable.has(m.name);
|
|
645
|
+
const tierUnchecked = newest.filter((m) => !mismatched(m) && !cleared(m)).map((m) => m.name);
|
|
417
646
|
const isQueued = (p) => p.labels.some((l) => l && l.name === "ready-to-merge");
|
|
418
647
|
const queued = prs.filter(isQueued);
|
|
419
648
|
const asc = (a, b) => a - b;
|
|
420
649
|
const state = (n) => byPr.get(n);
|
|
421
650
|
const heldBehind = (st) => (st?.held ?? []).some((n) => open.has(n));
|
|
422
|
-
const conflictHeld = (st) => st !== undefined && st.
|
|
651
|
+
const conflictHeld = (st) => st !== undefined && st.conflictOpen;
|
|
652
|
+
const fixRunning = (st) => [...st.fixMembers].some((n) => members.get(n).outcome === null);
|
|
423
653
|
// The halt holds only while the head is still past what was reviewed: a
|
|
424
654
|
// `reviewed=` head (7-40 hex) prefix-matching gh's full headRefOid is the
|
|
425
655
|
// head that review read, and there is nothing more to review.
|
|
@@ -430,14 +660,15 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
430
660
|
fixLive: live("fix-pr"),
|
|
431
661
|
mergeBotLive: live("merge-bot"),
|
|
432
662
|
reviewsLive: [...byPr.values()].filter((st) => st.inFlight).length,
|
|
433
|
-
// A returned review
|
|
434
|
-
//
|
|
435
|
-
// newer review running. The
|
|
436
|
-
//
|
|
437
|
-
//
|
|
663
|
+
// A returned review whose survivors no review fix-applier has answered,
|
|
664
|
+
// or a conflict hold no fix-applier has cleared — on a PR still open,
|
|
665
|
+
// with no fix-applier working it and no newer review running. The two
|
|
666
|
+
// are answered apart (#2328): a landed conflict fix-applier lifts the
|
|
667
|
+
// hold and leaves survivors it never read due for a review one.
|
|
438
668
|
fixDue: [...byPr.entries()]
|
|
439
|
-
.filter(([n, st]) => open.has(n)
|
|
440
|
-
&&
|
|
669
|
+
.filter(([n, st]) => open.has(n)
|
|
670
|
+
&& ((st.survived > 0 && !st.reviewFixed) || conflictHeld(st))
|
|
671
|
+
&& !fixRunning(st) && !st.inFlight)
|
|
441
672
|
.map(([n]) => n).sort(asc),
|
|
442
673
|
// Open, not signed off, closing an issue (GitHub's own linked set — a
|
|
443
674
|
// chore PR closing nothing is review work nobody in the run will ever be
|
|
@@ -455,10 +686,33 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
455
686
|
// A `held-behind` hold lifts once its premise PR has left the open list —
|
|
456
687
|
// MERGED or CLOSED, the same lift rule as a `behind-pr` Exclusion. A
|
|
457
688
|
// conflict hold lifts only once a fix-applier after it has SETTLED
|
|
458
|
-
// `applied:`/`no-op` —
|
|
689
|
+
// `applied:`/`no-op` — never on dispatch alone.
|
|
459
690
|
mergeHeld: queued.filter((p) => heldBehind(state(p.number)) || conflictHeld(state(p.number))).length,
|
|
460
691
|
// How many of those are conflict holds — the HOLD row's wording, no field.
|
|
461
692
|
mergeConflictHeld: queued.filter((p) => conflictHeld(state(p.number))).length,
|
|
693
|
+
// #2331: finishers settled `labelled` on an open PR without the label.
|
|
694
|
+
unlabelled: unlabelledFinishers({ rows, dispatched },
|
|
695
|
+
new Set(prs.filter((p) => !isQueued(p)).map((p) => p.number))),
|
|
696
|
+
// Every PR, open or not, on a conflict hold no fix-applier has cleared —
|
|
697
|
+
// the one reading of a hold (#2299): `ledger.mjs dispatch` names a
|
|
698
|
+
// fix-applier's definition off this list, so it answers the same per-PR
|
|
699
|
+
// fold this tick holds the merge on, split rows (#2283) and a settle made
|
|
700
|
+
// anywhere included, rather than re-deriving it from one row's text.
|
|
701
|
+
conflictHeld: [...byPr.entries()].filter(([, st]) => conflictHeld(st)).map(([n]) => n).sort(asc),
|
|
702
|
+
// Every PR, open or not, with a returned review: its latest `reviewed=`
|
|
703
|
+
// head and counts, the dispositions verdict currently answering that
|
|
704
|
+
// head, and every fix-applier on the PR still unsettled (`fixLive`) — a
|
|
705
|
+
// re-review at the same head would otherwise read the earlier
|
|
706
|
+
// fix-applier's verdict while the one answering it is still working.
|
|
707
|
+
// `ledger.mjs dispatch` gates a finisher off this, read from the same
|
|
708
|
+
// per-PR fold as everything above. Nothing in this tick acts on it.
|
|
709
|
+
reviewed: [...byPr.entries()].filter(([, st]) => st.reviewedHead !== null)
|
|
710
|
+
.map(([n, st]) => ({
|
|
711
|
+
pr: n, head: st.reviewedHead, survived: st.survived, unverified: st.unverified,
|
|
712
|
+
dispositions: currentDispositions(st.dispositions, st.reviewedHead),
|
|
713
|
+
fixLive: [...st.fixMembers].filter((name) => members.get(name).outcome === null).sort(),
|
|
714
|
+
}))
|
|
715
|
+
.sort((a, b) => a.pr - b.pr),
|
|
462
716
|
draining: drain ?? null,
|
|
463
717
|
tierMismatch,
|
|
464
718
|
// Every impl member the ledger names, settled or live: the retry letters
|
|
@@ -467,6 +721,13 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
467
721
|
tierUnchecked,
|
|
468
722
|
claimed,
|
|
469
723
|
excluded,
|
|
724
|
+
// Who is live, by name, for a MAIN-CHECKOUT line (#2210): every unsettled
|
|
725
|
+
// member token, then each in-flight review by its PR — a `review=wf:`
|
|
726
|
+
// run carries no member token of its own.
|
|
727
|
+
live: [
|
|
728
|
+
...all.filter((m) => m.outcome === null).map((m) => m.name),
|
|
729
|
+
...[...byPr.entries()].filter(([, st]) => st.inFlight).map(([n]) => `review:PR#${n}`),
|
|
730
|
+
],
|
|
470
731
|
};
|
|
471
732
|
}
|
|
472
733
|
|
|
@@ -517,11 +778,13 @@ import { execFileSync, spawnSync } from "node:child_process";
|
|
|
517
778
|
import { createHash } from "node:crypto";
|
|
518
779
|
import { readFileSync } from "node:fs";
|
|
519
780
|
import { dirname, join } from "node:path";
|
|
520
|
-
import { fileURLToPath
|
|
781
|
+
import { fileURLToPath } from "node:url";
|
|
782
|
+
import { isCLI } from "./is-cli.mjs";
|
|
521
783
|
import { parseArgs } from "node:util";
|
|
522
784
|
import { makeDie, isDigits } from "./arg.mjs";
|
|
523
785
|
import { gitEnv, workspaceDirFromGitCommonDir } from "./git-env.mjs";
|
|
524
786
|
import { statePath, readState, writeState, assessBeat, isStalled, stallReport } from "./fleet-state.mjs";
|
|
787
|
+
import { checkMainCheckout, describe } from "./main-checkout.mjs";
|
|
525
788
|
|
|
526
789
|
const NAME = "fleet-tick";
|
|
527
790
|
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -804,10 +1067,17 @@ function main() {
|
|
|
804
1067
|
}
|
|
805
1068
|
}
|
|
806
1069
|
|
|
1070
|
+
// #2210: the main checkout against the run's baseline, on every tick — the
|
|
1071
|
+
// backstop for what #1411's guard cannot see. Never a refusal of the tick:
|
|
1072
|
+
// every answer but `clean` is a hold on the dispatching rows plus one line
|
|
1073
|
+
// saying why, so the rest of the run keeps reporting.
|
|
1074
|
+
const mainCheckout = checkMainCheckout();
|
|
1075
|
+
|
|
807
1076
|
const rows = reconcile({
|
|
808
|
-
...caps, ...run, heads, supply, shortlistStatus: current.status, refresh: fresh,
|
|
1077
|
+
...caps, ...run, heads, supply, shortlistStatus: current.status, refresh: fresh, mainCheckout,
|
|
809
1078
|
});
|
|
810
|
-
const
|
|
1079
|
+
const said = describe(mainCheckout, run.live);
|
|
1080
|
+
const lines = [...(said === null ? [] : [said]), ...formatLines(rows)];
|
|
811
1081
|
|
|
812
1082
|
// The back-off streak and the fold digest, written on EVERY tick: an edge
|
|
813
1083
|
// tick that dispatched is the clearest possible "there is work here". Digest,
|
|
@@ -821,12 +1091,18 @@ function main() {
|
|
|
821
1091
|
// every invocation unconditionally — this tick running IS the occurrence.
|
|
822
1092
|
writeState(path, NAME, prev, { quiet: acts ? 0 : prev.quiet + 1, digest, ticked: { at: Date.now() } });
|
|
823
1093
|
|
|
824
|
-
// Fold only when BOTH hold: nothing to act on, and nothing new to say.
|
|
1094
|
+
// Fold only when BOTH hold: nothing to act on, and nothing new to say. A
|
|
1095
|
+
// main-checkout hold still holding dispatch stays named on the folded line
|
|
1096
|
+
// (#2307) — not actionable, so it never resets `quiet`, but the one reason
|
|
1097
|
+
// nothing dispatches must not drop out of view. Outside the digest, which
|
|
1098
|
+
// already covers it through the rows.
|
|
825
1099
|
if (fold && !acts && digest === prev.digest) {
|
|
826
|
-
|
|
1100
|
+
const why = mainCheckoutHoldReason(mainCheckout);
|
|
1101
|
+
const held = why === null ? "" : `; HOLD (${why}) persists`;
|
|
1102
|
+
console.log(`fleet-tick: unchanged, nothing to act on (quiet=${prev.quiet + 1})${held} — full rows on the next change`);
|
|
827
1103
|
return;
|
|
828
1104
|
}
|
|
829
1105
|
for (const line of lines) console.log(line);
|
|
830
1106
|
}
|
|
831
1107
|
|
|
832
|
-
if (import.meta.url
|
|
1108
|
+
if (isCLI(import.meta.url)) main();
|