@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
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
import { test } from "node:test";
|
|
20
20
|
import assert from "node:assert/strict";
|
|
21
21
|
import { spawnSync, spawn, execFileSync } from "node:child_process";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { mkdirSync, writeFileSync, realpathSync } from "node:fs";
|
|
23
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
24
24
|
import { join } from "node:path";
|
|
25
25
|
import { fileURLToPath } from "node:url";
|
|
26
26
|
import { encodeProjectDir } from "./board.mjs";
|
|
27
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
27
28
|
|
|
28
29
|
const BOARD = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
29
30
|
const LEDGER = fileURLToPath(new URL("./ledger.mjs", import.meta.url));
|
|
@@ -47,15 +48,14 @@ const ompTurn = (cacheWrite) => [
|
|
|
47
48
|
// case below needs a real one the read has to carry back whole. `seed` lays
|
|
48
49
|
// the transcript tree into the fake $HOME for the child's cwd.
|
|
49
50
|
function runBoard(sinceArgs, ledgerFile, seed = seedDefault) {
|
|
50
|
-
const home =
|
|
51
|
+
const home = tempDir("since-home-");
|
|
51
52
|
// realpath, not the bare mkdtemp path: on darwin $TMPDIR is under /var, which
|
|
52
53
|
// is a symlink to /private/var, and the child's process.cwd() reports the
|
|
53
54
|
// RESOLVED form. Encoding the unresolved one puts the fixture at a path
|
|
54
55
|
// findSubagentsDir never looks in, and the panel comes back { error }.
|
|
55
|
-
const cwd = realpathSync(
|
|
56
|
-
const bin =
|
|
57
|
-
|
|
58
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
56
|
+
const cwd = realpathSync(tempDir("since-cwd-"));
|
|
57
|
+
const bin = tempDir("since-bin-");
|
|
58
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 1\n");
|
|
59
59
|
seed(home, cwd);
|
|
60
60
|
return spawnSync(process.execPath, [BOARD, "build", "--ledger", ledgerFile ?? join(cwd, "nope.md"), ...sinceArgs], {
|
|
61
61
|
cwd, encoding: "utf8",
|
|
@@ -155,7 +155,7 @@ test("no --spend-since at all is not an error — the panel is simply unscoped",
|
|
|
155
155
|
// a resolvable session at the encoded cwd, so the heuristic has a real answer
|
|
156
156
|
// of its own and a flag that did nothing would still produce a panel.
|
|
157
157
|
test("build: --spend-dir reads the named directory instead of the session the heuristic picks", () => {
|
|
158
|
-
const root =
|
|
158
|
+
const root = tempDir("since-named-");
|
|
159
159
|
const dir = join(root, "2026-08-25T09-00-00-000Z_abcdef12-3456-7890-abcd-ef1234567890");
|
|
160
160
|
mkdirSync(dir, { recursive: true });
|
|
161
161
|
writeFileSync(join(dir, "named.jsonl"), ompTurn(2000));
|
|
@@ -185,7 +185,7 @@ test("build: --spend-dir naming a directory that does not exist yet is accepted,
|
|
|
185
185
|
// launch, and the cockpit launches in run-team phase 0, before that. The
|
|
186
186
|
// operator names the directory; it appears seconds later. Until then the
|
|
187
187
|
// panel hides — never zeroes, and never a refusal.
|
|
188
|
-
const r = runBoard(["--spend-dir", join(
|
|
188
|
+
const r = runBoard(["--spend-dir", join(tempDir("since-absent-"), "2026-08-26T09-00-00-000Z_01a08126-ee04-7095-a695-14e3249f1128")]);
|
|
189
189
|
assert.equal(r.status, 0, r.stderr);
|
|
190
190
|
const spend = JSON.parse(r.stdout).spend;
|
|
191
191
|
assert.equal(spend.ok, false, "an unreadable named directory must not report spend");
|
|
@@ -245,7 +245,7 @@ test("build: the panel comes from this workspace's own omp session, with its too
|
|
|
245
245
|
test("build: --spend-dir accepts a session directory over a heuristic that resolves elsewhere", () => {
|
|
246
246
|
// runBoard's default seed gives the heuristic a session of its own (1000),
|
|
247
247
|
// so these numbers can only arrive through the named directory.
|
|
248
|
-
const dir = ompSessionAt(
|
|
248
|
+
const dir = ompSessionAt(tempDir("since-omp-"));
|
|
249
249
|
const r = runBoard(["--spend-dir", dir]);
|
|
250
250
|
assert.equal(r.status, 0, r.stderr);
|
|
251
251
|
const spend = JSON.parse(r.stdout).spend;
|
|
@@ -391,10 +391,9 @@ assert.ok(
|
|
|
391
391
|
// rather than piped — nothing here asserts on it, and an unread pipe is one
|
|
392
392
|
// more thing that can stall the child.
|
|
393
393
|
function runBoardFlooded() {
|
|
394
|
-
const cwd =
|
|
395
|
-
const bin =
|
|
396
|
-
|
|
397
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
394
|
+
const cwd = tempDir("since-flood-cwd-");
|
|
395
|
+
const bin = tempDir("since-flood-bin-");
|
|
396
|
+
writeExecStub(join(bin, "gh"), FLOOD_GH_STUB);
|
|
398
397
|
return new Promise((resolve) => {
|
|
399
398
|
const child = spawn(
|
|
400
399
|
process.execPath,
|
|
@@ -517,7 +516,7 @@ function oversizedLedger() {
|
|
|
517
516
|
}
|
|
518
517
|
|
|
519
518
|
test("build: a ledger read past node's default stdout cap arrives whole, not as an empty board", () => {
|
|
520
|
-
const dir =
|
|
519
|
+
const dir = tempDir("board-big-ledger-");
|
|
521
520
|
const ledger = join(dir, "ledger.md");
|
|
522
521
|
writeFileSync(ledger, oversizedLedger());
|
|
523
522
|
|
|
@@ -568,14 +567,12 @@ test("build: a ledger read past node's default stdout cap arrives whole, not as
|
|
|
568
567
|
// Split from the spawn itself so the timing test below can drive the same
|
|
569
568
|
// fixture through python3's saturated-pipe rig instead of spawnSync.
|
|
570
569
|
function boardFaultFixture() {
|
|
571
|
-
const cwd = realpathSync(
|
|
572
|
-
const bin =
|
|
573
|
-
|
|
574
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
570
|
+
const cwd = realpathSync(tempDir("board-fault-cwd-"));
|
|
571
|
+
const bin = tempDir("board-fault-bin-");
|
|
572
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 1\n");
|
|
575
573
|
// Valid JSON, wrong shape: `rows` is an object where every consumer wants an
|
|
576
574
|
// array. Answers any argv, which is all gather()'s single `node` read needs.
|
|
577
|
-
|
|
578
|
-
chmodSync(join(bin, "node"), 0o755);
|
|
575
|
+
writeExecStub(join(bin, "node"), `#!/bin/sh\necho '{"rows":{},"filed":[],"ruled":[]}'\n`);
|
|
579
576
|
return {
|
|
580
577
|
cwd,
|
|
581
578
|
argv: [BOARD, "build", "--ledger", join(cwd, "nope.md")],
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
import { test } from "node:test";
|
|
24
24
|
import assert from "node:assert/strict";
|
|
25
25
|
import { spawnSync, spawn } from "node:child_process";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
26
|
+
import { rmSync, readFileSync, realpathSync, symlinkSync } from "node:fs";
|
|
27
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
28
28
|
import { join } from "node:path";
|
|
29
29
|
import { fileURLToPath } from "node:url";
|
|
30
30
|
import { resolveCockpitInstance } from "./board.mjs";
|
|
31
31
|
import { gitEnv } from "./git-env.mjs";
|
|
32
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
32
33
|
|
|
33
34
|
const SCRIPT = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
34
35
|
const HTML = readFileSync(new URL("./board.html", import.meta.url), "utf8");
|
|
@@ -44,12 +45,11 @@ const PORT_BASE = 8123;
|
|
|
44
45
|
// read fails fast instead of shelling out to a real ledger.mjs. None of these
|
|
45
46
|
// tests asserts a ticket.
|
|
46
47
|
function shimPath(ghBody) {
|
|
47
|
-
const bin =
|
|
48
|
+
const bin = tempDir("board-id-bin-");
|
|
48
49
|
const real = spawnSync("sh", ["-c", "command -v git"], { encoding: "utf8" });
|
|
49
50
|
assert.equal(real.status, 0, "test setup: no git on PATH to shim, so the resolved arm cannot be reached");
|
|
50
51
|
symlinkSync(real.stdout.trim(), join(bin, "git"));
|
|
51
|
-
|
|
52
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
52
|
+
writeExecStub(join(bin, "gh"), ghBody);
|
|
53
53
|
return bin;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -67,7 +67,7 @@ const ghNamed = (nameWithOwner) => "#!/bin/sh\ncase \"$1 $2\" in\n\"repo view\")
|
|
|
67
67
|
// the workspace it derives. Comparing against the unresolved form would fail
|
|
68
68
|
// on the symlink rather than on the behaviour.
|
|
69
69
|
function gitRepo(prefix) {
|
|
70
|
-
const dir = realpathSync(
|
|
70
|
+
const dir = realpathSync(tempDir(prefix));
|
|
71
71
|
// GIT_DIR/GIT_WORK_TREE scrubbed off the fixture too: under an ambient one
|
|
72
72
|
// `git init` exits 0 having re-inited whichever directory the variable
|
|
73
73
|
// names, leaving this one silently not a repository.
|
|
@@ -80,7 +80,7 @@ function gitRepo(prefix) {
|
|
|
80
80
|
// omp session transcripts, and pointing it at an empty directory keeps these
|
|
81
81
|
// runs off the machine's real session tree.
|
|
82
82
|
function runBuild(cwd, bin) {
|
|
83
|
-
const home =
|
|
83
|
+
const home = tempDir("board-id-home-");
|
|
84
84
|
const r = spawnSync(process.execPath, [SCRIPT, "build"], {
|
|
85
85
|
cwd, encoding: "utf8", timeout: 20000,
|
|
86
86
|
env: { ...process.env, PATH: bin, HOME: home },
|
|
@@ -116,7 +116,7 @@ test("CLI: a built snapshot names the workspace it describes and the port that w
|
|
|
116
116
|
// leaving a reader unable to tell an old payload from a degraded one.
|
|
117
117
|
test("CLI: a build with no resolvable workspace still carries both keys — null workspace, base port", () => {
|
|
118
118
|
const bin = shimPath(GH_FAILS);
|
|
119
|
-
const cwd = realpathSync(
|
|
119
|
+
const cwd = realpathSync(tempDir("board-id-nogit-"));
|
|
120
120
|
try {
|
|
121
121
|
const r = runBuild(cwd, bin);
|
|
122
122
|
assert.equal(r.status, 0, r.stderr);
|
|
@@ -138,7 +138,7 @@ const withTimeout = (pr, ms, what) => Promise.race([
|
|
|
138
138
|
]);
|
|
139
139
|
|
|
140
140
|
function serveProcess(cwd, bin) {
|
|
141
|
-
const home =
|
|
141
|
+
const home = tempDir("board-id-home-");
|
|
142
142
|
const p = spawn(process.execPath, [SCRIPT, "serve", "--port", "0", "--interval", "3600"],
|
|
143
143
|
{ cwd, env: { ...process.env, PATH: bin, HOME: home }, stdio: ["ignore", "ignore", "pipe"] });
|
|
144
144
|
p.stderr.setEncoding("utf8");
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
import { test } from "node:test";
|
|
15
15
|
import assert from "node:assert/strict";
|
|
16
16
|
import { spawnSync } from "node:child_process";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
18
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
19
19
|
import { join } from "node:path";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
21
22
|
|
|
22
23
|
const BOARD = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
23
24
|
const HTML = readFileSync(new URL("./board.html", import.meta.url), "utf8");
|
|
@@ -82,11 +83,10 @@ test("livenessBanner stays silent for a run with nothing to report", () => {
|
|
|
82
83
|
// their own default path resolution, in a throwaway repository, and asserts
|
|
83
84
|
// the mark one wrote reaches the board the other built.
|
|
84
85
|
test("a mark written by the real heartbeat reaches the real board (#1597)", () => {
|
|
85
|
-
const repo =
|
|
86
|
+
const repo = tempDir("board-liveness-e2e-");
|
|
86
87
|
assert.equal(spawnSync("git", ["init", "-q", repo], { encoding: "utf8" }).status, 0);
|
|
87
|
-
const bin =
|
|
88
|
-
|
|
89
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
88
|
+
const bin = tempDir("board-liveness-bin-");
|
|
89
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 1\n");
|
|
90
90
|
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
|
|
91
91
|
|
|
92
92
|
// `--stop` rather than a beat: a deliberate stop is reported at once, where
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
import { test } from "node:test";
|
|
30
30
|
import assert from "node:assert/strict";
|
|
31
31
|
import { spawnSync } from "node:child_process";
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
32
|
+
import { writeFileSync } from "node:fs";
|
|
33
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
34
34
|
import { join } from "node:path";
|
|
35
35
|
import { fileURLToPath } from "node:url";
|
|
36
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
36
37
|
|
|
37
38
|
const BOARD = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
38
39
|
|
|
@@ -57,18 +58,17 @@ process.exit(2);`;
|
|
|
57
58
|
// below would read `undefined` from a parse of nothing. Asserting status here
|
|
58
59
|
// keeps that failure legible at the one place it can happen.
|
|
59
60
|
function gathered(prevBody) {
|
|
60
|
-
const cwd =
|
|
61
|
-
const bin =
|
|
62
|
-
const scriptDir =
|
|
61
|
+
const cwd = tempDir("board-prevshape-");
|
|
62
|
+
const bin = tempDir("board-prevshape-bin-");
|
|
63
|
+
const scriptDir = tempDir("board-prevshape-scripts-");
|
|
63
64
|
|
|
64
65
|
writeFileSync(join(scriptDir, "ci-state.mjs"), CI_READ_FAILS);
|
|
65
66
|
// A real ledger answer, so the only unusual read on this stderr is the one
|
|
66
67
|
// under test — the assertions below count lines.
|
|
67
68
|
writeFileSync(join(scriptDir, "ledger.mjs"),
|
|
68
69
|
`console.log(JSON.stringify({ rows: [], filed: [], ruled: [] }));`);
|
|
69
|
-
|
|
70
|
+
writeExecStub(join(bin, "gh"),
|
|
70
71
|
'#!/bin/sh\ncase "$1 $2" in\n"pr list") echo \'[{"number":42,"state":"OPEN","labels":[],"title":"t"}]\' ;;\n*) exit 1 ;;\nesac\n');
|
|
71
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
72
72
|
|
|
73
73
|
const prevFile = join(cwd, "prev.json");
|
|
74
74
|
writeFileSync(prevFile, prevBody);
|
|
@@ -193,11 +193,10 @@ for (const body of ACCEPTED) {
|
|
|
193
193
|
// read degrades through tryRun — so the board still builds with no network and
|
|
194
194
|
// no read of this repo's live issue list.
|
|
195
195
|
function runBuild(prevArgs) {
|
|
196
|
-
const cwd =
|
|
197
|
-
const home =
|
|
198
|
-
const bin =
|
|
199
|
-
|
|
200
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
196
|
+
const cwd = tempDir("board-prevshape-cli-");
|
|
197
|
+
const home = tempDir("board-prevshape-home-");
|
|
198
|
+
const bin = tempDir("board-prevshape-cli-bin-");
|
|
199
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 1\n");
|
|
201
200
|
return spawnSync(process.execPath, [BOARD, "build", "--ledger", join(cwd, "nope.md"), ...prevArgs], {
|
|
202
201
|
cwd, encoding: "utf8", maxBuffer: 64 * 1024 * 1024,
|
|
203
202
|
env: { ...process.env, HOME: home, PATH: `${bin}:${process.env.PATH}` },
|
|
@@ -205,7 +204,7 @@ function runBuild(prevArgs) {
|
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
test("build: an ignored previous board changes neither the exit code nor stdout (#1192)", () => {
|
|
208
|
-
const prevFile = join(
|
|
207
|
+
const prevFile = join(tempDir("board-prevshape-file-"), "prev.json");
|
|
209
208
|
writeFileSync(prevFile, '{"tickets": 5}');
|
|
210
209
|
const withPrev = runBuild(["--prev", prevFile]);
|
|
211
210
|
// The baseline is measured in the same run rather than asserted as a
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
import { test } from "node:test";
|
|
34
34
|
import assert from "node:assert/strict";
|
|
35
35
|
import { spawnSync } from "node:child_process";
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
36
|
+
import { writeFileSync } from "node:fs";
|
|
37
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
38
38
|
import { join } from "node:path";
|
|
39
39
|
import { fileURLToPath } from "node:url";
|
|
40
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
40
41
|
|
|
41
42
|
const BOARD = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
42
43
|
|
|
@@ -49,20 +50,19 @@ const REPO_JSON = '{"nameWithOwner":"o/r","url":"https://example.invalid/o/r"}';
|
|
|
49
50
|
// `node <scriptDir>/ledger.mjs`, and only a stub can hand it stdout that
|
|
50
51
|
// arrives at exit 0 and parses to something no real ledger.mjs emits.
|
|
51
52
|
function gatherWith({ issuesJson = "[]", prsJson = "[]", ledgerBody = null } = {}) {
|
|
52
|
-
const cwd =
|
|
53
|
-
const bin =
|
|
54
|
-
const scriptDir =
|
|
53
|
+
const cwd = tempDir("board-tpnull-");
|
|
54
|
+
const bin = tempDir("board-tpnull-bin-");
|
|
55
|
+
const scriptDir = tempDir("board-tpnull-scripts-");
|
|
55
56
|
|
|
56
57
|
writeFileSync(join(scriptDir, "ci-state.mjs"), "process.stdout.write('{}');\n");
|
|
57
58
|
writeFileSync(join(scriptDir, "ledger.mjs"),
|
|
58
59
|
ledgerBody ?? `console.log(JSON.stringify({ rows: [], filed: [], ruled: [] }));`);
|
|
59
|
-
|
|
60
|
+
writeExecStub(join(bin, "gh"),
|
|
60
61
|
`#!/bin/sh\ncase "$1 $2" in\n` +
|
|
61
62
|
`"issue list") echo '${issuesJson}' ;;\n` +
|
|
62
63
|
`"pr list") echo '${prsJson}' ;;\n` +
|
|
63
64
|
`"repo view") echo '${REPO_JSON}' ;;\n` +
|
|
64
65
|
`*) exit 1 ;;\nesac\n`);
|
|
65
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
66
66
|
|
|
67
67
|
const driver = `const { gather } = await import(${JSON.stringify(BOARD)});
|
|
68
68
|
const r = await gather({ ledgerFile: ${JSON.stringify(join(cwd, "ledger.md"))},
|
package/scripts/board.mjs
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
// heuristic outright.
|
|
33
33
|
|
|
34
34
|
import { execFile, spawnSync } from "node:child_process";
|
|
35
|
-
import { readFileSync, writeFileSync, renameSync, existsSync,
|
|
35
|
+
import { readFileSync, writeFileSync, renameSync, existsSync, readdirSync, statSync, writeSync } from "node:fs";
|
|
36
36
|
import { classifyRole, computeSpend, attributeTools, mergeTools } from "./compute-spend.mjs";
|
|
37
37
|
import {
|
|
38
38
|
encodeProjectDir, isOmpSessionDirName, ompSessionTranscripts, foldOmpTranscript, ompMemberRecord,
|
|
@@ -49,6 +49,7 @@ import { mergedReadPrs } from "./compute-board.mjs";
|
|
|
49
49
|
// caller takes (#1582), and a second probe could answer differently.
|
|
50
50
|
import { readState, stateFileIn } from "./fleet-state.mjs";
|
|
51
51
|
import { fileURLToPath } from "node:url";
|
|
52
|
+
import { isCLI } from "./is-cli.mjs";
|
|
52
53
|
import { dirname, join, basename } from "node:path";
|
|
53
54
|
import { createServer, request as httpRequest } from "node:http";
|
|
54
55
|
import { inspect } from "node:util";
|
|
@@ -2029,9 +2030,5 @@ function fault(e) {
|
|
|
2029
2030
|
process.exit(FAULT_EXIT);
|
|
2030
2031
|
}
|
|
2031
2032
|
|
|
2032
|
-
// Only run main() as a CLI, never when imported by a test
|
|
2033
|
-
|
|
2034
|
-
// how node was invoked.
|
|
2035
|
-
const isCLI = process.argv[1] &&
|
|
2036
|
-
realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
2037
|
-
if (isCLI) main().catch(fault);
|
|
2033
|
+
// Only run main() as a CLI, never when imported by a test (see is-cli.mjs).
|
|
2034
|
+
if (isCLI(import.meta.url)) main().catch(fault);
|