@feigi/fleet-ctl 0.0.0 → 3.16.3
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/citation-sweep-prose.test.mjs +59 -1
- 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
|
@@ -9,8 +9,8 @@ import { anchorAt, phrase, stripQuoteGutter } from "./prose-pin.mjs";
|
|
|
9
9
|
// controller-facing prose the member sees only if the controller paraphrases it
|
|
10
10
|
// — and `sizing-a-ticket`'s fleet entry point is CONDITIONED on the reader being
|
|
11
11
|
// an unattended fleet member. Take that condition's evidence away and the member
|
|
12
|
-
// reads itself as a solo session,
|
|
13
|
-
//
|
|
12
|
+
// reads itself as a solo session, waits on a user to settle the open design
|
|
13
|
+
// choices before planning, and parks on an answer no unattended member can obtain.
|
|
14
14
|
//
|
|
15
15
|
// So the pin is on LOCATION, not vocabulary. Moving these words back out into
|
|
16
16
|
// prose IS the defect, and every word would still be somewhere in the file — a
|
|
@@ -58,9 +58,9 @@ const SIZING = readFileSync(join(REPO, "skills", "sizing-a-ticket", "SKILL.md"),
|
|
|
58
58
|
// #1804: the member-facing text is the BODY of the implementer agent
|
|
59
59
|
// definition (spec 2026-09-24 § 2 Decision 2), which each harness injects as
|
|
60
60
|
// the member's system prompt — the verbatim carrier the `>` blocks in phase 2
|
|
61
|
-
// used to be. Byte-identical in
|
|
62
|
-
// pins that), so one file stands for
|
|
63
|
-
const AGENT_FILE = readFileSync(join(REPO, "agents", "fleet-implementer.agent.md"), "utf8");
|
|
61
|
+
// used to be. Byte-identical in every `fleet-implementer-<cell>` file
|
|
62
|
+
// (implementer-model-tier.test.mjs pins that), so one file stands for all.
|
|
63
|
+
const AGENT_FILE = readFileSync(join(REPO, "agents", "fleet-implementer-slow-high.agent.md"), "utf8");
|
|
64
64
|
const memberBlocks = () => AGENT_FILE.split("---").slice(2).join("---");
|
|
65
65
|
const memberProse = () => stripQuoteGutter(memberBlocks());
|
|
66
66
|
const phase2 = () => RUN_TEAM.slice(anchorAt(RUN_TEAM, "## Phase 2", "run-team phase 2"), anchorAt(RUN_TEAM, "## Phase 3", "run-team phase 3"));
|
|
@@ -80,7 +80,7 @@ test("every member-facing rule sits in the agent body the harness injects, not i
|
|
|
80
80
|
test("the member is told it is unattended, in text it receives verbatim", () => {
|
|
81
81
|
const prose = memberProse();
|
|
82
82
|
|
|
83
|
-
// Without this, `sizing-a-ticket
|
|
83
|
+
// Without this, `sizing-a-ticket`'s `**Fleet member on heavy:**` condition
|
|
84
84
|
// cannot fire. The only prior signal was the incidental word "controller".
|
|
85
85
|
assert.match(
|
|
86
86
|
prose,
|
|
@@ -120,11 +120,10 @@ test("the handoff names its destination, and a light-row member cannot read it a
|
|
|
120
120
|
);
|
|
121
121
|
// The wrong binding, and the one that bites: the nearest place-like phrase was
|
|
122
122
|
// the heavy-row entry point, which would send a LIGHT-row member to plan-writing.
|
|
123
|
-
//
|
|
124
|
-
// wrap to land in and nothing for `phrase()` to tolerate.
|
|
123
|
+
// So the member prompt must not carry the heavy row's own first action.
|
|
125
124
|
assert.doesNotMatch(
|
|
126
125
|
prose,
|
|
127
|
-
|
|
126
|
+
phrase("write the plan under your own scratch path"),
|
|
128
127
|
"the member prompt names the heavy-row entry point, which a light-row member would follow",
|
|
129
128
|
);
|
|
130
129
|
});
|
|
@@ -150,12 +149,17 @@ test("the sizing skill stays conditioned — a solo session still runs the inter
|
|
|
150
149
|
// because it correctly serves solo sessions, which do have a user to approve.
|
|
151
150
|
assert.match(
|
|
152
151
|
SIZING,
|
|
153
|
-
phrase("**Fleet member on heavy:
|
|
154
|
-
"the fleet heavy-row
|
|
152
|
+
phrase("**Fleet member on heavy: write the plan under your own scratch path"),
|
|
153
|
+
"the fleet heavy-row branch is gone — sizing no longer tells a member from a solo session",
|
|
155
154
|
);
|
|
156
155
|
assert.match(
|
|
157
156
|
SIZING,
|
|
158
|
-
phrase("
|
|
159
|
-
"
|
|
157
|
+
phrase("Heavy is never a reason to give up"),
|
|
158
|
+
"the fleet heavy-row branch no longer says heavy is never a reason to give up",
|
|
159
|
+
);
|
|
160
|
+
assert.match(
|
|
161
|
+
SIZING,
|
|
162
|
+
phrase("Solo session has a user: settle the open design choices with them before planning"),
|
|
163
|
+
"a solo session no longer settles design with its user before planning",
|
|
160
164
|
);
|
|
161
165
|
});
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
26
26
|
import { join, basename, relative, isAbsolute, sep } from "node:path";
|
|
27
27
|
|
|
28
|
-
import { classifyRole, CANONICAL_MEMBER_NAME_PREFIXES } from "./compute-spend.mjs";
|
|
28
|
+
import { classifyRole, canonicalMemberName, CANONICAL_MEMBER_NAME_PREFIXES } from "./compute-spend.mjs";
|
|
29
29
|
|
|
30
30
|
// ---------------------------------------------------------------------------
|
|
31
31
|
// cwd encoder
|
|
@@ -137,8 +137,13 @@ export function normalizeModel(raw) {
|
|
|
137
137
|
// Unrecognised, a `resolve-pr-<n>` member fell through to `{ticket:"",
|
|
138
138
|
// pr:""}`, losing its join key into tier-outcomes.tsv exactly the way an
|
|
139
139
|
// unmatched finisher spelling once did (#1072).
|
|
140
|
+
//
|
|
141
|
+
// Every pattern below is written against the lower-kebab spelling, so the
|
|
142
|
+
// name is first rewritten by `canonicalMemberName` (compute-spend.mjs), the
|
|
143
|
+
// same rewrite classifyRole applies: `Impl327` and `FixPr774` book the
|
|
144
|
+
// ticket and PR their kebab forms do instead of blanks (#2396).
|
|
140
145
|
export function parseMemberName(name) {
|
|
141
|
-
const s =
|
|
146
|
+
const s = canonicalMemberName(name).replace(/-(?:[a-z]|v\d+)$/, "");
|
|
142
147
|
let m = /^(?:fix|review|finish(?:er)?|resolve)-pr-(\d+)(?:-\d+)?$/.exec(s);
|
|
143
148
|
if (m) return { ticket: "", pr: m[1] };
|
|
144
149
|
m = /^finish(?:er)?-(\d+)$/.exec(s);
|
|
@@ -473,7 +478,7 @@ export function ompMemberRecord(folded, agentStem, spawnDepth = 0) {
|
|
|
473
478
|
// shape (always an array, never absent), so no `?.` is needed here.
|
|
474
479
|
const pr = namedPr || (folded.openedPrs.length === 1 ? folded.openedPrs[0] : "");
|
|
475
480
|
const hasRoleSignal = spawnDepth >= 1 || typeof folded.task === "string" || typeof folded.agent === "string"
|
|
476
|
-
|| OMP_CANONICAL_STEM_RE.test(member);
|
|
481
|
+
|| OMP_CANONICAL_STEM_RE.test(canonicalMemberName(member));
|
|
477
482
|
const role = hasRoleSignal
|
|
478
483
|
? classifyRole({ agentDefinition: folded.agent, memberName: member, description: folded.task, spawnDepth })
|
|
479
484
|
: "-";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
5
5
|
import { join, dirname } from "node:path";
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -55,7 +55,7 @@ const assistantEvt = (model, usage, ts = "2026-09-08T15:12:00.000Z") => evt({
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
function ompSessionFixture(sessionName, files) {
|
|
58
|
-
const root =
|
|
58
|
+
const root = tempDir("mr-omp-home-");
|
|
59
59
|
const sessionsRoot = join(root, ".omp", "agent", "sessions", "-x");
|
|
60
60
|
const sessionDir = join(sessionsRoot, sessionName);
|
|
61
61
|
mkdirSync(sessionDir, { recursive: true });
|
|
@@ -466,7 +466,7 @@ test("readMembers: a loose top-level session .jsonl FILE beside session director
|
|
|
466
466
|
// encoded-cwd directory itself for that reason, stamping every row
|
|
467
467
|
// `session=-dev-fleet-plugin` instead of the `<ISO>_<uuid>` name and
|
|
468
468
|
// booking the loose top-level file as a member.
|
|
469
|
-
const root =
|
|
469
|
+
const root = tempDir("mr-omp-realshape-");
|
|
470
470
|
const encDir = join(root, ".omp", "agent", "sessions", "-dev-fleet-plugin");
|
|
471
471
|
const sessionName = "2026-09-08T14-14-34-049Z_01a0815e-e141-716c-b2d8-2adf310fbe55";
|
|
472
472
|
const sessionDir = join(encDir, sessionName);
|
|
@@ -511,6 +511,6 @@ test("readMembers: a line matching NEITHER shape (no `type`, no Claude keys) is
|
|
|
511
511
|
});
|
|
512
512
|
|
|
513
513
|
test("readMembers: a root holding no omp session directory anywhere is refused, not silently empty", () => {
|
|
514
|
-
const stray =
|
|
514
|
+
const stray = tempDir("mr-stray-");
|
|
515
515
|
assert.throws(() => readMembers([stray]), /no omp session directory/);
|
|
516
516
|
});
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
// ignored in a fleet repo, so worktrees, run state and agent-brain's cache
|
|
34
34
|
// stay writable, and what is protected is exactly what the main
|
|
35
35
|
// checkout's `git status` would show dirty (#2210 watches the same set).
|
|
36
|
-
// - `bash` cwd, for `fleet-implementer
|
|
37
|
-
// fix-applier's own id (`fix-pr-<n>`) directly,
|
|
38
|
-
//
|
|
36
|
+
// - `bash` cwd, for every `fleet-implementer-<cell>` (ledger-grammar.mjs's
|
|
37
|
+
// `CELL_DEF`), and for a fix-applier's own id (`fix-pr-<n>`) directly,
|
|
38
|
+
// since a review fix-applier is a generic `task`: refuse when
|
|
39
39
|
// `input.cwd ?? ctx.cwd` lies inside the main checkout outside
|
|
40
40
|
// `.worktrees/`. Command text is never parsed. Review specialists and
|
|
41
41
|
// refuters are REQUIRED to start from the inherited cwd (`pwd` first,
|
|
@@ -68,11 +68,11 @@ import { homedir } from "node:os";
|
|
|
68
68
|
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
69
69
|
import { fileURLToPath } from "node:url";
|
|
70
70
|
import { gitEnv, workspaceDirFromGitCommonDir } from "./git-env.mjs";
|
|
71
|
+
import { CELL_DEF } from "./ledger-grammar.mjs";
|
|
71
72
|
|
|
72
73
|
/** The task names the controller gives fleet members; a subagent whose parent carries one is a member's child, and a fix-applier — dispatched under a generic `task` definition with no `fleet-` prefix — is caught by its own id matching this directly. */
|
|
73
74
|
const MEMBER_TASK_NAME = /^(impl|fix-pr|review-pr|finisher-pr)-\d+(-[a-z])?$/;
|
|
74
75
|
const FIX_APPLIER_ID = /^fix-pr-\d+(-[a-z])?$/;
|
|
75
|
-
const BASH_CWD_AGENTS = new Set(["fleet-implementer", "fleet-implementer-alt"]);
|
|
76
76
|
const PATH_WRITERS = new Set(["write", "edit", "ast_edit"]);
|
|
77
77
|
const GIT_TIMEOUT_MS = 10_000;
|
|
78
78
|
const REISSUE = "Re-issue it with an absolute path under your worktree `.worktrees/<n>-<slug>/`.";
|
|
@@ -82,7 +82,7 @@ function applies(agent, toolName) {
|
|
|
82
82
|
if (agent?.kind !== "sub") return false;
|
|
83
83
|
const name = typeof agent.name === "string" ? agent.name : "";
|
|
84
84
|
const id = typeof agent.id === "string" ? agent.id : "";
|
|
85
|
-
if (toolName === "bash") return
|
|
85
|
+
if (toolName === "bash") return CELL_DEF.test(name) || FIX_APPLIER_ID.test(id);
|
|
86
86
|
return PATH_WRITERS.has(toolName)
|
|
87
87
|
&& (name.startsWith("fleet-") || MEMBER_TASK_NAME.test(id)
|
|
88
88
|
|| (typeof agent.parentId === "string" && MEMBER_TASK_NAME.test(agent.parentId)));
|
|
@@ -52,8 +52,8 @@ const SCRATCH = join(BASE, "scratch");
|
|
|
52
52
|
mkdirSync(SCRATCH);
|
|
53
53
|
const ELSEWHERE = repo(join(BASE, "elsewhere"));
|
|
54
54
|
|
|
55
|
-
const IMPL = { kind: "sub", id: "impl-42", name: "fleet-implementer", depth: 1, parentId: "Main" };
|
|
56
|
-
const
|
|
55
|
+
const IMPL = { kind: "sub", id: "impl-42", name: "fleet-implementer-slow-high", depth: 1, parentId: "Main" };
|
|
56
|
+
const OTHER_CELLS = ["slow-medium", "task-high", "task-max", "smol-high"].map((cell) => ({ ...IMPL, name: `fleet-implementer-${cell}` }));
|
|
57
57
|
const REVIEWER = { kind: "sub", id: "review-pr-9.Correctness", name: "fleet-review-correctness", depth: 2, parentId: "review-pr-9" };
|
|
58
58
|
const FINISHER = { kind: "sub", id: "finisher-pr-9", name: "fleet-finisher", depth: 1, parentId: "Main" };
|
|
59
59
|
const CHILD = { kind: "sub", id: "impl-42.Probe", name: "task", depth: 2, parentId: "impl-42" };
|
|
@@ -147,7 +147,10 @@ test("a fix-applier dispatched under the generic `task` definition is guarded by
|
|
|
147
147
|
test("bash: an implementer is refused from the main checkout, never from its worktree; nobody else is", async () => {
|
|
148
148
|
const r = await refused(IMPL, "bash", { command: "git status" }, ROOT, "implementer bash with no cwd");
|
|
149
149
|
assert.ok(r.includes(REAL_ROOT), `the bash refusal does not name the cwd it resolved: ${r}`);
|
|
150
|
-
await refused(
|
|
150
|
+
for (const cell of OTHER_CELLS) await refused(cell, "bash", { command: "true" }, ROOT, `${cell.name} bash with no cwd`);
|
|
151
|
+
// The bash rule is closed to the `CELL` grammar: a `fleet-implementer-`
|
|
152
|
+
// name outside it is no implementer definition, and keeps the inherited cwd.
|
|
153
|
+
await allowed({ ...IMPL, id: "probe-1", name: "fleet-implementer-probe" }, "bash", { command: "true" }, ROOT, "a non-cell fleet-implementer- name");
|
|
151
154
|
await refused(IMPL, "bash", { command: "true", cwd: "plugin" }, ROOT, "a relative cwd inside the main checkout");
|
|
152
155
|
await refused(IMPL, "bash", { command: "true", cwd: ROOT }, WT, "an explicit cwd at the main checkout root");
|
|
153
156
|
await refused(IMPL, "bash", { command: "true", cwd: join(ROOT, ".worktrees") }, ROOT, "cwd at the bare .worktrees directory itself, not a worktree under it");
|
package/scripts/no-undo-audit.sh
CHANGED
|
@@ -251,11 +251,12 @@ json_lib="$(dirname "$0")/json.sh"
|
|
|
251
251
|
wt=$1
|
|
252
252
|
branch=$2
|
|
253
253
|
base=${BASE_REF:-origin/main}
|
|
254
|
-
# Only a remote-tracking ref is accepted — the accept-list
|
|
255
|
-
# and reap.sh
|
|
256
|
-
# carries the same accept-list
|
|
257
|
-
# #1329 shorthand fix:
|
|
258
|
-
#
|
|
254
|
+
# Only a remote-tracking ref is accepted — the accept-list `case` that
|
|
255
|
+
# release-ticket.sh and reap.sh carry, and the one this script had none of.
|
|
256
|
+
# worktree-audit.sh carries the same accept-list `case` and already applies the
|
|
257
|
+
# #1329 shorthand fix: its `base_rev` qualify `case` turns `$base` into
|
|
258
|
+
# `$base_rev`, and both its `rev-parse --verify "$base_rev"` and its
|
|
259
|
+
# `rev-list --count "$base_rev"..HEAD` read `$base_rev`, never the bare
|
|
259
260
|
# shorthand. Its stake is smaller, though: being audit-only,
|
|
260
261
|
# worktree-audit.sh only ever prints a report, while this
|
|
261
262
|
# script GATES something consequential: the comment below
|
|
@@ -282,20 +283,21 @@ case "$base" in
|
|
|
282
283
|
esac
|
|
283
284
|
|
|
284
285
|
# release-ticket.sh's SECOND guard — `*/"$branch") die` — is carried too, for
|
|
285
|
-
# the reason release-ticket.sh
|
|
286
|
-
# leaving it out. `origin/$branch` IS a remote-tracking ref, so the
|
|
287
|
-
# above passes it and nothing else here refuses it, and every
|
|
288
|
-
# then asks whether the branch conflicts with ITSELF:
|
|
289
|
-
# conflicting files, the at-risk list stays empty, and
|
|
290
|
-
# `conflicts: []`, `atRisk: []` at exit 0 for a worktree whose
|
|
291
|
-
# does add/add-conflict with the real origin/main. Measured on a
|
|
292
|
-
# fixture: the same tree and the same commit report
|
|
293
|
-
# with one at-risk main commit when BASE_REF is
|
|
294
|
-
# when it is `origin/<the audited branch>`.
|
|
295
|
-
# comment above says must not reach a rebase
|
|
296
|
-
# guard out because its `fetch --prune` drops
|
|
297
|
-
#
|
|
298
|
-
#
|
|
286
|
+
# the reason release-ticket.sh gives on that guard and not the reason reap.sh
|
|
287
|
+
# gives for leaving it out. `origin/$branch` IS a remote-tracking ref, so the
|
|
288
|
+
# accept-list above passes it and nothing else here refuses it, and every
|
|
289
|
+
# measurement below then asks whether the branch conflicts with ITSELF:
|
|
290
|
+
# merge-tree reports no conflicting files, the at-risk list stays empty, and
|
|
291
|
+
# the audit prints `conflicts: []`, `atRisk: []` at exit 0 for a worktree whose
|
|
292
|
+
# branch really does add/add-conflict with the real origin/main. Measured on a
|
|
293
|
+
# bare-origin fixture: the same tree and the same commit report
|
|
294
|
+
# `conflicts: ["conflict.txt"]` with one at-risk main commit when BASE_REF is
|
|
295
|
+
# unset, and the empty pair above when it is `origin/<the audited branch>`.
|
|
296
|
+
# That is the false "clean" the comment above says must not reach a rebase
|
|
297
|
+
# decision. reap.sh can leave the guard out because its `fetch --prune` drops
|
|
298
|
+
# the stale refs that make the same spelling vacuous there; this script
|
|
299
|
+
# fetches nothing — the only fetch it names is the advice in the
|
|
300
|
+
# `$branch_rev does not resolve` die below.
|
|
299
301
|
case "$base" in
|
|
300
302
|
*/"$branch") die "BASE_REF must not name the audited branch, got '$base'";;
|
|
301
303
|
esac
|
|
@@ -308,8 +310,9 @@ esac
|
|
|
308
310
|
# the bare shorthand below would answer about that ref's target instead — at
|
|
309
311
|
# rc 0, with git's own `warning: refname 'origin/main' is ambiguous.` on
|
|
310
312
|
# stderr as the only tell (measured), which this script reads nothing of and
|
|
311
|
-
# which an unattended caller has no one to read. The same class
|
|
312
|
-
#
|
|
313
|
+
# which an unattended caller has no one to read. The same class release-ticket.sh
|
|
314
|
+
# and reap.sh already found in the same default, each in its own `base_rev`
|
|
315
|
+
# qualify `case`.
|
|
313
316
|
# Fix: qualify to the full refs/remotes/ path, where there is nothing left to
|
|
314
317
|
# disambiguate, unless it is already qualified. The accept-list above is
|
|
315
318
|
# what makes this qualify step safe rather than a guess — BASE_REF could
|
|
@@ -31,6 +31,7 @@ import { tmpdir } from "node:os";
|
|
|
31
31
|
import { dirname, join } from "node:path";
|
|
32
32
|
import { fileURLToPath } from "node:url";
|
|
33
33
|
import { between, phrase, stripHashGutter } from "./prose-pin.mjs";
|
|
34
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
34
35
|
|
|
35
36
|
const SCRIPT = fileURLToPath(new URL("./no-undo-audit.sh", import.meta.url));
|
|
36
37
|
|
|
@@ -252,8 +253,7 @@ function withSplitXargs(t, size = 300) {
|
|
|
252
253
|
const log = join(bin, "batches");
|
|
253
254
|
const shim = (name, body) => {
|
|
254
255
|
const real = execFileSync("sh", ["-c", `command -v ${name}`], { encoding: "utf8" }).trim();
|
|
255
|
-
|
|
256
|
-
chmodSync(join(bin, name), 0o755);
|
|
256
|
+
writeExecStub(join(bin, name), `#!/bin/sh\n${body}exec ${real} "$@"\n`);
|
|
257
257
|
};
|
|
258
258
|
shim("xargs", `set -- -s ${size} "$@"\n`);
|
|
259
259
|
shim("git", `case " $* " in *':(literal)'*) echo x >>"${log}" ;; esac\n`);
|
|
@@ -277,8 +277,7 @@ function shimDir(t, prefix) {
|
|
|
277
277
|
bin,
|
|
278
278
|
real: (name) => execFileSync("sh", ["-c", `command -v ${name}`], { encoding: "utf8" }).trim(),
|
|
279
279
|
write: (name, body) => {
|
|
280
|
-
|
|
281
|
-
chmodSync(join(bin, name), 0o755);
|
|
280
|
+
writeExecStub(join(bin, name), `#!/bin/sh\n${body}`);
|
|
282
281
|
},
|
|
283
282
|
path: () => `${bin}:${process.env.PATH}`,
|
|
284
283
|
};
|
|
@@ -1305,7 +1304,7 @@ function withFailingDedupeAwk(t) {
|
|
|
1305
1304
|
const bin = mkdtempSync(join(tmpdir(), "no-undo-audit-awk-"));
|
|
1306
1305
|
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
1307
1306
|
const real = execFileSync("sh", ["-c", "command -v awk"], { encoding: "utf8" }).trim();
|
|
1308
|
-
|
|
1307
|
+
writeExecStub(join(bin, "awk"), `#!/bin/sh
|
|
1309
1308
|
f="${bin}/stdin.$$"
|
|
1310
1309
|
cat > "$f"
|
|
1311
1310
|
if grep -qF 'MAIN COMMIT AT RISK' "$f"; then
|
|
@@ -1315,7 +1314,6 @@ if grep -qF 'MAIN COMMIT AT RISK' "$f"; then
|
|
|
1315
1314
|
fi
|
|
1316
1315
|
exec ${real} "$@" < "$f"
|
|
1317
1316
|
`);
|
|
1318
|
-
chmodSync(join(bin, "awk"), 0o755);
|
|
1319
1317
|
return { path: `${bin}:${process.env.PATH}`, fired: join(bin, "fired") };
|
|
1320
1318
|
}
|
|
1321
1319
|
|
|
@@ -1362,7 +1360,7 @@ function withFailingStashCountAwk(t) {
|
|
|
1362
1360
|
const bin = mkdtempSync(join(tmpdir(), "no-undo-audit-awk-stash-"));
|
|
1363
1361
|
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
1364
1362
|
const real = execFileSync("sh", ["-c", "command -v awk"], { encoding: "utf8" }).trim();
|
|
1365
|
-
|
|
1363
|
+
writeExecStub(join(bin, "awk"), `#!/bin/sh
|
|
1366
1364
|
f="${bin}/stdin.$$"
|
|
1367
1365
|
cat > "$f"
|
|
1368
1366
|
if grep -qF 'stash@{' "$f"; then
|
|
@@ -1372,7 +1370,6 @@ if grep -qF 'stash@{' "$f"; then
|
|
|
1372
1370
|
fi
|
|
1373
1371
|
exec ${real} "$@" < "$f"
|
|
1374
1372
|
`);
|
|
1375
|
-
chmodSync(join(bin, "awk"), 0o755);
|
|
1376
1373
|
return { path: `${bin}:${process.env.PATH}`, fired: join(bin, "fired") };
|
|
1377
1374
|
}
|
|
1378
1375
|
|
|
@@ -1924,9 +1921,9 @@ test("a BASE_REF that dereferences to a blob is unanswerable (2), never safe (0)
|
|
|
1924
1921
|
});
|
|
1925
1922
|
|
|
1926
1923
|
test("a local ref shadowing `origin/main` does not read a real add/add conflict as none (#1565)", (t) => {
|
|
1927
|
-
// Same class release-ticket.sh
|
|
1928
|
-
//
|
|
1929
|
-
//
|
|
1924
|
+
// Same class release-ticket.sh, reap.sh and worktree-audit.sh already
|
|
1925
|
+
// found in the same default — each qualifies the shorthand base into
|
|
1926
|
+
// refs/remotes/<name> before measuring. `origin/main` is a SHORTHAND, and git
|
|
1930
1927
|
// resolves a shorthand through its own disambiguation order (gitrevisions:
|
|
1931
1928
|
// refs/<name>, refs/tags/<name>, refs/heads/<name>, refs/remotes/<name>,
|
|
1932
1929
|
// …), in which refs/remotes/origin/main comes LAST. A local TAG literally
|
|
@@ -3309,7 +3306,7 @@ function withBrokenEscaper(t, { tool, marker, selector }) {
|
|
|
3309
3306
|
// The selector arg is what keeps this off the script's OWN sed/tr calls:
|
|
3310
3307
|
// `s/^/"/` appears only in jarr's rule list and `-d` only in jrewritten's.
|
|
3311
3308
|
selector = selector ?? (tool === "sed" ? `'s/^/"/'` : "-d");
|
|
3312
|
-
|
|
3309
|
+
writeExecStub(join(bin, tool), `#!/bin/sh
|
|
3313
3310
|
case " $* " in
|
|
3314
3311
|
*${selector}*)
|
|
3315
3312
|
in=$(cat)
|
|
@@ -3318,7 +3315,6 @@ case " $* " in
|
|
|
3318
3315
|
esac
|
|
3319
3316
|
exec ${real} "$@"
|
|
3320
3317
|
`);
|
|
3321
|
-
chmodSync(join(bin, tool), 0o755);
|
|
3322
3318
|
return `${bin}:${process.env.PATH}`;
|
|
3323
3319
|
}
|
|
3324
3320
|
|
|
@@ -9,7 +9,7 @@ import { logicalLines } from "./prose-pin.mjs";
|
|
|
9
9
|
// emphasis, so the name in the pointer was never the string on the target.
|
|
10
10
|
// That reads fine linearly and fails exactly one way: an agent that greps for
|
|
11
11
|
// the pointer string finds the pointer and nothing else, i.e. the citation
|
|
12
|
-
// resolves to itself. Same class as `
|
|
12
|
+
// resolves to itself. Same class as `citation-sweep-prose.test.mjs`, one
|
|
13
13
|
// document inward — there the citation was a line number, here it is a name.
|
|
14
14
|
//
|
|
15
15
|
// THE CEILING: this proves every pointer NAME resolves to a distinct target,
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
import { test } from "node:test";
|
|
13
13
|
import assert from "node:assert/strict";
|
|
14
14
|
import { spawnSync, execFileSync } from "node:child_process";
|
|
15
|
-
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync,
|
|
15
|
+
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
16
16
|
import { tmpdir } from "node:os";
|
|
17
17
|
import { join, dirname } from "node:path";
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
19
20
|
|
|
20
21
|
const SCRIPT = fileURLToPath(new URL("./pr-overlap.mjs", import.meta.url));
|
|
21
22
|
|
|
@@ -57,11 +58,10 @@ test("CLI: well-formed --a/--b values are accepted and the CLI reports a verdict
|
|
|
57
58
|
const gh = join(bin, "gh");
|
|
58
59
|
const log = join(bin, "calls");
|
|
59
60
|
// `$3` is the PR number pr-overlap.mjs passes as `gh pr diff <pr> --name-only`.
|
|
60
|
-
|
|
61
|
+
writeExecStub(
|
|
61
62
|
gh,
|
|
62
63
|
`#!/bin/sh\nprintf '%s\\n' "$*" >> ${log}\ncase "$3" in\n 1) echo src/shared.ts ;;\n 2) echo src/shared.ts ;;\nesac\n`,
|
|
63
64
|
);
|
|
64
|
-
chmodSync(gh, 0o755);
|
|
65
65
|
const r = spawnSync(process.execPath, [SCRIPT, "--a", "1", "--b", "2"], {
|
|
66
66
|
encoding: "utf8",
|
|
67
67
|
env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
@@ -107,7 +107,7 @@ function fixture({ prs, tracked = [] }) {
|
|
|
107
107
|
if (diff !== undefined) writeFileSync(join(data, `${pr}.diff`), diff);
|
|
108
108
|
}
|
|
109
109
|
const gh = join(bin, "gh");
|
|
110
|
-
|
|
110
|
+
writeExecStub(
|
|
111
111
|
gh,
|
|
112
112
|
"#!/bin/sh\n" +
|
|
113
113
|
`case "$4" in\n` +
|
|
@@ -115,7 +115,6 @@ function fixture({ prs, tracked = [] }) {
|
|
|
115
115
|
` *) cat ${data}/"$3".diff ;;\n` +
|
|
116
116
|
"esac\n",
|
|
117
117
|
);
|
|
118
|
-
chmodSync(gh, 0o755);
|
|
119
118
|
execFileSync("git", ["init", "-q"], { cwd: repo });
|
|
120
119
|
for (const f of tracked) {
|
|
121
120
|
mkdirSync(join(repo, dirname(f)), { recursive: true });
|
|
@@ -489,8 +488,7 @@ test("prose: a full-diff read that fails names itself and leaves the other three
|
|
|
489
488
|
test("#878: --a 0/--b 0 reach gh rather than drawing the usage line for an absent flag", () => {
|
|
490
489
|
const bin = mkdtempSync(join(tmpdir(), "pr-overlap-bin-"));
|
|
491
490
|
const gh = join(bin, "gh");
|
|
492
|
-
|
|
493
|
-
chmodSync(gh, 0o755);
|
|
491
|
+
writeExecStub(gh, '#!/bin/sh\ncase "$3" in\n 0) echo src/shared.ts ;;\nesac\n');
|
|
494
492
|
const r = spawnSync(process.execPath, [SCRIPT, "--a", "0", "--b", "0"], {
|
|
495
493
|
encoding: "utf8",
|
|
496
494
|
env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
@@ -551,8 +549,7 @@ test("prose: a git ls-files failure names its cause instead of vanishing into a
|
|
|
551
549
|
},
|
|
552
550
|
});
|
|
553
551
|
const git = join(fx.bin, "git");
|
|
554
|
-
|
|
555
|
-
chmodSync(git, 0o755);
|
|
552
|
+
writeExecStub(git, "#!/bin/sh\nexit 1\n");
|
|
556
553
|
const r = spawnSync(process.execPath, [SCRIPT, "--a", "1", "--b", "2"], {
|
|
557
554
|
encoding: "utf8",
|
|
558
555
|
cwd: fx.repo,
|
|
@@ -6,15 +6,16 @@ import { stripComments } from "./strip-comments.mjs";
|
|
|
6
6
|
// #1552. The extract-then-compile idiom — read a workflow's source, strip its
|
|
7
7
|
// comments so a block-commented call cannot render as live text, find a
|
|
8
8
|
// template literal's start/end anchors, trim its wrapping backticks, and
|
|
9
|
-
// compile it with `new Function` — existed independently in three test files
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
9
|
+
// compile it with `new Function` — existed independently in three test files,
|
|
10
|
+
// each around a different anchor pair:
|
|
11
|
+
// `835ef5d03c^:plugin/scripts/review-pr-specialist-scratch.test.mjs`,
|
|
12
|
+
// `835ef5d03c^:plugin/scripts/review-pr-refuter-scratch.test.mjs`, and
|
|
13
|
+
// injection-control-prose.test.mjs. One of the three (the specialist twin)
|
|
14
|
+
// already delegated the anchor-finding half to prose-pin.mjs's `between()`;
|
|
15
|
+
// the other two reimplemented the same `indexOf`/`assert.notEqual` pair by
|
|
16
|
+
// hand. Commit 835ef5d03c moved only the extraction MACHINERY here; the
|
|
17
|
+
// prompt RULE PROSE itself stays inline in review-core.mjs per #496's brief
|
|
18
|
+
// against a shared source for the rules themselves.
|
|
18
19
|
const REPO = join(import.meta.dirname, "..");
|
|
19
20
|
|
|
20
21
|
// `file` is relative to the plugin root (e.g. "scripts/review-core.mjs").
|
package/scripts/prose-pin.mjs
CHANGED
|
@@ -506,13 +506,13 @@ function rawOffset(text, unemphasizedOffset) {
|
|
|
506
506
|
return i;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
// The offset of an anchor that must occur EXACTLY ONCE,
|
|
510
|
-
//
|
|
511
|
-
//
|
|
512
|
-
//
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
//
|
|
509
|
+
// The offset of an anchor that must occur EXACTLY ONCE, asserted by count because
|
|
510
|
+
// a search takes the FIRST match silently, so an un-gutter'd restatement of the
|
|
511
|
+
// anchored block ABOVE the real one — the shape this repo's prose already uses
|
|
512
|
+
// where a phase quotes a member prompt back at itself — binds the pin to the copy
|
|
513
|
+
// while the real rule is gutted. A blockquoted copy is harmless (`\s+` cannot
|
|
514
|
+
// span the `>` gutter); a plain one is not. A missing anchor throws rather than
|
|
515
|
+
// widening, for `paragraph`'s reason.
|
|
516
516
|
//
|
|
517
517
|
// Split out of `paragraph` rather than left inside it because a slice whose END
|
|
518
518
|
// bound is not a blank line needs the same guarantee and must not copy it:
|
|
@@ -555,7 +555,8 @@ export function anchorAt(text, anchor, what, { emphasisTolerant = false } = {})
|
|
|
555
555
|
// because its callers diagnose that differently and both are right:
|
|
556
556
|
// `gp-sep-invariant-prose.test.mjs` slices at module load and wants the empty
|
|
557
557
|
// case as a NAMED test rather than an import-time crash, while
|
|
558
|
-
// `review-pr-inbound-citation-prose.test.mjs`
|
|
558
|
+
// `ed9f2967^:plugin/scripts/review-pr-inbound-citation-prose.test.mjs` asserted
|
|
559
|
+
// non-empty on the spot.
|
|
559
560
|
// The exactly-once half is not the caller's and is not optional: it is
|
|
560
561
|
// `anchorAt`'s, so a second copy of the anchored declaration reds here instead
|
|
561
562
|
// of silently binding the pin to whichever copy comes first.
|
|
@@ -589,9 +590,7 @@ export function anchorAt(text, anchor, what, { emphasisTolerant = false } = {})
|
|
|
589
590
|
// `paragraph`'s reason and after its history: three pins hand-rolled this same
|
|
590
591
|
// regex locally first, each carrying its own chance of dropping a guard. A pin
|
|
591
592
|
// needing this bound imports it — a local copy is the defect, not a style
|
|
592
|
-
// choice.
|
|
593
|
-
// (`review-pr-inbound-citation-prose.test.mjs`'s `commentBelow`) has one
|
|
594
|
-
// consumer and so no duplicate to close.
|
|
593
|
+
// choice.
|
|
595
594
|
|
|
596
595
|
// The closed list `runAbove`'s tail bound tolerates between the comment block
|
|
597
596
|
// and the anchor's own declaration keyword. Deliberately narrow: modifiers
|
|
@@ -19,6 +19,7 @@ import { tmpdir } from "node:os";
|
|
|
19
19
|
import { join } from "node:path";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
21
|
import { slowTransport, SSH_URL } from "./slow-transport.mjs";
|
|
22
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
22
23
|
|
|
23
24
|
const SCRIPT = fileURLToPath(new URL("./prove-merge.sh", import.meta.url));
|
|
24
25
|
|
|
@@ -395,10 +396,9 @@ test("a git failure reading the parents is an error, never a silent disproof", (
|
|
|
395
396
|
// DIRECTORY — "Permission denied", the fetch fails first, and the parents are
|
|
396
397
|
// never read, so this test measures the wrong failure. Resolved out here,
|
|
397
398
|
// where PATH is still the real one; inside the shim, `git` is the shim.
|
|
398
|
-
|
|
399
|
+
writeExecStub(
|
|
399
400
|
join(bin, "git"),
|
|
400
401
|
`#!/bin/sh\n[ "$1" = rev-list ] && exit 128\nexec ${REAL_GIT} "$@"\n`,
|
|
401
|
-
{ mode: 0o755 },
|
|
402
402
|
);
|
|
403
403
|
|
|
404
404
|
const r = spawnSync("sh", [SCRIPT, head, head, merge], {
|
|
@@ -856,7 +856,7 @@ test("a missing json.sh is exit 2, never the exit 1 that means `not proved`", (t
|
|
|
856
856
|
function sedShim(t, body) {
|
|
857
857
|
const bin = mkdtempSync(join(tmpdir(), "prove-merge-sed-shim-"));
|
|
858
858
|
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
859
|
-
|
|
859
|
+
writeExecStub(join(bin, "sed"), `#!/bin/sh\n${body}\n`);
|
|
860
860
|
return `${bin}:${ENV.PATH ?? process.env.PATH}`;
|
|
861
861
|
}
|
|
862
862
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
// it in the same sentence, ahead of the `drops` — the clause bound starts at
|
|
84
84
|
// `drops` and leaves it outside the pin. And it covers four sites, not every
|
|
85
85
|
// statement in the repo: the script-surface row in
|
|
86
|
-
// `docs/specs/2026-07-23-fleet-plugin-design.md` names
|
|
86
|
+
// `docs/specs/2026-07-23-fleet-plugin-design.md` names every dropped field
|
|
87
87
|
// today and is left to the pattern its siblings already use —
|
|
88
88
|
// `worktree-audit.test.mjs` and `no-undo-audit.test.mjs` each check their
|
|
89
89
|
// script's Out cell against a real run of that script, which for ci-state.mjs
|
package/scripts/reap.test.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { tmpdir } from "node:os";
|
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
import { fileURLToPath } from "node:url";
|
|
18
18
|
import { slowTransport, SSH_URL } from "./slow-transport.mjs";
|
|
19
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
19
20
|
|
|
20
21
|
const SCRIPT = fileURLToPath(new URL("./reap.sh", import.meta.url));
|
|
21
22
|
|
|
@@ -224,7 +225,7 @@ function failOnlyShim(t, match, stderr, code = 1) {
|
|
|
224
225
|
function toolFailShim(t, tool, realTool, match, stderr, code = 1) {
|
|
225
226
|
const bin = mkdtempSync(join(tmpdir(), `reap-${tool}-shim-`));
|
|
226
227
|
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
227
|
-
|
|
228
|
+
writeExecStub(
|
|
228
229
|
join(bin, tool),
|
|
229
230
|
`#!/bin/sh\n` +
|
|
230
231
|
`if ${match}; then\n` +
|
|
@@ -236,7 +237,6 @@ function toolFailShim(t, tool, realTool, match, stderr, code = 1) {
|
|
|
236
237
|
` exit ${code}\n` +
|
|
237
238
|
`fi\n` +
|
|
238
239
|
`exec ${realTool} "$@"\n`,
|
|
239
|
-
{ mode: 0o755 },
|
|
240
240
|
);
|
|
241
241
|
return bin;
|
|
242
242
|
}
|
|
@@ -3774,14 +3774,13 @@ test("git_probe's captured stderr on a successful `for-each-ref` still reaches t
|
|
|
3774
3774
|
mergedGoneBranch(w, "feature/merged", "merged work");
|
|
3775
3775
|
const bin = mkdtempSync(join(tmpdir(), "reap-shim-"));
|
|
3776
3776
|
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
3777
|
-
|
|
3777
|
+
writeExecStub(
|
|
3778
3778
|
join(bin, "git"),
|
|
3779
3779
|
`#!/bin/sh\n` +
|
|
3780
3780
|
`if [ "$1" = for-each-ref ]; then\n` +
|
|
3781
3781
|
` echo "warning: unable to access '/some/broken/config': Permission denied" >&2\n` +
|
|
3782
3782
|
`fi\n` +
|
|
3783
3783
|
`exec ${REAL_GIT} "$@"\n`,
|
|
3784
|
-
{ mode: 0o755 },
|
|
3785
3784
|
);
|
|
3786
3785
|
|
|
3787
3786
|
const { code, json, stderr } = runReap(w, ["--apply"], withShim(bin));
|
|
@@ -26,13 +26,13 @@ const RUN_TEAM = read("skills", "run-team", "SKILL.md");
|
|
|
26
26
|
const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
|
|
27
27
|
|
|
28
28
|
const step7 = () =>
|
|
29
|
-
between(NEXT_TICKET, "## 7. When the
|
|
29
|
+
between(NEXT_TICKET, "## 7. When the sizing-a-ticket path reports done", "## Red flags", "next-ticket/SKILL.md step 7");
|
|
30
30
|
|
|
31
31
|
// The member reads the implementer agent body verbatim — its system prompt
|
|
32
32
|
// since #1804 moved the blocks there out of run-team's phase 2
|
|
33
33
|
// (spec 2026-09-24 § 2 Decision 2); the same slice `member-prompt-prose.test.mjs`
|
|
34
34
|
// takes, for the same reason.
|
|
35
|
-
const memberBlocks = () => read("agents", "fleet-implementer.agent.md").split("---").slice(2).join("---");
|
|
35
|
+
const memberBlocks = () => read("agents", "fleet-implementer-slow-high.agent.md").split("---").slice(2).join("---");
|
|
36
36
|
|
|
37
37
|
const finisherLabelDuty = () =>
|
|
38
38
|
between(RUN_TEAM, "Add `ready-to-merge`", "A halt at step 1 reads identical from a bare SHA mismatch", "run-team finisher duty 3");
|
|
@@ -143,6 +143,21 @@ test("the finisher's assertion accepts a normally-labelled PR — it counts rele
|
|
|
143
143
|
);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
+
// #2331: duty 3 read as one item let two finishers stop at the release-label
|
|
147
|
+
// check and report `labelled` with no `ready-to-merge` on the PR. The add is
|
|
148
|
+
// its own sub-step, after the check, and carries the command itself — sliced
|
|
149
|
+
// to each sub-step, so a command left elsewhere in duty 3 does not satisfy it.
|
|
150
|
+
test("duty 3 is two sub-steps — the release-label check, then the add-label command", () => {
|
|
151
|
+
const a = between(RUN_TEAM, "- **(a) Exactly one release label.**", "- **(b) Add the label:**", "finisher duty 3(a)");
|
|
152
|
+
const b = between(RUN_TEAM, "- **(b) Add the label:**", "4. Report you the label", "finisher duty 3(b)");
|
|
153
|
+
assert.match(a, phrase("exactly one"), "3(a) no longer holds the release-label count");
|
|
154
|
+
assert.doesNotMatch(a, /--add-label/, "3(a) adds a label — the precondition and the action are one step again");
|
|
155
|
+
assert.match(b, /`gh pr edit <pr> --add-label ready-to-merge`/, "3(b) no longer spells out the add-label command");
|
|
156
|
+
assert.ok(RUN_TEAM.indexOf("- **(a) Exactly one release label.**") < RUN_TEAM.indexOf("- **(b) Add the label:**"), "the add precedes its precondition");
|
|
157
|
+
assert.match(between(RUN_TEAM, "4. Report you the label", "\n\n", "finisher duty 4"), phrase("post-add read-back: `gh pr view <pr> --json labels`"),
|
|
158
|
+
"duty 4 no longer reports the label read back after the add");
|
|
159
|
+
});
|
|
160
|
+
|
|
146
161
|
test("the solo labelling step gates on the release label too — the fleet finisher is not its only writer", () => {
|
|
147
162
|
// `review-and-fix.md` step 6 is the other writer of `ready-to-merge`. A guard
|
|
148
163
|
// on the fleet path alone leaves the standalone path labelling PRs with no
|