@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
4
5
|
import { join } from "node:path";
|
|
5
6
|
|
|
6
7
|
// #516. A scan over every tracked `.mjs`/`.sh`/`.js`/`.yml` file for
|
|
@@ -1570,3 +1571,60 @@ test("both rows and the window count read a bare footnote marker as a sentence e
|
|
|
1570
1571
|
assert.doesNotMatch("For minor and patch bumps, jq '.[] | .x' keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
|
|
1571
1572
|
assert.doesNotMatch("For minor and patch bumps, `m?.[1] || x` keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
|
|
1572
1573
|
});
|
|
1574
|
+
|
|
1575
|
+
// #2431. The `review-pr-*.test.mjs` suite was deleted (ed9f2967) and its
|
|
1576
|
+
// surviving pins moved to `review-core-*`; the citations that kept naming the old files were
|
|
1577
|
+
// retargeted by hand. A citation of a file that is gone is only legitimate as a
|
|
1578
|
+
// git-object path — `<sha>^:plugin/scripts/<name>` or `<sha>:plugin/scripts/<name>`
|
|
1579
|
+
// — which names the revision it is read at.
|
|
1580
|
+
const DELETED_TEST_CITATION = /(?<![0-9a-f]{7,40}\^?:\s?plugin\/scripts\/)(?<![\w-])review-pr-[a-z0-9-]+\.test\.mjs/g;
|
|
1581
|
+
const deletedTestCitations = (text) => [...normalize(text).matchAll(DELETED_TEST_CITATION)].map((m) => m[0]);
|
|
1582
|
+
|
|
1583
|
+
function* pluginFiles(dir) {
|
|
1584
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
1585
|
+
if (entry.name === "node_modules") continue;
|
|
1586
|
+
const full = join(dir, entry.name);
|
|
1587
|
+
if (entry.isDirectory()) yield* pluginFiles(full);
|
|
1588
|
+
else yield full;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
test("no file under plugin/ cites a deleted review-pr-*.test.mjs without a git-object path (#2431)", () => {
|
|
1593
|
+
for (const file of pluginFiles(REPO)) {
|
|
1594
|
+
if (file === import.meta.filename) continue;
|
|
1595
|
+
assert.deepEqual(deletedTestCitations(readFileSync(file, "utf8")), [], `${file} cites a review-pr-*.test.mjs file that no longer exists — name its review-core-* successor, or a pinned revision such as \`ed9f2967^:plugin/scripts/<name>\``);
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
test("the plugin walk reads extensionless scripts and skips node_modules (#2431)", () => {
|
|
1600
|
+
const dir = mkdtempSync(join(tmpdir(), "plugin-walk-"));
|
|
1601
|
+
try {
|
|
1602
|
+
mkdirSync(join(dir, "sub"));
|
|
1603
|
+
mkdirSync(join(dir, "node_modules"));
|
|
1604
|
+
writeFileSync(join(dir, "fleet-run"), "// see review-pr-reads.test.mjs\n");
|
|
1605
|
+
writeFileSync(join(dir, "sub", "board.html"), "<!-- review-pr-reads.test.mjs -->\n");
|
|
1606
|
+
writeFileSync(join(dir, "node_modules", "dep.mjs"), "// review-pr-reads.test.mjs\n");
|
|
1607
|
+
assert.deepEqual([...pluginFiles(dir)].map((f) => f.slice(dir.length + 1)).sort(), ["fleet-run", join("sub", "board.html")]);
|
|
1608
|
+
} finally {
|
|
1609
|
+
rmSync(dir, { recursive: true, force: true });
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
test("the deleted-test citation ban accepts git-object paths and review-core-* names", () => {
|
|
1614
|
+
for (const text of [
|
|
1615
|
+
"// `ed9f2967^:plugin/scripts/review-pr-inbound-citation-prose.test.mjs` asserted",
|
|
1616
|
+
"// f743264:plugin/scripts/review-pr-reads.test.mjs | grep -A2",
|
|
1617
|
+
"// in `ed9f2967^:plugin/scripts/review-pr-citation-prose.test.mjs` looked like",
|
|
1618
|
+
"// `ed9f2967^:\n// plugin/scripts/review-pr-x.test.mjs` wrapped after the colon",
|
|
1619
|
+
"// review-core-snapshot-path.test.mjs's guard-ordering pin.",
|
|
1620
|
+
"// prefix-review-pr-x.test.mjs is a different file",
|
|
1621
|
+
]) assert.deepEqual(deletedTestCitations(text), [], text);
|
|
1622
|
+
for (const text of [
|
|
1623
|
+
"// review-pr-snapshot-path.test.mjs's guard-ordering pin.",
|
|
1624
|
+
"// `review-pr-citation-prose.test.mjs`, one",
|
|
1625
|
+
"// plugin/scripts/review-pr-reads.test.mjs",
|
|
1626
|
+
"// abc^:review-pr-reads.test.mjs",
|
|
1627
|
+
"// abc123^:plugin/scripts/review-pr-x.test.mjs",
|
|
1628
|
+
"// review-pr-2nd-pass.test.mjs",
|
|
1629
|
+
]) assert.equal(deletedTestCitations(text).length, 1, text);
|
|
1630
|
+
});
|
|
@@ -17,6 +17,7 @@ import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
|
17
17
|
import { tmpdir } from "node:os";
|
|
18
18
|
import { join } from "node:path";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
20
21
|
|
|
21
22
|
const CLAIM = fileURLToPath(new URL("./claim-ticket.sh", import.meta.url));
|
|
22
23
|
const REAP = fileURLToPath(new URL("./reap.sh", import.meta.url));
|
|
@@ -53,7 +54,7 @@ function fixture(t) {
|
|
|
53
54
|
execFileSync("git", ["-c", "init.defaultBranch=main", "init", "-q", "--bare", origin], { env: BASE_ENV });
|
|
54
55
|
execFileSync("git", ["clone", "-q", origin, w], { env: BASE_ENV });
|
|
55
56
|
execFileSync("mkdir", ["-p", bin]);
|
|
56
|
-
|
|
57
|
+
writeExecStub(join(bin, "gh"), '#!/bin/sh\ncase "$*" in *"issue view"*) echo in-progress;; esac\nexit 0\n');
|
|
57
58
|
const env = { ...BASE_ENV, PATH: `${bin}:${process.env.PATH}` };
|
|
58
59
|
const git = (cwd, ...a) => execFileSync("git", a, { cwd, env, encoding: "utf8" }).trim();
|
|
59
60
|
writeFileSync(join(w, "README.md"), "fixture\n");
|
|
@@ -3,7 +3,9 @@ import assert from "node:assert/strict";
|
|
|
3
3
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
4
4
|
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, chmodSync, existsSync, symlinkSync, copyFileSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
6
7
|
import { join, dirname } from "node:path";
|
|
8
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
7
9
|
|
|
8
10
|
const SCRIPT = join(import.meta.dirname, "claim-ticket.sh");
|
|
9
11
|
|
|
@@ -26,7 +28,7 @@ const FIXTURE_ENV = { ...process.env, GIT_DIR: undefined, GIT_WORK_TREE: undefin
|
|
|
26
28
|
// overridable; `null` writes no cache at all. The default is the smallest
|
|
27
29
|
// Recipe that runs anywhere: nothing to install, nothing to fail.
|
|
28
30
|
function repo(files, local = {}, recipe = {}) {
|
|
29
|
-
const dir =
|
|
31
|
+
const dir = tempDir("claim-");
|
|
30
32
|
const git = (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", env: FIXTURE_ENV, encoding: "utf8" });
|
|
31
33
|
git("init", "-q");
|
|
32
34
|
git("config", "user.email", "t@t");
|
|
@@ -77,8 +79,8 @@ const TESTS = "run-tests.sh";
|
|
|
77
79
|
// template.
|
|
78
80
|
function apply(files, script = SCRIPT, recipe = {}) {
|
|
79
81
|
const dir = repo(files, {}, recipe);
|
|
80
|
-
const bin =
|
|
81
|
-
|
|
82
|
+
const bin = tempDir("claim-bin-");
|
|
83
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
82
84
|
const r = spawnSync("sh", [script, "42", "slug", "fix", "--apply"], {
|
|
83
85
|
cwd: dir,
|
|
84
86
|
encoding: "utf8",
|
|
@@ -226,7 +228,7 @@ test("runner: the stamp is stable across claims of the same template", () => {
|
|
|
226
228
|
// script and the stamp must move. Copying rather than editing the real
|
|
227
229
|
// script in place keeps this test from mutating the file under test.
|
|
228
230
|
test("runner: the stamp changes when the script's content changes", () => {
|
|
229
|
-
const scriptDir =
|
|
231
|
+
const scriptDir = tempDir("claim-script-");
|
|
230
232
|
const editedScript = join(scriptDir, "claim-ticket.sh");
|
|
231
233
|
writeFileSync(editedScript, readFileSync(SCRIPT, "utf8") + "\n# a harmless edit\n");
|
|
232
234
|
// claim-ticket.sh resolves three siblings relative to itself
|
|
@@ -236,8 +238,7 @@ test("runner: the stamp changes when the script's content changes", () => {
|
|
|
236
238
|
// edited copy or the script refuses before it emits anything — which is the
|
|
237
239
|
// guard working, not a regression.
|
|
238
240
|
const sibling = join(scriptDir, "derive-testcmd.sh");
|
|
239
|
-
|
|
240
|
-
chmodSync(sibling, 0o755);
|
|
241
|
+
writeExecStub(sibling, readFileSync(join(import.meta.dirname, "derive-testcmd.sh"), "utf8"));
|
|
241
242
|
for (const lib of ["json.sh", "worktree.sh"]) {
|
|
242
243
|
copyFileSync(join(import.meta.dirname, lib), join(scriptDir, lib));
|
|
243
244
|
}
|
|
@@ -303,7 +304,7 @@ for (const [what, stub] of [
|
|
|
303
304
|
]) {
|
|
304
305
|
test(`a checksum that ${what} refuses before anything is claimed, in both modes`, () => {
|
|
305
306
|
const dir = repo({ [TESTS]: "" });
|
|
306
|
-
const bin =
|
|
307
|
+
const bin = tempDir("claim cksum-");
|
|
307
308
|
assert.match(bin, / /, "fixture: the stub's directory must hold a space, or this pins nothing");
|
|
308
309
|
const ghLog = join(bin, "gh.log");
|
|
309
310
|
// `>> "$GH_LOG"`, not the interpolated path (#880). The path comes from
|
|
@@ -314,8 +315,8 @@ for (const [what, stub] of [
|
|
|
314
315
|
// ci-state.test.mjs's GH_STUB form keeps the path out of the script text.
|
|
315
316
|
// The prefix above now holds a space so this shape is exercised on every
|
|
316
317
|
// machine, not only one whose TMPDIR has one.
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
writeExecStub(join(bin, "gh"), `#!/bin/sh\necho "$@" >> "$GH_LOG"\nexit 0\n`);
|
|
319
|
+
writeExecStub(join(bin, "cksum"), stub);
|
|
319
320
|
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}`, GH_LOG: ghLog };
|
|
320
321
|
|
|
321
322
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], { cwd: dir, encoding: "utf8", env });
|
|
@@ -370,9 +371,9 @@ test("an absent Recipe cache refuses the claim before anything is claimed, namin
|
|
|
370
371
|
assert.match(dry.err, /claim-ticket: derive-testcmd: no Recipe cache at .*\/\.fleet\/recipe\.json/);
|
|
371
372
|
assert.match(dry.err, /run the Recipe derivation step \(run-team phase 0/);
|
|
372
373
|
|
|
373
|
-
const bin =
|
|
374
|
+
const bin = tempDir("claim-bin-");
|
|
374
375
|
const ghLog = join(bin, "gh.log");
|
|
375
|
-
|
|
376
|
+
writeExecStub(join(bin, "gh"), '#!/bin/sh\necho "$@" >> "$GH_LOG"\nexit 0\n');
|
|
376
377
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], {
|
|
377
378
|
cwd: dir, encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}`, GH_LOG: ghLog },
|
|
378
379
|
});
|
|
@@ -405,8 +406,8 @@ test("a repo with no origin/main refuses before anything is claimed", () => {
|
|
|
405
406
|
// Install step only runs under --apply.
|
|
406
407
|
function applyRecipe(recipe, files = { [TESTS]: "" }, local = {}) {
|
|
407
408
|
const dir = repo(files, local, recipe);
|
|
408
|
-
const bin =
|
|
409
|
-
|
|
409
|
+
const bin = tempDir("claim-bin-");
|
|
410
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
410
411
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], {
|
|
411
412
|
cwd: dir, encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
412
413
|
});
|
|
@@ -442,8 +443,8 @@ test("an Install step that writes only ignored files claims cleanly", () => {
|
|
|
442
443
|
test("an Install step that cannot run is named an invalid cache; one that fails is named failing", () => {
|
|
443
444
|
const dir = repo({ [TESTS]: "" }, { "setup.sh": "#!/bin/sh\n" }, { install: "./setup.sh" });
|
|
444
445
|
chmodSync(join(dir, "setup.sh"), 0o755);
|
|
445
|
-
const bin =
|
|
446
|
-
|
|
446
|
+
const bin = tempDir("claim-bin-");
|
|
447
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
447
448
|
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
|
|
448
449
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], { cwd: dir, encoding: "utf8", env });
|
|
449
450
|
assert.equal(r.status, 2, r.stdout + r.stderr);
|
|
@@ -469,8 +470,8 @@ test("an Install step that cannot run is named an invalid cache; one that fails
|
|
|
469
470
|
test("an Install step present but not executable is also named an invalid cache (exit 126)", () => {
|
|
470
471
|
const dir = repo({ [TESTS]: "", "setup.sh": "#!/bin/sh\n" }, {}, { install: "./setup.sh" });
|
|
471
472
|
chmodSync(join(dir, "setup.sh"), 0o755);
|
|
472
|
-
const bin =
|
|
473
|
-
|
|
473
|
+
const bin = tempDir("claim-bin-");
|
|
474
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
474
475
|
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
|
|
475
476
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], { cwd: dir, encoding: "utf8", env });
|
|
476
477
|
assert.equal(r.status, 2, r.stdout + r.stderr);
|
|
@@ -514,8 +515,8 @@ test("an install that creates an UNTRACKED file is caught under status.showUntra
|
|
|
514
515
|
const dir = repo({ [TESTS]: "" }, {}, { install: "printf '{}' > yarn.lock" });
|
|
515
516
|
// On the repo's own config, so the linked worktree the check runs in shares it.
|
|
516
517
|
execFileSync("git", ["config", "status.showUntrackedFiles", "no"], { cwd: dir, stdio: "pipe" });
|
|
517
|
-
const bin =
|
|
518
|
-
|
|
518
|
+
const bin = tempDir("claim-bin-");
|
|
519
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
519
520
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], {
|
|
520
521
|
cwd: dir,
|
|
521
522
|
encoding: "utf8",
|
|
@@ -645,10 +646,10 @@ test("--apply refuses an unreadable ancestor BEFORE the in-progress label", (t)
|
|
|
645
646
|
// above (#880): interpolated unquoted, this marker path word-split under a
|
|
646
647
|
// spaced `TMPDIR` and recorded nothing, turning the assertion below into a
|
|
647
648
|
// pin that passes hardest exactly when the stub is broken.
|
|
648
|
-
const bin =
|
|
649
|
+
const bin = tempDir("claim bin-");
|
|
649
650
|
assert.match(bin, / /, "fixture: the stub's directory must hold a space, or this pins nothing");
|
|
650
651
|
const marker = join(bin, "gh-ran");
|
|
651
|
-
|
|
652
|
+
writeExecStub(join(bin, "gh"), `#!/bin/sh\necho "$@" >> "$GH_LOG"\nexit 0\n`);
|
|
652
653
|
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}`, GH_LOG: marker };
|
|
653
654
|
|
|
654
655
|
const r = spawnSync("sh", [SCRIPT, "42", "slug", "fix", "--apply"], {
|
|
@@ -741,10 +742,10 @@ test("an ordinary slug is byte-identical — the escaping accepts what it should
|
|
|
741
742
|
// before a worktree, a label or a runner exists.
|
|
742
743
|
test("a missing json.sh is exit 2, before anything is created", () => {
|
|
743
744
|
const dir = repo({ [TESTS]: "" });
|
|
744
|
-
const lone =
|
|
745
|
+
const lone = tempDir("claim-nolib-");
|
|
745
746
|
copyFileSync(SCRIPT, join(lone, "claim-ticket.sh"));
|
|
746
|
-
const bin =
|
|
747
|
-
|
|
747
|
+
const bin = tempDir("claim-nolib-bin-");
|
|
748
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
748
749
|
|
|
749
750
|
const r = spawnSync("sh", [join(lone, "claim-ticket.sh"), "42", "slug", "fix", "--apply"], {
|
|
750
751
|
cwd: dir, encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
@@ -761,11 +762,11 @@ test("a missing json.sh is exit 2, before anything is created", () => {
|
|
|
761
762
|
// (#727's fourth caller of `gone()`) — json.sh present, worktree.sh absent.
|
|
762
763
|
test("a missing worktree.sh is exit 2, before anything is created", () => {
|
|
763
764
|
const dir = repo({ [TESTS]: "" });
|
|
764
|
-
const lone =
|
|
765
|
+
const lone = tempDir("claim-nowt-");
|
|
765
766
|
copyFileSync(SCRIPT, join(lone, "claim-ticket.sh"));
|
|
766
767
|
copyFileSync(join(dirname(SCRIPT), "json.sh"), join(lone, "json.sh"));
|
|
767
|
-
const bin =
|
|
768
|
-
|
|
768
|
+
const bin = tempDir("claim-nowt-bin-");
|
|
769
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
769
770
|
|
|
770
771
|
const r = spawnSync("sh", [join(lone, "claim-ticket.sh"), "42", "slug", "fix", "--apply"], {
|
|
771
772
|
cwd: dir, encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
@@ -813,8 +814,8 @@ const REAL_SED = execFileSync("sh", ["-c", "command -v sed"], { encoding: "utf8"
|
|
|
813
814
|
|
|
814
815
|
/** A dir holding a `sed` shim with the given body, prepended to PATH. */
|
|
815
816
|
function sedShim(body) {
|
|
816
|
-
const bin =
|
|
817
|
-
|
|
817
|
+
const bin = tempDir("claim-sed-shim-");
|
|
818
|
+
writeExecStub(join(bin, "sed"), `#!/bin/sh\n${body}\n`);
|
|
818
819
|
return `${bin}:${process.env.PATH}`;
|
|
819
820
|
}
|
|
820
821
|
|
|
@@ -891,7 +892,7 @@ test("a shadowed `sed` that works claims normally — the guard refuses only a r
|
|
|
891
892
|
// derive-testcmd.sh's stderr capture.
|
|
892
893
|
const SHIMMED = ["sh", "git", "sed", "tr", "python3", "dirname", "cksum", "grep", "mktemp", "cat", "rm"];
|
|
893
894
|
function shimPath({ node }) {
|
|
894
|
-
const bin =
|
|
895
|
+
const bin = tempDir("claim-path-");
|
|
895
896
|
for (const name of SHIMMED) {
|
|
896
897
|
const real = execFileSync("sh", ["-c", `command -v ${name}`], { encoding: "utf8" }).trim();
|
|
897
898
|
symlinkSync(real, join(bin, name));
|
|
@@ -943,10 +944,10 @@ function ghSpy() {
|
|
|
943
944
|
// the same job is what lets the unquoted one look normal, and the
|
|
944
945
|
// `ran() === true` assertion in the accept test below is what holds the env
|
|
945
946
|
// threading here honest.
|
|
946
|
-
const bin =
|
|
947
|
+
const bin = tempDir("claim ghspy-");
|
|
947
948
|
assert.match(bin, / /, "fixture: the stub's directory must hold a space, or this pins nothing");
|
|
948
949
|
const marker = join(bin, "ran");
|
|
949
|
-
|
|
950
|
+
writeExecStub(join(bin, "gh"), `#!/bin/sh\necho "$@" >> "$GH_LOG"\nexit 0\n`);
|
|
950
951
|
return { env: { ...process.env, PATH: `${bin}:${process.env.PATH}`, GH_LOG: marker }, ran: () => existsSync(marker) };
|
|
951
952
|
}
|
|
952
953
|
|
|
@@ -1093,8 +1094,8 @@ test("an ambient GIT_WORK_TREE does not make a mutated tree look clean (#1020)",
|
|
|
1093
1094
|
// cross-platform optional deps out of a lockfile is the header's own example.
|
|
1094
1095
|
const files = { [TESTS]: "", ".gitignore": ".fleet/\n.worktrees/\n" };
|
|
1095
1096
|
const recipe = { install: "echo MUTATED >> run-tests.sh" };
|
|
1096
|
-
const bin =
|
|
1097
|
-
|
|
1097
|
+
const bin = tempDir("claim-bin-");
|
|
1098
|
+
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 0\n");
|
|
1098
1099
|
const env = (extra) => ({ ...FIXTURE_ENV, PATH: `${bin}:${process.env.PATH}`, ...extra });
|
|
1099
1100
|
|
|
1100
1101
|
// The control, and it is not optional: it proves the install really mutates
|
|
@@ -150,7 +150,7 @@ test("a reflowed section still matches", () => {
|
|
|
150
150
|
// anchors as force-with-lease-reason-prose.test.mjs's step-7 slice.
|
|
151
151
|
const NEXT_TICKET = readFileSync(join(REPO, "plugin", "skills", "next-ticket", "SKILL.md"), "utf8");
|
|
152
152
|
const step7 = (text = NEXT_TICKET) =>
|
|
153
|
-
between(text, "## 7. When the
|
|
153
|
+
between(text, "## 7. When the sizing-a-ticket path reports done", "## Red flags", "next-ticket/SKILL.md step 7");
|
|
154
154
|
|
|
155
155
|
test("next-ticket step 7 says one keyword per intended close, and that several such closes are fine", () => {
|
|
156
156
|
// The per-issue half and the multi-close example are one span: a rewrite to
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
import { test } from "node:test";
|
|
26
26
|
import assert from "node:assert/strict";
|
|
27
27
|
import { spawn, spawnSync } from "node:child_process";
|
|
28
|
-
import {
|
|
28
|
+
import { symlinkSync, rmSync, realpathSync, existsSync } from "node:fs";
|
|
29
29
|
import { createServer } from "node:net";
|
|
30
|
-
import {
|
|
30
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
31
31
|
import { join } from "node:path";
|
|
32
32
|
import { fileURLToPath } from "node:url";
|
|
33
33
|
import { resolveCockpitInstance, cockpitPorts, probeCockpitWorkspace } from "./board.mjs";
|
|
34
34
|
import { gitEnv } from "./git-env.mjs";
|
|
35
|
+
import { writeExecStub } from "./exec-stub.mjs";
|
|
35
36
|
|
|
36
37
|
const SCRIPT = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
37
38
|
|
|
@@ -61,12 +62,11 @@ const slowGh = (mark) => "#!/bin/sh\ncase \"$1 $2\" in\n"
|
|
|
61
62
|
// ledger.mjs — the same shim board-identity.test.mjs uses, and no row here
|
|
62
63
|
// asserts a ticket.
|
|
63
64
|
function shimPath(mark) {
|
|
64
|
-
const bin =
|
|
65
|
+
const bin = tempDir("tick-bin-");
|
|
65
66
|
const real = spawnSync("sh", ["-c", "command -v git"], { encoding: "utf8" });
|
|
66
67
|
assert.equal(real.status, 0, "test setup: no git on PATH to shim, so the derived-port arm cannot be reached");
|
|
67
68
|
symlinkSync(real.stdout.trim(), join(bin, "git"));
|
|
68
|
-
|
|
69
|
-
chmodSync(join(bin, "gh"), 0o755);
|
|
69
|
+
writeExecStub(join(bin, "gh"), slowGh(mark));
|
|
70
70
|
return bin;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -74,7 +74,7 @@ function shimPath(mark) {
|
|
|
74
74
|
// which is a symlink to /private/var, and resolveCockpitInstance canonicalises
|
|
75
75
|
// the workspace it derives.
|
|
76
76
|
function gitRepo(prefix) {
|
|
77
|
-
const dir = realpathSync(
|
|
77
|
+
const dir = realpathSync(tempDir(prefix));
|
|
78
78
|
// GIT_DIR/GIT_WORK_TREE scrubbed off the fixture: under an ambient one `git
|
|
79
79
|
// init` exits 0 having re-inited whichever directory the variable names.
|
|
80
80
|
const init = spawnSync("git", ["init", "-q"], { cwd: dir, stdio: "ignore", env: gitEnv() });
|
|
@@ -148,9 +148,9 @@ const boardJson = async (port) => {
|
|
|
148
148
|
// candidate and never exits, so spawnSync reports the timeout instead of 0.
|
|
149
149
|
test("CLI: a relaunch that lands mid-gather() is answered within 1s and reuses the live cockpit", async () => {
|
|
150
150
|
const repo = gitRepo("tick-block-");
|
|
151
|
-
const mark = join(
|
|
151
|
+
const mark = join(tempDir("tick-mark-"), "gathering");
|
|
152
152
|
const bin = shimPath(mark);
|
|
153
|
-
const home =
|
|
153
|
+
const home = tempDir("tick-home-");
|
|
154
154
|
const instance = resolveCockpitInstance({ cwd: repo, gitCommonDir: join(repo, ".git") });
|
|
155
155
|
const expected = await firstFreePort(cockpitPorts(instance));
|
|
156
156
|
const first = serveProcess(repo, bin, home);
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
// here, main() being guarded on argv[1].
|
|
26
26
|
import { assessBeat, isStalled, stallReport } from "./fleet-state.mjs";
|
|
27
27
|
import { parseToken, HALT_CAUSES } from "./ledger-grammar.mjs";
|
|
28
|
-
import { PR_MENTION, REVIEWED } from "./fleet-tick.mjs";
|
|
28
|
+
import { PR_MENTION, REVIEWED, unlabelledFinishers } from "./fleet-tick.mjs";
|
|
29
29
|
|
|
30
30
|
// A ledger row is freeform, controller-authored text. Two real examples:
|
|
31
31
|
// #332 impl-332=PR#344 → PR#344 → MERGED 73b356de
|
|
@@ -65,6 +65,13 @@ import { PR_MENTION, REVIEWED } from "./fleet-tick.mjs";
|
|
|
65
65
|
// finisher tokens bound to the row's own PR: a live `-b` after the halt
|
|
66
66
|
// clears it.
|
|
67
67
|
//
|
|
68
|
+
// #2331: a PR whose finisher settled `labelled` while the open list shows no
|
|
69
|
+
// `ready-to-merge` on it carries a severity-4 `unlabelled` flag in REVIEW —
|
|
70
|
+
// fleet-tick.mjs's own reading (unlabelledFinishers: the latest attempt since
|
|
71
|
+
// the last `label-off=`), off the same `## Dispatched` and row tokens the tick
|
|
72
|
+
// reads, so the card is flagged whenever the tick is repairing it or escalated
|
|
73
|
+
// it — including after a whole-line `row` rewrite dropped the settled token.
|
|
74
|
+
//
|
|
68
75
|
// A PR's review is not a member (#1773 §7): `review=wf:<runId>` is a Workflow
|
|
69
76
|
// with nobody to name, while `review=member:<name>` and
|
|
70
77
|
// `review=fallback:<name>` name a runner member, live until the token is
|
|
@@ -288,6 +295,7 @@ export function deriveFlags(parsed, ctx) {
|
|
|
288
295
|
// gap the other way: still counted due for a fresh review while this flag
|
|
289
296
|
// is up and the head has not caught up to what was reviewed.
|
|
290
297
|
if (parsed.finisherOutcome?.startsWith("halted:") && ctx.column === "REVIEW") flags.push(parsed.finisherOutcome);
|
|
298
|
+
if (ctx.unlabelled && ctx.column === "REVIEW") flags.push("unlabelled");
|
|
291
299
|
const limit = STALE_MS[ctx.column];
|
|
292
300
|
if (limit != null && ctx.sinceEnteredStage != null && ctx.now - ctx.sinceEnteredStage > limit) {
|
|
293
301
|
flags.push("stale");
|
|
@@ -316,7 +324,7 @@ function titleFor(issue, pr, issues) {
|
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
const FLAG_SEVERITY = {
|
|
319
|
-
"red-ci": 5, "ledger-error": 5, killed: 4, "tier-mismatch": 4, blocked: 4, "sha-off-branch": 4,
|
|
327
|
+
"red-ci": 5, "ledger-error": 5, killed: 4, "tier-mismatch": 4, blocked: 4, "sha-off-branch": 4, unlabelled: 4,
|
|
320
328
|
...Object.fromEntries(HALT_CAUSES.map((c) => [`halted:${c}`, 4])),
|
|
321
329
|
stale: 1,
|
|
322
330
|
};
|
|
@@ -444,6 +452,8 @@ export function computeBoard(inputs) {
|
|
|
444
452
|
}
|
|
445
453
|
|
|
446
454
|
const parsed = (ledger.rows || []).map(parseRow).filter(Boolean);
|
|
455
|
+
const unqueued = new Set(prs.filter((p) => p.state === "OPEN" && !(p.labels || []).includes("ready-to-merge")).map((p) => p.number));
|
|
456
|
+
const unlabelled = new Set(unlabelledFinishers({ rows: ledger.rows || [], dispatched: ledger.dispatched || [] }, unqueued).map((u) => u.pr));
|
|
447
457
|
const rowIssues = new Set();
|
|
448
458
|
const tickets = [];
|
|
449
459
|
|
|
@@ -458,7 +468,7 @@ export function computeBoard(inputs) {
|
|
|
458
468
|
rowIssues.add(p.issue);
|
|
459
469
|
const sinceEnteredStage = stageEntry(prevTicket, column, now);
|
|
460
470
|
const ciState = p.pr != null ? (ci[p.pr] ?? "unknown") : null;
|
|
461
|
-
const flags = deriveFlags(p, { ci: ciState, column, sinceEnteredStage, now });
|
|
471
|
+
const flags = deriveFlags(p, { ci: ciState, column, sinceEnteredStage, now, unlabelled: unlabelled.has(p.pr) });
|
|
462
472
|
tickets.push({
|
|
463
473
|
issue: p.issue,
|
|
464
474
|
title: titleFor(p.issue, pr, issues),
|
|
@@ -596,7 +596,8 @@ test("#2083: a later finisher attempt decides — a live or labelled `-b` clears
|
|
|
596
596
|
for (const [row, flags] of [
|
|
597
597
|
["#941 impl-941=PR#931 · finisher-pr-931=halted:past-pin · finisher-pr-931-b", []],
|
|
598
598
|
["#941 impl-941=PR#931 · finisher-pr-931-b · finisher-pr-931=halted:past-pin", []],
|
|
599
|
-
|
|
599
|
+
// The halt clears; the `-b` labelled a PR that still has no label (#2331).
|
|
600
|
+
["#941 impl-941=PR#931 · finisher-pr-931=halted:live-editor · finisher-pr-931-b=labelled", ["unlabelled"]],
|
|
600
601
|
["#941 impl-941=PR#931 · finisher-pr-931=failed · finisher-pr-931-b=halted:rebase", ["halted:rebase"]],
|
|
601
602
|
// A bare copy beside the settled token is what a whole-line rewrite
|
|
602
603
|
// leaves; the member is still settled halted.
|
|
@@ -620,6 +621,68 @@ test("#2083: a halt a human already resolved — PR labelled or merged — flags
|
|
|
620
621
|
assert.deepEqual(card(merged, 941).flags, []);
|
|
621
622
|
});
|
|
622
623
|
|
|
624
|
+
// #2331: a finisher settled `labelled` on a PR the open list shows without
|
|
625
|
+
// `ready-to-merge` — the tick's reading, flagged at severity 4 whether the tick
|
|
626
|
+
// is repairing it or has escalated it.
|
|
627
|
+
test("#2331: a labelled finisher on a PR without ready-to-merge flags unlabelled, ranked exactly at severity 4", () => {
|
|
628
|
+
const b = computeBoard(reproInputs({
|
|
629
|
+
rows: ["#904 impl-904=killed", "#941 impl-941=PR#931 · finisher-pr-931=labelled", "#942 impl-942=killed",
|
|
630
|
+
"#943 impl-943=PR#932 · held-behind:#931"],
|
|
631
|
+
prev: { tickets: [] },
|
|
632
|
+
}));
|
|
633
|
+
assert.equal(card(b, 941).column, "REVIEW");
|
|
634
|
+
assert.deepEqual(card(b, 941).flags, ["unlabelled"]);
|
|
635
|
+
assert.deepEqual(b.attention.map((t) => t.issue), [904, 941, 942, 943]);
|
|
636
|
+
// Escalated (a second labelled attempt) flags the same.
|
|
637
|
+
assert.deepEqual(cardFor("#941 impl-941=PR#931 · finisher-pr-931=labelled · finisher-pr-931-b=labelled", 941).card.flags, ["unlabelled"]);
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
test("#2331: the label present, a live repair, a label-off'd attempt, or a closed PR flags nothing", () => {
|
|
641
|
+
const ready = computeBoard(reproInputs({ rows: ["#941 impl-941=PR#931 · finisher-pr-931=labelled"],
|
|
642
|
+
prs: [openPr(931, ["ready-to-merge"])], prev: { tickets: [] } }));
|
|
643
|
+
assert.equal(card(ready, 941).column, "READY");
|
|
644
|
+
assert.deepEqual(card(ready, 941).flags, []);
|
|
645
|
+
for (const row of [
|
|
646
|
+
"#941 impl-941=PR#931 · finisher-pr-931=labelled · finisher-pr-931-b",
|
|
647
|
+
"#941 impl-941=PR#931 · finisher-pr-931=labelled label-off=finisher-pr-931",
|
|
648
|
+
"#941 impl-941=PR#931 · finisher-pr-931",
|
|
649
|
+
]) {
|
|
650
|
+
assert.deepEqual(cardFor(row, 941).card.flags, [], row);
|
|
651
|
+
}
|
|
652
|
+
const merged = computeBoard(reproInputs({ rows: ["#941 impl-941=PR#931 · finisher-pr-931=labelled"], prs: [], merged: [931], prev: { tickets: [] } }));
|
|
653
|
+
assert.deepEqual(card(merged, 941).flags, []);
|
|
654
|
+
// gh still lists the PR but not as open — no open list to read a missing label off.
|
|
655
|
+
for (const state of ["CLOSED", "MERGED"]) {
|
|
656
|
+
const shut = computeBoard(reproInputs({ rows: ["#941 impl-941=PR#931 · finisher-pr-931=labelled"],
|
|
657
|
+
prs: [{ ...openPr(931), state }], prev: { tickets: [] } }));
|
|
658
|
+
assert.deepEqual(card(shut, 941).flags, [], state);
|
|
659
|
+
}
|
|
660
|
+
// REVIEW only: a card the row already carries past review flags nothing, even unlabelled.
|
|
661
|
+
const past = cardFor("#941 impl-941=PR#931 → MERGED abc1234 · finisher-pr-931=labelled", 941).card;
|
|
662
|
+
assert.equal(past.column, "MERGED");
|
|
663
|
+
assert.deepEqual(past.flags, []);
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
// The tick reads `## Dispatched` as well as the rows, and a whole-line `row`
|
|
667
|
+
// rewrite can drop a settled finisher token from the row while `## Dispatched`
|
|
668
|
+
// keeps it. The cockpit reads the same two places, so the card the tick is
|
|
669
|
+
// repairing or escalating is the card it flags — and a label-off on the row
|
|
670
|
+
// clears both alike.
|
|
671
|
+
test("#2331: the cockpit reads `## Dispatched` as the tick does — a settled finisher a row rewrite dropped still flags", () => {
|
|
672
|
+
const dispatched = ["impl-941=PR#931", "finisher-pr-931=labelled"];
|
|
673
|
+
const open = [{ number: 931, labels: [], closingIssuesReferences: [{ number: 941 }], headRefOid: "abc1234abc1234abc1234abc1234abc1234abcd" }];
|
|
674
|
+
for (const [rows, flags] of [
|
|
675
|
+
[["#941 impl-941=PR#931 → PR#931 · reviewed=abc1234:0/0/0"], ["unlabelled"]],
|
|
676
|
+
[["#941 impl-941=PR#931 → PR#931 · reviewed=abc1234:0/0/0 label-off=finisher-pr-931"], []],
|
|
677
|
+
]) {
|
|
678
|
+
const tick = deriveRun({ rows, dispatched, drain: null }, open).unlabelled;
|
|
679
|
+
assert.deepEqual(tick.map((u) => u.pr), flags.length ? [931] : [], rows[0]);
|
|
680
|
+
const b = computeBoard(reproInputs({ rows, ledger: { rows, dispatched, filed: [], ruled: [] }, prev: { tickets: [] } }));
|
|
681
|
+
assert.equal(card(b, 941).column, "REVIEW", rows[0]);
|
|
682
|
+
assert.deepEqual(card(b, 941).flags, flags, rows[0]);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
623
686
|
test("#1820: a live implementer is IMPLEMENTING, and still earns stale", () => {
|
|
624
687
|
const b = computeBoard(reproInputs());
|
|
625
688
|
assert.equal(card(b, 906).column, "IMPLEMENTING");
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
// expensive. cache_creation is what actually tracks spend, so it is the sort key
|
|
10
10
|
// and the percentage base; the rest is carried for context, never for ranking.
|
|
11
11
|
|
|
12
|
+
import { CELL_DEF } from "./ledger-grammar.mjs";
|
|
13
|
+
|
|
14
|
+
// The implementer definitions #2129 retired — see classifyRole's `def` branch.
|
|
15
|
+
const RETIRED_IMPLEMENTER_DEF = /^fleet-implementer(-alt)?$/;
|
|
16
|
+
|
|
12
17
|
// A fleet agent's role is not recorded anywhere as a field — it has to be
|
|
13
18
|
// recovered from how the controller named the work. Depth first: anything the
|
|
14
19
|
// controller did not spawn directly is a specialist, whatever it calls itself.
|
|
@@ -17,10 +22,11 @@
|
|
|
17
22
|
// `finisher-pr-<n>`, `merge-bot-<n>`).
|
|
18
23
|
//
|
|
19
24
|
// TWO IDENTITY SIGNALS, NEVER ONE (#1505). `agentDefinition` is the agent
|
|
20
|
-
// DEFINITION the dispatch recorded — `memory-housekeeper`,
|
|
21
|
-
// `fleet-review-verifier` — and `""` when it
|
|
22
|
-
// what the member was CALLED (`impl-387`,
|
|
23
|
-
// unnamed dispatch. They used to arrive as
|
|
25
|
+
// DEFINITION the dispatch recorded — `memory-housekeeper`,
|
|
26
|
+
// `fleet-implementer-slow-high`, `fleet-review-verifier` — and `""` when it
|
|
27
|
+
// recorded none. `memberName` is what the member was CALLED (`impl-387`,
|
|
28
|
+
// `brain-housekeeping`), `""` for an unnamed dispatch. They used to arrive as
|
|
29
|
+
// ONE `agentType` parameter,
|
|
24
30
|
// documented as "the DISPATCH's identity for the member" but sometimes
|
|
25
31
|
// carrying the definition and sometimes the member's own name depending on
|
|
26
32
|
// which was available — so every rule below silently read whichever value
|
|
@@ -43,7 +49,7 @@
|
|
|
43
49
|
// measurement (#326).
|
|
44
50
|
export function classifyRole(signals) {
|
|
45
51
|
const def = String(signals?.agentDefinition ?? "");
|
|
46
|
-
const name =
|
|
52
|
+
const name = canonicalMemberName(signals?.memberName);
|
|
47
53
|
const desc = String(signals?.description ?? "");
|
|
48
54
|
|
|
49
55
|
// Not fleet work at all — the memory system. Before everything else so it can
|
|
@@ -98,8 +104,17 @@ export function classifyRole(signals) {
|
|
|
98
104
|
// The review side is a PREFIX and the implementer side is EXACT, deliberately:
|
|
99
105
|
// the fan-out's dimensions are an open set that `review-core.mjs` sizes per
|
|
100
106
|
// PR, so a dimension added tomorrow must not silently fall back to prose,
|
|
101
|
-
// while the implementer definitions are closed
|
|
102
|
-
//
|
|
107
|
+
// while the implementer definitions are closed to the `CELL` grammar
|
|
108
|
+
// (`fleet-implementer-<role>-<level>`, ledger-grammar.mjs): a name outside
|
|
109
|
+
// it is no implementer definition, however it starts.
|
|
110
|
+
//
|
|
111
|
+
// Except the pre-cell pair #2129 deleted, `fleet-implementer` and
|
|
112
|
+
// `fleet-implementer-alt`, matched for the same reason the finisher branch
|
|
113
|
+
// keeps old spellings: deliberate compatibility with recorded history.
|
|
114
|
+
// Measured on docs/metrics/member-outcomes.tsv at #2129: 20 of the 303 rows
|
|
115
|
+
// under those two definitions carried no `impl-` name (`Impl1133`,
|
|
116
|
+
// `FixPr1568`, …) and booked `implementer` off the definition alone — a
|
|
117
|
+
// re-scrape of their sessions would have moved them to "other".
|
|
103
118
|
//
|
|
104
119
|
// One definition under that prefix is NOT fan-out: `fleet-review-runner`
|
|
105
120
|
// (#1802) is the member that HOLDS an omp review — dispatched as
|
|
@@ -108,7 +123,7 @@ export function classifyRole(signals) {
|
|
|
108
123
|
// and is booked "specialist" by the depth check above.
|
|
109
124
|
if (/^fleet-review-runner$/.test(def)) return "reviewer";
|
|
110
125
|
if (/^fleet-review-/.test(def)) return "specialist";
|
|
111
|
-
if (
|
|
126
|
+
if (CELL_DEF.test(def) || RETIRED_IMPLEMENTER_DEF.test(def)) return "implementer";
|
|
112
127
|
|
|
113
128
|
// The dispatch NAME is checked alone, in this same fixed order, before the
|
|
114
129
|
// prose blend below ever runs (#1506). Both readers now hand a canonical
|
|
@@ -182,6 +197,29 @@ function roleFromNamePatterns(hay) {
|
|
|
182
197
|
// `roleFromNamePatterns`'s own bare-word check already uses.
|
|
183
198
|
export const CANONICAL_MEMBER_NAME_PREFIXES = "impl|fix-pr|finish(?:er)?|review-pr|merge-bot";
|
|
184
199
|
|
|
200
|
+
// One member family name in any spelling a controller has dispatched it
|
|
201
|
+
// under — PascalCase, mixed case, hyphens dropped (`Impl676`, `FixPr1568`,
|
|
202
|
+
// `Review-pr-1449`, `ReviewPR77`, `FinisherPr1567b`, all in
|
|
203
|
+
// docs/metrics/member-outcomes.tsv) — rewritten to the lower-kebab form every
|
|
204
|
+
// name pattern in this file and in member-record.mjs's parseMemberName is
|
|
205
|
+
// written against (#2396). omp task names are free-form, so nothing upstream
|
|
206
|
+
// guarantees the kebab spelling, and an unmatched spelling lost both its role
|
|
207
|
+
// and its tier-outcomes.tsv join key.
|
|
208
|
+
//
|
|
209
|
+
// Only a WHOLE name of that shape is rewritten — family, number, at most one
|
|
210
|
+
// retry suffix — and anything else is returned as given. Kebab-casing every
|
|
211
|
+
// CamelCase name would turn a generated word pair like `FinishSetupDocs` into
|
|
212
|
+
// `finish-setup-docs`, which classifyRole's `^finish-` books as a finisher.
|
|
213
|
+
const MEMBER_NAME_SPELLING_RE = /^(impl|(?:fix|review|resolve|finish(?:er)?)-?pr|finish(?:er)?|merge-?bot)-?(\d+)(-?(?:v\d+|[a-z])|-\d+)?$/i;
|
|
214
|
+
export function canonicalMemberName(name) {
|
|
215
|
+
const s = String(name ?? "").trim();
|
|
216
|
+
const m = MEMBER_NAME_SPELLING_RE.exec(s);
|
|
217
|
+
if (!m) return s;
|
|
218
|
+
const family = m[1].replace(/^(.*?)-?(pr|bot)$/i, "$1-$2");
|
|
219
|
+
const suffix = m[3] ? `-${m[3].replace(/^-/, "")}` : "";
|
|
220
|
+
return `${family}-${m[2]}${suffix}`.toLowerCase();
|
|
221
|
+
}
|
|
222
|
+
|
|
185
223
|
// Seeds the rollup buckets and breaks ties in the report, which is otherwise
|
|
186
224
|
// sorted by spend — so this is not the order the UI shows. Review roles lead so
|
|
187
225
|
// that at equal spend they still read first.
|