@feigi/fleet-ctl 3.23.35 → 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,368 +0,0 @@
|
|
|
1
|
-
// #161. Gate for the CI checks that run a checker over `git ls-files '<glob>'`.
|
|
2
|
-
//
|
|
3
|
-
// `git ls-files '*.mjs' | xargs -r node --check` exits 0 on an empty match, and
|
|
4
|
-
// every checker in that job prints nothing on success — so a run that checked 23
|
|
5
|
-
// files and a run that checked 0 were byte-identical in the log. That last part
|
|
6
|
-
// is an observation from outside this repo — GitHub Actions runner log
|
|
7
|
-
// 30629390698, zero bytes between `##[endgroup]` and the next `##[group]` — and
|
|
8
|
-
// no copy of that log is in this tree, so nothing here can settle it. `pipefail`
|
|
9
|
-
// cannot see it either: the left-hand side SUCCEEDS, it just succeeds with
|
|
10
|
-
// nothing. One directory rename and a step is vacuously green forever. `shopt -s
|
|
11
|
-
// failglob`, which PR #157 used for the Tests step, does not apply — the glob is
|
|
12
|
-
// quoted and expanded by `git ls-files`, not by the shell.
|
|
13
|
-
//
|
|
14
|
-
// Two halves, because a guard that only ever sees valid input pins neither:
|
|
15
|
-
// - REFUSE: an empty match is exit 1 and the checker never runs.
|
|
16
|
-
// - ACCEPT: a populated tree still runs the checker on every file and exits 0,
|
|
17
|
-
// and a failing checker still fails the step. Every glob ci.yml routes
|
|
18
|
-
// through check-tracked.sh matches files today, so the guard is not firing
|
|
19
|
-
// on the real tree — these two cases are what says so. No count of those
|
|
20
|
-
// globs and no file count per glob, on purpose: the "five globs" this
|
|
21
|
-
// sentence used to count, with a file count each, went stale as ci.yml's
|
|
22
|
-
// steps changed (#1943). ci.yml owns that set.
|
|
23
|
-
//
|
|
24
|
-
// The behavioural cases pin the script. The source assertions at the bottom pin
|
|
25
|
-
// that ci.yml actually ROUTES through it: without them a step reverted to bare
|
|
26
|
-
// `xargs -r` leaves this whole file green while the defect is back. They pin
|
|
27
|
-
// the routing AND the status — a step is free to route through the guard and
|
|
28
|
-
// then discard the exit code it just asked for, which checks exactly as much
|
|
29
|
-
// as not routing at all.
|
|
30
|
-
|
|
31
|
-
import { test } from "node:test";
|
|
32
|
-
import assert from "node:assert/strict";
|
|
33
|
-
import { execFileSync, spawnSync } from "node:child_process";
|
|
34
|
-
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
35
|
-
import { tmpdir } from "node:os";
|
|
36
|
-
import { join } from "node:path";
|
|
37
|
-
import { fileURLToPath } from "node:url";
|
|
38
|
-
import { between, phrase } from "./prose-pin.mjs";
|
|
39
|
-
|
|
40
|
-
const SCRIPT = fileURLToPath(new URL("../../.github/scripts/check-tracked.sh", import.meta.url));
|
|
41
|
-
const CI_YML = fileURLToPath(new URL("../../.github/workflows/ci.yml", import.meta.url));
|
|
42
|
-
|
|
43
|
-
// Cut the developer's ~/.gitconfig out of the fixtures, and stop a GIT_* export
|
|
44
|
-
// in the ambient environment from pointing them out of their own temp dir.
|
|
45
|
-
const ENV = {
|
|
46
|
-
...process.env,
|
|
47
|
-
GIT_DIR: undefined,
|
|
48
|
-
GIT_WORK_TREE: undefined,
|
|
49
|
-
GIT_INDEX_FILE: undefined,
|
|
50
|
-
GIT_AUTHOR_NAME: "t",
|
|
51
|
-
GIT_AUTHOR_EMAIL: "t@example.com",
|
|
52
|
-
GIT_COMMITTER_NAME: "t",
|
|
53
|
-
GIT_COMMITTER_EMAIL: "t@example.com",
|
|
54
|
-
GIT_CONFIG_GLOBAL: "/dev/null",
|
|
55
|
-
GIT_CONFIG_SYSTEM: "/dev/null",
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** Throwaway repo with `files` tracked (name -> contents). Returns its path. */
|
|
59
|
-
function repo(t, files) {
|
|
60
|
-
const dir = mkdtempSync(join(tmpdir(), "ci-vacuous-green-"));
|
|
61
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
62
|
-
execFileSync("git", ["-c", "init.defaultBranch=main", "init", "-q", dir], { env: ENV });
|
|
63
|
-
for (const [name, body] of Object.entries(files)) writeFileSync(join(dir, name), body);
|
|
64
|
-
execFileSync("git", ["add", "-A"], { cwd: dir, env: ENV });
|
|
65
|
-
execFileSync("git", ["commit", "-qm", "fixture"], { cwd: dir, env: ENV });
|
|
66
|
-
return dir;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const check = (cwd, ...args) =>
|
|
70
|
-
spawnSync(SCRIPT, args, { cwd, env: ENV, encoding: "utf8" });
|
|
71
|
-
|
|
72
|
-
test("empty match: exit 1, says so, and the checker never runs", (t) => {
|
|
73
|
-
const dir = repo(t, { "readme.md": "no scripts here\n" });
|
|
74
|
-
|
|
75
|
-
const r = check(dir, "*.mjs", "-n1", "sh", "-c", "echo CHECKER-RAN", "sh");
|
|
76
|
-
|
|
77
|
-
assert.equal(r.status, 1);
|
|
78
|
-
const out = r.stdout + r.stderr;
|
|
79
|
-
assert.match(out, /::error::/, "an empty match must be loud in the runner log");
|
|
80
|
-
assert.match(out, /\*\.mjs/, "the message must name the glob that matched nothing");
|
|
81
|
-
// The point of the whole ticket: the old form exited 0 having run nothing.
|
|
82
|
-
assert.doesNotMatch(out, /CHECKER-RAN/, "nothing may be checked on an empty match");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test("populated match: runs the checker on every file, prints the count, exits 0", (t) => {
|
|
86
|
-
const dir = repo(t, { "a.mjs": "1\n", "b.mjs": "2\n", "c.txt": "3\n" });
|
|
87
|
-
|
|
88
|
-
const r = check(dir, "*.mjs", "-n1", "sh", "-c", 'echo "saw $1"', "sh");
|
|
89
|
-
|
|
90
|
-
assert.equal(r.status, 0, `${r.stdout}${r.stderr}`);
|
|
91
|
-
assert.match(r.stdout, /checking 2 file\(s\)/, "the count must be visible in the log");
|
|
92
|
-
assert.match(r.stdout, /saw a\.mjs/);
|
|
93
|
-
assert.match(r.stdout, /saw b\.mjs/);
|
|
94
|
-
assert.doesNotMatch(r.stdout, /c\.txt/, "the glob must still select");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("no checker given: refuses instead of echoing the files it never checked", (t) => {
|
|
98
|
-
const dir = repo(t, { "a.mjs": "1\n" });
|
|
99
|
-
|
|
100
|
-
const r = check(dir, "*.mjs");
|
|
101
|
-
|
|
102
|
-
assert.notEqual(r.status, 0, "a glob with no checker verifies nothing and must not pass");
|
|
103
|
-
// `xargs` handed no command runs its default, `echo`, so the filenames scroll
|
|
104
|
-
// past in the log looking like a check that ran.
|
|
105
|
-
assert.doesNotMatch(r.stdout, /a\.mjs/, "xargs' default echo must not stand in for the checker");
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test("no arguments at all: an ::error:: line, not a raw bash diagnostic", (t) => {
|
|
109
|
-
const dir = repo(t, { "a.mjs": "1\n" });
|
|
110
|
-
|
|
111
|
-
const r = check(dir);
|
|
112
|
-
|
|
113
|
-
assert.notEqual(r.status, 0);
|
|
114
|
-
assert.match(r.stdout + r.stderr, /::error::/, "every refusal has to reach the runner log as an annotation");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("a checker that fails still fails the step", (t) => {
|
|
118
|
-
const dir = repo(t, { "a.mjs": "1\n" });
|
|
119
|
-
|
|
120
|
-
const r = check(dir, "*.mjs", "-n1", "false");
|
|
121
|
-
|
|
122
|
-
assert.notEqual(r.status, 0, "the guard must not swallow the real check's status");
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test("a path holding a space reaches the checker as one argument", (t) => {
|
|
126
|
-
const dir = repo(t, { "a b.mjs": "1\n" });
|
|
127
|
-
|
|
128
|
-
const r = check(dir, "*.mjs", "-n1", "sh", "-c", 'printf "[%s]\\n" "$1"', "sh");
|
|
129
|
-
|
|
130
|
-
assert.equal(r.status, 0, `${r.stdout}${r.stderr}`);
|
|
131
|
-
assert.match(r.stdout, /\[a b\.mjs\]/, "NUL-delimited, not word-split");
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// --- ci.yml routes through the guard -----------------------------------------
|
|
135
|
-
// Flattened, so a re-indent or a line break inside the step cannot red this;
|
|
136
|
-
// only the command actually changing can. Same convention as the *-prose tests.
|
|
137
|
-
const flat = (s) => s.replace(/\s+/g, " ");
|
|
138
|
-
|
|
139
|
-
test("every ls-files check in ci.yml goes through check-tracked.sh", () => {
|
|
140
|
-
const ci = flat(readFileSync(CI_YML, "utf8"));
|
|
141
|
-
|
|
142
|
-
// No "*.py": skills/caveman-compress, then the only tracked Python, left
|
|
143
|
-
// with the 2026-09-08 config split, taking its ci.yml step with it.
|
|
144
|
-
for (const glob of ["*.mjs", "*.json", "*.sh"]) {
|
|
145
|
-
// ok(), not match(): a failed match dumps the whole flattened workflow into
|
|
146
|
-
// the log and buries the one line saying which check lost its guard.
|
|
147
|
-
assert.ok(phrase(`check-tracked.sh '${glob}'`).test(ci), `the ${glob} check no longer routes through check-tracked.sh`);
|
|
148
|
-
}
|
|
149
|
-
assert.ok(!/xargs\s+-r\b/.test(ci), "`xargs -r` is back — that is the vacuous-green form #161 removed");
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
test("a routed check's own exit status still reaches the job", () => {
|
|
153
|
-
const src = readFileSync(CI_YML, "utf8");
|
|
154
|
-
const routed = src
|
|
155
|
-
.split("\n")
|
|
156
|
-
.map((l) => l.trim())
|
|
157
|
-
.filter((l) => l.startsWith("run:") && l.includes("check-tracked.sh"));
|
|
158
|
-
|
|
159
|
-
// 3 original (*.mjs / *.js loop is hand-rolled, not check-tracked.sh /
|
|
160
|
-
// *.json / *.sh) + 3 for #1347's allow-list checker (agents/skills/
|
|
161
|
-
// commands), one single-line `run:` step each so each stays visible to
|
|
162
|
-
// this collector — a multi-line `run: |` block hides every invocation
|
|
163
|
-
// inside it from a line-anchored `run:` filter, which is exactly what an
|
|
164
|
-
// earlier draft of #1347 did before this test's own review caught it.
|
|
165
|
-
assert.equal(routed.length, 6, "expected six ci.yml steps to route through check-tracked.sh");
|
|
166
|
-
for (const line of routed) {
|
|
167
|
-
// Unflattened and anchored at both ends, unlike the assertions above, because
|
|
168
|
-
// what this one pins is what is NOT on the line: ` || true`, `; true`, `&& :`
|
|
169
|
-
// and a trailing pipe all leave every substring those match in place and hand
|
|
170
|
-
// the job exit 0 whatever the guard decided. The `+` also requires a checker
|
|
171
|
-
// to follow the glob, which is the same contract the script now enforces.
|
|
172
|
-
// The glob itself is `'[^']*\*[^']*'` rather than the original bare
|
|
173
|
-
// `'\*\.\w+'` — #1347's allow-list checks glob a directory path plus an
|
|
174
|
-
// extension (`'plugin/agents/*.md'`), not just a bare extension pattern
|
|
175
|
-
// (`'*.json'`), and both shapes carry the same no-swallow contract.
|
|
176
|
-
assert.match(
|
|
177
|
-
line,
|
|
178
|
-
/^run: \.github\/scripts\/check-tracked\.sh '[^']*\*[^']*'(?: [\w./-]+)+$/,
|
|
179
|
-
`this routed check no longer fails the step on its own status: ${line}`,
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
// The same swallow, one level up: a step marked continue-on-error reports its
|
|
183
|
-
// failure and the job passes regardless.
|
|
184
|
-
assert.ok(!/continue-on-error:\s*true/.test(src), "a step that cannot fail the job cannot check anything either");
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// The `#`-comment-stripped read both gojq pins below share. A commented-out
|
|
188
|
-
// line still CONTAINS the literal an assertion looks for, so against the raw
|
|
189
|
-
// file a live command and a dead one read identically — and commenting out the
|
|
190
|
-
// wiring is exactly the mutation that hands the engine gates back their skip.
|
|
191
|
-
// Both comment forms, because killing only whole-line ones leaves the trailing
|
|
192
|
-
// form as the same hole. One definition rather than a copy per pin: a local
|
|
193
|
-
// copy of a pin's own bound is how the second pin ships without it, which is
|
|
194
|
-
// the call `prose-pin.mjs` makes about `paragraph` for the same reason.
|
|
195
|
-
const ciWithoutComments = () =>
|
|
196
|
-
readFileSync(CI_YML, "utf8")
|
|
197
|
-
.split("\n")
|
|
198
|
-
.map((l) => l.replace(/(^|\s)#.*$/, ""))
|
|
199
|
-
.join("\n");
|
|
200
|
-
|
|
201
|
-
// --- the Tests step provisions the engine its gates need -----------------------
|
|
202
|
-
// #337. A different shape of the same vacuous green, and the reason this pin
|
|
203
|
-
// lives here rather than beside the gate it protects: candidates.test.mjs gates
|
|
204
|
-
// its engine-parity tests on a resolvable gojq binary, and a gate that resolves
|
|
205
|
-
// none SKIPS — which node counts as a test and reports under a `fail 0` summary.
|
|
206
|
-
// So the wiring below can be deleted with the whole suite still green, and only
|
|
207
|
-
// the `skipped` count moves. That is what this test refuses.
|
|
208
|
-
//
|
|
209
|
-
// It pins the wiring — all three legs of it, the install command, the GOBIN
|
|
210
|
-
// that decides where the install deposits the binary, and the GOJQ_BIN the
|
|
211
|
-
// gates read — but not that a binary really lands at the path those two imply,
|
|
212
|
-
// which is go's placement behaviour and runs nowhere in this suite: a GOJQ_BIN
|
|
213
|
-
// naming a binary the install did not produce is already loud, since
|
|
214
|
-
// findGojq() throws on a GOJQ_BIN that is not gojq rather than falling back to
|
|
215
|
-
// a skip.
|
|
216
|
-
test("ci.yml provisions gojq for the engine gates, at a pinned version", () => {
|
|
217
|
-
const ciRaw = ciWithoutComments();
|
|
218
|
-
const ci = flat(ciRaw);
|
|
219
|
-
|
|
220
|
-
assert.ok(
|
|
221
|
-
phrase("go install github.com/itchyny/gojq/cmd/gojq@v0.12.19").test(ci),
|
|
222
|
-
"the Install gojq step no longer installs the gojq the engine gates resolve — they are back to skipping",
|
|
223
|
-
);
|
|
224
|
-
// `@latest` installs a gojq that satisfies the gate while changing what the
|
|
225
|
-
// gate measures, with no commit here to say so.
|
|
226
|
-
assert.ok(!/gojq[^\s]*@latest/.test(ci), "the gojq install is floating again — pin the version");
|
|
227
|
-
// The leg between the other two: `go install` deposits its output where GOBIN
|
|
228
|
-
// says, so dropping this env leaves the binary in $(go env GOPATH)/bin and
|
|
229
|
-
// GOJQ_BIN pointing at nothing. That does red the job — but it reds it saying
|
|
230
|
-
// `GOJQ_BIN=… is not gojq`, naming the variable that is still correct. This
|
|
231
|
-
// assertion exists to name the one that went missing.
|
|
232
|
-
//
|
|
233
|
-
// Scoped to the Install-gojq step's own slice, not the whole flattened file:
|
|
234
|
-
// an unscoped phrase() match is a substring test, so GOBIN moved verbatim
|
|
235
|
-
// into the Tests step's env block would still satisfy it. And the phrase is
|
|
236
|
-
// followed by a negative lookahead for a non-whitespace character, so a
|
|
237
|
-
// value with an extra path segment tacked on (`.../gojq/bin`, which still
|
|
238
|
-
// starts with the pinned value) cannot slide through as a prefix match —
|
|
239
|
-
// `go install` would drop the binary somewhere GOJQ_BIN does not point at.
|
|
240
|
-
const installStep = flat(between(ciRaw, "- name: Install gojq", "- name: Tests", "ci.yml Install gojq step"));
|
|
241
|
-
assert.ok(
|
|
242
|
-
new RegExp(phrase("GOBIN: ${{ runner.temp }}/gojq").source + String.raw`(?!\S)`).test(installStep),
|
|
243
|
-
"the Install gojq step lost its GOBIN, or GOBIN no longer points at exactly ${{ runner.temp }}/gojq — restore it, whatever the job's own failure says about GOJQ_BIN",
|
|
244
|
-
);
|
|
245
|
-
assert.ok(
|
|
246
|
-
phrase("GOJQ_BIN: ${{ runner.temp }}/gojq/gojq").test(ci),
|
|
247
|
-
"the Tests step no longer names the binary, so a failed provision skips quietly instead of failing the job",
|
|
248
|
-
);
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// --- the version ci.yml installs is the version the instructions name -------
|
|
252
|
-
// #956. The pinned gojq version literal appears in seven places tracked by
|
|
253
|
-
// this repo, not five — five of them are what this check requires to agree,
|
|
254
|
-
// and the other two are deliberately outside that agreement (see below).
|
|
255
|
-
// Exactly one of the five that agree runs: ci.yml's install step. The pin
|
|
256
|
-
// above lifts it verbatim, and three local-reproduction instructions under
|
|
257
|
-
// `candidates.*` restate it — the SKIP_WITHOUT_GOJQ message a developer reads
|
|
258
|
-
// when the engine gates decline to run, plus two comments quoting the same
|
|
259
|
-
// `go install` line. Nothing asserted they agree. A bump to ci.yml reds the
|
|
260
|
-
// pin above, so THAT copy gets updated; the instructions do not red, and a
|
|
261
|
-
// developer following them installs an engine CI does not run while the gate
|
|
262
|
-
// reports green. That is the drift #947's pin exists to refuse, one step
|
|
263
|
-
// removed — a floating engine changes what the gate MEASURES with no commit
|
|
264
|
-
// saying so.
|
|
265
|
-
//
|
|
266
|
-
// The other two literal sites: candidates.test.mjs's "gojq 0.12.19 (rev: …)"
|
|
267
|
-
// line illustrates the `--version` output format next to jq's own version
|
|
268
|
-
// string (`jq-1.7.1-apple`, itself unpinned anywhere) — an example of SHAPE,
|
|
269
|
-
// not an install instruction naming a VALUE, so forcing it to track the pin
|
|
270
|
-
// would make a format illustration assert something it never claimed.
|
|
271
|
-
// `.out-of-scope/gojq-parity-harness.md` records which gojq version a past
|
|
272
|
-
// parity run measured against — a historical record, not a live instruction
|
|
273
|
-
// — and is out of scope for #956. Neither is asserted here.
|
|
274
|
-
//
|
|
275
|
-
// Direction is the whole design. ci.yml is the source of truth because it is
|
|
276
|
-
// the only site with an effect, so the version is READ from it — a literal
|
|
277
|
-
// here would be a fifth copy, and it would agree with itself while every
|
|
278
|
-
// instruction went stale. The pin above keeps its verbatim lift deliberately:
|
|
279
|
-
// that assertion says "a bump is a deliberate edit in this repo", which an
|
|
280
|
-
// assertion derived from the file it reads cannot say. Two different claims
|
|
281
|
-
// about one literal, and this one needs the other to stay hardcoded.
|
|
282
|
-
//
|
|
283
|
-
// `candidates.*` are read RAW — the opposite of the ci.yml read above —
|
|
284
|
-
// because two of the three instructions ARE comments. That is the form a
|
|
285
|
-
// local reproduction takes, and stripping them would leave this test reading
|
|
286
|
-
// nothing. The escape that forces the strip above does not exist here: that
|
|
287
|
-
// pin proves a command is LIVE, where this one proves every occurrence
|
|
288
|
-
// AGREES, and commenting one out cannot buy a false green because the
|
|
289
|
-
// occurrence still has to name the same version.
|
|
290
|
-
const CANDIDATES = fileURLToPath(new URL("./candidates.mjs", import.meta.url));
|
|
291
|
-
const CANDIDATES_TEST = fileURLToPath(new URL("./candidates.test.mjs", import.meta.url));
|
|
292
|
-
|
|
293
|
-
// Every `go install …/gojq@<version>` ref in `src`, in order. A fresh regex per
|
|
294
|
-
// call, never a shared `/g` literal: `lastIndex` persists on those between
|
|
295
|
-
// call sites, and a pin whose result depends on which site ran first is not a
|
|
296
|
-
// pin. The capture is lazy and stops at the first character a version token
|
|
297
|
-
// cannot contain — backtick, quote, closing paren, or whitespace — so the
|
|
298
|
-
// backtick closing a comment's code span is not swallowed into it the way an
|
|
299
|
-
// unbounded `\S+` would, comparing a trailing "`)" against ci.yml's bare
|
|
300
|
-
// version and redding a clean tree. `cmd/` and `gojq@` may have whitespace
|
|
301
|
-
// between them: a hard-wrapped comment (see `unwrapComments` below) rejoins
|
|
302
|
-
// across the gutter with an inserted space rather than a raw concatenation,
|
|
303
|
-
// which would otherwise glue unrelated words together elsewhere in the file.
|
|
304
|
-
// The version token itself is unanchored — `v` is not required — so `@latest`
|
|
305
|
-
// captures "latest" instead of matching nothing: a candidates.* site with no
|
|
306
|
-
// separate count assertion would otherwise let `@latest` produce zero matches
|
|
307
|
-
// and pass silently, the exact silent hole `.equal(got, want, …)` below now
|
|
308
|
-
// closes by having a token to disagree with.
|
|
309
|
-
const installRefs = (src) => [...src.matchAll(/gojq\/cmd\/\s*gojq@(\S+?)(?=[\s`)"']|$)/g)].map((m) => m[1]);
|
|
310
|
-
|
|
311
|
-
test("candidates.*'s gojq install instructions name the version ci.yml installs", () => {
|
|
312
|
-
// Guarded, and inside the test body rather than at module scope. An
|
|
313
|
-
// unguarded `.match(…)[0]` throws where it stands on a ci.yml this suite only
|
|
314
|
-
// READS, and at module scope that throw takes every test in this file with
|
|
315
|
-
// it — a zero-behaviour reformat must cost one red assertion, not a whole
|
|
316
|
-
// file. candidates.test.mjs already carries two module-scope collapse paths,
|
|
317
|
-
// which is the reason not to author a third anywhere in this area.
|
|
318
|
-
const pinned = installRefs(ciWithoutComments());
|
|
319
|
-
assert.equal(
|
|
320
|
-
pinned.length,
|
|
321
|
-
1,
|
|
322
|
-
`.github/workflows/ci.yml must name exactly one pinned gojq install ref for the instructions to agree with — found ${pinned.length}: ${pinned.join(", ") || "none, so the Install gojq step is gone, commented out, or floating on @latest"}`,
|
|
323
|
-
);
|
|
324
|
-
const want = pinned[0];
|
|
325
|
-
|
|
326
|
-
// Comment-wrapped, so a hard rewrap across the `//` gutter cannot drop a
|
|
327
|
-
// `gojq/cmd/gojq@<version>` ref out of this check by breaking it across
|
|
328
|
-
// two lines, the way `ciWithoutComments()` above already guards against a
|
|
329
|
-
// `#`-wrapped ci.yml line. Rejoins with a space, the same shape
|
|
330
|
-
// `prose-pin.mjs`'s `phrase()` uses for a hard-wrapped sentence — collapse
|
|
331
|
-
// the newline plus the next line's `// ` gutter to one space — and
|
|
332
|
-
// `installRefs`'s own `\s*` between `cmd/` and `gojq@` absorbs the space
|
|
333
|
-
// this can insert mid-URL, so a wrap landing inside the path still reads
|
|
334
|
-
// as one token.
|
|
335
|
-
const unwrapComments = (src) => src.replace(/\n[ \t]*\/\/ ?/g, " ");
|
|
336
|
-
|
|
337
|
-
for (const [name, path] of [
|
|
338
|
-
["plugin/scripts/candidates.mjs", CANDIDATES],
|
|
339
|
-
["plugin/scripts/candidates.test.mjs", CANDIDATES_TEST],
|
|
340
|
-
]) {
|
|
341
|
-
for (const got of installRefs(unwrapComments(readFileSync(path, "utf8")))) {
|
|
342
|
-
assert.equal(
|
|
343
|
-
got,
|
|
344
|
-
want,
|
|
345
|
-
`${name} tells a developer to install gojq ${got}, but .github/workflows/ci.yml installs ${want} — unskipping the engine gates locally would measure a different engine than CI runs; bump both or neither`,
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// The loop pins agreement, not presence, so alone it is satisfied by a
|
|
351
|
-
// `candidates.*` with every instruction deleted. This is the one instruction
|
|
352
|
-
// that may not go missing: it is live code, it is what a developer actually
|
|
353
|
-
// reads when the gates skip, and it is the site #956 names. Sliced to its own
|
|
354
|
-
// declaration rather than matched file-wide, so neither comment can stand in
|
|
355
|
-
// for it. Presence is deliberately NOT asserted for those two — whether
|
|
356
|
-
// `candidates.mjs`'s comment should carry a version at all is an open
|
|
357
|
-
// question on #956, and a presence pin here would settle it by force.
|
|
358
|
-
const skip = between(
|
|
359
|
-
readFileSync(CANDIDATES_TEST, "utf8"),
|
|
360
|
-
"const SKIP_WITHOUT_GOJQ",
|
|
361
|
-
"\n",
|
|
362
|
-
"plugin/scripts/candidates.test.mjs",
|
|
363
|
-
);
|
|
364
|
-
assert.ok(
|
|
365
|
-
installRefs(skip).includes(want),
|
|
366
|
-
`plugin/scripts/candidates.test.mjs's SKIP_WITHOUT_GOJQ message no longer tells a developer to install gojq ${want}, the version .github/workflows/ci.yml installs — the skip message now names no version at all, or names it in a form this assertion cannot read`,
|
|
367
|
-
);
|
|
368
|
-
});
|