@feigi/fleet-ctl 3.144.3 → 3.144.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.144.3",
3
+ "version": "3.144.4",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -845,6 +845,20 @@ export function foldLedger({ rows, dispatched }, open, { lenient = false } = {})
845
845
  // retry suffix sorts after every landed one's. `killed` and live members
846
846
  // are not in it, and a `reviewed=` empties it, as it resets `reviewFixed`.
847
847
  // `reviewedHead`/`reviewedRun`: the latest `reviewed=<head>:…:<run>`.
848
+ // `fleetHead`: the head the PR's branch stands at as the ledger knows it,
849
+ // lowercase. A `reviewed=` sets it to that review's head; after it, the
850
+ // fix-applier that landed `applied:<head>` (`fixLanded` decides which
851
+ // landed after it, by row position, once per member however many copies
852
+ // of its token the rows carry) with the greatest retry suffix
853
+ // ("" < "b" < "c" …) sets it to that head — never the one whose token sits
854
+ // last in the row text: `dispatch` refuses a second live fix-applier on a
855
+ // PR, so a later suffix landed later, and a row rewrite can put a `-b`
856
+ // retry's token before the older one's. `fleetRetry` is the retry suffix
857
+ // of the fix-applier that set it, null while a `reviewed=` did. A `no-op`
858
+ // landing pushed nothing, and a member settled `failed` or `killed`, or
859
+ // still live, never lands: none of them moves it.
860
+ // `ledger.mjs settle --from-report` checks a fix-applier's `no-op`
861
+ // against it.
848
862
  // `pastPinHalt`: the latest
849
863
  // finisher since that review settled `halted:past-pin` — any
850
864
  // later finisher attempt, live or settled, replaces it, and a later
@@ -858,7 +872,7 @@ export function foldLedger({ rows, dispatched }, open, { lenient = false } = {})
858
872
  const st = (pr !== null && byPr.get(pr)) || {
859
873
  inFlight: false, reviewedAny: false, survived: 0, unverified: 0, reviewFixed: false,
860
874
  fixMembers: new Set(), fixLanded: new Set(), conflictLanded: new Set(), fixFailed: new Set(),
861
- conflictOpen: false, reviewedHead: null, reviewedRun: null, pastPinHalt: false, dispositions: [], workers: new Set(),
875
+ conflictOpen: false, reviewedHead: null, reviewedRun: null, fleetHead: null, fleetRetry: null, pastPinHalt: false, dispositions: [], workers: new Set(),
862
876
  finishers: new Set(), parked: [],
863
877
  };
864
878
  // The finisher-pr token currently deciding `pastPinHalt`, picked by
@@ -915,6 +929,10 @@ export function foldLedger({ rows, dispatched }, open, { lenient = false } = {})
915
929
  const placed = t.outcome !== null || !settledInRow.has(t.name);
