@feigi/fleet-ctl 3.23.36 → 3.23.37
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/package.json +1 -1
- package/scripts/main-checkout.mjs +1 -1
- package/scripts/member-write-guard.mjs +1 -1
- package/scripts/repo-root.mjs +1 -1
- package/skills/run-team/references/reaping.md +1 -1
- package/scripts/agent-test-dir-prose.test.mjs +0 -59
- package/scripts/agent-test.test.mjs +0 -1640
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
- package/scripts/ambient-git-vars-prose.test.mjs +0 -192
- package/scripts/ancestry-check-position-prose.test.mjs +0 -175
- package/scripts/apply-ruleset.test.mjs +0 -421
- package/scripts/arg-header-probes-prose.test.mjs +0 -394
- package/scripts/arg.test.mjs +0 -1354
- package/scripts/board-cli.test.mjs +0 -710
- package/scripts/board-identity.test.mjs +0 -429
- package/scripts/board-liveness-banner.test.mjs +0 -119
- package/scripts/board-prev-shape.test.mjs +0 -228
- package/scripts/board-tryparse-null.test.mjs +0 -119
- package/scripts/board.test.mjs +0 -3121
- package/scripts/brief-after-cut-prose.test.mjs +0 -53
- package/scripts/candidates-exit3-prose.test.mjs +0 -302
- package/scripts/candidates.test.mjs +0 -2312
- package/scripts/caveat-unification-prose.test.mjs +0 -98
- package/scripts/cell-readout.test.mjs +0 -615
- package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
- package/scripts/ci-completes-premise-prose.test.mjs +0 -257
- package/scripts/ci-state-prose.test.mjs +0 -113
- package/scripts/ci-state.test.mjs +0 -1933
- package/scripts/ci-vacuous-green.test.mjs +0 -368
- package/scripts/citation-sweep-prose.test.mjs +0 -1712
- package/scripts/claim-lifecycle.test.mjs +0 -187
- package/scripts/claim-ticket.test.mjs +0 -1122
- package/scripts/closing-keyword-prose.test.mjs +0 -193
- package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
- package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
- package/scripts/compute-board.test.mjs +0 -1214
- package/scripts/compute-spend.test.mjs +0 -517
- package/scripts/consumer-technology-prose.test.mjs +0 -126
- package/scripts/cross-repo-citation-prose.test.mjs +0 -155
- package/scripts/cwd-isolation-pins.mjs +0 -83
- package/scripts/dedupe-guard-prose.test.mjs +0 -243
- package/scripts/delete-merged-branch.test.mjs +0 -576
- package/scripts/derive-testcmd.test.mjs +0 -595
- package/scripts/diff-stats.test.mjs +0 -404
- package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
- package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
- package/scripts/dispositions-check.test.mjs +0 -936
- package/scripts/dispositions-gate-prose.test.mjs +0 -129
- package/scripts/drop-merged-label.test.mjs +0 -479
- package/scripts/exec-stub.mjs +0 -93
- package/scripts/exec-stub.test.mjs +0 -69
- package/scripts/expected-jobs-prose.test.mjs +0 -80
- package/scripts/fan-out-authorization-prose.test.mjs +0 -80
- package/scripts/filing-bar-seat-prose.test.mjs +0 -242
- package/scripts/filing-claim-bar-prose.test.mjs +0 -166
- package/scripts/finisher-died-prose.test.mjs +0 -31
- package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
- package/scripts/finisher-halt-prose.test.mjs +0 -106
- package/scripts/finisher-name-prose.test.mjs +0 -134
- package/scripts/finisher-own-tree-prose.test.mjs +0 -299
- package/scripts/finisher-pin-race-prose.test.mjs +0 -339
- package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
- package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
- package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
- package/scripts/fleet-bootstrap.test.mjs +0 -75
- package/scripts/fleet-heartbeat.test.mjs +0 -450
- package/scripts/fleet-provenance.test.mjs +0 -138
- package/scripts/fleet-run.test.mjs +0 -90
- package/scripts/fleet-state.test.mjs +0 -460
- package/scripts/fleet-tick-prose.test.mjs +0 -300
- package/scripts/fleet-tick.test.mjs +0 -2444
- package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
- package/scripts/frontmatter-check.test.mjs +0 -436
- package/scripts/git-env.test.mjs +0 -149
- package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
- package/scripts/gone-walk.test.mjs +0 -213
- package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
- package/scripts/head-moved-after-label-prose.test.mjs +0 -233
- package/scripts/immutable-body-claim-prose.test.mjs +0 -204
- package/scripts/implementer-model-tier.test.mjs +0 -235
- package/scripts/inflight-citation-prose.test.mjs +0 -144
- package/scripts/inflight-exit2-prose.test.mjs +0 -81
- package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
- package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
- package/scripts/inflight.test.mjs +0 -2882
- package/scripts/injection-control-prose.test.mjs +0 -404
- package/scripts/install-root-audit.test.mjs +0 -464
- package/scripts/instrument-check-prose.test.mjs +0 -235
- package/scripts/instruments.test.mjs +0 -787
- package/scripts/is-cli.test.mjs +0 -99
- package/scripts/issue-tracker-prose.test.mjs +0 -71
- package/scripts/json.test.mjs +0 -364
- package/scripts/ledger-dispatch.test.mjs +0 -927
- package/scripts/ledger-grammar.test.mjs +0 -227
- package/scripts/ledger-read-require-file.test.mjs +0 -197
- package/scripts/ledger-rotate.test.mjs +0 -142
- package/scripts/ledger.test.mjs +0 -3436
- package/scripts/line-distance-prose.test.mjs +0 -245
- package/scripts/liveness-rationale-prose.test.mjs +0 -83
- package/scripts/locale-pin-prose.test.mjs +0 -189
- package/scripts/main-checkout.test.mjs +0 -332
- package/scripts/member-outcome-prose.test.mjs +0 -167
- package/scripts/member-outcomes-header.test.mjs +0 -129
- package/scripts/member-outcomes-prose.test.mjs +0 -63
- package/scripts/member-outcomes.test.mjs +0 -638
- package/scripts/member-prompt-prose.test.mjs +0 -165
- package/scripts/member-record.test.mjs +0 -541
- package/scripts/member-write-guard.test.mjs +0 -214
- package/scripts/merge-commit-probe-prose.test.mjs +0 -122
- package/scripts/merge-gate.test.mjs +0 -613
- package/scripts/muted-git-guard-sweep.test.mjs +0 -493
- package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
- package/scripts/net-watchdog-prose.test.mjs +0 -79
- package/scripts/net.test.mjs +0 -211
- package/scripts/no-ci-gate-prose.test.mjs +0 -108
- package/scripts/no-undo-audit.test.mjs +0 -3961
- package/scripts/no-wave.test.mjs +0 -138
- package/scripts/node-floor-sweep.test.mjs +0 -611
- package/scripts/pointer-target-prose.test.mjs +0 -186
- package/scripts/pr-cost.test.mjs +0 -521
- package/scripts/pr-overlap.test.mjs +0 -692
- package/scripts/printf-die-sweep.test.mjs +0 -384
- package/scripts/prompt-renderer.mjs +0 -40
- package/scripts/prompt-renderer.test.mjs +0 -68
- package/scripts/prose-pin.mjs +0 -807
- package/scripts/prose-pin.test.mjs +0 -1034
- package/scripts/prove-merge.test.mjs +0 -995
- package/scripts/pull-table-relabel-prose.test.mjs +0 -60
- package/scripts/quiet-payload-prose.test.mjs +0 -222
- package/scripts/reap-cherry-check-prose.test.mjs +0 -80
- package/scripts/reap.test.mjs +0 -4432
- package/scripts/reaping-prose.test.mjs +0 -239
- package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
- package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
- package/scripts/recipe-derivation-prose.test.mjs +0 -112
- package/scripts/recipe-prove.test.mjs +0 -1042
- package/scripts/refuter-scratch-prose.test.mjs +0 -135
- package/scripts/release-label-required-prose.test.mjs +0 -71
- package/scripts/release-label-split-prose.test.mjs +0 -184
- package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
- package/scripts/release-ticket.test.mjs +0 -5099
- package/scripts/renovate-release-contract.test.mjs +0 -379
- package/scripts/repo-root.test.mjs +0 -873
- package/scripts/reporter-output-rule-prose.test.mjs +0 -208
- package/scripts/review-agent-report-only.test.mjs +0 -49
- package/scripts/review-core-booking.test.mjs +0 -35
- package/scripts/review-core-cwd-isolation.test.mjs +0 -374
- package/scripts/review-core-reads.test.mjs +0 -478
- package/scripts/review-core-refuter-scratch.test.mjs +0 -148
- package/scripts/review-core-scratch-refusal.test.mjs +0 -64
- package/scripts/review-core-shared-test-run.test.mjs +0 -275
- package/scripts/review-core-snapshot-path.test.mjs +0 -830
- package/scripts/review-core-specialist-scratch.test.mjs +0 -191
- package/scripts/review-core-testcmd.test.mjs +0 -335
- package/scripts/review-core-unrun.test.mjs +0 -566
- package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
- package/scripts/review-eval-resolver-path.test.mjs +0 -55
- package/scripts/review-host-fixture.mjs +0 -89
- package/scripts/review-in-run-retry.test.mjs +0 -211
- package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
- package/scripts/review-path-default.test.mjs +0 -796
- package/scripts/review-runner-spawns.test.mjs +0 -95
- package/scripts/review-runner.test.mjs +0 -166
- package/scripts/review-tier-audit.test.mjs +0 -140
- package/scripts/run-artifact-pr-prose.test.mjs +0 -341
- package/scripts/run-merge-bot-prose.test.mjs +0 -1413
- package/scripts/run-team-local-hook.test.mjs +0 -442
- package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
- package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
- package/scripts/section-between-guard-prose.test.mjs +0 -379
- package/scripts/select-dimensions.test.mjs +0 -674
- package/scripts/shared-refusal.test.mjs +0 -388
- package/scripts/shell-traps-prose.test.mjs +0 -504
- package/scripts/shortlist.test.mjs +0 -380
- package/scripts/slow-transport.mjs +0 -72
- package/scripts/snapshot-repo.test.mjs +0 -1006
- package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
- package/scripts/spend-view.test.mjs +0 -312
- package/scripts/staleness-qualifier-prose.test.mjs +0 -251
- package/scripts/staleness-verdict-prose.test.mjs +0 -142
- package/scripts/staleness.test.mjs +0 -893
- package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
- package/scripts/stash-prohibition-prose.test.mjs +0 -313
- package/scripts/strip-comments.mjs +0 -44
- package/scripts/temp-dir.mjs +0 -47
- package/scripts/ticket-router.test.mjs +0 -981
- package/scripts/tier-check.test.mjs +0 -828
- package/scripts/tier-outcomes-header.test.mjs +0 -518
- package/scripts/tier-outcomes.test.mjs +0 -572
- package/scripts/tier-roles.test.mjs +0 -535
- package/scripts/tracker-block-copy-prose.test.mjs +0 -288
- package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
- package/scripts/unattended-git-sweep.test.mjs +0 -142
- package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
- package/scripts/verify-sha.test.mjs +0 -692
- package/scripts/watcher-degraded-block.test.mjs +0 -369
- package/scripts/watcher-key-prose.test.mjs +0 -106
- package/scripts/within-run-pair-prose.test.mjs +0 -212
- package/scripts/worktree-audit.test.mjs +0 -1408
- package/scripts/worktree-head-prose.test.mjs +0 -276
- package/scripts/worktree-listing-sweep.test.mjs +0 -217
- package/scripts/worktree-model-prose.test.mjs +0 -216
- package/scripts/worktree-porcelain.mjs +0 -35
- package/scripts/worktree-porcelain.test.mjs +0 -102
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// The finisher's member name is a convention two documents state and two
|
|
2
|
-
// modules read. Nothing pinned it: adding it to run-team's naming list moved no
|
|
3
|
-
// test, which is why the convention could be read by `classifyRole` while being
|
|
4
|
-
// written down nowhere (#326).
|
|
5
|
-
//
|
|
6
|
-
// The fix-applier's own presence in the same paragraph is pinned separately, in
|
|
7
|
-
// review-path-default.test.mjs by "the member-naming rule still names the
|
|
8
|
-
// fix-applier". These are not duplicates: that one guards one name against
|
|
9
|
-
// deletion, these guard the list against disagreeing with the module that
|
|
10
|
-
// reads it.
|
|
11
|
-
import { test } from "node:test";
|
|
12
|
-
import assert from "node:assert/strict";
|
|
13
|
-
import { readFileSync } from "node:fs";
|
|
14
|
-
import { join } from "node:path";
|
|
15
|
-
import { classifyRole } from "./compute-spend.mjs";
|
|
16
|
-
import { parseMemberName } from "./member-outcomes.mjs";
|
|
17
|
-
import { between } from "./prose-pin.mjs";
|
|
18
|
-
|
|
19
|
-
const REPO = join(import.meta.dirname, "..");
|
|
20
|
-
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
21
|
-
|
|
22
|
-
// Every slice is flattened before matching, so a rewrap of the same words is a
|
|
23
|
-
// no-op. A pin that reds on a reflow discriminates nothing — it only teaches the
|
|
24
|
-
// next editor to work around it.
|
|
25
|
-
const flat = (s) => s.replace(/\s+/g, " ");
|
|
26
|
-
|
|
27
|
-
// Read RAW, not flattened: the slice below ends at the blank line that closes
|
|
28
|
-
// the paragraph, and flattening collapses it away. Flattening happens after.
|
|
29
|
-
const SKILL = read("skills", "run-team", "SKILL.md");
|
|
30
|
-
const LIFECYCLE = read("skills", "run-team", "references", "member-lifecycle.md");
|
|
31
|
-
const SPEND = flat(read("scripts", "compute-spend.mjs"));
|
|
32
|
-
|
|
33
|
-
const MEMBER_NAMES = ["impl-<issue#>", "fix-pr-<pr#>", "review-pr-<pr#>", "finisher-pr-<pr#>", "merge-bot-<n>"];
|
|
34
|
-
|
|
35
|
-
// Sliced to the naming PARAGRAPH, never file-wide: run-team mentions the
|
|
36
|
-
// finisher in its narrative dozens of times, and any of those hits would
|
|
37
|
-
// satisfy a file-wide match, leaving this list free to lose the name with the
|
|
38
|
-
// pin green. The paragraph, not the sentence: ending the slice at the first "."
|
|
39
|
-
// truncates on any inner period — an abbreviation, or the
|
|
40
|
-
// references/member-lifecycle.md pointer this very paragraph already carries —
|
|
41
|
-
// which reds the pin and reports every name as removed while none was. A blank
|
|
42
|
-
// line outlives a rewrap the way a sentence boundary does not. `between` is the
|
|
43
|
-
// shared two-ended slicer the rest of this directory already uses, and it
|
|
44
|
-
// carries the "update this test" guard for either anchor moving.
|
|
45
|
-
const namingSentence = (doc, label) => flat(between(doc, "Names follow", "\n\n", label));
|
|
46
|
-
|
|
47
|
-
test("both member-naming lists name every member, the finisher included", () => {
|
|
48
|
-
// Both, not just the runbook's: SKILL.md's list ends by pointing at
|
|
49
|
-
// references/member-lifecycle.md, which carries the same list, so a reader who
|
|
50
|
-
// follows the pointer must not land on one that omits the finisher.
|
|
51
|
-
//
|
|
52
|
-
// Compared as a SET. List order carries no instruction, and a pin that fires
|
|
53
|
-
// on a reorder is one the next editor learns to work around. Every missing
|
|
54
|
-
// name is collected and reported at once — asserting inside the loop would let
|
|
55
|
-
// the first miss mask the rest, and the count of failures would read as the
|
|
56
|
-
// count of defects.
|
|
57
|
-
for (const [label, doc] of [["run-team/SKILL.md", SKILL], ["references/member-lifecycle.md", LIFECYCLE]]) {
|
|
58
|
-
const sentence = namingSentence(doc, label);
|
|
59
|
-
const missing = MEMBER_NAMES.filter((n) => !sentence.includes(`\`${n}\``));
|
|
60
|
-
assert.deepEqual(
|
|
61
|
-
missing,
|
|
62
|
-
[],
|
|
63
|
-
`${label}'s member-naming list no longer names ${missing.join(", ")} — a controller reading it names that member something else, and a misnamed member is invisible to the ledger and unreachable by \`hub send\``,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("every name compute-spend calls stable-because-run-team-fixes-it is one run-team fixes", () => {
|
|
69
|
-
// The comment's claim is about run-team, so it is only true while run-team's
|
|
70
|
-
// own list carries every name the comment cites. Derived from the comment
|
|
71
|
-
// rather than restated: a name added to the comment alone — the exact half-fix
|
|
72
|
-
// #326 was deferred to avoid — reds here, and a restated list would not.
|
|
73
|
-
const m = /run-team fixes them \(([^)]*)\)/.exec(SPEND);
|
|
74
|
-
assert.ok(m, "compute-spend.mjs's 'run-team fixes them' comment moved — re-anchor this pin");
|
|
75
|
-
const cited = [...m[1].matchAll(/`([a-z-]+)-<n>`/g)].map((x) => x[1]);
|
|
76
|
-
assert.ok(cited.length > 0, `no member names parsed out of the comment's list: ${m[1]}`);
|
|
77
|
-
assert.ok(cited.includes("finisher-pr"), "the finisher is missing from the list the comment claims run-team fixes");
|
|
78
|
-
// The naming list, not the whole file — which is what the comment above says
|
|
79
|
-
// this checks. A name cited here reaches SKILL.md's narrative without ever
|
|
80
|
-
// being added to the list, and a file-wide haystack scores that as a hit.
|
|
81
|
-
const list = namingSentence(SKILL, "run-team/SKILL.md");
|
|
82
|
-
for (const role of cited) {
|
|
83
|
-
assert.match(
|
|
84
|
-
list,
|
|
85
|
-
new RegExp("`" + role + "-<(?:issue#|pr#|n)>`"),
|
|
86
|
-
`compute-spend.mjs claims run-team fixes \`${role}-<n>\`, but run-team's naming list never mentions it`,
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("classifyRole and parseMemberName accept the same finisher spellings", () => {
|
|
92
|
-
// The other half, and the half that fails silently. Documenting one canonical
|
|
93
|
-
// name must not narrow what either module accepts — and the two answer
|
|
94
|
-
// different questions, so a narrowing of one alone does not show up in the
|
|
95
|
-
// other's output. `classifyRole` decides the role the spend headline counts;
|
|
96
|
-
// `parseMemberName` decides which PR the name books, which is the join key
|
|
97
|
-
// into tier-outcomes.tsv. Narrow the parser alone and every member still
|
|
98
|
-
// classifies as a finisher, the headline stays right, and only the row
|
|
99
|
-
// linkage disappears — the failure that once cost 120 of 283 finisher members
|
|
100
|
-
// their join key. #969 pinned the classifier against all five of these and
|
|
101
|
-
// never imported the parser, so that narrowing passed the whole suite (#1072).
|
|
102
|
-
//
|
|
103
|
-
// All five member names below are in docs/metrics/member-outcomes.tsv verbatim,
|
|
104
|
-
// each booked to exactly the PR number its own name carries. The descriptions
|
|
105
|
-
// deliberately carry no finisher word — the name has to carry the match, or
|
|
106
|
-
// this passes for the wrong reason. The last is a retry suffix: the same
|
|
107
|
-
// member's second attempt, not a different name. It is the only one of the
|
|
108
|
-
// five that reds when the classifier anchors to a trailing number, and the
|
|
109
|
-
// only one that reds when the parser stops stripping that suffix.
|
|
110
|
-
//
|
|
111
|
-
// `merge-bot-<n>` is deliberately absent: its number is a per-run dispatch
|
|
112
|
-
// counter, never a PR, and the parser refusing to book it as a PR is correct
|
|
113
|
-
// disagreement, not drift. It is pinned where it belongs, in
|
|
114
|
-
// member-outcomes.test.mjs.
|
|
115
|
-
const NAMES = ["finisher-pr-945", "finish-pr-751", "finisher-933", "finish-315", "finisher-pr-958-b"];
|
|
116
|
-
|
|
117
|
-
// Compared as ONE table rather than asserted inside the loop: the first
|
|
118
|
-
// disagreement would otherwise mask the rest, and a failure that names one
|
|
119
|
-
// broken spelling when four broke reads as a smaller defect than it is.
|
|
120
|
-
const got = NAMES.map((name) => {
|
|
121
|
-
const { ticket, pr } = parseMemberName(name);
|
|
122
|
-
const role = classifyRole({ spawnDepth: 0, memberName: name, description: "Apply reviewer findings" });
|
|
123
|
-
return `${name}: role=${role} ticket=${JSON.stringify(ticket)} pr=${JSON.stringify(pr)}`;
|
|
124
|
-
});
|
|
125
|
-
// The expected PR is READ OUT OF the name, never restated beside it. "pr is
|
|
126
|
-
// non-empty" is satisfied by a parser that books some other row's number, and
|
|
127
|
-
// a restated column drifts into agreeing with whatever the parser now returns.
|
|
128
|
-
const want = NAMES.map((name) => `${name}: role=finisher ticket="" pr=${JSON.stringify(/(\d+)/.exec(name)[1])}`);
|
|
129
|
-
assert.deepEqual(
|
|
130
|
-
got,
|
|
131
|
-
want,
|
|
132
|
-
"classifyRole and parseMemberName no longer accept the same finisher spellings — a spelling only one of them still recognises either moves the spend headline for a run already recorded, or silently drops that member's join key into tier-outcomes.tsv",
|
|
133
|
-
);
|
|
134
|
-
});
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { sentences } from "./prose-pin.mjs";
|
|
6
|
-
|
|
7
|
-
// #389. The runbook calls the finisher an auditor, but its gate MUTATES: the
|
|
8
|
-
// controller has it independently re-run the ticket's acceptance mutation, run
|
|
9
|
-
// the suite, and discard. That makes it a writer in the worktree the
|
|
10
|
-
// fix-applier owns, with nothing sequencing the two. Measured on #380 — the
|
|
11
|
-
// finisher was inside that worktree at the instant the fix-applier announced
|
|
12
|
-
// one more clause to land. Neither ordering is detectable afterwards from the
|
|
13
|
-
// diff: a restore eats the uncommitted clause, or the mutant is still there
|
|
14
|
-
// when the fix-applier commits and a deliberately broken guard ships as the
|
|
15
|
-
// fix, in a commit nothing re-reviews.
|
|
16
|
-
//
|
|
17
|
-
// The ruling was the middle option of the three the ticket raised: give the
|
|
18
|
-
// finisher its own tree. NOT "sequence them" (controller discipline is what
|
|
19
|
-
// failed) and NOT "make the finisher non-mutating" (that trades away the
|
|
20
|
-
// independent verification the gate exists for) — so this file pins the
|
|
21
|
-
// mutation as much as the isolation.
|
|
22
|
-
//
|
|
23
|
-
// Slice-scoped, not whole-file: a bare presence check anywhere in this
|
|
24
|
-
// 1900+ line SKILL.md stays green even when the text moves somewhere its
|
|
25
|
-
// reader never reaches (measured before in this same file, #172).
|
|
26
|
-
const REPO = join(import.meta.dirname, "..");
|
|
27
|
-
const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
|
|
28
|
-
|
|
29
|
-
// The gate belongs to the finisher's duty 2 — verifying a claim by RUNNING is
|
|
30
|
-
// the same duty as verifying it by reading the diff, and duty 2 is where the
|
|
31
|
-
// finisher already reads. Anchored on the two duties' own opening text, so a
|
|
32
|
-
// renumber or a move out of the duty list reds rather than passing vacuously.
|
|
33
|
-
const DUTY1_START = "1. **Audit the worktree**";
|
|
34
|
-
const DUTY2_START = "2. **Confirm every deferral";
|
|
35
|
-
const DUTY2_END = "3. Add `ready-to-merge`";
|
|
36
|
-
|
|
37
|
-
// Markdown hard-wraps at ~80 columns and this text is a list continuation, so
|
|
38
|
-
// every phrase can split across a line with leading indent re-injected at the
|
|
39
|
-
// wrap point. Flattening makes the wrap invisible to a phrase match — so a
|
|
40
|
-
// pure rewrap, words untouched, cannot red a pin here. Every match in this
|
|
41
|
-
// file goes through it; a raw-RUN_TEAM assertion is reflow-brittle and reds
|
|
42
|
-
// with a message implying the prose was weakened when nothing was.
|
|
43
|
-
const flat = (s) => s.replace(/\n[ \t]*/g, " ");
|
|
44
|
-
|
|
45
|
-
function between(start, end) {
|
|
46
|
-
const at = RUN_TEAM.indexOf(start);
|
|
47
|
-
assert.notEqual(at, -1, `finisher duty opener ('${start}') moved — update this test`);
|
|
48
|
-
const to = RUN_TEAM.indexOf(end, at);
|
|
49
|
-
assert.notEqual(to, -1, `finisher duty opener ('${end}') moved — update this test`);
|
|
50
|
-
return flat(RUN_TEAM.slice(at, to));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const duty1Text = () => between(DUTY1_START, DUTY2_START);
|
|
54
|
-
const duty2Text = () => between(DUTY2_START, DUTY2_END);
|
|
55
|
-
|
|
56
|
-
test("the mutation gate runs in a worktree the finisher adds itself, at its dispatch pin", () => {
|
|
57
|
-
const text = duty2Text();
|
|
58
|
-
// ONE contiguous span. The command and its ref operand have to stay joined:
|
|
59
|
-
// `worktree add --detach` at some other ref is a different instruction, and
|
|
60
|
-
// two independent phrase matches stay green through exactly that swap.
|
|
61
|
-
assert.match(
|
|
62
|
-
text,
|
|
63
|
-
/git worktree add --detach [^`]*<your dispatch pin>/,
|
|
64
|
-
"the gate no longer adds its own detached worktree at the dispatch pin — either the finisher is back to mutating the worktree another member owns, or the tree is created at some other ref",
|
|
65
|
-
);
|
|
66
|
-
// Which ref is the whole point, and it is the same substitution the halt
|
|
67
|
-
// block's head-equality check already rejects: a member that kept working
|
|
68
|
-
// and pushed after the pin matches the branch tip, so a tree cut at
|
|
69
|
-
// `headRefOid` gets mutation-verified over commits no reviewer read.
|
|
70
|
-
assert.doesNotMatch(
|
|
71
|
-
text,
|
|
72
|
-
/git worktree add --detach [^`]*(headRefOid|origin\/)/,
|
|
73
|
-
"the throwaway tree is cut at the pushed branch tip rather than the dispatch pin — a member that pushed past the pin gets its unreviewed commits verified and labelled",
|
|
74
|
-
);
|
|
75
|
-
// The scratch root is shared with every sibling member, so the PR number
|
|
76
|
-
// alone is not a unique path: a PR with a second finisher collides, and
|
|
77
|
-
// `worktree add` on an occupied path fails closed into a halt with a purely
|
|
78
|
-
// mechanical cause.
|
|
79
|
-
//
|
|
80
|
-
// Read the path OFF the add and require the remove to name it back. The
|
|
81
|
-
// token appears twice, so a bare match on the scoping is satisfied by
|
|
82
|
-
// either occurrence alone: strip it from just one command and add/remove
|
|
83
|
-
// silently target different paths, which is undetectable in both
|
|
84
|
-
// directions. Mismatched, the remove either refuses (rc 128, tree leaked)
|
|
85
|
-
// or succeeds against a differently-scoped path and takes a sibling
|
|
86
|
-
// finisher's tree with it.
|
|
87
|
-
const added = text.match(/git worktree add --detach ([^`]*?) <your dispatch pin>/);
|
|
88
|
-
assert.ok(added, "no `git worktree add --detach <path> <your dispatch pin>` left to read a path out of");
|
|
89
|
-
assert.match(
|
|
90
|
-
added[1],
|
|
91
|
-
/^<scratch>\/pr<N>\/finish-<your member name>$/,
|
|
92
|
-
"the throwaway tree's path no longer carries the member name — the scratch root is shared, so two finishers on one PR collide on it",
|
|
93
|
-
);
|
|
94
|
-
assert.match(
|
|
95
|
-
text,
|
|
96
|
-
new RegExp(`git worktree remove --force ${added[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`),
|
|
97
|
-
"the remove names a different path than the add — either the remove refuses and the tree leaks, or it removes a differently-scoped tree that is not this finisher's",
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test("the throwaway tree is removed on every path, failures included, and --force is scoped to it", () => {
|
|
102
|
-
const text = duty2Text();
|
|
103
|
-
assert.match(
|
|
104
|
-
text,
|
|
105
|
-
/git worktree remove --force/,
|
|
106
|
-
"the removal no longer forces — the tree is deliberately dirty when the gate finishes, so a plain remove refuses it and the tree leaks",
|
|
107
|
-
);
|
|
108
|
-
// Contiguous: "remove it" and "on every path including the failing ones" are
|
|
109
|
-
// one invariant. A removal documented only on the success path is exactly
|
|
110
|
-
// the leak this criterion exists to prevent, and it reads as satisfied if
|
|
111
|
-
// the two halves are matched separately.
|
|
112
|
-
assert.match(
|
|
113
|
-
text,
|
|
114
|
-
/Remove it on every path, the failing ones included/,
|
|
115
|
-
"the every-path removal invariant is gone or was split — a gate that only removes the tree when the mutation behaves leaks one worktree per halt",
|
|
116
|
-
);
|
|
117
|
-
// `--force` is banned elsewhere in this runbook on worktrees that might hold
|
|
118
|
-
// someone's only copy. Without the stated scope this reads as a licence.
|
|
119
|
-
assert.match(
|
|
120
|
-
text,
|
|
121
|
-
/right only here/,
|
|
122
|
-
"the `--force` exception no longer says it is scoped to this tree — elsewhere in this runbook a `worktree remove` refusal is a finding, and an unscoped exception reads as permission to force past it",
|
|
123
|
-
);
|
|
124
|
-
// Nothing sweeps a leak for the finisher: reap's branchless sweep is bounded
|
|
125
|
-
// to the fleet's worktree home, so a tree under <scratch> is reported and
|
|
126
|
-
// left. A gate that assumes reap collects it will leak silently.
|
|
127
|
-
assert.match(
|
|
128
|
-
text,
|
|
129
|
-
/reap\.sh/,
|
|
130
|
-
"the gate no longer says a leaked scratch tree is outside reap's sweep — a finisher that assumes the leak is collected for it leaves one per finish",
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
test("the owned worktree stays a read — the finisher never writes to or restores it", () => {
|
|
135
|
-
const text = duty2Text();
|
|
136
|
-
// The live incident's near-miss: the controller's halt instruction said
|
|
137
|
-
// "restore the mutated paths", which IS the silent-destruction ordering. The
|
|
138
|
-
// finisher refused because it could not prove the diff was its own. That
|
|
139
|
-
// refusal was judgement, not a rule; this makes it a rule.
|
|
140
|
-
assert.match(
|
|
141
|
-
text,
|
|
142
|
-
/None of this licenses a write to the owned worktree\./,
|
|
143
|
-
"the ban on writing to the owned worktree is gone — the throwaway tree removes the hazard only while the finisher also stops treating the owned tree as a write target",
|
|
144
|
-
);
|
|
145
|
-
assert.match(
|
|
146
|
-
text,
|
|
147
|
-
/you never restore that tree, because you never wrote to it/,
|
|
148
|
-
"the no-restore rule no longer reads as a consequence of never having written — stated as a bare prohibition it invites a controller instruction to override it, which is what happened live",
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
test("independent re-verification survives — the gate still mutates and runs the suite itself", () => {
|
|
153
|
-
const text = duty2Text();
|
|
154
|
-
// ACCEPT side. The ticket's third option was to make the finisher
|
|
155
|
-
// non-mutating and have it read the fix-applier's record instead. That was
|
|
156
|
-
// ruled out: the independent gate caught two unpinned fixes in the run that
|
|
157
|
-
// produced this ticket. A change that isolates the writes but quietly drops
|
|
158
|
-
// the mutation satisfies every other test here and guts the gate.
|
|
159
|
-
assert.match(
|
|
160
|
-
text,
|
|
161
|
-
/acceptance mutation/,
|
|
162
|
-
"the gate no longer re-runs the ticket's acceptance mutation — isolating the write is not the point if the independent verification goes with it",
|
|
163
|
-
);
|
|
164
|
-
assert.match(
|
|
165
|
-
text,
|
|
166
|
-
/<testCmd>/,
|
|
167
|
-
"the gate no longer runs the suite itself — reading the fix-applier's recorded result is the option this ticket's ruling rejected",
|
|
168
|
-
);
|
|
169
|
-
// A placeholder nobody substitutes is not a gate. `<testCmd>` reaches the
|
|
170
|
-
// finisher only through the controller's prompt — there is no fleet-finisher
|
|
171
|
-
// agent definition to carry a default — and the runbook's pass-list named
|
|
172
|
-
// the workflow and the fix-applier only, so the gate shipped unenforceable.
|
|
173
|
-
//
|
|
174
|
-
// The instruction and its reason in ONE sentence, `sentences()`'s (#1940).
|
|
175
|
-
// The first-period `[^.]*` gap this replaces refused a valid rewording with
|
|
176
|
-
// an "e.g." or a filename between the two, and ran on past a `?` or `!` —
|
|
177
|
-
// the latter nearly inert here, since both phrases must be verbatim anyway.
|
|
178
|
-
assert.ok(
|
|
179
|
-
sentences(duty1Text()).some((s) => /Give it `<testCmd>` too.*duty 2's mutation gate runs it/.test(s)),
|
|
180
|
-
"the controller is no longer told to hand the finisher a `<testCmd>` — duty 2's placeholders reach it unsubstituted and the gate has no command to run",
|
|
181
|
-
);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// #525: duty 1 names `worktree-audit.sh` as the audit to run, and that script
|
|
185
|
-
// takes NO argument and audits every worktree at once. Without the clause, a
|
|
186
|
-
// finisher reads "run worktree-audit.sh" against a runbook full of
|
|
187
|
-
// path-taking siblings, passes this worktree's path, and gets exit 2 — or,
|
|
188
|
-
// before #525's guard, a full audit of every OTHER worktree at exit 0 with
|
|
189
|
-
// the main checkout on top, which is the failure the guard exists to stop.
|
|
190
|
-
// The contract is pinned at the script (worktree-audit.test.mjs), unpinned in
|
|
191
|
-
// the runbook the finisher actually reads.
|
|
192
|
-
test("duty 1 says worktree-audit.sh takes no argument and audits every worktree", () => {
|
|
193
|
-
// ONE contiguous span: "takes no argument" and "find this worktree's row"
|
|
194
|
-
// are halves of the same instruction. Matched separately, dropping the
|
|
195
|
-
// lookup half stays green and leaves a finisher reading the first row —
|
|
196
|
-
// the main checkout — as if it were this worktree's.
|
|
197
|
-
assert.match(
|
|
198
|
-
duty1Text(),
|
|
199
|
-
/it takes no argument; it audits every worktree in one pass, so find this worktree's row in its output/,
|
|
200
|
-
"duty 1 no longer says `worktree-audit.sh` takes no argument and audits every worktree — a finisher that passes it this worktree's path gets exit 2, and one that reads the first row reads the main checkout",
|
|
201
|
-
);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// #1106: duty 1 offered the audit and `git status --porcelain -unormal` as
|
|
205
|
-
// equal alternatives, then halted on "dirty or diverged" — and neither can
|
|
206
|
-
// see diverged. Porcelain is empty over a clean tree one commit past the pin,
|
|
207
|
-
// and the audit's `ahead` is counted against `origin/main`
|
|
208
|
-
// (worktree-audit.sh's `base=${BASE_REF:-origin/main}`), which a healthy
|
|
209
|
-
// worktree on an open, unmerged PR is ahead of too. The only divergence check
|
|
210
|
-
// is the cause block's head-equality against the dispatch pin. And "find this
|
|
211
|
-
// worktree's row" gave no rule for a row that cannot answer, or for no row at
|
|
212
|
-
// all. Each pin below holds ONE sentence (`sentences()`, #1940), so a clause
|
|
213
|
-
// deleted from inside the duty reds its own pin rather than being satisfied by
|
|
214
|
-
// a neighbour.
|
|
215
|
-
test("duty 1 names the instrument for each check, and halts on a row that cannot answer", () => {
|
|
216
|
-
const said = (re) => sentences(duty1Text()).some((s) => re.test(s));
|
|
217
|
-
assert.ok(
|
|
218
|
-
said(/\*\*Dirty:\*\* the row's `dirty` field, or `git status --porcelain -unormal` inside the worktree/),
|
|
219
|
-
"duty 1 no longer names the dirty check's two instruments — the row's `dirty` field and `git status --porcelain -unormal`",
|
|
220
|
-
);
|
|
221
|
-
assert.ok(
|
|
222
|
-
said(/\*\*Diverged:\*\* the worktree's `HEAD` against your dispatch pin/),
|
|
223
|
-
"duty 1 no longer says diverged is the worktree's HEAD against the dispatch pin — neither the audit nor git status can see a clean tree that moved past it",
|
|
224
|
-
);
|
|
225
|
-
assert.ok(
|
|
226
|
-
said(/row's `ahead`.*counted against `origin\/main`.*cannot answer/),
|
|
227
|
-
"duty 1 no longer says the audit's `ahead` is counted against origin/main — a finisher reading it as divergence sees every PR worktree as diverged, or learns to ignore it",
|
|
228
|
-
);
|
|
229
|
-
// The reason `ahead` cannot answer holds for the PR the finisher runs on: an
|
|
230
|
-
// open, unmerged one. It is not true of every PR worktree — after a merge
|
|
231
|
-
// commit into a fetched origin/main the branch's `ahead` reads 0 — so the
|
|
232
|
-
// claim is scoped, never "always", and the scope sits in the same sentence.
|
|
233
|
-
assert.ok(
|
|
234
|
-
said(/row's `ahead`.*counted against `origin\/main`.*open, unmerged PR.*cannot answer/),
|
|
235
|
-
"duty 1 no longer scopes the `ahead` reason to an open, unmerged PR's worktree — after a merge into a fetched origin/main a PR worktree's `ahead` reads 0, so an unscoped claim is false",
|
|
236
|
-
);
|
|
237
|
-
assert.doesNotMatch(
|
|
238
|
-
flat(RUN_TEAM),
|
|
239
|
-
/\balways\b[^.]{0,20}\bahead\b/i,
|
|
240
|
-
"the run-team skill states an unconditional lead over origin/main again — a PR worktree's `ahead` reads 0 once its merge commit is in a fetched origin/main",
|
|
241
|
-
);
|
|
242
|
-
// The three non-clean row shapes, each halting and each named. Unreadable
|
|
243
|
-
// and missing share `readable:false` and differ only in their counts, so
|
|
244
|
-
// each is pinned with its count shape and stderr line — dropping one leaves
|
|
245
|
-
// a finisher to read the other's zero counts as clean.
|
|
246
|
-
assert.ok(
|
|
247
|
-
said(/halt.*`readable:false` with `null` counts \(`UNREADABLE: <wt> \(<cause>\)`\) is \*worktree unreadable\*/),
|
|
248
|
-
"duty 1 no longer halts on an unreadable row (`readable:false`, null counts) — the one state the audit exists never to report as clean",
|
|
249
|
-
);
|
|
250
|
-
assert.ok(
|
|
251
|
-
said(/halt.*`readable:false` with zero counts \(`MISSING on disk: <wt>`\) is \*worktree missing\*/),
|
|
252
|
-
"duty 1 no longer halts on a missing row (`readable:false`, zero counts) — zero counts read as a clean tree",
|
|
253
|
-
);
|
|
254
|
-
assert.ok(
|
|
255
|
-
said(/halt.*no row for this worktree at all is \*worktree absent\*/),
|
|
256
|
-
"duty 1 no longer halts when this worktree has no row — a finisher finds nothing wrong in a row it never found",
|
|
257
|
-
);
|
|
258
|
-
// #2141: the row's `worktree` field is `git worktree list`'s, which always
|
|
259
|
-
// reports the resolved physical path — worktree-audit.sh resolves nothing
|
|
260
|
-
// itself. A finisher dispatched with a symlinked spelling (macOS's `/tmp`
|
|
261
|
-
// and `/var/folders` are symlinks too) finds no row for the path as
|
|
262
|
-
// written and halts a healthy tree as *worktree absent*. Its own sentence,
|
|
263
|
-
// so deleting the clause reds here and nowhere else.
|
|
264
|
-
assert.ok(
|
|
265
|
-
said(/Match the row by the resolved form of the worktree path you were dispatched with.*`realpath <abs-path>`.*`cd <abs-path> && pwd -P`.*never by that path as written/),
|
|
266
|
-
"duty 1 no longer tells the finisher to match its row by the resolved (`realpath` / `pwd -P`) form of its dispatched worktree path — a symlinked spelling finds no row and halts a healthy tree as *worktree absent*",
|
|
267
|
-
);
|
|
268
|
-
// `git status` answers the dirty check only. Presented as a full
|
|
269
|
-
// substitute, it lets a finisher skip the audit and never see the three
|
|
270
|
-
// shapes above.
|
|
271
|
-
assert.ok(
|
|
272
|
-
said(/`git status` is no substitute for the audit here/),
|
|
273
|
-
"duty 1 no longer says `git status` cannot stand in for the audit on the three row shapes — it is back to reading as an equal alternative",
|
|
274
|
-
);
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
test("duty 1's dirty-tree halt survives, and duty 2's own caveats are not clipped", () => {
|
|
278
|
-
// ACCEPT side, and the neighbour check. Duty 1's halt is the guard that
|
|
279
|
-
// caught #389 live; the throwaway tree makes an overlap harmless, which is
|
|
280
|
-
// not a reason to stop detecting one. It is unpinned everywhere else, and it
|
|
281
|
-
// sits one duty away from this edit. (The always-halts invariant in the halt
|
|
282
|
-
// block's cause list is already owned by finisher-pin-race-prose.test.mjs —
|
|
283
|
-
// not re-pinned here.)
|
|
284
|
-
assert.match(
|
|
285
|
-
duty1Text(),
|
|
286
|
-
/Dirty, diverged, unreadable, missing or absent halts the finisher \*here\*, before the label/,
|
|
287
|
-
"duty 1's halt no longer covers all five causes, or no longer halts *here*, before the label — check it was not weakened",
|
|
288
|
-
);
|
|
289
|
-
// The paragraph the new gate is appended directly after, and the half of
|
|
290
|
-
// duty 2 that dedupe-guard-prose.test.mjs does NOT cover: it pins the
|
|
291
|
-
// positive `origin/main...HEAD` check, nothing pins this scoping caveat. An
|
|
292
|
-
// insertion that swallows a trailing paragraph is the ordinary way to break
|
|
293
|
-
// a neighbour, and it leaves every other test here green.
|
|
294
|
-
assert.match(
|
|
295
|
-
duty2Text(),
|
|
296
|
-
/That range is right for the positive check and wrong for a negative one\./,
|
|
297
|
-
"duty 2's negative-claim scoping caveat was clipped — appending the mutation gate must not swallow the paragraph it lands after",
|
|
298
|
-
);
|
|
299
|
-
});
|