@feigi/fleet-ctl 3.153.1 → 3.153.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.
|
@@ -90,7 +90,7 @@ It cannot ask the user anything and cannot wait on CI — rebasing, watching che
|
|
|
90
90
|
- **Say read-only.** No `fleet-review-*` definition's frontmatter restricts tool access — a `.agent.md` prompt saying "report only" is instruction, not enforcement — so an agent hand-dispatched here, named or general-purpose, has write tools it must not use: one committed and pushed during a report-only dispatch. No commits, no pushes, no worktree edits.
|
|
91
91
|
- **Cut TWO trees, not one — a shared snapshot is not enough.** Mutation probing is a *write*, so a mutating specialist and read-only specialists cannot share a copy: the readers then observe the mutant exactly as if it were real code. Give them `snap-ro`, pristine and **never written**, and one private copy **per mutating specialist**. Keep every one out of the worktree. What one shared snapshot did is in run-team's `references/reviewers.md` (**What a shared snapshot did to its readers**). Reverting a probe does not help — it leaves a window where every concurrent reader sees a lie, and serializing does not close it because readers are concurrent with the *mutator*.
|
|
92
92
|
- **Do not trust the obvious contamination check.** `diff -rq` and `md5` against the mutating tree both returned *clean* — because the probe had been reverted between the two reads. A clean diff against a live tree is not evidence in either direction; only `snap-ro` and the object store settle it.
|
|
93
|
-
- **`git archive` carries tracked files only.** No installed dependencies, no gitignored runner or config. Provision in the same step — run the Install step in the copy (read it off the worktree or main checkout, `derive-testcmd.sh <worktree or main checkout> install`; pointed at the copy it refuses, since a copy holds no Recipe cache), from the copy's root, before anyone measures in it — or specialists silently have no runnable suite and reason from source instead of measuring. That failure is invisible: you get confident prose where you asked for a measurement. Never `cp -R` an installed tree, and never symlink or clone its ignored paths into a copy: an install can record absolute paths back into the tree it ran in, so the copy runs that tree's source and a mutation made in the copy never runs.
|
|
93
|
+
- **`git archive` carries tracked files only.** No installed dependencies, no gitignored runner or config. Provision in the same step — run the Install step in the copy (read it off the worktree or main checkout, `derive-testcmd.sh <worktree or main checkout> install --at origin/main`; pointed at the copy it refuses, since a copy holds no Recipe cache), from the copy's root, before anyone measures in it — or specialists silently have no runnable suite and reason from source instead of measuring. That failure is invisible: you get confident prose where you asked for a measurement. Never `cp -R` an installed tree, and never symlink or clone its ignored paths into a copy: an install can record absolute paths back into the tree it ran in, so the copy runs that tree's source and a mutation made in the copy never runs.
|
|
94
94
|
- **Initialize the copy before anyone measures in it — a bare `git archive` tree cannot validly run every suite.** It is not a git repository, so anything that asks git about the checkout breaks: `derive_workspace_id` shells out to `git rev-parse`, falls back to the directory basename and the hook tests fail on the *name* — naming the dir after the repo makes those pass **by coincidence, not correctness** — while every sweep that asks git what ships declines instead of running, which is the silent half. `git init && git add -A -f && git commit` in the extracted copy is what makes a count mean what it looks like; the review's snapshot agent does exactly that, verifies it by comparing the new commit's tree hash against the reviewed commit's, and then runs the Install step in it, and a hand-cut tree needs the same before you read a count off it. **Every agent you send to work in its own copy of the snapshot makes that copy the same way:** copy the tracked files only (`git -C <snapshot> archive HEAD | tar -x -C <copy>`, or a `git clone` of the snapshot repository), `git init`, `git add -A -f` and commit, then run the Install step in the copy before measuring anything in it — never `cp -R` the snapshot. Suites that need the real worktree for some *other* reason — the stack below — still do.
|
|
95
95
|
- **Give specialists a stack-free test command, not the worktree's runner, and their own scratch dir** — `<scratch>/pr<N>/fleet-review-<key>/`, resolved to an absolute path that you write into that specialist's prompt; a specialist never derives its own. Specialists inherit no environment, and one falling back to the default config runs a `globalSetup` that brings the shared compose stack up and tears it down, recreating the DB mid-run for every sibling. **The snapshot does not cover this** — the compose project name comes from the environment, not the working directory, so three agents on three copies still collide. But `./agent-test` does not fix it either: it exports **one** `TEST_COMPOSE_PROJECT`/port triple per *worktree* (`ab-<issue>`), so N concurrent specialists sharing it tear down each other's postgres mid-run. So tell specialists the repo's test command directly — the Test entrypoint, read off the Recipe cache the way step 3 reads it (`derive-testcmd.sh <worktree or main checkout> test` prints it; the snapshot carries no `.fleet/` cache, so pointing it at the snapshot refuses) — when it brings up no shared stack, and the repo's own stack-free config when it does; never name a config the repo does not have, which sends every specialist into a missing-file error that reads as a broken tree rather than a bad instruction. Keep `./agent-test` for your own verification. **Hand that command with its reading rule: `tests 0` is a failed run, not a pass.** A command is not self-checking: a path glob or filter that matches nothing can exit 0 having run nothing. Measured with `node --test` over a glob matching no file: bash passes the pattern through literally, node globs it itself and finds no files, and you get `ℹ tests 0` / exit 0 — and `# tests 0` to a pipe on older node, so a rule that greps only for `ℹ` finds nothing in a CI log and cannot tell a zero-test run from a full one. Do not count on the shell to catch it: zsh errors (`no matches found`, exit 1) and bash does not, so the guard has to be the reading rule. **And zero is not the only no-work count.** **0 passes with no failures** is everything skipped, and a count **materially below the full suite** is a partial copy of the tree — which is the *documented* behavior, since the prompt tells specialists to run their probe work inside their own copy of the snapshot and nothing anchors an expected count for them. `review-core.mjs` classifies the first itself, in `suiteVerdictOf`; the second it structurally cannot, because that function is kept pure and so never learns how many tests the tree has. Handing the rule over with the command is the only guard the partial-copy case has. Carry the rule, not the command: wherever a repo has a stack, N concurrent specialists sharing one runner collide, and the escape is whatever that repo's stack-free config is.
|
|
96
96
|
- **Completion is not delivery — but you can reach a specialist, so never wait idle.** A specialist you dispatched reports when it settles; if a report is missing, `hub send` it by name and ask for the report. Judge delivery by whether a report came out. **Do not settle a dimension you hold no report for**: ask the specialist, then the controller by name; only when neither answers, rule and name that dimension **unrun** — a killed specialist never reports, so waiting on one is unbounded. Never ship "dispatched, never delivered" as settled; a ruling citing a report you do not hold gets verified from source, never applied on trust.
|
package/package.json
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
#
|
|
15
15
|
# The ONE reader of the cache — reused, not reimplemented, by claim-ticket.sh
|
|
16
16
|
# (the Install step it runs and the Test entrypoint it bakes into the runner)
|
|
17
|
-
# and by review-core.mjs's snapshot agent (the
|
|
18
|
-
#
|
|
17
|
+
# and by review-core.mjs's snapshot agent (the Install step it runs in the
|
|
18
|
+
# snapshot). Two independent readers is what drifts.
|
|
19
19
|
#
|
|
20
20
|
# THE CACHE is `<workspace>/.fleet/recipe.json`, where <workspace> is the
|
|
21
21
|
# directory git-env.mjs's resolveWorkspace() names for the repository: the
|
|
@@ -114,7 +114,7 @@ export LC_ALL=C
|
|
|
114
114
|
# `$repo` — and the cache it then reads is another repository's Recipe,
|
|
115
115
|
# reported as this one's. Both consumers act on that string: claim-ticket.sh
|
|
116
116
|
# runs it in a fresh worktree and bakes it into the runner, and review-core.mjs's
|
|
117
|
-
# snapshot agent
|
|
117
|
+
# snapshot agent runs it in the snapshot.
|
|
118
118
|
#
|
|
119
119
|
# GIT_WORK_TREE is unset alongside it: the vacuous-suite probe's `check-ignore`
|
|
120
120
|
# reads the ignore rules of whatever work tree git is pointed at, so an ambient
|
|
@@ -416,9 +416,9 @@ fi
|
|
|
416
416
|
# `;`, `&`, or a newline lets a real shell read the caller's "$@" as an
|
|
417
417
|
# unrelated top-level command instead of args reaching the Test entrypoint, and
|
|
418
418
|
# one containing a `#`-led word swallows everything after it, "$@" included, as
|
|
419
|
-
# a comment. review-core.mjs's
|
|
420
|
-
#
|
|
421
|
-
#
|
|
419
|
+
# a comment. review-core.mjs's shared test run hands the string to
|
|
420
|
+
# suite-slot.mjs single-quoted and appends no arguments, so neither hazard
|
|
421
|
+
# reaches it there. A trailing
|
|
422
422
|
# newline is checked here too: the frame above lets a value keep one
|
|
423
423
|
# where an unframed `$(…)` capture always dropped it silently, so a value
|
|
424
424
|
# that used to read as `true;` now reads as `true;\n` and would otherwise
|
package/scripts/review-core.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// review-core.mjs — the review body for PR review.
|
|
2
2
|
//
|
|
3
3
|
// This file holds every host-independent declaration PR review needs: the
|
|
4
|
-
// JSON schemas, `usableDiff`, `usableMessages`, `messagesNote`, `refuterMessagesNote`, `readRules`,
|
|
4
|
+
// JSON schemas, `usableDiff`, `usableMessages`, `messagesNote`, `refuterMessagesNote`, `readRules`,
|
|
5
5
|
// `decodeArgs`, `selectDimensions`, `resolveDimensions`, `snapshotMissing`,
|
|
6
6
|
// `installReason`/`installFinding`, `suiteVerdictOf`/`unrunCrashed`,
|
|
7
7
|
// `sharedRunNote`, `copyRule`,
|
|
@@ -134,8 +134,6 @@ export const SNAPSHOT_SCHEMA = {
|
|
|
134
134
|
messagesPath: { type: "string" },
|
|
135
135
|
refHead: { type: "string" },
|
|
136
136
|
prHead: { type: "string" },
|
|
137
|
-
testCmd: { type: "string" },
|
|
138
|
-
testCmdError: { type: "string" },
|
|
139
137
|
// The Recipe's `uncovered` as derive-testcmd.sh printed it: the merge-gating
|
|
140
138
|
// CI steps neither the Test entrypoint nor the Check step runs, one line of JSON, `[]` for none.
|
|
141
139
|
// `uncoveredError` carries the reader's refusal instead when it could not
|
|
@@ -410,23 +408,6 @@ re-billed as cache-read each time. Measured over one run, 88 unpiped whole-file
|
|
|
410
408
|
reads carried 434 KB.`;
|
|
411
409
|
}
|
|
412
410
|
|
|
413
|
-
// The step a missing Test entrypoint is derived by, named in the refusal so the
|
|
414
|
-
// caller — a controller or a reviewer — knows what to run rather than what went
|
|
415
|
-
// wrong. derive-testcmd.sh's refusals about the cache name the same
|
|
416
|
-
// step; its exit-3 refusals name an environment fault instead, which the caller
|
|
417
|
-
// fixes rather than deriving. This one covers the case where the snapshot agent
|
|
418
|
-
// reported no reason at all.
|
|
419
|
-
const DERIVATION_STEP =
|
|
420
|
-
"run the Recipe derivation step (run-team phase 0, before the first claim) to derive, prove and write the Recipe cache";
|
|
421
|
-
|
|
422
|
-
export function resolveTestCmd(explicit, snap) {
|
|
423
|
-
if (explicit) return explicit;
|
|
424
|
-
if (snap && snap.testCmd) return snap.testCmd;
|
|
425
|
-
throw new Error(
|
|
426
|
-
`review-pr: no test command for this repository — ${(snap && snap.testCmdError) || `the snapshot agent read no Recipe cache; ${DERIVATION_STEP}`}. Pass args.testCmd to override.`,
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
411
|
// The review's one run goes through the suite-slot wrapper, by the Resolver,
|
|
431
412
|
// so it counts against the host-wide bound on concurrent full runs. The
|
|
432
413
|
// command is one word to the wrapper — it hands the string to `sh -c` itself —
|
|
@@ -1104,6 +1085,15 @@ async function reviewRun(host, args, run) {
|
|
|
1104
1085
|
// into it: an absent `pr` is owed "required", not a complaint about digits.
|
|
1105
1086
|
if (!isDigits(pr)) throw new Error(`review-pr: args.pr must be a PR number, got ${JSON.stringify(pr)}`);
|
|
1106
1087
|
|
|
1088
|
+
// Nothing in the review derives a test command: every caller reads the Test
|
|
1089
|
+
// entrypoint off the Recipe cache and passes it. Refused here, beside the
|
|
1090
|
+
// other argument refusals, so a review that could never run its suite costs
|
|
1091
|
+
// no snapshot.
|
|
1092
|
+
const testCmd = A.testCmd;
|
|
1093
|
+
if (typeof testCmd !== "string" || testCmd.trim() === "") {
|
|
1094
|
+
throw new Error(`review-pr: args.testCmd is required — the Test entrypoint the shared run executes, got ${JSON.stringify(testCmd)}`);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1107
1097
|
// Resolved only now: the default spawns git, so a missing or malformed `pr`
|
|
1108
1098
|
// is refused on its own terms before anything is resolved or spawned.
|
|
1109
1099
|
const scratch = A.scratch === undefined ? standaloneScratchRoot() : A.scratch;
|
|
@@ -1154,7 +1144,7 @@ async function reviewRun(host, args, run) {
|
|
|
1154
1144
|
( cd "$SNAP" && git init -q && git add -A -f && git -c user.name=fleet -c user.email=fleet@invalid commit -q --no-verify -m "review snapshot of $SHA" ) || echo SNAPSHOT_INIT_FAILED
|
|
1155
1145
|
SNAPTREE=$(git -C "$SNAP" rev-parse 'HEAD^{tree}' 2>/dev/null); SRCTREE=$(git -C ${worktree} rev-parse 'HEAD^{tree}')
|
|
1156
1146
|
{ [ -d "$SNAP/.git" ] && [ -n "$SNAPTREE" ] && [ "$SNAPTREE" = "$SRCTREE" ]; } && echo SNAPSHOT_TREE_MATCH || echo SNAPSHOT_TREE_MISMATCH="snapshot $SNAPTREE vs commit $SRCTREE"
|
|
1157
|
-
INSTALL=$(~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh ${worktree} install) && echo SNAPSHOT_INSTALL_STEP="$INSTALL" || { INSTALL=; echo SNAPSHOT_INSTALL_UNREAD; }
|
|
1147
|
+
INSTALL=$(~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh ${worktree} install --at origin/main) && echo SNAPSHOT_INSTALL_STEP="$INSTALL" || { INSTALL=; echo SNAPSHOT_INSTALL_UNREAD; }
|
|
1158
1148
|
[ -z "$INSTALL" ] || { ( cd "$SNAP" && env -u CI sh -c "$INSTALL" ) >"$RUN/install.log" 2>&1; echo SNAPSHOT_INSTALL_EXIT=$?; }
|
|
1159
1149
|
if [ -d "$SNAP/.git" ] && git -C "$SNAP" status --porcelain --untracked-files=all >"$RUN/status.txt"; then head -n 20 "$RUN/status.txt" | sed 's/^/SNAPSHOT_UNTRACKED=/'; echo SNAPSHOT_UNTRACKED_COUNT=$(wc -l <"$RUN/status.txt" | tr -d ' '); else echo SNAPSHOT_STATUS_FAILED; fi
|
|
1160
1150
|
|
|
@@ -1273,17 +1263,7 @@ a match nor a mismatch. Do not judge whether the diff is usable, and do not
|
|
|
1273
1263
|
withhold one field because another failed: report what you got and let the
|
|
1274
1264
|
caller decide.
|
|
1275
1265
|
|
|
1276
|
-
Then read
|
|
1277
|
-
|
|
1278
|
-
~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh ${worktree} test
|
|
1279
|
-
|
|
1280
|
-
Report \`testCmd\` = its stdout ONLY if it exited 0. If it exited non-zero,
|
|
1281
|
-
report \`testCmdError\` = its stderr and omit \`testCmd\`. Never derive or
|
|
1282
|
-
guess a command yourself: a refusal about the cache names the step that
|
|
1283
|
-
derives it; an exit-3 refusal names an environment fault, and the caller fixes
|
|
1284
|
-
that instead of deriving.
|
|
1285
|
-
|
|
1286
|
-
Then read, out of the same cache, the merge-gating CI steps that neither the
|
|
1266
|
+
Then read, out of the Recipe cache, the merge-gating CI steps that neither the
|
|
1287
1267
|
Test entrypoint nor the Check step runs:
|
|
1288
1268
|
|
|
1289
1269
|
~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh ${worktree} uncovered
|
|
@@ -1334,8 +1314,7 @@ replaces uncovered.`,
|
|
|
1334
1314
|
log(`snapshot ${snap.head} at ${snap.path} — head ref ${snap.refHead || "(absent): head check SKIPPED"} — PR head ${snap.prHead ?? "(absent)"}`);
|
|
1335
1315
|
log(environmentNote(snap));
|
|
1336
1316
|
|
|
1337
|
-
|
|
1338
|
-
log(`testCmd ${A.testCmd ? "(caller override)" : "(derived)"} ${testCmd}`);
|
|
1317
|
+
log(`testCmd ${testCmd}`);
|
|
1339
1318
|
// An Install step that failed or never ran leaves a snapshot that cannot
|
|
1340
1319
|
// measure the tree: the shared run is skipped, the suite verdict is not
|
|
1341
1320
|
// usable through `testRunReason`, and a non-zero exit is filed as a finding.
|
|
@@ -484,7 +484,7 @@ code in the claim tree.
|
|
|
484
484
|
**Derive the Recipe — the Recipe derivation step — before the fold-in below
|
|
485
485
|
and before the first claim.** Every claim runs this repository's Install
|
|
486
486
|
step and bakes its Test entrypoint into the member's runner, and every
|
|
487
|
-
review
|
|
487
|
+
review runs the Install step, all out of the **Recipe cache**
|
|
488
488
|
(`.fleet/recipe.json` beside the common git dir); no script infers either
|
|
489
489
|
command. Check it first: `~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh .
|
|
490
490
|
install --at origin/main`, `~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh . check
|
|
@@ -522,7 +522,7 @@ stall, below.
|
|
|
522
522
|
**Where `checkCmd` comes from:** the repository's Check step, out of the same Recipe cache — `~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run derive-testcmd.sh . check` prints it. Pass it to the fix-applier beside `testCmd`; the review does not run it. Neither member runs the two by hand: `recipe-check.mjs` runs the Check step it reads off that cache, then the `testCmd` it is handed, on the member's staged tree, and writes the record `ledger.mjs settle --from-report` requires of an implementer's and a fix-applier's report.
|
|
523
523
|
|
|
524
524
|
**Mid-run, a cache that stops running is re-derived once, then the run
|
|
525
|
-
stalls.** A claim
|
|
525
|
+
stalls.** A claim that refuses because the Recipe cache is
|
|
526
526
|
invalid — a command that no longer runs, or an Install step that changed
|
|
527
527
|
the tree — is a mid-run trigger: dispatch `derive-recipe` again
|
|
528
528
|
exactly as above, then retry what refused. So is the `NEED derive-recipe`
|
|
@@ -131,7 +131,7 @@ that ran clean has nothing in those three either.
|
|
|
131
131
|
|
|
132
132
|
## A failed review is a failure event, not a clean review
|
|
133
133
|
|
|
134
|
-
The review throws on missing `args.pr`/`args.worktree` and on a snapshot agent
|
|
134
|
+
The review throws on missing `args.pr`/`args.worktree`/`args.testCmd` and on a snapshot agent
|
|
135
135
|
that returned no tree, and a failure surfaces mid-loop, where "react, never
|
|
136
136
|
block" makes it easy to log and carry on — leaving a PR that *reads* as
|
|
137
137
|
reviewed and is not.
|