@feigi/fleet-ctl 0.0.0 → 3.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// Regression gate for main-checkout.mjs (#2210), the tick's main-checkout
|
|
2
|
+
// dirty check. Zero deps:
|
|
3
|
+
// node --test plugin/scripts/main-checkout.test.mjs
|
|
4
|
+
//
|
|
5
|
+
// Every case runs in a real temporary repository: what is under test is how
|
|
6
|
+
// git's porcelain, the gitignore, a linked worktree and the filesystem answer,
|
|
7
|
+
// and a stubbed git would answer whatever the stub was told.
|
|
8
|
+
import { test } from "node:test";
|
|
9
|
+
import assert from "node:assert/strict";
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
import {
|
|
12
|
+
appendFileSync, chmodSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, unlinkSync, writeFileSync,
|
|
13
|
+
} from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { checkMainCheckout, recordBaseline, baselinePath, describe } from "./main-checkout.mjs";
|
|
18
|
+
|
|
19
|
+
const SCRIPT = fileURLToPath(new URL("./main-checkout.mjs", import.meta.url));
|
|
20
|
+
// Permission cases mean nothing to root, which reads through any mode bits.
|
|
21
|
+
const ROOT = process.getuid?.() === 0;
|
|
22
|
+
|
|
23
|
+
const git = (cwd, ...args) => {
|
|
24
|
+
const r = spawnSync("git", ["-c", "user.email=t@t", "-c", "user.name=t", ...args], { cwd, encoding: "utf8" });
|
|
25
|
+
assert.equal(r.status, 0, `git ${args.join(" ")}: ${r.stderr}`);
|
|
26
|
+
return r.stdout;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// A fleet-shaped main checkout: one tracked file, `.fleet/` and `.worktrees/`
|
|
30
|
+
// ignored the way a fleet repo's .gitignore ignores them.
|
|
31
|
+
function repo(t) {
|
|
32
|
+
const dir = realpathSync(mkdtempSync(join(tmpdir(), "main-checkout-")));
|
|
33
|
+
t.after(() => {
|
|
34
|
+
// Restore what a case took away, or rmSync cannot clear it.
|
|
35
|
+
for (const p of [join(dir, ".fleet"), join(dir, "locked.txt")]) try { chmodSync(p, 0o755); } catch {}
|
|
36
|
+
rmSync(dir, { recursive: true, force: true });
|
|
37
|
+
});
|
|
38
|
+
git(dir, "init", "-q");
|
|
39
|
+
writeFileSync(join(dir, ".gitignore"), ".fleet/\n.worktrees/\n.agent-brain/\n");
|
|
40
|
+
writeFileSync(join(dir, "tracked.txt"), "one\n");
|
|
41
|
+
git(dir, "add", "-A");
|
|
42
|
+
git(dir, "commit", "-qm", "init");
|
|
43
|
+
return dir;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const record = (cwd, env) => {
|
|
47
|
+
const r = recordBaseline({ cwd, env });
|
|
48
|
+
assert.equal(r.ok, true, r.why);
|
|
49
|
+
return r;
|
|
50
|
+
};
|
|
51
|
+
const check = (cwd, env) => checkMainCheckout({ cwd, env });
|
|
52
|
+
|
|
53
|
+
test("a clean tree recorded and left alone is clean", (t) => {
|
|
54
|
+
const dir = repo(t);
|
|
55
|
+
record(dir);
|
|
56
|
+
assert.equal(check(dir).state, "clean");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("uncommitted work present at run start is in the baseline and holds nothing", (t) => {
|
|
60
|
+
const dir = repo(t);
|
|
61
|
+
writeFileSync(join(dir, "tracked.txt"), "mine, uncommitted\n");
|
|
62
|
+
writeFileSync(join(dir, "notes.md"), "untracked, mine\n");
|
|
63
|
+
record(dir);
|
|
64
|
+
assert.equal(check(dir).state, "clean");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("a new untracked file is dirty, and named", (t) => {
|
|
68
|
+
const dir = repo(t);
|
|
69
|
+
record(dir);
|
|
70
|
+
mkdirSync(join(dir, "plugin", "scripts"), { recursive: true });
|
|
71
|
+
writeFileSync(join(dir, "plugin", "scripts", "stray.mjs"), "x\n");
|
|
72
|
+
const c = check(dir);
|
|
73
|
+
assert.equal(c.state, "dirty");
|
|
74
|
+
// -uall: the file itself, never only its new directory.
|
|
75
|
+
assert.deepEqual(c.changed, ["plugin/scripts/stray.mjs"]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("an untracked file is dirty even where status.showUntrackedFiles=no would silence it (#730)", (t) => {
|
|
79
|
+
const dir = repo(t);
|
|
80
|
+
git(dir, "config", "status.showUntrackedFiles", "no");
|
|
81
|
+
record(dir);
|
|
82
|
+
writeFileSync(join(dir, "stray.txt"), "x\n");
|
|
83
|
+
assert.deepEqual(check(dir).changed, ["stray.txt"]);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("a modified tracked file is dirty", (t) => {
|
|
87
|
+
const dir = repo(t);
|
|
88
|
+
record(dir);
|
|
89
|
+
writeFileSync(join(dir, "tracked.txt"), "two\n");
|
|
90
|
+
assert.deepEqual(check(dir), { state: "dirty", root: dir, baseline: baselinePath(dir), changed: ["tracked.txt"] });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("a further edit to a file already dirty at the baseline is dirty — the hash, not the status line, catches it", (t) => {
|
|
94
|
+
const dir = repo(t);
|
|
95
|
+
writeFileSync(join(dir, "tracked.txt"), "mine\n");
|
|
96
|
+
writeFileSync(join(dir, "notes.md"), "mine\n");
|
|
97
|
+
record(dir);
|
|
98
|
+
appendFileSync(join(dir, "tracked.txt"), "a member's line\n");
|
|
99
|
+
assert.deepEqual(check(dir).changed, ["tracked.txt"]);
|
|
100
|
+
appendFileSync(join(dir, "notes.md"), "a member's line\n");
|
|
101
|
+
assert.deepEqual(check(dir).changed, ["notes.md", "tracked.txt"]);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("a deleted tracked file, and an entry that leaves porcelain, are both dirty", (t) => {
|
|
105
|
+
const dir = repo(t);
|
|
106
|
+
writeFileSync(join(dir, "notes.md"), "mine\n");
|
|
107
|
+
record(dir);
|
|
108
|
+
unlinkSync(join(dir, "tracked.txt"));
|
|
109
|
+
unlinkSync(join(dir, "notes.md"));
|
|
110
|
+
assert.deepEqual(check(dir).changed, ["notes.md", "tracked.txt"]);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("staging a change is a change", (t) => {
|
|
114
|
+
const dir = repo(t);
|
|
115
|
+
writeFileSync(join(dir, "tracked.txt"), "mine\n");
|
|
116
|
+
record(dir);
|
|
117
|
+
git(dir, "add", "tracked.txt");
|
|
118
|
+
assert.deepEqual(check(dir).changed, ["tracked.txt"]);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test("a write under a gitignored directory is clean — run state, agent-brain's cache", (t) => {
|
|
122
|
+
const dir = repo(t);
|
|
123
|
+
record(dir);
|
|
124
|
+
writeFileSync(join(dir, ".fleet", "ledger.md"), "# ledger\n");
|
|
125
|
+
mkdirSync(join(dir, ".agent-brain"));
|
|
126
|
+
writeFileSync(join(dir, ".agent-brain", "index.md"), "x\n");
|
|
127
|
+
assert.equal(check(dir).state, "clean");
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("the run's own bookkeeping is not a stray write: the controller's metrics appends stay clean, anything beside them does not", (t) => {
|
|
131
|
+
const dir = repo(t);
|
|
132
|
+
mkdirSync(join(dir, "docs", "metrics"), { recursive: true });
|
|
133
|
+
writeFileSync(join(dir, "docs", "metrics", "tier-outcomes.tsv"), "# header\n");
|
|
134
|
+
writeFileSync(join(dir, "docs", "metrics", "member-outcomes.tsv"), "# header\n");
|
|
135
|
+
git(dir, "add", "-A");
|
|
136
|
+
git(dir, "commit", "-qm", "metrics");
|
|
137
|
+
record(dir);
|
|
138
|
+
// What the controller does mid-run: `tier-outcomes.mjs append` per ruled
|
|
139
|
+
// PR, the member-facts scrape rewriting its file. Twice, as a run does.
|
|
140
|
+
for (const row of ["2026-10-01\t2298\n", "2026-10-01\t2302\n"]) {
|
|
141
|
+
appendFileSync(join(dir, "docs", "metrics", "tier-outcomes.tsv"), row);
|
|
142
|
+
writeFileSync(join(dir, "docs", "metrics", "member-outcomes.tsv"), `# header\n${row}`);
|
|
143
|
+
assert.equal(check(dir).state, "clean", "the controller's own append held the run");
|
|
144
|
+
}
|
|
145
|
+
// Two named files, never the directory, and a stray beside them is named alone.
|
|
146
|
+
writeFileSync(join(dir, "docs", "metrics", "stray.tsv"), "x\n");
|
|
147
|
+
writeFileSync(join(dir, "tracked.txt"), "a member's\n");
|
|
148
|
+
assert.deepEqual(check(dir).changed, ["docs/metrics/stray.tsv", "tracked.txt"]);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("a write inside .worktrees/<x>/ is clean, and the check run from that worktree still answers for the main checkout", (t) => {
|
|
152
|
+
const dir = repo(t);
|
|
153
|
+
git(dir, "worktree", "add", "-q", "-b", "impl/1", join(dir, ".worktrees", "1-x"));
|
|
154
|
+
record(dir);
|
|
155
|
+
const wt = join(dir, ".worktrees", "1-x");
|
|
156
|
+
writeFileSync(join(wt, "tracked.txt"), "a member's own work\n");
|
|
157
|
+
writeFileSync(join(wt, "new.mjs"), "x\n");
|
|
158
|
+
assert.equal(check(dir).state, "clean");
|
|
159
|
+
const fromWt = check(wt);
|
|
160
|
+
assert.equal(fromWt.state, "clean");
|
|
161
|
+
assert.equal(fromWt.root, dir, "resolved the worktree as the main checkout — --show-toplevel's answer, not the common dir's");
|
|
162
|
+
writeFileSync(join(dir, "stray.txt"), "x\n");
|
|
163
|
+
assert.deepEqual(check(wt).changed, ["stray.txt"], "a stray write is invisible from a member's worktree");
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("paths that would split or blur the line are quoted in it", (t) => {
|
|
167
|
+
const dir = repo(t);
|
|
168
|
+
record(dir);
|
|
169
|
+
writeFileSync(join(dir, "plain.txt"), "x\n");
|
|
170
|
+
writeFileSync(join(dir, "a b.txt"), "x\n");
|
|
171
|
+
writeFileSync(join(dir, 'q"uote.txt'), "x\n");
|
|
172
|
+
writeFileSync(join(dir, "back\\slash.txt"), "x\n");
|
|
173
|
+
writeFileSync(join(dir, "ctl\x01.txt"), "x\n");
|
|
174
|
+
writeFileSync(join(dir, "new\nline.txt"), "x\n");
|
|
175
|
+
const c = check(dir);
|
|
176
|
+
assert.deepEqual(c.changed, ["a b.txt", "back\\slash.txt", "ctl\x01.txt", "new\nline.txt", "plain.txt", 'q"uote.txt']);
|
|
177
|
+
const said = describe(c, ["impl-7"]);
|
|
178
|
+
assert.ok(said.startsWith(`MAIN-CHECKOUT-DIRTY "a b.txt" "back\\\\slash.txt" "ctl\\u0001.txt" "new\\nline.txt" plain.txt "q\\"uote.txt" — `), said);
|
|
179
|
+
assert.doesNotMatch(said, /[\x00-\x1f]/, "a raw control byte reached the printed line");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("a git that fails is unknown, never clean", (t) => {
|
|
183
|
+
const dir = repo(t);
|
|
184
|
+
record(dir);
|
|
185
|
+
// A corrupt index: git status exits non-zero.
|
|
186
|
+
writeFileSync(join(dir, ".git", "index"), "not an index");
|
|
187
|
+
const c = check(dir);
|
|
188
|
+
assert.equal(c.state, "unknown");
|
|
189
|
+
assert.equal(c.cause, "read");
|
|
190
|
+
assert.match(c.why, /git status --porcelain -uall exited \d+/);
|
|
191
|
+
assert.match(describe(c, []), /^MAIN-CHECKOUT-UNKNOWN could not look: .*NEVER re-baseline over it/);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("a directory that is no repository is unknown, never clean", (t) => {
|
|
195
|
+
const dir = realpathSync(mkdtempSync(join(tmpdir(), "main-checkout-norepo-")));
|
|
196
|
+
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
197
|
+
const c = check(dir, { ...process.env, GIT_CEILING_DIRECTORIES: dir });
|
|
198
|
+
assert.equal(c.state, "unknown");
|
|
199
|
+
assert.match(c.why, /git rev-parse --git-common-dir exited 128/);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("a path git names but the check cannot hash is unknown, never clean", { skip: ROOT }, (t) => {
|
|
203
|
+
const dir = repo(t);
|
|
204
|
+
record(dir);
|
|
205
|
+
writeFileSync(join(dir, "locked.txt"), "x\n");
|
|
206
|
+
chmodSync(join(dir, "locked.txt"), 0o000);
|
|
207
|
+
const c = check(dir);
|
|
208
|
+
assert.equal(c.state, "unknown");
|
|
209
|
+
assert.match(c.why, /cannot hash locked\.txt: EACCES/);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test("an ambient GIT_DIR naming another repository does not change the answer (#1599)", (t) => {
|
|
213
|
+
const dir = repo(t);
|
|
214
|
+
const decoy = repo(t);
|
|
215
|
+
writeFileSync(join(decoy, "decoy-stray.txt"), "x\n");
|
|
216
|
+
const env = { ...process.env, GIT_DIR: join(decoy, ".git"), GIT_WORK_TREE: decoy };
|
|
217
|
+
record(dir, env);
|
|
218
|
+
assert.equal(readFileSync(baselinePath(dir), "utf8").includes("decoy-stray"), false, "the baseline recorded the decoy's tree");
|
|
219
|
+
assert.equal(check(dir, env).state, "clean");
|
|
220
|
+
writeFileSync(join(dir, "stray.txt"), "x\n");
|
|
221
|
+
assert.deepEqual(check(dir, env).changed, ["stray.txt"]);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("no baseline is its own refusal, never clean", (t) => {
|
|
225
|
+
const dir = repo(t);
|
|
226
|
+
const c = check(dir);
|
|
227
|
+
assert.deepEqual(c, { state: "absent", root: dir, baseline: baselinePath(dir) });
|
|
228
|
+
assert.match(describe(c, []), /^MAIN-CHECKOUT-NO-BASELINE no baseline at .*main-checkout\.sha — .*record it at run start/);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test("a baseline that exists but cannot be read is its own unknown, never clean and never 'no baseline'", { skip: ROOT }, (t) => {
|
|
232
|
+
const dir = repo(t);
|
|
233
|
+
record(dir);
|
|
234
|
+
const base = baselinePath(dir);
|
|
235
|
+
|
|
236
|
+
chmodSync(base, 0o000);
|
|
237
|
+
let c = check(dir);
|
|
238
|
+
assert.equal(c.state, "unknown");
|
|
239
|
+
assert.equal(c.cause, "baseline");
|
|
240
|
+
assert.match(c.why, /exists but cannot be read: EACCES/);
|
|
241
|
+
assert.match(describe(c, []), /^MAIN-CHECKOUT-UNKNOWN baseline unreadable: .*NEVER re-baseline over it/);
|
|
242
|
+
chmodSync(base, 0o644);
|
|
243
|
+
|
|
244
|
+
// An unsearchable .fleet/ hides the file from stat: EACCES, not ENOENT.
|
|
245
|
+
chmodSync(join(dir, ".fleet"), 0o600);
|
|
246
|
+
c = check(dir);
|
|
247
|
+
assert.equal(c.state, "unknown");
|
|
248
|
+
assert.equal(c.cause, "baseline");
|
|
249
|
+
chmodSync(join(dir, ".fleet"), 0o755);
|
|
250
|
+
|
|
251
|
+
unlinkSync(base);
|
|
252
|
+
symlinkSync(join(dir, "gone"), base);
|
|
253
|
+
c = check(dir);
|
|
254
|
+
assert.equal(c.state, "unknown");
|
|
255
|
+
assert.match(c.why, /dangling symlink/);
|
|
256
|
+
unlinkSync(base);
|
|
257
|
+
|
|
258
|
+
writeFileSync(base, "deadbeef\n");
|
|
259
|
+
c = check(dir);
|
|
260
|
+
assert.equal(c.state, "unknown");
|
|
261
|
+
assert.match(c.why, /not a baseline main-checkout\.mjs --record wrote/);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test("--record overwrites rather than compares: after the stray paths are resolved it clears, and it clears a dirty tree too", (t) => {
|
|
265
|
+
const dir = repo(t);
|
|
266
|
+
record(dir);
|
|
267
|
+
writeFileSync(join(dir, "stray.txt"), "x\n");
|
|
268
|
+
assert.equal(check(dir).state, "dirty");
|
|
269
|
+
// Re-baselining while dirty certifies the tree as it stands — which is why
|
|
270
|
+
// the runbook says resolve FIRST.
|
|
271
|
+
record(dir);
|
|
272
|
+
assert.equal(check(dir).state, "clean");
|
|
273
|
+
unlinkSync(join(dir, "stray.txt"));
|
|
274
|
+
assert.equal(check(dir).state, "dirty", "removing a path the baseline recorded is a change");
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test("--record refuses over a baseline it cannot read, and leaves it in place", { skip: ROOT }, (t) => {
|
|
278
|
+
const dir = repo(t);
|
|
279
|
+
record(dir);
|
|
280
|
+
const base = baselinePath(dir);
|
|
281
|
+
chmodSync(base, 0o000);
|
|
282
|
+
const r = recordBaseline({ cwd: dir });
|
|
283
|
+
assert.equal(r.ok, false);
|
|
284
|
+
assert.match(r.why, /do NOT --record over it, --record overwrites rather than compares/);
|
|
285
|
+
chmodSync(base, 0o644);
|
|
286
|
+
writeFileSync(base, "not a baseline\n");
|
|
287
|
+
assert.equal(recordBaseline({ cwd: dir }).ok, false);
|
|
288
|
+
assert.equal(readFileSync(base, "utf8"), "not a baseline\n");
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test("--record refuses when git cannot look, and writes nothing", (t) => {
|
|
292
|
+
const dir = repo(t);
|
|
293
|
+
writeFileSync(join(dir, ".git", "index"), "not an index");
|
|
294
|
+
const r = recordBaseline({ cwd: dir });
|
|
295
|
+
assert.equal(r.ok, false);
|
|
296
|
+
assert.match(r.why, /could not look, so there is nothing to record/);
|
|
297
|
+
assert.equal(check(dir).state, "absent");
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test("CLI: --record then --check, with the exit codes the header names", (t) => {
|
|
301
|
+
const dir = repo(t);
|
|
302
|
+
const run = (...args) => spawnSync(process.execPath, [SCRIPT, ...args], { cwd: dir, encoding: "utf8" });
|
|
303
|
+
let r = run("--check");
|
|
304
|
+
assert.equal(r.status, 2);
|
|
305
|
+
assert.match(r.stdout, /^MAIN-CHECKOUT-NO-BASELINE /);
|
|
306
|
+
r = run("--record");
|
|
307
|
+
assert.equal(r.status, 0, r.stderr);
|
|
308
|
+
assert.match(r.stdout, /^main-checkout: recorded 0 porcelain entries at /);
|
|
309
|
+
r = run("--check");
|
|
310
|
+
assert.equal(r.status, 0, r.stderr);
|
|
311
|
+
assert.match(r.stdout, /^main-checkout: clean against /);
|
|
312
|
+
writeFileSync(join(dir, "stray.txt"), "x\n");
|
|
313
|
+
r = run("--check");
|
|
314
|
+
assert.equal(r.status, 1);
|
|
315
|
+
assert.match(r.stdout, /^MAIN-CHECKOUT-DIRTY stray\.txt — /);
|
|
316
|
+
writeFileSync(join(dir, ".git", "index"), "not an index");
|
|
317
|
+
r = run("--check");
|
|
318
|
+
assert.equal(r.status, 2);
|
|
319
|
+
assert.match(r.stdout, /^MAIN-CHECKOUT-UNKNOWN /);
|
|
320
|
+
r = run("--record");
|
|
321
|
+
assert.equal(r.status, 2);
|
|
322
|
+
assert.match(r.stderr, /^main-checkout: .*could not look/m);
|
|
323
|
+
r = run();
|
|
324
|
+
assert.equal(r.status, 2);
|
|
325
|
+
assert.match(r.stderr, /usage: main-checkout\.mjs --record \| --check/);
|
|
326
|
+
r = run("--record", "--check");
|
|
327
|
+
assert.equal(r.status, 2);
|
|
328
|
+
assert.match(r.stderr, /usage: main-checkout\.mjs --record \| --check/);
|
|
329
|
+
r = run("--recrod");
|
|
330
|
+
assert.equal(r.status, 2);
|
|
331
|
+
assert.match(r.stderr, /--recrod/, "a misspelt flag must be refused by name, never run as a check");
|
|
332
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync, writeFileSync
|
|
4
|
-
import {
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { COLUMNS } from "./member-outcomes.mjs";
|
|
@@ -137,7 +137,7 @@ test("the header's pair query counts DELIBERATE pairs, run against a corpus wher
|
|
|
137
137
|
// review fan-out runs one on every session and must not inflate anything
|
|
138
138
|
["sE", "2026-09-02", "specialist", "rev", "claude-haiku-4-5", "", "", "", "0", "0", "0", "1", "agent-a11", "claude", "fleet-review-tests"],
|
|
139
139
|
];
|
|
140
|
-
const corpus = join(
|
|
140
|
+
const corpus = join(tempDir("mo-hdr-"), "member-outcomes.tsv");
|
|
141
141
|
writeFileSync(corpus, "# header line, skipped by the query\n" + rows.map((r) => r.join("\t")).join("\n") + "\n");
|
|
142
142
|
|
|
143
143
|
const program = /awk -F'\\t' '([\s\S]*)' docs\/metrics\/member-outcomes\.tsv$/.exec(pairQuery());
|
|
@@ -140,16 +140,15 @@ export function parseTsv(text) {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
import { writeFileSync, existsSync, renameSync } from "node:fs";
|
|
143
|
-
import {
|
|
143
|
+
import { isCLI } from "./is-cli.mjs";
|
|
144
144
|
import { makeDie, isFlagLike } from "./arg.mjs";
|
|
145
145
|
|
|
146
146
|
const NAME = "member-outcomes";
|
|
147
147
|
|
|
148
148
|
// Only runs as a CLI, never on import — the test file and any wrapper import
|
|
149
|
-
// the pure helpers. Exact identity, not a suffix
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
if (import.meta.url === pathToFileURL(process.argv[1] || "").href) {
|
|
149
|
+
// the pure helpers. Exact identity (by realpath, see is-cli.mjs), not a suffix
|
|
150
|
+
// match: a suffix test fires for any file ending in this one's name.
|
|
151
|
+
if (isCLI(import.meta.url)) {
|
|
153
152
|
const die = makeDie(NAME);
|
|
154
153
|
const argv = process.argv.slice(2);
|
|
155
154
|
const fileIdx = argv.indexOf("--file");
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { mkdirSync, writeFileSync, readFileSync, utimesSync, existsSync } from "node:fs";
|
|
4
|
+
import { tempDir } from "./temp-dir.mjs";
|
|
5
5
|
import { join, dirname } from "node:path";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { normalizeModel, parseMemberName, rowsForSession, COLUMNS, mergeRows, formatTsv, parseTsv } from "./member-outcomes.mjs";
|
|
8
|
+
import { COLUMNS as TIER_COLUMNS, TIER_SWITCH_DATE } from "./tier-outcomes.mjs";
|
|
9
|
+
|
|
10
|
+
const TIER_CLI = new URL("./tier-outcomes.mjs", import.meta.url).pathname;
|
|
8
11
|
|
|
9
12
|
test("a versioned model id is kept verbatim", () => {
|
|
10
13
|
assert.equal(normalizeModel("claude-opus-5"), "claude-opus-5");
|
|
@@ -105,6 +108,35 @@ test("an unrecognised name yields blanks, never a guess", () => {
|
|
|
105
108
|
assert.deepEqual(parseMemberName(""), { ticket: "", pr: "" });
|
|
106
109
|
});
|
|
107
110
|
|
|
111
|
+
test("a member family spelled PascalCase or without hyphens yields the same join key as its kebab form (#2396)", () => {
|
|
112
|
+
// omp task names are free-form: this repo's own member-outcomes.tsv carries
|
|
113
|
+
// `ReviewPR77`, `FinisherPr1567b` and `FixPr1568-2` beside `impl-580`. Each
|
|
114
|
+
// returned blanks, losing the row's join key into tier-outcomes.tsv.
|
|
115
|
+
assert.deepEqual(parseMemberName("Impl327"), { ticket: "327", pr: "" });
|
|
116
|
+
assert.deepEqual(parseMemberName("Fix-pr-766"), { ticket: "", pr: "766" });
|
|
117
|
+
assert.deepEqual(parseMemberName("FixPr774"), { ticket: "", pr: "774" });
|
|
118
|
+
assert.deepEqual(parseMemberName("Review-pr-771"), { ticket: "", pr: "771" });
|
|
119
|
+
assert.deepEqual(parseMemberName("ReviewPR77"), { ticket: "", pr: "77" });
|
|
120
|
+
assert.deepEqual(parseMemberName("Finisher-pr-766"), { ticket: "", pr: "766" });
|
|
121
|
+
assert.deepEqual(parseMemberName("ResolvePr1232"), { ticket: "", pr: "1232" });
|
|
122
|
+
assert.deepEqual(parseMemberName("Finisher532"), { ticket: "", pr: "532" });
|
|
123
|
+
// The retry suffixes keep their meaning when glued on without a hyphen.
|
|
124
|
+
assert.deepEqual(parseMemberName("FinisherPr1567b"), { ticket: "", pr: "1567" });
|
|
125
|
+
assert.deepEqual(parseMemberName("FixPr1568-2"), { ticket: "", pr: "1568" });
|
|
126
|
+
assert.deepEqual(parseMemberName("Impl580b"), { ticket: "580", pr: "" });
|
|
127
|
+
// ...and the deliberate blanks stay blank in either spelling.
|
|
128
|
+
assert.deepEqual(parseMemberName("Impl137-2"), { ticket: "", pr: "" });
|
|
129
|
+
assert.deepEqual(parseMemberName("MergeBot12"), { ticket: "", pr: "" });
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("a generated word pair that merely starts with a family word yields blanks (#2396)", () => {
|
|
133
|
+
assert.deepEqual(parseMemberName("InstallVerifySearch"), { ticket: "", pr: "" });
|
|
134
|
+
assert.deepEqual(parseMemberName("ReviewPrDispatch"), { ticket: "", pr: "" });
|
|
135
|
+
assert.deepEqual(parseMemberName("Issue134Implement"), { ticket: "", pr: "" });
|
|
136
|
+
assert.deepEqual(parseMemberName("Implementer5"), { ticket: "", pr: "" });
|
|
137
|
+
assert.deepEqual(parseMemberName("Impl1341/Impl1341.CwdProbe"), { ticket: "", pr: "" });
|
|
138
|
+
});
|
|
139
|
+
|
|
108
140
|
// ---------------------------------------------------------------------------
|
|
109
141
|
// omp fixtures — shaped like real ~/.omp/agent/sessions/**/*.jsonl lines
|
|
110
142
|
// ---------------------------------------------------------------------------
|
|
@@ -126,7 +158,7 @@ const assistantEvt = (model, usage = {}, ts = "2026-08-25T09:00:00.000Z") => evt
|
|
|
126
158
|
// the CLI (member-outcomes.mjs's main()) and readMembers()'s tree walk
|
|
127
159
|
// (member-record.test.mjs) do.
|
|
128
160
|
function fixture(members) {
|
|
129
|
-
const root =
|
|
161
|
+
const root = tempDir("mo-");
|
|
130
162
|
const sessionDir = join(root, "2026-08-25T09-00-00-000Z_abcdef12-3456-7890-abcd-ef1234567890");
|
|
131
163
|
for (const [name, lines] of members) {
|
|
132
164
|
const file = join(sessionDir, `${name}.jsonl`);
|
|
@@ -159,7 +191,7 @@ test("a member whose file readFileSync cannot read is skipped without losing its
|
|
|
159
191
|
});
|
|
160
192
|
|
|
161
193
|
test("a session directory that does not exist yields no rows and does not throw", () => {
|
|
162
|
-
const root =
|
|
194
|
+
const root = tempDir("mo-");
|
|
163
195
|
assert.deepEqual(rowsForSession(join(root, "never-created")), []);
|
|
164
196
|
});
|
|
165
197
|
|
|
@@ -334,8 +366,8 @@ test("a nonexistent session directory is a refusal, not a silent no-op", () => {
|
|
|
334
366
|
// EXISTS but holds no transcripts yet is a real, legitimate state (a
|
|
335
367
|
// session between launch and its first member's spawn) and must not
|
|
336
368
|
// refuse; only a path that genuinely does not resolve should.
|
|
337
|
-
const missing = join(
|
|
338
|
-
const out = join(
|
|
369
|
+
const missing = join(tempDir("mo-empty-"), "never-created");
|
|
370
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
339
371
|
const r = spawnSync(process.execPath, [CLI, missing, "--file", out], { encoding: "utf8" });
|
|
340
372
|
assert.equal(r.status, 2);
|
|
341
373
|
assert.match(r.stderr, /cannot read/);
|
|
@@ -343,10 +375,10 @@ test("a nonexistent session directory is a refusal, not a silent no-op", () => {
|
|
|
343
375
|
});
|
|
344
376
|
|
|
345
377
|
test("a session-dir argument that is actually a FILE is a refusal, not a silent no-op", () => {
|
|
346
|
-
const root =
|
|
378
|
+
const root = tempDir("mo-notdir-");
|
|
347
379
|
const notADir = join(root, "impl-580.jsonl");
|
|
348
380
|
writeFileSync(notADir, "");
|
|
349
|
-
const out = join(
|
|
381
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
350
382
|
const r = spawnSync(process.execPath, [CLI, notADir, "--file", out], { encoding: "utf8" });
|
|
351
383
|
assert.equal(r.status, 2);
|
|
352
384
|
assert.match(r.stderr, /ENOTDIR/);
|
|
@@ -361,7 +393,7 @@ test("a directory that is not an omp <ISO>_<uuid> session dir is a refusal, not
|
|
|
361
393
|
// shape) used to be silently accepted whole: every session under it
|
|
362
394
|
// stamped with the project dir's own name, and the controller's own
|
|
363
395
|
// main-session transcript booked as a member.
|
|
364
|
-
const root =
|
|
396
|
+
const root = tempDir("mo-proj-");
|
|
365
397
|
const projectDir = join(root, "-dev-fleet-plugin");
|
|
366
398
|
const sessionName = "2026-09-08T14-14-34-049Z_01a0815e-e141-716c-b2d8-2adf310fbe55";
|
|
367
399
|
mkdirSync(join(projectDir, sessionName), { recursive: true });
|
|
@@ -369,7 +401,7 @@ test("a directory that is not an omp <ISO>_<uuid> session dir is a refusal, not
|
|
|
369
401
|
[sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")].join("\n") + "\n");
|
|
370
402
|
writeFileSync(join(projectDir, `${sessionName}.jsonl`),
|
|
371
403
|
[sessionEvt("/x"), assistantEvt("claude-sonnet-5")].join("\n") + "\n");
|
|
372
|
-
const out = join(
|
|
404
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
373
405
|
const r = spawnSync(process.execPath, [CLI, projectDir, "--file", out], { encoding: "utf8" });
|
|
374
406
|
assert.equal(r.status, 2);
|
|
375
407
|
assert.match(r.stderr, /is not an omp .* session directory/);
|
|
@@ -397,7 +429,7 @@ test("two separate sessions scraped in two runs merge into one TSV", () => {
|
|
|
397
429
|
const dirA = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), sessionInitEvt("Implement ticket 580", "fleet-implementer"), assistantEvt("claude-opus-5")]]]);
|
|
398
430
|
const dirB = fixture([["Solo", [sessionEvt("/x"), thinkingEvt("high"), sessionInitEvt("Implement ticket 581", "fleet-implementer-alt"), assistantEvt("claude-sonnet-5")]]]);
|
|
399
431
|
|
|
400
|
-
const out = join(
|
|
432
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
401
433
|
const runA = spawnSync(process.execPath, [CLI, dirA, "--file", out], { encoding: "utf8" });
|
|
402
434
|
assert.equal(runA.status, 0, runA.stderr);
|
|
403
435
|
const runB = spawnSync(process.execPath, [CLI, dirB, "--file", out], { encoding: "utf8" });
|
|
@@ -412,7 +444,7 @@ test("two separate sessions scraped in two runs merge into one TSV", () => {
|
|
|
412
444
|
|
|
413
445
|
test("a run writes rows, and a second run over the same session changes nothing", () => {
|
|
414
446
|
const dir = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")]]]);
|
|
415
|
-
const out = join(
|
|
447
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
416
448
|
const run = () => spawnSync(process.execPath, [CLI, dir, "--file", out], { encoding: "utf8" });
|
|
417
449
|
assert.equal(run().status, 0);
|
|
418
450
|
const first = readFileSync(out, "utf8");
|
|
@@ -424,7 +456,7 @@ test("the header survives a rewrite", () => {
|
|
|
424
456
|
// The header carries the read-out commands and the blank-means-unknown rule.
|
|
425
457
|
// A rewrite that drops it strands every reader.
|
|
426
458
|
const dir = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")]]]);
|
|
427
|
-
const out = join(
|
|
459
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
428
460
|
writeFileSync(out, "# keep me\n");
|
|
429
461
|
spawnSync(process.execPath, [CLI, dir, "--file", out], { encoding: "utf8" });
|
|
430
462
|
assert.match(readFileSync(out, "utf8"), /^# keep me$/m);
|
|
@@ -434,7 +466,7 @@ test("importing the module never runs the CLI, even from a file whose name ends
|
|
|
434
466
|
// The guard used to be a suffix match, so a wrapper called
|
|
435
467
|
// run-member-outcomes.mjs tripped the CLI block on import: it wrote a file
|
|
436
468
|
// and exited 2 in a process that only wanted the helpers.
|
|
437
|
-
const dir =
|
|
469
|
+
const dir = tempDir("mo-wrap-");
|
|
438
470
|
const wrapper = join(dir, "run-member-outcomes.mjs");
|
|
439
471
|
writeFileSync(wrapper, `import { normalizeModel } from ${JSON.stringify(CLI)};\n`
|
|
440
472
|
+ `console.log(normalizeModel("claude-opus-5"));\n`);
|
|
@@ -450,7 +482,7 @@ test("the documented bare form works — no --file needed", () => {
|
|
|
450
482
|
// until the filter stopped treating `fileIdx + 1` as a real index when
|
|
451
483
|
// --file is absent.
|
|
452
484
|
const dir = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")]]]);
|
|
453
|
-
const cwd =
|
|
485
|
+
const cwd = tempDir("mo-cwd-");
|
|
454
486
|
mkdirSync(join(cwd, "docs", "metrics"), { recursive: true });
|
|
455
487
|
const r = spawnSync(process.execPath, [CLI, dir], { encoding: "utf8", cwd });
|
|
456
488
|
assert.equal(r.status, 0);
|
|
@@ -470,7 +502,7 @@ test("the run reports its own YIELD, not just the file's size", () => {
|
|
|
470
502
|
// transcript that exists, carries no assistant turn, and so yields no row.
|
|
471
503
|
["impl-581", [sessionEvt("/x"), thinkingEvt("xhigh"), sessionInitEvt("Implement ticket 581", "fleet-implementer")]],
|
|
472
504
|
]);
|
|
473
|
-
const out = join(
|
|
505
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
474
506
|
writeFileSync(out, formatTsv([row({ session: "other", member: "impl-1" })]));
|
|
475
507
|
|
|
476
508
|
const r = spawnSync(process.execPath, [CLI, dir, "--file", out], { encoding: "utf8" });
|
|
@@ -485,7 +517,7 @@ test("a corpus this schema cannot read is refused before anything is rewritten",
|
|
|
485
517
|
// Reading an out-of-schema file used to pad it and rewrite it, converting a
|
|
486
518
|
// human's unresolved merge conflict into confident-looking data.
|
|
487
519
|
const dir = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")]]]);
|
|
488
|
-
const out = join(
|
|
520
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
489
521
|
const conflicted = "# hdr\n<<<<<<< HEAD\n" + formatTsv([row()]) + "=======\n>>>>>>> theirs\n";
|
|
490
522
|
writeFileSync(out, conflicted);
|
|
491
523
|
const r = spawnSync(process.execPath, [CLI, dir, "--file", out], { encoding: "utf8" });
|
|
@@ -499,9 +531,51 @@ test("the header's blank lines and paragraph order survive a rewrite", () => {
|
|
|
499
531
|
// top and dropped the blank separators, silently, while the comment promised
|
|
500
532
|
// "preserved verbatim".
|
|
501
533
|
const dir = fixture([["impl-580", [sessionEvt("/x"), thinkingEvt("xhigh"), assistantEvt("claude-opus-5")]]]);
|
|
502
|
-
const out = join(
|
|
534
|
+
const out = join(tempDir("mo-out-"), "member-outcomes.tsv");
|
|
503
535
|
const header = "# first paragraph\n\n# second paragraph\n";
|
|
504
536
|
writeFileSync(out, header);
|
|
505
537
|
spawnSync(process.execPath, [CLI, dir, "--file", out], { encoding: "utf8" });
|
|
506
538
|
assert.equal(readFileSync(out, "utf8").startsWith(header), true);
|
|
507
539
|
});
|
|
540
|
+
|
|
541
|
+
test("a run dispatched under PascalCase names scrapes into rows tier-outcomes check can join, and a wrong tier fails (#2396)", () => {
|
|
542
|
+
// End to end, the two CLIs the ticket's measurement ran: scrape the session,
|
|
543
|
+
// then check tier-outcomes.tsv against what was scraped. Before the fix the
|
|
544
|
+
// scraped row's ticket was blank, so check reported 0 checked and exited 0
|
|
545
|
+
// even with a deliberately wrong tier.
|
|
546
|
+
const dir = fixture([
|
|
547
|
+
["Impl327", [sessionEvt("/x"), thinkingEvt("high"), sessionInitEvt("Ticket 327", "fleet-implementer-alt"), assistantEvt("claude-sonnet-5")]],
|
|
548
|
+
// Dispatched under the generic `task` definition, so only the NAME can
|
|
549
|
+
// book it implementer — implementerRows() filters on role as well as ticket.
|
|
550
|
+
["Impl333", [sessionEvt("/x"), thinkingEvt("high"), sessionInitEvt("Ticket 333"), assistantEvt("claude-opus-5")]],
|
|
551
|
+
["FixPr774", [sessionEvt("/x"), thinkingEvt("high"), sessionInitEvt("Apply the findings"), assistantEvt("claude-opus-5")]],
|
|
552
|
+
// No `session_init` line at all, so neither `task` nor `agent` exists: only
|
|
553
|
+
// the canonical-stem gate in ompMemberRecord lets the name classify it.
|
|
554
|
+
["Impl340", [sessionEvt("/x"), thinkingEvt("high"), assistantEvt("claude-opus-5")]],
|
|
555
|
+
]);
|
|
556
|
+
const work = tempDir("mo-tier-");
|
|
557
|
+
const members = join(work, "member-outcomes.tsv");
|
|
558
|
+
const scrape = spawnSync(process.execPath, [CLI, dir, "--file", members], { encoding: "utf8" });
|
|
559
|
+
assert.equal(scrape.status, 0, scrape.stderr);
|
|
560
|
+
const byMember = Object.fromEntries(parseTsv(readFileSync(members, "utf8")).map((r) => [r.member, `${r.role} ticket=${r.ticket} pr=${r.pr}`]));
|
|
561
|
+
assert.deepEqual(byMember, {
|
|
562
|
+
Impl327: "implementer ticket=327 pr=",
|
|
563
|
+
Impl333: "implementer ticket=333 pr=",
|
|
564
|
+
FixPr774: "reviewer ticket= pr=774",
|
|
565
|
+
Impl340: "implementer ticket=340 pr=",
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
const check = (tier) => {
|
|
569
|
+
const tierFile = join(work, "tier-outcomes.tsv");
|
|
570
|
+
const row = [TIER_SWITCH_DATE, "774", "327", "routine", tier, "yes", "no", "n", "light", "production", "40", "2"].join("\t");
|
|
571
|
+
writeFileSync(tierFile, `# ${TIER_COLUMNS.join("\t")}\n${row}\n`);
|
|
572
|
+
return spawnSync(process.execPath, [TIER_CLI, "check", "--file", tierFile, "--member-outcomes", members, "--ledger", join(work, "no-ledger.md")], { encoding: "utf8", cwd: work });
|
|
573
|
+
};
|
|
574
|
+
const ok = check("alt");
|
|
575
|
+
assert.equal(ok.status, 0, ok.stderr);
|
|
576
|
+
assert.match(ok.stdout, /1 rows; 1 checked, 0 failed/);
|
|
577
|
+
const mutant = check("WRONGTIER");
|
|
578
|
+
assert.equal(mutant.status, 1);
|
|
579
|
+
assert.match(mutant.stdout, /1 rows; 1 checked, 1 failed/);
|
|
580
|
+
assert.match(mutant.stderr, /PR #774 \(ticket #327\): tier=WRONGTIER/);
|
|
581
|
+
});
|