916
930
  if ((o === "no-op" || /^applied:/.test(o)) && !st.fixLanded.has(t.name) && placed) {
917
931
  st.fixLanded.add(t.name);
932
+ if (o !== "no-op" && (st.fleetRetry === null || (t.retry ?? "") > st.fleetRetry)) {
933
+ st.fleetHead = o.slice("applied:".length).toLowerCase();
934
+ st.fleetRetry = t.retry ?? "";
935
+ }
918
936
  if (st.conflictOpen) {
919
937
  st.conflictOpen = false;
920
938
  st.conflictLanded.add(t.name);
@@ -955,9 +973,10 @@ export function foldLedger({ rows, dispatched }, open, { lenient = false } = {})
955
973
  }
956
974
  if (!m) throw new LedgerError(`${where}: '${tok}' is not reviewed=<head>:<survived>/<refuted>/<unverified>:<run>`);
957
975
  latestFinisher = null;
976
+ const head = m[1].toLowerCase();
958
977
  Object.assign(st, {
959
978
  inFlight: false, reviewedAny: true, survived: Number(m[2]), unverified: Number(m[4]), reviewFixed: false,
960
- reviewedHead: m[1].toLowerCase(), reviewedRun: m[5], pastPinHalt: false, fixFailed: new Set(),
979
+ reviewedHead: head, reviewedRun: m[5], fleetHead: head, fleetRetry: null, pastPinHalt: false, fixFailed: new Set(),
961
980
  });
962
981
  } else if (labelOffMember(tok) === null) {
963
982
  if (!lenient) throw new LedgerError(`${where}: '${tok}' is not label-off=<finisher-pr member> — fix the row with \`ledger.mjs row\``);
@@ -1263,16 +1282,19 @@ export function deriveRun({ rows, dispatched, drain, retired = [] }, prs, queued
1263
1282
  conflicts: conflicting.filter((p) => !treadmill(p)).map((p) => p.number).sort(asc),
1264
1283
  conflictEscalate: conflicting.filter(treadmill).map((p) => p.number).sort(asc),
1265
1284
  // Every PR, open or not, with a returned review: its latest `reviewed=`
1266
- // head, run and counts, the dispositions verdict currently answering that
1267
- // run, and every fix-applier on the PR still unsettled (`fixLive`) — a
1268
- // re-review would otherwise read the earlier
1285
+ // head and the head its branch stands at as the ledger knows it
1286
+ // (`fleetHead`), run and counts, the dispositions verdict currently
1287
+ // answering that run, and every fix-applier on the PR still unsettled
1288
+ // (`fixLive`) — a re-review would otherwise read the earlier
1269
1289
  // fix-applier's verdict while the one answering it is still working.
1270
1290
  // `ledger.mjs dispatch` gates a finisher off this, read from the same
1271
- // per-PR fold as everything above, and dispositions-check.mjs reads the
1272
- // review file it judges against off `run`. Nothing in this tick acts on it.
1291
+ // per-PR fold as everything above, `ledger.mjs settle --from-report`
1292
+ // checks a fix-applier's `no-op` against `fleetHead`, and
1293
+ // dispositions-check.mjs reads the review file it judges against off
1294
+ // `run`. Nothing in this tick acts on it.
1273
1295
  reviewed: [...byPr.entries()].filter(([, st]) => st.reviewedHead !== null)
1274
1296
  .map(([n, st]) => ({
1275
- pr: n, head: st.reviewedHead, run: st.reviewedRun, survived: st.survived, unverified: st.unverified,
1297
+ pr: n, head: st.reviewedHead, fleetHead: st.fleetHead, run: st.reviewedRun, survived: st.survived, unverified: st.unverified,
1276
1298
  dispositions: currentDispositions(st.dispositions, st.reviewedRun),
1277
1299
  fixLive: [...st.fixMembers].filter((name) => members.get(name).outcome === null).sort(),
1278
1300
  }))
@@ -2711,8 +2711,12 @@ function recordFiled(id, subject) {
2711
2711
  // fix-pr-M=applied:<head> origin's refs/heads/<branch> is <head>, fetched
2712
2712
  // by verify-sha.sh; the Check-step record (below)
2713
2713
  // holds for <head>
2714
- // fix-pr-M=no-op origin's refs/heads/<branch> is the head PR M's
2715
- // latest reviewed= names, as the tick folds it
2714
+ // fix-pr-M=no-op origin's refs/heads/<branch> is PR M's fleet
2715
+ // head, as the tick folds it: the head of the
2716
+ // applied:<head> the fix-applier with the
2717
+ // greatest retry suffix landed since PR M's
2718
+ // latest reviewed=, else the head that reviewed=
2719
+ // names
2716
2720
  // finisher-pr-M=labelled PR M's labels carry ready-to-merge, and so does
2717
2721
  // the report's labelsReadBack
2718
2722
  // finisher-pr-M=halted:<c> cause is in the halted:<cause> vocabulary and
@@ -2912,13 +2916,21 @@ async function runSettleFromReport() {
2912
2916
  if (!(e instanceof LedgerError)) throw e;
2913
2917
  die(`${where}: ${e.message} — fleet-tick.mjs refuses this ledger, so PR #${live.number}'s latest reviewed= cannot be read off it; nothing written`);
2914
2918
  }
2915
- const reviewed = fold.reviewed.find((r) => r.pr === live.number)?.head ?? null;
2916
- if (reviewed === null) {
2919
+ // An earlier fix-applier's push moved the branch past the head the latest
2920
+ // review names, so the head required is the fold's `fleetHead`, which
2921
+ // is that review's head until an `applied:` lands after it. The fold
2922
+ // writes it lowercase, so only origin's head needs lowercasing.
2923
+ const review = fold.reviewed.find((r) => r.pr === live.number);
2924
+ if (review === undefined) {
2917
2925
  check(`PR #${live.number}'s row names a reviewed= head`, false);
2918
2926
  } else {
2919
2927
  const head = remoteHead(report.branch);
2920
- check(`origin refs/heads/${report.branch} is ${reviewed}, the head PR #${live.number}'s latest reviewed= names`,
2921
- head !== null && head.toLowerCase().startsWith(reviewed.toLowerCase()));
2928
+ const required = review.fleetHead;
2929
+ const why = required === review.head
2930
+ ? `the head PR #${live.number}'s latest reviewed= names`
2931
+ : `the head PR #${live.number}'s latest applied: names, landed since its latest reviewed= ${review.head}`;
2932
+ check(`origin refs/heads/${report.branch} is ${required}, ${why}`,
2933
+ head !== null && head.toLowerCase().startsWith(required));
2922
2934
  }
2923
2935
  } else {
2924
2936
  outcome = "failed";