@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
package/scripts/exec-stub.mjs
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// Executable stubs for test fixtures, at one new executable inode per process.
|
|
2
|
-
//
|
|
3
|
-
// macOS holds the FIRST direct exec of every newly created executable inode
|
|
4
|
-
// for a system scan: 1.2-1.9s measured on an idle machine, and unbounded under
|
|
5
|
-
// load. A second exec of the same inode costs ~0.01s, and so does exec'ing a
|
|
6
|
-
// HARD LINK to an already-scanned inode (~0.03s), while a `cp` of one is a new
|
|
7
|
-
// inode and pays the scan again (1.35s). A fixture that writes a fresh `gh` or
|
|
8
|
-
// `git` stub per case therefore pays that scan once per case.
|
|
9
|
-
//
|
|
10
|
-
// So every stub this module writes is a hard link to ONE trampoline, written
|
|
11
|
-
// and exec'd once per process, and the stub's own body goes in a plain,
|
|
12
|
-
// non-executable file beside it that the trampoline reads. Reading a file is
|
|
13
|
-
// not an exec, so a body may differ in every case, interpolate per-case paths,
|
|
14
|
-
// or be rewritten mid-case, for free. Per-case state stays per case because
|
|
15
|
-
// the body file lives in the caller's own directory.
|
|
16
|
-
//
|
|
17
|
-
// The trampoline locates the body from `$0`, which for a PATH lookup is the
|
|
18
|
-
// absolute path of the link that was found: `<dir>/<name>` reads
|
|
19
|
-
// `<dir>/.stub-<name>`. That name ends in the stub's own name, so the body file
|
|
20
|
-
// has whatever extension the stub itself had (none, for `gh` or `node`): node
|
|
21
|
-
// picks a loader by extension, and a suffix of our own would make it refuse a
|
|
22
|
-
// `#!/usr/bin/env node` body under an `--import` preload or a `"type":
|
|
23
|
-
// "module"` package, where the extensionless script it replaced still runs.
|
|
24
|
-
//
|
|
25
|
-
// A `#!/bin/sh` body, exactly that line, is SOURCED, so it runs in the same
|
|
26
|
-
// shell with the same `$0` (the stub's own path) and `"$@"` it would have had
|
|
27
|
-
// as a script of its own, and its `exit`/`exec` end the stub as before. It
|
|
28
|
-
// also sees `__stub`, the body file's path, which the `.` that sources it
|
|
29
|
-
// needs. Any other interpreter line (`#!/usr/bin/env node`, `#!/bin/sh -e`,
|
|
30
|
-
// `#!/bin/bash`) is exec'd with the body file as its script, the way the
|
|
31
|
-
// kernel would have run the stub, with one difference: that body's own path —
|
|
32
|
-
// `$0`, `process.argv[1]` — is the body file, not the stub. Its arguments,
|
|
33
|
-
// stdin and exit status are the stub's.
|
|
34
|
-
//
|
|
35
|
-
// Not a fit, and left to a plain write, wherever the executable ITSELF is
|
|
36
|
-
// under test: its mode bits, its freshness, a rewrite through an existing
|
|
37
|
-
// link, or a script that reads the executable's content rather than running
|
|
38
|
-
// it. Nor reached through a symlink from another directory: `$0` is then the
|
|
39
|
-
// symlink, and no body file sits beside it. `chmod` or `writeFileSync` on a
|
|
40
|
-
// stub path would reach the shared inode, which is why the trampoline is
|
|
41
|
-
// 0o555: an accidental write into it fails EACCES instead of silently
|
|
42
|
-
// rewriting every stub in the process — for any user but root, whose writes
|
|
43
|
-
// mode bits do not stop.
|
|
44
|
-
//
|
|
45
|
-
// Deliberately not a `.test.mjs`, so `node --test` never loads it as a suite.
|
|
46
|
-
|
|
47
|
-
import { spawnSync } from "node:child_process";
|
|
48
|
-
import { linkSync, rmSync, writeFileSync } from "node:fs";
|
|
49
|
-
import { basename, dirname, join } from "node:path";
|
|
50
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
51
|
-
|
|
52
|
-
// `__stub`/`__stub_l` rather than short names: a sourced body shares this
|
|
53
|
-
// shell's variables, and one that tests `$s` or `$l` must not find them set.
|
|
54
|
-
const TRAMPOLINE = `#!/bin/sh
|
|
55
|
-
__stub="\${0%/*}/.stub-\${0##*/}"
|
|
56
|
-
IFS= read -r __stub_l < "$__stub"
|
|
57
|
-
case $__stub_l in
|
|
58
|
-
'#!/bin/sh') unset __stub_l; . "$__stub" ;;
|
|
59
|
-
*) exec \${__stub_l#??} "$__stub" "$@" ;;
|
|
60
|
-
esac
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
// Written and exec'd at import, so the scan is paid before any case starts and
|
|
64
|
-
// never against a case's own timeout. Removed at exit rather than in a
|
|
65
|
-
// node:test `after()`: an import has no test to hang a hook on, and one hung on
|
|
66
|
-
// whichever test first wrote a stub would pull the inode out from under the
|
|
67
|
-
// rest of the file. Unbounded on purpose: a first exec killed before the scan
|
|
68
|
-
// finishes leaves it unpaid.
|
|
69
|
-
const trampoline = (() => {
|
|
70
|
-
const dir = tempDir("exec-stub-");
|
|
71
|
-
const path = join(dir, "trampoline");
|
|
72
|
-
writeFileSync(path, TRAMPOLINE, { mode: 0o555 });
|
|
73
|
-
writeFileSync(join(dir, ".stub-trampoline"), "#!/bin/sh\nexit 0\n");
|
|
74
|
-
const warm = spawnSync(path);
|
|
75
|
-
if (warm.status !== 0) throw new Error(`exec-stub: trampoline warm-up failed: ${warm.error ?? warm.stderr}`);
|
|
76
|
-
return path;
|
|
77
|
-
})();
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Make `path` an executable that runs `body` as a script of its own would,
|
|
81
|
-
* with the `$0` difference the header describes for a body that is not
|
|
82
|
-
* `#!/bin/sh`.
|
|
83
|
-
*
|
|
84
|
-
* Replaces whatever is at `path`. Calling it again on the same path swaps the
|
|
85
|
-
* body and leaves the shared inode untouched. `body` must start with a `#!`
|
|
86
|
-
* line, since that line is what selects how the trampoline runs it.
|
|
87
|
-
*/
|
|
88
|
-
export function writeExecStub(path, body) {
|
|
89
|
-
if (!body.startsWith("#!")) throw new Error(`exec-stub: body for ${path} has no #! line`);
|
|
90
|
-
writeFileSync(join(dirname(path), `.stub-${basename(path)}`), body);
|
|
91
|
-
rmSync(path, { force: true });
|
|
92
|
-
linkSync(trampoline, path);
|
|
93
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// exec-stub.mjs: every stub is a link to one shared trampoline, and the body
|
|
2
|
-
// lives in a file beside it. What a fixture relies on is that a stub still
|
|
3
|
-
// behaves as its body would as a script of its own, and that one stub's body
|
|
4
|
-
// never leaks into another's through the shared inode.
|
|
5
|
-
import { test } from "node:test";
|
|
6
|
-
import assert from "node:assert/strict";
|
|
7
|
-
import { spawnSync } from "node:child_process";
|
|
8
|
-
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
9
|
-
import { tmpdir } from "node:os";
|
|
10
|
-
import { join } from "node:path";
|
|
11
|
-
import { writeExecStub } from "./exec-stub.mjs";
|
|
12
|
-
|
|
13
|
-
function bins(t, n) {
|
|
14
|
-
return Array.from({ length: n }, () => {
|
|
15
|
-
// A space in the path: the trampoline locates the body from `$0`, and an
|
|
16
|
-
// unquoted expansion of it would split here.
|
|
17
|
-
const d = mkdtempSync(join(tmpdir(), "exec stub-"));
|
|
18
|
-
t.after(() => rmSync(d, { recursive: true, force: true }));
|
|
19
|
-
return d;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
test("a sh stub found on PATH sees its own path, its argv, its stdin, and exits with its own status", (t) => {
|
|
24
|
-
const [bin] = bins(t, 1);
|
|
25
|
-
writeExecStub(join(bin, "gh"), `#!/bin/sh\nprintf '%s|' "$0" "$#" "$@"\nread -r line; printf '%s' "$line"\nexit 7\n`);
|
|
26
|
-
const r = spawnSync("gh", ["a b", "", "c"], {
|
|
27
|
-
input: "from stdin\n", encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}` },
|
|
28
|
-
});
|
|
29
|
-
assert.equal(r.status, 7, r.stderr);
|
|
30
|
-
assert.equal(r.stdout, `${join(bin, "gh")}|3|a b||c|from stdin`);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("rewriting one stub changes that stub alone, never another written from the same process", (t) => {
|
|
34
|
-
const [a, b] = bins(t, 2);
|
|
35
|
-
writeExecStub(join(a, "tool"), "#!/bin/sh\necho a1\n");
|
|
36
|
-
writeExecStub(join(b, "tool"), "#!/bin/sh\necho b1\n");
|
|
37
|
-
writeExecStub(join(a, "tool"), "#!/bin/sh\necho a2\n");
|
|
38
|
-
assert.equal(spawnSync(join(a, "tool"), { encoding: "utf8" }).stdout, "a2\n");
|
|
39
|
-
assert.equal(spawnSync(join(b, "tool"), { encoding: "utf8" }).stdout, "b1\n");
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("a body for another interpreter runs under that interpreter, argv intact", (t) => {
|
|
43
|
-
const [bin] = bins(t, 1);
|
|
44
|
-
writeExecStub(join(bin, "gh"), "#!/usr/bin/env node\nprocess.stdout.write(JSON.stringify(process.argv.slice(2)));\nprocess.exit(3);\n");
|
|
45
|
-
const r = spawnSync(join(bin, "gh"), ["x y", "z"], { encoding: "utf8" });
|
|
46
|
-
assert.equal(r.status, 3, r.stderr);
|
|
47
|
-
assert.deepEqual(JSON.parse(r.stdout), ["x y", "z"]);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test("a node body runs wherever the extensionless script it replaces would: an --import preload, a type:module package", (t) => {
|
|
51
|
-
// Node picks a loader by the script's extension, so the body file must not
|
|
52
|
-
// carry one the stub did not have: both conditions refuse an unknown one.
|
|
53
|
-
const [bin] = bins(t, 1);
|
|
54
|
-
writeFileSync(join(bin, "package.json"), '{"type":"module"}');
|
|
55
|
-
writeFileSync(join(bin, "preload.mjs"), "");
|
|
56
|
-
writeExecStub(join(bin, "gh"), "#!/usr/bin/env node\nprocess.stdout.write(process.argv.slice(2).join());\n");
|
|
57
|
-
// Quoted: NODE_OPTIONS splits on spaces, and `bins` puts one in the path.
|
|
58
|
-
const r = spawnSync(join(bin, "gh"), ["a"], {
|
|
59
|
-
encoding: "utf8", env: { ...process.env, NODE_OPTIONS: `--import="${join(bin, "preload.mjs")}"` },
|
|
60
|
-
});
|
|
61
|
-
assert.equal(r.status, 0, r.stderr);
|
|
62
|
-
assert.equal(r.stdout, "a");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("a body with no #! line is refused, since that line is what picks the interpreter", (t) => {
|
|
66
|
-
const [bin] = bins(t, 1);
|
|
67
|
-
assert.throws(() => writeExecStub(join(bin, "gh"), "exit 0\n"), /no #! line/);
|
|
68
|
-
assert.throws(() => writeExecStub(join(bin, "gh"), "#exit 0\n"), /no #! line/);
|
|
69
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// #847. The comment introducing ci-state.mjs's expected-job derivation carried
|
|
2
|
-
// figures — how many jobs "the fleet's prose" names, how many "the workflow"
|
|
3
|
-
// defines. What a reader checking whether an empty `missing` is vacuous needs
|
|
4
|
-
// from that comment is the PROPERTY: the list is derived from the workflow this
|
|
5
|
-
// run resolved, never hardcoded. This file pins that claim, with its polarity.
|
|
6
|
-
//
|
|
7
|
-
// It does not ban a job count. The ban it once carried refused every cardinal
|
|
8
|
-
// sharing a sentence with "job" — "3 workers", "job 2 of a matrix build" (#1194)
|
|
9
|
-
// — and still let a count spelled above ten through (#1193). The list is
|
|
10
|
-
// derived, so a stale count in this comment misleads a reader and changes no
|
|
11
|
-
// behaviour, and the comment itself says why it names no set. A pin that reds
|
|
12
|
-
// on legitimate prose to police a figure that moves nothing costs more than the
|
|
13
|
-
// figure.
|
|
14
|
-
//
|
|
15
|
-
// THE CEILING: this reds when no comment introduces expectedJobs(), and when the
|
|
16
|
-
// comment stops claiming the list is derived or never hardcoded. It cannot prove
|
|
17
|
-
// the surrounding argument sound, and it never runs ci-state.mjs —
|
|
18
|
-
// ci-state.test.mjs owns the derivation's behavior.
|
|
19
|
-
|
|
20
|
-
import { test } from "node:test";
|
|
21
|
-
import assert from "node:assert/strict";
|
|
22
|
-
import { readFileSync } from "node:fs";
|
|
23
|
-
import { fileURLToPath } from "node:url";
|
|
24
|
-
|
|
25
|
-
const CI_STATE = readFileSync(fileURLToPath(new URL("./ci-state.mjs", import.meta.url)), "utf8");
|
|
26
|
-
|
|
27
|
-
// The ARGUED comment introducing the derivation: the contiguous `//` run directly
|
|
28
|
-
// above `function expectedJobs(`, stopping below the `// --- … ---` section
|
|
29
|
-
// banner. ci-state.mjs discusses jobs, workflows and derivation in neighbouring
|
|
30
|
-
// comments, so a match over the file would stay green with this block gutted —
|
|
31
|
-
// satisfied entirely by prose the rule does not govern. The banner is that same
|
|
32
|
-
// hole one line closer: it says "derived" by itself, so including it would let
|
|
33
|
-
// the whole argued comment be deleted with the derivation half still satisfied.
|
|
34
|
-
// Stopping at the first non-comment line also means a block moved away from
|
|
35
|
-
// expectedJobs() reds here rather than silently widening the slice back to the
|
|
36
|
-
// file.
|
|
37
|
-
function derivationComment() {
|
|
38
|
-
const at = CI_STATE.indexOf("function expectedJobs(");
|
|
39
|
-
assert.notEqual(at, -1, "expectedJobs() moved or was renamed — update this test");
|
|
40
|
-
const lines = CI_STATE.slice(0, at).split("\n");
|
|
41
|
-
const block = [];
|
|
42
|
-
for (let i = lines.length - 2; i >= 0 && /^\s*\/\//.test(lines[i]) && !/^\s*\/\/\s*---/.test(lines[i]); i--) {
|
|
43
|
-
block.unshift(lines[i].replace(/^\s*\/\/\s?/, ""));
|
|
44
|
-
}
|
|
45
|
-
assert.notEqual(block.length, 0, "no comment introduces expectedJobs() any more — #847 asked for one that states the property");
|
|
46
|
-
return block.join(" ").replace(/\s+/g, " ");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The rule, as a function so the refuse cases can be fed prose this repo does
|
|
51
|
-
* not contain. Returns null when the comment is sound, else the reason.
|
|
52
|
-
*/
|
|
53
|
-
export function derivationCommentFault(comment) {
|
|
54
|
-
// The NEGATED form, not the bare word, on BOTH sides: `hardcoded` alone is
|
|
55
|
-
// polarity-blind, and so is `deriv` alone — a comment asserting the list IS
|
|
56
|
-
// hardcoded, or that it is NOT derived, is the exact fault this refuses.
|
|
57
|
-
const derivedSound = /\bderiv/i.test(comment) && !/\b(?:never|not)\s+deriv/i.test(comment);
|
|
58
|
-
const hardcodedSound = /\b(?:never|not)\s+hardcoded/i.test(comment);
|
|
59
|
-
if (!derivedSound && !hardcodedSound) {
|
|
60
|
-
return "the expected-job comment no longer says the list is derived from the workflow rather than hardcoded — the one thing a reader checking whether an empty `missing` is vacuous needs from it";
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
test("the expected-job comment says the list is derived, never hardcoded", () => {
|
|
66
|
-
assert.equal(derivationCommentFault(derivationComment()), null);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// What the rule REFUSES, which the test above cannot show: a comment that drops
|
|
70
|
-
// the claim, and one that reverses it.
|
|
71
|
-
test("a comment that drops or reverses the derivation claim is refused", () => {
|
|
72
|
-
assert.equal(derivationCommentFault("Never hardcoded: expectedJobs() parses the `jobs:` block of the workflow file this run resolved."), null);
|
|
73
|
-
assert.equal(derivationCommentFault("Derived from the workflow, which defines 5 jobs."), null);
|
|
74
|
-
assert.match(derivationCommentFault("The list tracks the workflow file automatically."), /no longer says the list is derived/);
|
|
75
|
-
// Polarity: asserting the list IS hardcoded must refuse, not satisfy.
|
|
76
|
-
assert.match(derivationCommentFault("The expected job list is hardcoded below because the workflow never changes."), /no longer says the list is derived/);
|
|
77
|
-
// Polarity, the other direction: asserting the list is NOT derived must
|
|
78
|
-
// refuse too, not slip through on the bare `deriv` substring match.
|
|
79
|
-
assert.match(derivationCommentFault("This list is not derived from anything; it is fully hardcoded for performance."), /no longer says the list is derived/);
|
|
80
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// A reviewer that holds the dispatch tool still has to be TOLD the fan-out is
|
|
2
|
-
// requested work, or it declines to dispatch the specialists and the run
|
|
3
|
-
// silently downgrades to a thinner solo review. Two documents say so: run-team's
|
|
4
|
-
// "Authorize the fan-out explicitly" paragraph, and member-lifecycle.md's
|
|
5
|
-
// "Capability is not permission" section.
|
|
6
|
-
//
|
|
7
|
-
// What the rule rests on is the distinction itself — holding the tool is not
|
|
8
|
-
// authorization to use it — and not on any standing instruction an omp member
|
|
9
|
-
// inherits. The retired wording named such an instruction (`AgentTool`) and
|
|
10
|
-
// rested the rule on that inheritance; reverting either document to it left
|
|
11
|
-
// every other test green, because nothing read these two passages at all.
|
|
12
|
-
//
|
|
13
|
-
// Each passage is sliced to its own paragraph or section, never matched
|
|
14
|
-
// file-wide: both documents discuss the fan-out in many other places, and a
|
|
15
|
-
// file-wide match is satisfied by any of them while the rule's own wording is
|
|
16
|
-
// gutted. Every match goes through `phrase()`, which tolerates a rewrap of the
|
|
17
|
-
// same words — a pin that reds on a reflow discriminates nothing.
|
|
18
|
-
import { test } from "node:test";
|
|
19
|
-
import assert from "node:assert/strict";
|
|
20
|
-
import { readFileSync } from "node:fs";
|
|
21
|
-
import { join } from "node:path";
|
|
22
|
-
import { between, paragraph, phrase } from "./prose-pin.mjs";
|
|
23
|
-
|
|
24
|
-
const REPO = join(import.meta.dirname, "..");
|
|
25
|
-
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
26
|
-
|
|
27
|
-
const SKILL = read("skills", "run-team", "SKILL.md");
|
|
28
|
-
const LIFECYCLE = read("skills", "run-team", "references", "member-lifecycle.md");
|
|
29
|
-
|
|
30
|
-
// [label, passage, the sentence stating "holding the tool is not authorization",
|
|
31
|
-
// the sentence stating what the reviewer must be told]. The two documents word
|
|
32
|
-
// the same rule differently, so each carries its own spelling.
|
|
33
|
-
const PASSAGES = [
|
|
34
|
-
[
|
|
35
|
-
"run-team/SKILL.md's 'Authorize the fan-out explicitly' paragraph",
|
|
36
|
-
paragraph(SKILL, "Authorize the fan-out explicitly.", "run-team/SKILL.md"),
|
|
37
|
-
"holding the dispatch tool is not authorization to use it",
|
|
38
|
-
"State that the full specialist set IS the requested work",
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"member-lifecycle.md's 'Capability is not permission' section",
|
|
42
|
-
between(LIFECYCLE, "## Capability is not permission", "\n## ", "references/member-lifecycle.md"),
|
|
43
|
-
"Holding the dispatch tool does not authorize using it",
|
|
44
|
-
"reviewer prompt must state full specialist set IS requested work",
|
|
45
|
-
],
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
test("both fan-out passages say holding the dispatch tool is not authorization to use it", () => {
|
|
49
|
-
for (const [label, passage, notAuthorization] of PASSAGES) {
|
|
50
|
-
assert.match(
|
|
51
|
-
passage,
|
|
52
|
-
phrase(notAuthorization),
|
|
53
|
-
`${label} no longer says "${notAuthorization}" — without it a reviewer that holds the dispatch tool reads the fan-out as optional and silently downgrades to a thinner solo review`,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("both fan-out passages tell the controller to state the full specialist set IS the requested work", () => {
|
|
59
|
-
for (const [label, passage, , mustState] of PASSAGES) {
|
|
60
|
-
assert.match(
|
|
61
|
-
passage,
|
|
62
|
-
phrase(mustState),
|
|
63
|
-
`${label} no longer says "${mustState}" — the controller is no longer told what the reviewer prompt must carry`,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("neither fan-out passage rests the rule on a standing instruction the member inherits", () => {
|
|
69
|
-
// The retired premise, not a spelling of it: any restatement that grounds the
|
|
70
|
-
// rule in an inherited do-not-dispatch instruction is the claim this ticket
|
|
71
|
-
// removed, whichever tool name it uses. `AgentTool` and the verb `inherits`
|
|
72
|
-
// are the two ways it was written.
|
|
73
|
-
for (const [label, passage] of PASSAGES) {
|
|
74
|
-
assert.doesNotMatch(
|
|
75
|
-
passage,
|
|
76
|
-
/AgentTool|\binherit/i,
|
|
77
|
-
`${label} grounds the fan-out rule in an inherited standing instruction again — omp members inherit no such instruction; the rule is that holding the tool is not authorization to use it`,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
// #239. `decided?` is a correct test that was running in the wrong seat.
|
|
2
|
-
// `review-and-fix.md` step 5 sent the FILER to `run-team/SKILL.md` phase 0's
|
|
3
|
-
// criterion, importing phase 0's cost model — where implementer divergence
|
|
4
|
-
// costs a claim, a worktree and a dispatch — into a seat where divergence costs
|
|
5
|
-
// one PR review the maintainer already runs. Same test, two seats, opposite
|
|
6
|
-
// correct answers. The ruling and its reasoning are ADR 0001.
|
|
7
|
-
//
|
|
8
|
-
// What this pins is the SPLIT, which lives in the join between two documents
|
|
9
|
-
// read by two different agents. Neither file is wrong on its own after a
|
|
10
|
-
// revert: step 5 can go back to delegating and phase 0 will still be a
|
|
11
|
-
// perfectly good consumption gate, and nothing else in the tree notices. That
|
|
12
|
-
// is why the pin is here rather than inside either file's existing suite.
|
|
13
|
-
//
|
|
14
|
-
// Slices are flattened. `run-team/SKILL.md` hard-wraps at ~80 columns, so every
|
|
15
|
-
// literal space in these phrases may be a newline plus indent; `review-and-fix.md`
|
|
16
|
-
// authors one long line per step today, which makes `flat()` a no-op there
|
|
17
|
-
// until the day someone wraps it. Reflow-brittleness is a class defect in this
|
|
18
|
-
// repo's prose pins, so both are flattened whether or not a width reds today.
|
|
19
|
-
//
|
|
20
|
-
// CEILING: presence and adjacency over bounded slices. These prove the rule is
|
|
21
|
-
// stated and that its inverse is not; they cannot prove a later sentence in the
|
|
22
|
-
// same slice does not carve out an exception.
|
|
23
|
-
//
|
|
24
|
-
// Measured as of this commit, on an isolated copy of the four files: 12 semantic
|
|
25
|
-
// mutations — both label branches inverted, the torn tie-break deleted and
|
|
26
|
-
// exception-spliced, the delegation restored, the gate sentence deleted and
|
|
27
|
-
// stripped of its seat pricing, the ADR pointer renamed on one side, the guard
|
|
28
|
-
// floor and trigger each retuned, complements swapped to supersedes, and the
|
|
29
|
-
// apply/label roles swapped — each reddened its own pin and no other. Nine
|
|
30
|
-
// controls stayed green: the gate paragraph rewrapped at 70/100/140 and by
|
|
31
|
-
// `fmt(1)`, the guard bullets and step 5 rewrapped, an unpinned step-5 sentence
|
|
32
|
-
// reworded, and an ADR heading reworded. Re-derive after any edit to these
|
|
33
|
-
// slices; a rationale indexed to wording rots with the wording.
|
|
34
|
-
import { test } from "node:test";
|
|
35
|
-
import assert from "node:assert/strict";
|
|
36
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
37
|
-
import { join } from "node:path";
|
|
38
|
-
import { between, phrase } from "./prose-pin.mjs";
|
|
39
|
-
|
|
40
|
-
const REPO = join(import.meta.dirname, "..");
|
|
41
|
-
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
42
|
-
const RUN_TEAM = read("skills", "run-team", "SKILL.md");
|
|
43
|
-
const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
|
|
44
|
-
const ROOT = join(import.meta.dirname, "..", "..");
|
|
45
|
-
const readRoot = (...p) => readFileSync(join(ROOT, ...p), "utf8");
|
|
46
|
-
|
|
47
|
-
const flat = (s) => s.replace(/\s+/g, " ");
|
|
48
|
-
|
|
49
|
-
const step5 = () => flat(between(REVIEW_AND_FIX, "5. File each deferred finding", "\n6. Diff-check green", "review-and-fix step 5"));
|
|
50
|
-
// Bounded by the two phase-0 markers that bracket the note, never by the note
|
|
51
|
-
// itself: anchoring on the sentence under test turns its deletion into a
|
|
52
|
-
// slicing error rather than a failed assertion.
|
|
53
|
-
const decidedNote = () => flat(between(RUN_TEAM, "**Torn → surface, never guess**", "4. **Collision scan", "run-team phase 0 decided? note"));
|
|
54
|
-
|
|
55
|
-
test("step 5 routes a confirmed defect with an open remedy to ready-for-agent", () => {
|
|
56
|
-
const s = step5();
|
|
57
|
-
// The MAPPING, not the two labels. Both label strings occur in this slice
|
|
58
|
-
// whichever way the rule points, so a pin on either alone stays green with
|
|
59
|
-
// the branches swapped. `needs-triage` is excluded from the gap and `[^.]`
|
|
60
|
-
// keeps the match inside one sentence.
|
|
61
|
-
assert.match(
|
|
62
|
-
s,
|
|
63
|
-
/Confirmed defect with the remedy still open(?:(?!needs-triage)[^.])*?ready-for-agent/,
|
|
64
|
-
"step 5 no longer sends a confirmed defect with an open remedy to `ready-for-agent`",
|
|
65
|
-
);
|
|
66
|
-
// The tie-break and its narrowed meaning are ONE claim: `torn → needs-triage`
|
|
67
|
-
// survived the reprice only because torn was redefined to "unsure anything is
|
|
68
|
-
// broken". Pinned as a contiguous span, because two separate matches would
|
|
69
|
-
// leave the join open — an exception clause spliced between them reverses the
|
|
70
|
-
// rule and satisfies both.
|
|
71
|
-
assert.match(
|
|
72
|
-
s,
|
|
73
|
-
phrase("Torn → `needs-triage`, narrowed: torn means **unsure anything is broken**, not unsure how to fix it."),
|
|
74
|
-
"step 5 lost the narrowed torn tie-break, so `needs-triage` is back to meaning `unsure how to fix it`",
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("step 5 states its own bar instead of delegating to phase 0's criterion", () => {
|
|
79
|
-
const s = step5();
|
|
80
|
-
// The positive companion. A bare negative on `decided?` would be vacuous here
|
|
81
|
-
// by construction — step 5 names the test deliberately, in order to rule it
|
|
82
|
-
// out — so what is pinned is the sentence that rules it out.
|
|
83
|
-
assert.match(
|
|
84
|
-
s,
|
|
85
|
-
phrase("Do **not** reach for phase 0's **decided?** test here."),
|
|
86
|
-
"step 5 no longer tells the filer to leave phase 0's `decided?` test alone",
|
|
87
|
-
);
|
|
88
|
-
// The superseded delegation, verbatim from the text 6d0c1f6 replaced.
|
|
89
|
-
// Verified zero occurrences in the current file.
|
|
90
|
-
assert.doesNotMatch(
|
|
91
|
-
s,
|
|
92
|
-
phrase("read the criterion there rather than re-deriving it here"),
|
|
93
|
-
"step 5 delegates the label choice back to phase 0 — the two seats have re-collided",
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("phase 0 marks decided? as a consumption gate and names an ADR that exists", () => {
|
|
98
|
-
const s = decidedNote();
|
|
99
|
-
// Contiguous span again: "consumption gate" and "the filing-time counterpart
|
|
100
|
-
// was repriced" pin nothing apart. The gate label is only meaningful bound to
|
|
101
|
-
// the seat it is priced for and to the counterpart that is priced differently.
|
|
102
|
-
assert.match(
|
|
103
|
-
s,
|
|
104
|
-
phrase(
|
|
105
|
-
"**This is a consumption gate**, priced for the seat where implementer divergence costs a claim, a worktree and a dispatch; the filing-time counterpart was repriced to *is the defect confirmed* and states its own bar inline",
|
|
106
|
-
),
|
|
107
|
-
"phase 0's `decided?` note no longer marks it a consumption gate with a repriced filing-time counterpart",
|
|
108
|
-
);
|
|
109
|
-
// Read the path out of the prose rather than restating it, so a rename that
|
|
110
|
-
// updates only one side reds. A pointer into a document that is not there
|
|
111
|
-
// fails silently for every reader.
|
|
112
|
-
const [, adr] = s.match(/see `(docs\/adr\/[^`]+)`/) ?? [];
|
|
113
|
-
assert.ok(adr, "phase 0's `decided?` note no longer points at an ADR under `docs/adr/`");
|
|
114
|
-
assert.ok(existsSync(join(ROOT, adr)), `phase 0 points at \`${adr}\`, which does not exist`);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("the ADR keeps its pre-chosen guard and its #211 relationship", () => {
|
|
118
|
-
const adr = flat(readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md"));
|
|
119
|
-
// Floor and trigger as one span. Chosen before any data, on the tier guard's
|
|
120
|
-
// precedent, so that a later run cannot derive a threshold that happens to
|
|
121
|
-
// clear the number in front of it. Separate pins would let either be retuned
|
|
122
|
-
// alone.
|
|
123
|
-
assert.match(
|
|
124
|
-
adr,
|
|
125
|
-
phrase(
|
|
126
|
-
"**Floor:** 20 deferrals filed across at least 3 distinct run dates after this decision lands. - **Trigger:** `needs-triage` still taking more than half of them.",
|
|
127
|
-
),
|
|
128
|
-
"the ADR's guard floor or trigger moved — a pre-chosen guard that is retuned later is not a guard",
|
|
129
|
-
);
|
|
130
|
-
// The conflation this ADR exists to stop, pinned in both halves: the verdict
|
|
131
|
-
// and the division of labour it rests on. Swapping `applied` and `labelled`
|
|
132
|
-
// reds the second while the first stays green, so both are asserted.
|
|
133
|
-
assert.match(
|
|
134
|
-
adr,
|
|
135
|
-
phrase("This decision **complements #211 and does not supersede it.**"),
|
|
136
|
-
"the ADR no longer states that it complements #211 rather than superseding it",
|
|
137
|
-
);
|
|
138
|
-
assert.match(
|
|
139
|
-
adr,
|
|
140
|
-
phrase("#211 governs what gets **applied**; this governs what gets **labelled**"),
|
|
141
|
-
"the ADR no longer separates #211's apply policy from this decision's label policy",
|
|
142
|
-
);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// #839. ADR 0001's guard pre-chose a floor and a trigger but never said WHICH
|
|
146
|
-
// POPULATION the trigger measures — open issues only, or open and closed
|
|
147
|
-
// together. Both readings are available from the same text and they do not
|
|
148
|
-
// agree: a refuted deferral filed as `needs-triage` and later closed is in the
|
|
149
|
-
// denominator under one and absent under the other. An undefined input surface
|
|
150
|
-
// hands back exactly the discretion a pre-chosen guard exists to remove — the
|
|
151
|
-
// evaluator picks the population and the population picks the verdict.
|
|
152
|
-
//
|
|
153
|
-
// Ruled open AND closed on #839. The reason is pinned WITH the ruling, in one
|
|
154
|
-
// contiguous span, because a bare ruling is re-derivable against itself: a later
|
|
155
|
-
// reader who finds open-only more convenient can restore it from a text that
|
|
156
|
-
// never says why it was rejected. Same reason the pre-chosen-guard test pins
|
|
157
|
-
// the floor and the trigger as one span rather than two.
|
|
158
|
-
//
|
|
159
|
-
// CEILING: presence and contiguity over one bounded section. This proves the
|
|
160
|
-
// clause is stated and that its reason travels with it; it cannot prove a
|
|
161
|
-
// sentence elsewhere in the ADR does not carve out an exception.
|
|
162
|
-
const guardSection = (text) =>
|
|
163
|
-
flat(between(text, "## The guard — floor and trigger, chosen before any data", "\n## Relationship to #211", "ADR 0001 guard section"));
|
|
164
|
-
|
|
165
|
-
// The ruling and its reason as ONE phrase, wrap-tolerant. Reworded on purpose →
|
|
166
|
-
// update this string. Do not delete the pin to clear the red.
|
|
167
|
-
const POPULATION = phrase(
|
|
168
|
-
"**Population:** open **and** closed issues together, never open alone. The trigger measures filing behaviour, and a refuted deferral filed as `needs-triage` and later closed counts under one reading and vanishes under the other — so under open-only any triage pass that reads the backlog improves the ratio without one filing having changed. A guard on the filing bar must not be satisfiable by triaging the queue.",
|
|
169
|
-
);
|
|
170
|
-
// The population made operational. A prose ruling the evaluator's own command
|
|
171
|
-
// contradicts is not a ruling, and `--state all` is the single token that
|
|
172
|
-
// carries it.
|
|
173
|
-
const STATE_ALL = phrase("--state all");
|
|
174
|
-
// The as-of duty. Per this ADR's own rule, a count off an append-only tracker
|
|
175
|
-
// rots on the next filing, so the date the count was taken is part of the count.
|
|
176
|
-
const AS_OF = phrase("record the date taken with the verdict");
|
|
177
|
-
|
|
178
|
-
// Presence alone doesn't defend a pin: a mutant can wrap the matched span in
|
|
179
|
-
// markdown strikethrough or drop a negating sentence right after it, and a
|
|
180
|
-
// bare `.test()` still finds every pinned word in order. Bound the match's own
|
|
181
|
-
// surroundings too, not just its content.
|
|
182
|
-
const notNeutralized = (s) => {
|
|
183
|
-
const m = s.match(POPULATION);
|
|
184
|
-
if (!m) return true; // population pin already reports the clause missing; don't double-fire
|
|
185
|
-
const before = s.slice(Math.max(0, m.index - 5), m.index);
|
|
186
|
-
const after = s.slice(m.index + m[0].length, m.index + m[0].length + 200);
|
|
187
|
-
return !/~~/.test(before + after) && !/Superseded/i.test(after);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
const guardPins = {
|
|
191
|
-
population: (s) => !POPULATION.test(s),
|
|
192
|
-
stateAll: (s) => !STATE_ALL.test(s),
|
|
193
|
-
asOf: (s) => !AS_OF.test(s),
|
|
194
|
-
notNeutralized: (s) => !notNeutralized(s),
|
|
195
|
-
};
|
|
196
|
-
const guardFiring = (s) => Object.keys(guardPins).filter((n) => guardPins[n](s));
|
|
197
|
-
|
|
198
|
-
test("the guard names the population its trigger measures, and why", () => {
|
|
199
|
-
const s = guardSection(readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md"));
|
|
200
|
-
// Positive control against a vacuous slice: a stale anchor matching almost
|
|
201
|
-
// nothing would still satisfy a doesNotMatch and assert nothing.
|
|
202
|
-
assert.ok(s.length > 200, "the guard slice is shorter than its own heading and bullets — the extractor is broken, not the ADR wrong");
|
|
203
|
-
assert.deepEqual(guardFiring(s), [], "the guard's population clause, its `--state all` count, or its as-of duty is gone");
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
// The refuse direction: each fixture asserts it changed the document before it
|
|
207
|
-
// is scored, because a fixture that applies nothing is green in exactly the way
|
|
208
|
-
// a pin that does not bite is green.
|
|
209
|
-
const guardMutants = [
|
|
210
|
-
["the population is flipped to open-only", ["population"],
|
|
211
|
-
(t) => t.replace(phrase("open **and** closed issues together, never open alone"), "open issues only, never the closed ones")],
|
|
212
|
-
["the ruling survives but its reason is stripped", ["population"],
|
|
213
|
-
(t) => t.replace(phrase("The trigger measures filing behaviour, and a refuted deferral filed as `needs-triage` and later closed counts under one reading and vanishes under the other — so under open-only any triage pass that reads the backlog improves the ratio without one filing having changed. A guard on the filing bar must not be satisfiable by triaging the queue."), "Count them all.")],
|
|
214
|
-
["the count command is narrowed to open issues", ["stateAll"],
|
|
215
|
-
(t) => t.replace(phrase("--state all"), "--state open")],
|
|
216
|
-
["the as-of duty is dropped", ["asOf"],
|
|
217
|
-
(t) => t.replace(phrase("and record the date taken with the verdict"), "and read it off the tracker")],
|
|
218
|
-
["the population clause is struck through and marked superseded", ["notNeutralized"],
|
|
219
|
-
(t) => t.replace(POPULATION, (m) => `~~${m}~~ Superseded: use open issues only, it is simpler to compute.`)],
|
|
220
|
-
];
|
|
221
|
-
|
|
222
|
-
for (const [what, expected, mutate] of guardMutants) {
|
|
223
|
-
test(`the guard pins redden when ${what}`, () => {
|
|
224
|
-
const adr = readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md");
|
|
225
|
-
const mutated = mutate(adr);
|
|
226
|
-
assert.notEqual(mutated, adr, `the "${what}" fixture no longer matches the guard section and applied nothing — update the fixture, do not delete it`);
|
|
227
|
-
assert.deepEqual(guardFiring(guardSection(mutated)), expected, `the "${what}" fixture did not fire exactly the pins it is here to exercise`);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
test("rewrapping the guard section and editing it elsewhere stays green", () => {
|
|
232
|
-
// The accept direction. A pin that reds on any edit to the section has
|
|
233
|
-
// discriminated nothing and gets deleted by whoever next reflows this file.
|
|
234
|
-
const adr = readRoot("docs", "adr", "0001-filing-label-bar-is-defect-confirmed.md");
|
|
235
|
-
const section = between(adr, "## The guard — floor and trigger, chosen before any data", "\n## Relationship to #211", "ADR 0001 guard section");
|
|
236
|
-
const benign = adr.replace(section, () =>
|
|
237
|
-
section
|
|
238
|
-
.replace(/\n(?! *[-*] )(?! *```)/g, " ")
|
|
239
|
-
.replace("When the guard fires, its verdict lands on `main`.", "When the guard fires, its verdict lands on `main` before the next run starts."));
|
|
240
|
-
assert.notEqual(benign, adr, "the benign-edit fixture no longer matches the guard section — update it");
|
|
241
|
-
assert.deepEqual(guardFiring(guardSection(benign)), [], "a reflow plus an unrelated edit reddened a guard pin — the pins are over-tight, not the ADR wrong");
|
|
242
|
-
});
|