@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,184 +0,0 @@
|
|
|
1
|
-
// #443. Step 7's push was documented unconditionally with `--force-with-lease`,
|
|
2
|
-
// on a path whose common case is a first push where the lease buys nothing —
|
|
3
|
-
// and it is the exact string #149 documents as intermittently denied by the
|
|
4
|
-
// auto-mode classifier, before the push is attempted — so a denial is not a
|
|
5
|
-
// lease race. It is judged per invocation and intermittently, never once for
|
|
6
|
-
// the command, so a retry is a coin flip rather than a fix
|
|
7
|
-
// (`run-merge-bot.md`: "judged and intermittently denied per invocation").
|
|
8
|
-
//
|
|
9
|
-
// Two stronger claims were measured and REFUTED — this file must never pin
|
|
10
|
-
// either back in:
|
|
11
|
-
// - the lease does NOT fail on a fresh branch. `git push --force-with-lease
|
|
12
|
-
// -u origin HEAD` on a never-pushed branch succeeds cleanly at rc 0
|
|
13
|
-
// (measured, git 2.50.1, bare origin + clone).
|
|
14
|
-
// - the flag is NOT unconditionally useless. Step 7 rebases immediately
|
|
15
|
-
// before pushing, so a member re-entering step 7 after an earlier push
|
|
16
|
-
// genuinely needs the force — removing the flag would be wrong.
|
|
17
|
-
//
|
|
18
|
-
// Ruling: keep the push command exactly as written, add one sentence saying
|
|
19
|
-
// WHY the lease is there — a member who knows it protects a re-push can
|
|
20
|
-
// reason about a denial; one told only "use a plain push if denied" uses a
|
|
21
|
-
// plain push on the re-push too, where the force is load-bearing.
|
|
22
|
-
import { test } from "node:test";
|
|
23
|
-
import assert from "node:assert/strict";
|
|
24
|
-
import { readFileSync } from "node:fs";
|
|
25
|
-
import { join } from "node:path";
|
|
26
|
-
import { between, phrase } from "./prose-pin.mjs";
|
|
27
|
-
|
|
28
|
-
const REPO = join(import.meta.dirname, "..");
|
|
29
|
-
const NEXT_TICKET = readFileSync(join(REPO, "skills", "next-ticket", "SKILL.md"), "utf8");
|
|
30
|
-
|
|
31
|
-
const step7 = () =>
|
|
32
|
-
between(NEXT_TICKET, "## 7. When the sizing-a-ticket path reports done", "## Red flags", "next-ticket/SKILL.md step 7");
|
|
33
|
-
|
|
34
|
-
// Narrow to the note itself before pinning anything, the way
|
|
35
|
-
// candidates-exit3-prose.test.mjs narrows to one table row. A positive
|
|
36
|
-
// `assert.match` over the whole step-7 slice is presence-only: it reddens when
|
|
37
|
-
// a pinned phrase is DELETED and stays green when a contradicting clause is
|
|
38
|
-
// spliced in beside it, phrases intact. Both halves below were measured passing
|
|
39
|
-
// 3/3 against a section-wide slice while asserting the opposite of the truth.
|
|
40
|
-
const note = () =>
|
|
41
|
-
between(step7(), "`--force-with-lease` matters only on a re-push", "`Closes #N` closes issue on merge", "step 7's lease note");
|
|
42
|
-
|
|
43
|
-
// The note's own `;` splits it into the two claims that must not leak into each
|
|
44
|
-
// other: the force is required on a re-push, the plain push is safe only on a
|
|
45
|
-
// first one. Slicing at the LAST `;` keeps every appended clause inside the
|
|
46
|
-
// fallback half rather than letting a new one escape both pins.
|
|
47
|
-
const semi = () => {
|
|
48
|
-
const at = note().lastIndexOf(";");
|
|
49
|
-
assert.notEqual(at, -1, "step 7's lease note no longer joins its two halves with `;` — update this test");
|
|
50
|
-
return at;
|
|
51
|
-
};
|
|
52
|
-
const reasonHalf = () => note().slice(0, semi());
|
|
53
|
-
const fallbackHalf = () => note().slice(semi());
|
|
54
|
-
|
|
55
|
-
test("step 7 still pushes with the lease, unconditionally — the command itself is untouched", () => {
|
|
56
|
-
assert.match(
|
|
57
|
-
step7(),
|
|
58
|
-
/git push --force-with-lease -u origin HEAD/,
|
|
59
|
-
"step 7's push command changed — the ruling was to add a sentence beside it, not to touch the command",
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("step 7 says the lease matters only on a re-push, and why", () => {
|
|
64
|
-
const s = reasonHalf();
|
|
65
|
-
assert.match(
|
|
66
|
-
s,
|
|
67
|
-
phrase("rebases immediately before pushing"),
|
|
68
|
-
"step 7 lost the mechanism the reason rests on — without it a reader can't tell why a re-push needs the force",
|
|
69
|
-
);
|
|
70
|
-
assert.match(
|
|
71
|
-
s,
|
|
72
|
-
phrase("re-entering step 7 after an earlier push"),
|
|
73
|
-
"step 7 no longer ties the force to the re-push case — the reason is now floating, unattached to when it applies",
|
|
74
|
-
);
|
|
75
|
-
// Both pins above are subject-side, so a reversal that rewrites only the
|
|
76
|
-
// PREDICATE leaves them verbatim. Pin the predicate too, and ban its
|
|
77
|
-
// negation, or the note can carry the refuted "the flag is unconditionally
|
|
78
|
-
// useless" claim with every pinned phrase still in place.
|
|
79
|
-
assert.match(
|
|
80
|
-
s,
|
|
81
|
-
phrase("needs the force to land the rebased commits"),
|
|
82
|
-
"step 7 no longer says what the force is FOR on a re-push — the claim's predicate is what a reversal rewrites first",
|
|
83
|
-
);
|
|
84
|
-
assert.doesNotMatch(
|
|
85
|
-
s,
|
|
86
|
-
/\b(?:not|never)\b[\s\S]{0,40}\bneeds?\b/i,
|
|
87
|
-
"step 7 now denies that a re-push needs the force — measured false, and #443's Brief refuted it: step 7 rebases immediately before pushing, so the force is load-bearing there",
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("step 7 scopes the plain-push fallback to a branch that has never been pushed", () => {
|
|
92
|
-
const s = fallbackHalf();
|
|
93
|
-
// The wrongly-ACCEPT half (AC-4): a reader must not come away licensed to
|
|
94
|
-
// plain-push on a re-push, where a denial means the force is load-bearing.
|
|
95
|
-
assert.match(
|
|
96
|
-
s,
|
|
97
|
-
phrase("a branch that has never been pushed"),
|
|
98
|
-
"step 7 no longer scopes the plain-push fallback to a first push — a reader could now use it on a denied re-push, where the force is load-bearing",
|
|
99
|
-
);
|
|
100
|
-
assert.match(
|
|
101
|
-
s,
|
|
102
|
-
phrase("git push -u origin HEAD"),
|
|
103
|
-
"step 7 no longer names the plain-push fallback command itself",
|
|
104
|
-
);
|
|
105
|
-
// Scoping the fallback IN to the first push does not scope it OUT of the
|
|
106
|
-
// re-push: both pins above survive a clause that widens it, appended right
|
|
107
|
-
// beside them. This half is the one that hands out the plain push, so the
|
|
108
|
-
// re-push must not be named in it at all.
|
|
109
|
-
assert.doesNotMatch(
|
|
110
|
-
s,
|
|
111
|
-
/\bre-?push\b/i,
|
|
112
|
-
"step 7's plain-push fallback now reaches the re-push case — that is the AC-4 defect: on a re-push the force is load-bearing and a denial there is not routed around",
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// #1049. The ruling above settled WHY the lease is documented; it left open
|
|
117
|
-
// what a member does when the force is DENIED on a re-push. There is no route
|
|
118
|
-
// around that one — the force is load-bearing there — so the page states the
|
|
119
|
-
// only correct move: stop and report the denial. The failure it closes is a
|
|
120
|
-
// member reading a denial as "use more force" and retrying with a plain
|
|
121
|
-
// `--force`, which drops the lease the step exists to keep.
|
|
122
|
-
//
|
|
123
|
-
// NOT a route, measured (#1049) and banned here so a later author does not add
|
|
124
|
-
// it back: `gh pr update-branch` is server-side and pulls changes FROM the base
|
|
125
|
-
// branch, so it cannot upload locally-rebased commits — which is exactly what a
|
|
126
|
-
// step-7 re-push has to do. The merge bot's own denial-recovery route runs that
|
|
127
|
-
// command for a different purpose; the analogy does not carry to step 7.
|
|
128
|
-
test("step 7 routes a denied re-push to stop-and-report, never to a plain force", () => {
|
|
129
|
-
// In the REASON half, never the fallback one: that half bans the term
|
|
130
|
-
// `re-push` outright (the test above), so the same clause moved after the
|
|
131
|
-
// note's last `;` reds both this pin and that ban — measured, two reds — and
|
|
132
|
-
// correctly, since the fallback half is the one that hands out a plain push.
|
|
133
|
-
const s = reasonHalf();
|
|
134
|
-
assert.match(
|
|
135
|
-
s,
|
|
136
|
-
phrase("stop and report the denial"),
|
|
137
|
-
"step 7 no longer says what to do when the force is denied on a re-push — the gap #1049 was filed for",
|
|
138
|
-
);
|
|
139
|
-
assert.match(
|
|
140
|
-
s,
|
|
141
|
-
phrase("never retry with a plain `--force`"),
|
|
142
|
-
"step 7 no longer bans the plain-force retry — the move a member makes when a denial reads as 'use more force', and the one that drops the lease",
|
|
143
|
-
);
|
|
144
|
-
// Both pins above are deletion-only: they red when the clause goes, and on a
|
|
145
|
-
// reversal to "retry with a plain `--force` until it lands" (both measured).
|
|
146
|
-
// They stay green when a clause licensing the retry is spliced in BESIDE
|
|
147
|
-
// them, phrases intact — measured with "— if the classifier still denies it,
|
|
148
|
-
// `git push --force` lands the rebase" appended inside the reason half: the
|
|
149
|
-
// file goes 3/4 and the ONLY assertion that reds is the ban below. What such
|
|
150
|
-
// a clause has to name is the bare command, so that is what is banned — over
|
|
151
|
-
// the whole note, not one half, since either half could carry it. The
|
|
152
|
-
// lookahead is load-bearing rather than cautious: `\b` sits between `force`
|
|
153
|
-
// and `-with`, so the step's own documented command matches without it.
|
|
154
|
-
//
|
|
155
|
-
// #1446. `--force` is not the only spelling of "more force": `git push -f`
|
|
156
|
-
// (or `-f` bundled into another short option, e.g. `-uf`) and a raw
|
|
157
|
-
// force-push refspec (`git push origin +HEAD`) retry with exactly the same
|
|
158
|
-
// effect and neither named `--force` at all — measured 4/4 green against
|
|
159
|
-
// the un-widened regex above, i.e. the ban did not cover the class of retry
|
|
160
|
-
// the prose exists to forbid, only one spelling of it. Widened to three
|
|
161
|
-
// alternatives sharing one `git push` anchor, skipping up to three
|
|
162
|
-
// intervening tokens (remote/refspec/other flags) before the one that must
|
|
163
|
-
// carry the force: `--force` (long, as before), a short option whose letters
|
|
164
|
-
// include `f` and are not preceded by a hyphen or word character (excludes
|
|
165
|
-
// matching inside `--force[-with-lease]`, where the second `f` is preceded
|
|
166
|
-
// by the first dash, and inside a hyphenated English word, where it is
|
|
167
|
-
// preceded by a letter), or a bare `+<ref>` force-push refspec. Measured
|
|
168
|
-
// against the real note: still 4/4 green (baseline unchanged); against
|
|
169
|
-
// "`git push -f`" and "`git push origin +HEAD`" appended the same way as the
|
|
170
|
-
// `--force` mutation above: both now red on this assertion alone, matching
|
|
171
|
-
// the `--force` case exactly.
|
|
172
|
-
//
|
|
173
|
-
// Deliberately still uncaught: prose that licenses "more force" without
|
|
174
|
-
// naming a `git push` command at all (e.g. "retry with more force" or "force
|
|
175
|
-
// it through"). That is a semantic ban, not a lexical one — no regex over
|
|
176
|
-
// command text can catch prose that never spells the command — and is out
|
|
177
|
-
// of scope for this pin the same way the un-widened version never attempted
|
|
178
|
-
// it either.
|
|
179
|
-
assert.doesNotMatch(
|
|
180
|
-
note(),
|
|
181
|
-
/git push(?:\s+[\w./:-]+){0,3}\s+(?:--force(?!-with-lease)\b|(?<![-\w])-\w*f\w*\b|\+[\w./:-]+)/,
|
|
182
|
-
"step 7's lease note now names a bare `git push --force`, a short `-f` retry, or a `+<ref>` force-push refspec — a denial has no forcing route around it, and these are the commands a member reaches for when the page implies there is",
|
|
183
|
-
);
|
|
184
|
-
});
|
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
// The allow-list checker's own tests (#1314, #1347). Two halves:
|
|
2
|
-
//
|
|
3
|
-
// (1) a pure-core unit/mutation suite over `parseAllowlist`, `kindForPath`,
|
|
4
|
-
// `parseFrontmatter`, `checkFields`, `formatViolation` — fixture-driven,
|
|
5
|
-
// independent of what happens to be checked into the tree right now.
|
|
6
|
-
// (2) a CLI/end-to-end suite driving the script as a child process, over
|
|
7
|
-
// fixture files on disk, proving the exit-code contract (0/1/2) and the
|
|
8
|
-
// exact `file:line: key — reason` line shape.
|
|
9
|
-
//
|
|
10
|
-
// The MUTATION PROOF #1314's own acceptance criterion asks for — "a
|
|
11
|
-
// disallowed key -> red, revert -> green; repeat for a missing required key"
|
|
12
|
-
// — is done directly against the CLI (not simulated): a fixture agent file is
|
|
13
|
-
// mutated in place, the checker is run, the run is asserted red, the mutation
|
|
14
|
-
// is reverted, the checker is run again, the run is asserted green. Three
|
|
15
|
-
// mutations covered: a forbidden key, a missing required key, an unknown key
|
|
16
|
-
// — plus the real-tree run at the bottom, which is the checker's own first
|
|
17
|
-
// real green (#1345 having landed `thinking-level` beside `effort` on both
|
|
18
|
-
// fleet agents; #1298/#1314/ADR 0005 name this as the gate's first real red
|
|
19
|
-
// until then, and green after).
|
|
20
|
-
import { test } from "node:test";
|
|
21
|
-
import assert from "node:assert/strict";
|
|
22
|
-
import { spawnSync } from "node:child_process";
|
|
23
|
-
import { writeFileSync, readFileSync, mkdirSync, existsSync } from "node:fs";
|
|
24
|
-
import { join } from "node:path";
|
|
25
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
26
|
-
import { fileURLToPath } from "node:url";
|
|
27
|
-
import {
|
|
28
|
-
parseAllowlist, kindForPath, parseFrontmatter, checkFields, formatViolation,
|
|
29
|
-
} from "./frontmatter-check.mjs";
|
|
30
|
-
|
|
31
|
-
const SCRIPT = fileURLToPath(new URL("./frontmatter-check.mjs", import.meta.url));
|
|
32
|
-
const REAL_ALLOWLIST_PATH = fileURLToPath(new URL("./frontmatter-allowlist.json", import.meta.url));
|
|
33
|
-
const REPO = fileURLToPath(new URL("..", import.meta.url));
|
|
34
|
-
|
|
35
|
-
function dir() {
|
|
36
|
-
return tempDir("frontmatter-check-");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function runCli(argv, cwd) {
|
|
40
|
-
return spawnSync(process.execPath, [SCRIPT, ...argv], { cwd, encoding: "utf8" });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// A minimal but real three-kind allow-list, standing in for the real one so
|
|
44
|
-
// these fixtures are not coupled to #1314's exact recorded content.
|
|
45
|
-
const FIXTURE_ALLOWLIST = {
|
|
46
|
-
agents: {
|
|
47
|
-
required: ["name", "description", "model"],
|
|
48
|
-
allowed: ["tools"],
|
|
49
|
-
forbidden: { "thinking-level": "the level rides on model's `@<role>:<level>` suffix — one spelling only" },
|
|
50
|
-
values: {
|
|
51
|
-
model: {
|
|
52
|
-
pattern: "^@(slow|task|smol):(minimal|low|medium|high|xhigh|max)$",
|
|
53
|
-
message: "must be a fleet tier route @slow|@task|@smol with an explicit :<level> suffix",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
skills: {
|
|
58
|
-
required: ["name", "description"],
|
|
59
|
-
allowed: ["argument-hint"],
|
|
60
|
-
forbidden: { model: "a per-skill tier override with no documented effect" },
|
|
61
|
-
},
|
|
62
|
-
commands: {
|
|
63
|
-
required: ["description"],
|
|
64
|
-
allowed: ["argument-hint"],
|
|
65
|
-
forbidden: { model: "a per-skill tier override with no documented effect" },
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function writeFixtureAllowlist(d) {
|
|
70
|
-
const p = join(d, "allowlist.json");
|
|
71
|
-
writeFileSync(p, JSON.stringify(FIXTURE_ALLOWLIST));
|
|
72
|
-
return p;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
// parseAllowlist
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
|
|
79
|
-
test("parseAllowlist: the real allow-list on disk is well-shaped", () => {
|
|
80
|
-
const raw = readFileSync(REAL_ALLOWLIST_PATH, "utf8");
|
|
81
|
-
const { allowlist, error } = parseAllowlist(raw);
|
|
82
|
-
assert.equal(error, undefined);
|
|
83
|
-
for (const kind of ["agents", "skills", "commands"]) {
|
|
84
|
-
assert.ok(Array.isArray(allowlist[kind].required), `${kind}.required is an array`);
|
|
85
|
-
assert.ok(Array.isArray(allowlist[kind].allowed), `${kind}.allowed is an array`);
|
|
86
|
-
assert.equal(typeof allowlist[kind].forbidden, "object", `${kind}.forbidden is an object`);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("parseAllowlist: malformed JSON is an error, not a thrown exception", () => {
|
|
91
|
-
const { allowlist, error } = parseAllowlist("{not json");
|
|
92
|
-
assert.equal(allowlist, undefined);
|
|
93
|
-
assert.match(error, /not valid JSON/);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test("parseAllowlist: a JSON file missing a kind section is an error naming it", () => {
|
|
97
|
-
const { error } = parseAllowlist(JSON.stringify({ agents: FIXTURE_ALLOWLIST.agents, skills: FIXTURE_ALLOWLIST.skills }));
|
|
98
|
-
assert.match(error, /"commands"/);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test("parseAllowlist: a kind section with forbidden as an array (wrong shape) is an error", () => {
|
|
102
|
-
const bad = JSON.parse(JSON.stringify(FIXTURE_ALLOWLIST));
|
|
103
|
-
bad.agents.forbidden = ["hooks"];
|
|
104
|
-
const { error } = parseAllowlist(JSON.stringify(bad));
|
|
105
|
-
assert.match(error, /agents\.forbidden/);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
// kindForPath
|
|
110
|
-
// ---------------------------------------------------------------------------
|
|
111
|
-
|
|
112
|
-
test("kindForPath: classifies agents, skills, commands under a plugin/ prefix", () => {
|
|
113
|
-
assert.equal(kindForPath("plugin/agents/fleet-implementer-slow-high.agent.md"), "agents");
|
|
114
|
-
assert.equal(kindForPath("plugin/skills/run-team/SKILL.md"), "skills");
|
|
115
|
-
assert.equal(kindForPath("plugin/commands/review-and-fix.md"), "commands");
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test("kindForPath: classifies the same shapes with no plugin/ prefix (bare repo-relative)", () => {
|
|
119
|
-
assert.equal(kindForPath("agents/x.md"), "agents");
|
|
120
|
-
assert.equal(kindForPath("skills/foo/SKILL.md"), "skills");
|
|
121
|
-
assert.equal(kindForPath("commands/y.md"), "commands");
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test("kindForPath: a file one level too deep or too shallow does not classify", () => {
|
|
125
|
-
assert.equal(kindForPath("plugin/agents/nested/x.md"), null);
|
|
126
|
-
assert.equal(kindForPath("plugin/skills/SKILL.md"), null);
|
|
127
|
-
assert.equal(kindForPath("plugin/skills/foo/bar/SKILL.md"), null);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test("kindForPath: an unrelated path classifies as null", () => {
|
|
131
|
-
assert.equal(kindForPath("plugin/scripts/frontmatter-check.mjs"), null);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// ---------------------------------------------------------------------------
|
|
135
|
-
// parseFrontmatter
|
|
136
|
-
// ---------------------------------------------------------------------------
|
|
137
|
-
|
|
138
|
-
test("parseFrontmatter: reads flat key: value fields with 1-based source lines", () => {
|
|
139
|
-
const { fields, error } = parseFrontmatter("---\nname: fleet-x\ndescription: does a thing\n---\nbody\n");
|
|
140
|
-
assert.equal(error, undefined);
|
|
141
|
-
assert.deepEqual(fields, [
|
|
142
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
143
|
-
{ key: "description", value: "does a thing", line: 3 },
|
|
144
|
-
]);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test("parseFrontmatter: a blank line inside the block is skipped, not a parse error", () => {
|
|
148
|
-
const { fields, error } = parseFrontmatter("---\nname: x\n\ndescription: y\n---\n");
|
|
149
|
-
assert.equal(error, undefined);
|
|
150
|
-
assert.equal(fields.length, 2);
|
|
151
|
-
assert.equal(fields[1].line, 4);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test("parseFrontmatter: no opening fence is a parse error", () => {
|
|
155
|
-
const { error } = parseFrontmatter("name: x\ndescription: y\n");
|
|
156
|
-
assert.match(error, /opening --- fence/);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test("parseFrontmatter: no closing fence is a parse error", () => {
|
|
160
|
-
const { error } = parseFrontmatter("---\nname: x\ndescription: y\n");
|
|
161
|
-
assert.match(error, /closing --- fence/);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test("parseFrontmatter: a line that is neither blank nor key: value is a parse error naming the line", () => {
|
|
165
|
-
const { error } = parseFrontmatter("---\nname: x\nnot a field at all\n---\n");
|
|
166
|
-
assert.match(error, /unparseable frontmatter at line 3/);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test("parseFrontmatter: an empty value (key: with nothing after it) parses as an empty string, not an error", () => {
|
|
170
|
-
const { fields, error } = parseFrontmatter("---\nargument-hint:\n---\n");
|
|
171
|
-
assert.equal(error, undefined);
|
|
172
|
-
assert.equal(fields[0].value, "");
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test("parseFrontmatter: a double-quoted value has its quotes stripped", () => {
|
|
176
|
-
const { fields, error } = parseFrontmatter('---\nmodel: "@slow:xhigh"\n---\n');
|
|
177
|
-
assert.equal(error, undefined);
|
|
178
|
-
assert.equal(fields[0].value, "@slow:xhigh");
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
test("parseFrontmatter: a single-quoted value has its quotes stripped", () => {
|
|
182
|
-
const { fields, error } = parseFrontmatter("---\nmodel: '@slow:xhigh'\n---\n");
|
|
183
|
-
assert.equal(error, undefined);
|
|
184
|
-
assert.equal(fields[0].value, "@slow:xhigh");
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// A mismatched pair is not a quoted value: stripping must require the SAME
|
|
188
|
-
// quote character on both ends, so neither direction may be stripped.
|
|
189
|
-
test("parseFrontmatter: a mismatched pair (opening double, closing single) is left unstripped", () => {
|
|
190
|
-
const { fields, error } = parseFrontmatter("---\nmodel: \"@slow:xhigh'\n---\n");
|
|
191
|
-
assert.equal(error, undefined);
|
|
192
|
-
assert.equal(fields[0].value, "\"@slow:xhigh'");
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test("parseFrontmatter: a mismatched pair (opening single, closing double) is left unstripped", () => {
|
|
196
|
-
const { fields, error } = parseFrontmatter("---\nmodel: '@slow:xhigh\"\n---\n");
|
|
197
|
-
assert.equal(error, undefined);
|
|
198
|
-
assert.equal(fields[0].value, "'@slow:xhigh\"");
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// ---------------------------------------------------------------------------
|
|
202
|
-
// checkFields — the both-directions contract plus value rules
|
|
203
|
-
// ---------------------------------------------------------------------------
|
|
204
|
-
|
|
205
|
-
test("checkFields: a clean agent file (every required key, no forbidden/unknown) has zero violations", () => {
|
|
206
|
-
const fields = [
|
|
207
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
208
|
-
{ key: "description", value: "d", line: 3 },
|
|
209
|
-
{ key: "model", value: "@slow:xhigh", line: 4 },
|
|
210
|
-
];
|
|
211
|
-
assert.deepEqual(checkFields("agents", FIXTURE_ALLOWLIST, fields), []);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
test("checkFields: a forbidden key is a violation carrying the allow-list's own reason", () => {
|
|
215
|
-
const fields = [
|
|
216
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
217
|
-
{ key: "description", value: "d", line: 3 },
|
|
218
|
-
{ key: "model", value: "@slow:xhigh", line: 4 },
|
|
219
|
-
{ key: "thinking-level", value: "low", line: 5 },
|
|
220
|
-
];
|
|
221
|
-
const violations = checkFields("agents", FIXTURE_ALLOWLIST, fields);
|
|
222
|
-
assert.deepEqual(violations, [{ line: 5, key: "thinking-level", reason: FIXTURE_ALLOWLIST.agents.forbidden["thinking-level"] }]);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
test("checkFields: an unrecognised key (neither required, allowed, nor forbidden) is its own violation class", () => {
|
|
226
|
-
const fields = [
|
|
227
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
228
|
-
{ key: "description", value: "d", line: 3 },
|
|
229
|
-
{ key: "model", value: "@slow:xhigh", line: 4 },
|
|
230
|
-
{ key: "totallyUnknownKey", value: "1", line: 5 },
|
|
231
|
-
];
|
|
232
|
-
const violations = checkFields("agents", FIXTURE_ALLOWLIST, fields);
|
|
233
|
-
assert.equal(violations.length, 1);
|
|
234
|
-
assert.equal(violations[0].key, "totallyUnknownKey");
|
|
235
|
-
assert.match(violations[0].reason, /unrecognised key/);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test("checkFields: a missing required key is a violation reported at line 1, not silently dropped", () => {
|
|
239
|
-
const fields = [
|
|
240
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
241
|
-
{ key: "model", value: "@slow:xhigh", line: 3 },
|
|
242
|
-
];
|
|
243
|
-
const violations = checkFields("agents", FIXTURE_ALLOWLIST, fields);
|
|
244
|
-
assert.deepEqual(violations, [{ line: 1, key: "description", reason: "required key missing" }]);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
test("checkFields: an allowed key with no value rule at all never becomes a violation on its value", () => {
|
|
248
|
-
const fields = [
|
|
249
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
250
|
-
{ key: "description", value: "d", line: 3 },
|
|
251
|
-
{ key: "model", value: "@slow:xhigh", line: 4 },
|
|
252
|
-
{ key: "tools", value: "Bash,Read,Write,AnythingGoes", line: 5 },
|
|
253
|
-
];
|
|
254
|
-
assert.deepEqual(checkFields("agents", FIXTURE_ALLOWLIST, fields), []);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
test("checkFields: a value that does not match its pattern is a violation carrying the pattern's own message", () => {
|
|
258
|
-
const fields = [
|
|
259
|
-
{ key: "name", value: "fleet-x", line: 2 },
|
|
260
|
-
{ key: "description", value: "d", line: 3 },
|
|
261
|
-
{ key: "model", value: "claude-opus-5", line: 4 },
|
|
262
|
-
];
|
|
263
|
-
const violations = checkFields("agents", FIXTURE_ALLOWLIST, fields);
|
|
264
|
-
assert.equal(violations.length, 1);
|
|
265
|
-
assert.equal(violations[0].key, "model");
|
|
266
|
-
assert.equal(violations[0].reason, FIXTURE_ALLOWLIST.agents.values.model.message);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
test("checkFields: forbidden is checked before the required/allowed membership test — a forbidden required-looking key still reports its forbidden reason", () => {
|
|
270
|
-
const allowlist = {
|
|
271
|
-
agents: {
|
|
272
|
-
required: ["name"],
|
|
273
|
-
allowed: [],
|
|
274
|
-
forbidden: { name: "shadowed on purpose for this fixture" },
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
const violations = checkFields("agents", allowlist, [{ key: "name", value: "x", line: 2 }]);
|
|
278
|
-
assert.deepEqual(violations, [{ line: 2, key: "name", reason: "shadowed on purpose for this fixture" }]);
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
// ---------------------------------------------------------------------------
|
|
282
|
-
// formatViolation
|
|
283
|
-
// ---------------------------------------------------------------------------
|
|
284
|
-
|
|
285
|
-
test("formatViolation: the ticket's exact file:line: key — reason shape", () => {
|
|
286
|
-
assert.equal(
|
|
287
|
-
formatViolation("plugin/agents/x.agent.md", { line: 5, key: "hooks", reason: "ignored for plugin subagents" }),
|
|
288
|
-
"plugin/agents/x.agent.md:5: hooks — ignored for plugin subagents",
|
|
289
|
-
);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
// ---------------------------------------------------------------------------
|
|
293
|
-
// CLI — exit codes, output shape, over real files on disk
|
|
294
|
-
// ---------------------------------------------------------------------------
|
|
295
|
-
// A fixture agent file lives under a real agents/ subdirectory, so
|
|
296
|
-
// kindForPath classifies it the same way it would a real repo-relative path.
|
|
297
|
-
|
|
298
|
-
// The fixture above needs a real agents/ subdirectory for kindForPath to
|
|
299
|
-
// classify it — build that directly rather than via the throwaway probe.
|
|
300
|
-
function agentFixtureDir() {
|
|
301
|
-
const d = dir();
|
|
302
|
-
const allowlistPath = writeFixtureAllowlist(d);
|
|
303
|
-
const agentsDir = join(d, "agents");
|
|
304
|
-
mkdirSync(agentsDir, { recursive: true });
|
|
305
|
-
return { d, allowlistPath, agentsDir, file: join(agentsDir, "x.agent.md") };
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
test("CLI: a clean agent file under agents/ exits 0 with no stdout", () => {
|
|
309
|
-
const { allowlistPath, agentsDir, file, d } = agentFixtureDir();
|
|
310
|
-
writeFileSync(file, "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\n---\nbody\n");
|
|
311
|
-
const r = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
312
|
-
assert.equal(r.status, 0);
|
|
313
|
-
assert.equal(r.stdout, "");
|
|
314
|
-
void agentsDir;
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
test("CLI: a forbidden key exits 1 and prints file:line: key — reason", () => {
|
|
318
|
-
const { allowlistPath, file, d } = agentFixtureDir();
|
|
319
|
-
writeFileSync(file, "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\nthinking-level: low\n---\nbody\n");
|
|
320
|
-
const r = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
321
|
-
assert.equal(r.status, 1);
|
|
322
|
-
assert.equal(r.stdout.trim(), `agents/x.agent.md:5: thinking-level — ${FIXTURE_ALLOWLIST.agents.forbidden["thinking-level"]}`);
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
test("CLI: a missing allow-list exits 2, never 0 or 1 — a missing list must fail loudly, not pass with an empty ruleset", () => {
|
|
326
|
-
const { file, d } = agentFixtureDir();
|
|
327
|
-
writeFileSync(file, "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\n---\n");
|
|
328
|
-
const r = runCli(["--allowlist", join(d, "does-not-exist.json"), "agents/x.agent.md"], d);
|
|
329
|
-
assert.equal(r.status, 2);
|
|
330
|
-
assert.match(r.stderr, /allow-list unreadable/);
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
test("CLI: unparseable frontmatter exits 2, distinct from a violation's exit 1", () => {
|
|
334
|
-
const { allowlistPath, file, d } = agentFixtureDir();
|
|
335
|
-
writeFileSync(file, "no fence at all\n");
|
|
336
|
-
const r = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
337
|
-
assert.equal(r.status, 2);
|
|
338
|
-
assert.match(r.stderr, /opening --- fence/);
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
test("CLI: a file that classifies as none of agents/skills/commands exits 2 naming why", () => {
|
|
342
|
-
const { allowlistPath, d } = agentFixtureDir();
|
|
343
|
-
const stray = join(d, "stray.md");
|
|
344
|
-
writeFileSync(stray, "---\nname: x\n---\n");
|
|
345
|
-
const r = runCli(["--allowlist", allowlistPath, "stray.md"], d);
|
|
346
|
-
assert.equal(r.status, 2);
|
|
347
|
-
assert.match(r.stderr, /cannot classify/);
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
test("CLI: multiple files in one invocation report every violation across all of them before exiting", () => {
|
|
351
|
-
const { allowlistPath, agentsDir, d } = agentFixtureDir();
|
|
352
|
-
writeFileSync(join(agentsDir, "a.agent.md"), "---\nname: fleet-a\ndescription: d\nmodel: \"@slow:xhigh\"\nthinking-level: low\n---\n");
|
|
353
|
-
writeFileSync(join(agentsDir, "b.agent.md"), "---\nname: fleet-b\ndescription: d\nmodel: \"@task:medium\"\n---\n");
|
|
354
|
-
const r = runCli(["--allowlist", allowlistPath, "agents/a.agent.md", "agents/b.agent.md"], d);
|
|
355
|
-
assert.equal(r.status, 1);
|
|
356
|
-
assert.equal(r.stdout.trim(), "agents/a.agent.md:5: thinking-level — " + FIXTURE_ALLOWLIST.agents.forbidden["thinking-level"]);
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
// ---------------------------------------------------------------------------
|
|
360
|
-
// #1314's mutation proof, done literally: mutate a fixture in place, run the
|
|
361
|
-
// CLI, assert red; revert; run again; assert green. Three shapes: forbidden
|
|
362
|
-
// key, missing required key, unknown key.
|
|
363
|
-
// ---------------------------------------------------------------------------
|
|
364
|
-
|
|
365
|
-
test("MUTATION PROOF: a forbidden key introduced -> red; reverted -> green", () => {
|
|
366
|
-
const { allowlistPath, file, d } = agentFixtureDir();
|
|
367
|
-
const clean = "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\n---\nbody\n";
|
|
368
|
-
writeFileSync(file, clean);
|
|
369
|
-
const green1 = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
370
|
-
assert.equal(green1.status, 0, "clean fixture starts green");
|
|
371
|
-
|
|
372
|
-
const mutated = "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\nthinking-level: low\n---\nbody\n";
|
|
373
|
-
writeFileSync(file, mutated);
|
|
374
|
-
const red = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
375
|
-
assert.equal(red.status, 1, "forbidden key introduced -> red");
|
|
376
|
-
assert.match(red.stdout, /thinking-level — /);
|
|
377
|
-
|
|
378
|
-
writeFileSync(file, clean);
|
|
379
|
-
const green2 = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
380
|
-
assert.equal(green2.status, 0, "reverted -> green again");
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
test("MUTATION PROOF: a required key removed -> red; reverted -> green", () => {
|
|
384
|
-
const { allowlistPath, file, d } = agentFixtureDir();
|
|
385
|
-
const clean = "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\n---\nbody\n";
|
|
386
|
-
writeFileSync(file, clean);
|
|
387
|
-
assert.equal(runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d).status, 0);
|
|
388
|
-
|
|
389
|
-
const mutated = "---\nname: fleet-x\nmodel: \"@slow:xhigh\"\n---\nbody\n"; // description removed
|
|
390
|
-
writeFileSync(file, mutated);
|
|
391
|
-
const red = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
392
|
-
assert.equal(red.status, 1, "missing required key -> red");
|
|
393
|
-
assert.match(red.stdout, /description — required key missing/);
|
|
394
|
-
|
|
395
|
-
writeFileSync(file, clean);
|
|
396
|
-
const green = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
397
|
-
assert.equal(green.status, 0, "reverted -> green again");
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
test("MUTATION PROOF: an unknown key introduced -> red; reverted -> green", () => {
|
|
401
|
-
const { allowlistPath, file, d } = agentFixtureDir();
|
|
402
|
-
const clean = "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\n---\nbody\n";
|
|
403
|
-
writeFileSync(file, clean);
|
|
404
|
-
assert.equal(runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d).status, 0);
|
|
405
|
-
|
|
406
|
-
const mutated = "---\nname: fleet-x\ndescription: d\nmodel: \"@slow:xhigh\"\nomp-only-experimental-flag: yes\n---\nbody\n";
|
|
407
|
-
writeFileSync(file, mutated);
|
|
408
|
-
const red = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
409
|
-
assert.equal(red.status, 1, "unknown key -> red");
|
|
410
|
-
assert.match(red.stdout, /omp-only-experimental-flag — unrecognised key/);
|
|
411
|
-
|
|
412
|
-
writeFileSync(file, clean);
|
|
413
|
-
const green = runCli(["--allowlist", allowlistPath, "agents/x.agent.md"], d);
|
|
414
|
-
assert.equal(green.status, 0, "reverted -> green again");
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// ---------------------------------------------------------------------------
|
|
418
|
-
// The real tree, with the real allow-list: today's own first real green
|
|
419
|
-
// (#1298/ADR 0005's own prediction — red on missing thinking-level until
|
|
420
|
-
// #1343, green after; #1343 is on main, so this is the gate's first real
|
|
421
|
-
// green, run here rather than merely asserted).
|
|
422
|
-
// ---------------------------------------------------------------------------
|
|
423
|
-
|
|
424
|
-
test("REAL TREE: every tracked agents/skills/commands frontmatter file in this checkout passes the real allow-list", () => {
|
|
425
|
-
const agentFiles = ["slow-high", "slow-medium", "task-high", "task-max", "smol-high"]
|
|
426
|
-
.map((cell) => `agents/fleet-implementer-${cell}.agent.md`);
|
|
427
|
-
const skillFiles = ["next-ticket", "run-team", "sizing-a-ticket"].map((s) => `skills/${s}/SKILL.md`);
|
|
428
|
-
const commandFiles = ["review-and-fix.md", "run-merge-bot.md"].map((f) => `commands/${f}`);
|
|
429
|
-
const all = [...agentFiles, ...skillFiles, ...commandFiles];
|
|
430
|
-
for (const f of all) {
|
|
431
|
-
assert.ok(existsSync(join(REPO, f)), `${f} exists in the real tree`);
|
|
432
|
-
}
|
|
433
|
-
const r = runCli(["--allowlist", REAL_ALLOWLIST_PATH, ...all], REPO);
|
|
434
|
-
assert.equal(r.status, 0, `real tree is clean against the real allow-list:\n${r.stdout}${r.stderr}`);
|
|
435
|
-
assert.equal(r.stdout, "");
|
|
436
|
-
});
|