@feigi/fleet-ctl 3.66.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.66.1",
3
+ "version": "3.66.2",
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": {
@@ -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 prints one `SETTLE <member>` line naming
94
- // the `ledger.mjs settle <member> --from-report` it is for, and
95
- // one whose `member` is not its filename's prints REPORT-MISMATCH
96
- // instead; one that is there but cannot be read prints
97
- // REPORT-UNREADABLE. Advice, like CHECK-LIVENESS: the tick
98
- // settles nothing. A review runner has no report schema and files
99
- // none, so no `review=` token is looked up.
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}`. `reports` maps a name to what main() read off
1139
- // its file — `{path, since, member}`, `since` the file's mtime in ms and
1140
- // `member` the file's own `member` field, undefined when it has none or is
1141
- // not JSON, or `{path, unreadable}`, `unreadable` the error code of a file
1142
- // that is there and cannot be read — and has no entry for a name with no file.
1143
- // A file that names a member other than the one it is filed under prints
1144
- // REPORT-MISMATCH instead, once, and an unreadable one REPORT-UNREADABLE; for
1145
- // both `settle` is false. `reportsFrom`, when set, is the directory the
1146
- // printed settle reads its file from: ledger.mjs reads the default scratch
1147
- // root's `reports/` unless told otherwise. `key` is the line without its age,
1148
- // what the digest `--fold-unchanged` compares takes, so a report waiting on
1149
- // disk folds rather than moving the digest every minute.
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}`,
@@ -1287,7 +1300,7 @@ import { statePath, readState, writeState, assessBeat, isStalled, isReported, st
1287
1300
  import { checkMainCheckout, describe } from "./main-checkout.mjs";
1288
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));
@@ -1787,10 +1800,12 @@ function reportsScratch(receipt, flag) {
1787
1800
  }
1788
1801
 
1789
1802
  // The report file of each name in `reporters`, as reportLines() takes them:
1790
- // `{path, since, member}` per file on disk, `{path, unreadable}` for one that
1791
- // cannot be read, nothing for a name with none. Only `member` is read out of a
1792
- // file, and a file that is not JSON carries none.
1793
- function readReports(scratch, reporters) {
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) {
1794
1809
  const out = new Map();
1795
1810
  for (const member of reporters) {
1796
1811
  const path = reportPath(scratch, member);
@@ -1810,7 +1825,12 @@ function readReports(scratch, reporters) {
1810
1825
  } catch {
1811
1826
  named = undefined;
1812
1827
  }
1813
- out.set(member, { path, since, member: named });
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);
1814
1834
  }
1815
1835
  return out;
1816
1836
  }
@@ -2027,8 +2047,9 @@ function main() {
2027
2047
  // past its threshold. The digest already moves when its bucket does.
2028
2048
  const aged = stale.map((s) => `; CHECK-LIVENESS ${s.member} persists`).join("");
2029
2049
  // A report waiting on disk persists the same way, for as long as its
2030
- // member stays live.
2031
- const settle = reported.filter((r) => r.settle).map((r) => `; SETTLE ${r.member} persists`).join("");
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("");
2032
2053
  // A transcript the ledger lacks, or a live token lacking one, the same
2033
2054
  // way, for as long as it holds.
2034
2055
  const unmatched = transcribed.map((t) => `; ${t.kind} ${t.name} persists`).join("");
@@ -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, so a missing message is read off that line before
59
- anyone is pinged.
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