@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.
Files changed (204) hide show
  1. package/package.json +1 -1
  2. package/scripts/main-checkout.mjs +1 -1
  3. package/scripts/member-write-guard.mjs +1 -1
  4. package/scripts/repo-root.mjs +1 -1
  5. package/skills/run-team/references/reaping.md +1 -1
  6. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  7. package/scripts/agent-test.test.mjs +0 -1640
  8. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  9. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  10. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  11. package/scripts/apply-ruleset.test.mjs +0 -421
  12. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  13. package/scripts/arg.test.mjs +0 -1354
  14. package/scripts/board-cli.test.mjs +0 -710
  15. package/scripts/board-identity.test.mjs +0 -429
  16. package/scripts/board-liveness-banner.test.mjs +0 -119
  17. package/scripts/board-prev-shape.test.mjs +0 -228
  18. package/scripts/board-tryparse-null.test.mjs +0 -119
  19. package/scripts/board.test.mjs +0 -3121
  20. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  21. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  22. package/scripts/candidates.test.mjs +0 -2312
  23. package/scripts/caveat-unification-prose.test.mjs +0 -98
  24. package/scripts/cell-readout.test.mjs +0 -615
  25. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  26. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  27. package/scripts/ci-state-prose.test.mjs +0 -113
  28. package/scripts/ci-state.test.mjs +0 -1933
  29. package/scripts/ci-vacuous-green.test.mjs +0 -368
  30. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  31. package/scripts/claim-lifecycle.test.mjs +0 -187
  32. package/scripts/claim-ticket.test.mjs +0 -1122
  33. package/scripts/closing-keyword-prose.test.mjs +0 -193
  34. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  35. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  36. package/scripts/compute-board.test.mjs +0 -1214
  37. package/scripts/compute-spend.test.mjs +0 -517
  38. package/scripts/consumer-technology-prose.test.mjs +0 -126
  39. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  40. package/scripts/cwd-isolation-pins.mjs +0 -83
  41. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  42. package/scripts/delete-merged-branch.test.mjs +0 -576
  43. package/scripts/derive-testcmd.test.mjs +0 -595
  44. package/scripts/diff-stats.test.mjs +0 -404
  45. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  46. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  47. package/scripts/dispositions-check.test.mjs +0 -936
  48. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  49. package/scripts/drop-merged-label.test.mjs +0 -479
  50. package/scripts/exec-stub.mjs +0 -93
  51. package/scripts/exec-stub.test.mjs +0 -69
  52. package/scripts/expected-jobs-prose.test.mjs +0 -80
  53. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  54. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  55. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  56. package/scripts/finisher-died-prose.test.mjs +0 -31
  57. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  58. package/scripts/finisher-halt-prose.test.mjs +0 -106
  59. package/scripts/finisher-name-prose.test.mjs +0 -134
  60. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  61. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  62. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  63. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  64. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  65. package/scripts/fleet-bootstrap.test.mjs +0 -75
  66. package/scripts/fleet-heartbeat.test.mjs +0 -450
  67. package/scripts/fleet-provenance.test.mjs +0 -138
  68. package/scripts/fleet-run.test.mjs +0 -90
  69. package/scripts/fleet-state.test.mjs +0 -460
  70. package/scripts/fleet-tick-prose.test.mjs +0 -300
  71. package/scripts/fleet-tick.test.mjs +0 -2444
  72. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  73. package/scripts/frontmatter-check.test.mjs +0 -436
  74. package/scripts/git-env.test.mjs +0 -149
  75. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  76. package/scripts/gone-walk.test.mjs +0 -213
  77. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  78. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  79. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  80. package/scripts/implementer-model-tier.test.mjs +0 -235
  81. package/scripts/inflight-citation-prose.test.mjs +0 -144
  82. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  83. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  84. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  85. package/scripts/inflight.test.mjs +0 -2882
  86. package/scripts/injection-control-prose.test.mjs +0 -404
  87. package/scripts/install-root-audit.test.mjs +0 -464
  88. package/scripts/instrument-check-prose.test.mjs +0 -235
  89. package/scripts/instruments.test.mjs +0 -787
  90. package/scripts/is-cli.test.mjs +0 -99
  91. package/scripts/issue-tracker-prose.test.mjs +0 -71
  92. package/scripts/json.test.mjs +0 -364
  93. package/scripts/ledger-dispatch.test.mjs +0 -927
  94. package/scripts/ledger-grammar.test.mjs +0 -227
  95. package/scripts/ledger-read-require-file.test.mjs +0 -197
  96. package/scripts/ledger-rotate.test.mjs +0 -142
  97. package/scripts/ledger.test.mjs +0 -3436
  98. package/scripts/line-distance-prose.test.mjs +0 -245
  99. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  100. package/scripts/locale-pin-prose.test.mjs +0 -189
  101. package/scripts/main-checkout.test.mjs +0 -332
  102. package/scripts/member-outcome-prose.test.mjs +0 -167
  103. package/scripts/member-outcomes-header.test.mjs +0 -129
  104. package/scripts/member-outcomes-prose.test.mjs +0 -63
  105. package/scripts/member-outcomes.test.mjs +0 -638
  106. package/scripts/member-prompt-prose.test.mjs +0 -165
  107. package/scripts/member-record.test.mjs +0 -541
  108. package/scripts/member-write-guard.test.mjs +0 -214
  109. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  110. package/scripts/merge-gate.test.mjs +0 -613
  111. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  112. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  113. package/scripts/net-watchdog-prose.test.mjs +0 -79
  114. package/scripts/net.test.mjs +0 -211
  115. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  116. package/scripts/no-undo-audit.test.mjs +0 -3961
  117. package/scripts/no-wave.test.mjs +0 -138
  118. package/scripts/node-floor-sweep.test.mjs +0 -611
  119. package/scripts/pointer-target-prose.test.mjs +0 -186
  120. package/scripts/pr-cost.test.mjs +0 -521
  121. package/scripts/pr-overlap.test.mjs +0 -692
  122. package/scripts/printf-die-sweep.test.mjs +0 -384
  123. package/scripts/prompt-renderer.mjs +0 -40
  124. package/scripts/prompt-renderer.test.mjs +0 -68
  125. package/scripts/prose-pin.mjs +0 -807
  126. package/scripts/prose-pin.test.mjs +0 -1034
  127. package/scripts/prove-merge.test.mjs +0 -995
  128. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  129. package/scripts/quiet-payload-prose.test.mjs +0 -222
  130. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  131. package/scripts/reap.test.mjs +0 -4432
  132. package/scripts/reaping-prose.test.mjs +0 -239
  133. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  134. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  135. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  136. package/scripts/recipe-prove.test.mjs +0 -1042
  137. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  138. package/scripts/release-label-required-prose.test.mjs +0 -71
  139. package/scripts/release-label-split-prose.test.mjs +0 -184
  140. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  141. package/scripts/release-ticket.test.mjs +0 -5099
  142. package/scripts/renovate-release-contract.test.mjs +0 -379
  143. package/scripts/repo-root.test.mjs +0 -873
  144. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  145. package/scripts/review-agent-report-only.test.mjs +0 -49
  146. package/scripts/review-core-booking.test.mjs +0 -35
  147. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  148. package/scripts/review-core-reads.test.mjs +0 -478
  149. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  150. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  151. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  152. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  153. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  154. package/scripts/review-core-testcmd.test.mjs +0 -335
  155. package/scripts/review-core-unrun.test.mjs +0 -566
  156. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  157. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  158. package/scripts/review-host-fixture.mjs +0 -89
  159. package/scripts/review-in-run-retry.test.mjs +0 -211
  160. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  161. package/scripts/review-path-default.test.mjs +0 -796
  162. package/scripts/review-runner-spawns.test.mjs +0 -95
  163. package/scripts/review-runner.test.mjs +0 -166
  164. package/scripts/review-tier-audit.test.mjs +0 -140
  165. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  166. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  167. package/scripts/run-team-local-hook.test.mjs +0 -442
  168. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  169. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  170. package/scripts/section-between-guard-prose.test.mjs +0 -379
  171. package/scripts/select-dimensions.test.mjs +0 -674
  172. package/scripts/shared-refusal.test.mjs +0 -388
  173. package/scripts/shell-traps-prose.test.mjs +0 -504
  174. package/scripts/shortlist.test.mjs +0 -380
  175. package/scripts/slow-transport.mjs +0 -72
  176. package/scripts/snapshot-repo.test.mjs +0 -1006
  177. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  178. package/scripts/spend-view.test.mjs +0 -312
  179. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  180. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  181. package/scripts/staleness.test.mjs +0 -893
  182. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  183. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  184. package/scripts/strip-comments.mjs +0 -44
  185. package/scripts/temp-dir.mjs +0 -47
  186. package/scripts/ticket-router.test.mjs +0 -981
  187. package/scripts/tier-check.test.mjs +0 -828
  188. package/scripts/tier-outcomes-header.test.mjs +0 -518
  189. package/scripts/tier-outcomes.test.mjs +0 -572
  190. package/scripts/tier-roles.test.mjs +0 -535
  191. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  192. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  193. package/scripts/unattended-git-sweep.test.mjs +0 -142
  194. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  195. package/scripts/verify-sha.test.mjs +0 -692
  196. package/scripts/watcher-degraded-block.test.mjs +0 -369
  197. package/scripts/watcher-key-prose.test.mjs +0 -106
  198. package/scripts/within-run-pair-prose.test.mjs +0 -212
  199. package/scripts/worktree-audit.test.mjs +0 -1408
  200. package/scripts/worktree-head-prose.test.mjs +0 -276
  201. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  202. package/scripts/worktree-model-prose.test.mjs +0 -216
  203. package/scripts/worktree-porcelain.mjs +0 -35
  204. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,79 +0,0 @@
1
- import { test } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { readFileSync } from "node:fs";
4
- import { join } from "node:path";
5
- import { between, phrase, stripHashGutter } from "./prose-pin.mjs";
6
-
7
- // #346 asked for one thing that no behaviour test can hold: that the fate of
8
- // the per-transport knobs be DECIDED rather than left implicit. The watchdog
9
- // bounds every transport, which makes ConnectTimeout, the ServerAlive pair and
10
- // the lowSpeed keys redundant AS THE BOUND — so keeping them is a choice, and a
11
- // choice with no reason written beside it decays into an accident nobody dares
12
- // touch. The reason is the artifact; this file is what keeps it.
13
- //
14
- // A pair, like inflight-ssh-precedence-prose.test.mjs's. The positive pins
15
- // carry the decision and its grounds; the negative pin refuses the wording that
16
- // was true before the watchdog landed and is a lie after it. Neither holds
17
- // alone — the positive pins survive a stale "this is still open" sentence
18
- // spliced back in beside them, and the negative pin survives the whole
19
- // rationale being deleted.
20
- //
21
- // THE CEILING: presence pins over a bounded slice. Text spliced INSIDE a pinned
22
- // clause reddens them; a new sentence appended beside one does not. Reflow stays
23
- // green by design — the words are pinned, not their layout.
24
- const NET = readFileSync(join(import.meta.dirname, "net.sh"), "utf8");
25
-
26
- // Bounded by the http paragraph's own opening and by the first construct that
27
- // follows the comment block. net_git's is the only comment in net.sh that
28
- // discusses http transport options, but the bounds are what stop a later block
29
- // elsewhere from satisfying these pins with this clause gutted.
30
- const httpRationale = () =>
31
- stripHashGutter(
32
- between(
33
- NET,
34
- "# http: lowSpeedLimit/lowSpeedTime is git's (curl's) own bound",
35
- "net_base_ssh=$(git config --get core.sshCommand",
36
- "net.sh",
37
- ),
38
- );
39
-
40
- // The negative pins get a WIDER slice than the positive ones, and that is the
41
- // whole point of separating them. The stale sentence this PR deleted lived in
42
- // the ssh paragraph, above the http heading — so run over `httpRationale` the
43
- // two `doesNotMatch` pins below missed it entirely: measured, reinserting
44
- // "Closing that needs a bound outside git … An https origin can still hold a
45
- // fleet slot" into the ssh paragraph left both of them green. A negative pin
46
- // scoped narrower than the prose it forbids forbids nothing. The positive pins
47
- // stay on the narrow slice, where a bound at both ends is what stops an
48
- // unrelated block from satisfying them.
49
- const transportRationale = () =>
50
- stripHashGutter(
51
- between(
52
- NET,
53
- "# ssh: BatchMode=yes refuses any interactive prompt",
54
- "net_base_ssh=$(git config --get core.sshCommand",
55
- "net.sh",
56
- ),
57
- );
58
-
59
- test("net_git's comment states that the per-transport knobs are kept, and why", () => {
60
- const text = httpRationale();
61
- assert.match(text, phrase("stay anyway, and that is a decision rather than an oversight"),
62
- "#346 required the knobs' fate to be stated outright — a reader must not have to infer it from the fact that the lines are still there");
63
- assert.match(text, phrase("fails earlier than the watchdog and in git's own words"),
64
- "the first ground for keeping them: git's own diagnostic is the more useful thing to read, and the watchdog can only report that a budget elapsed");
65
- assert.match(text, phrase("would make every ssh stall wait out the full budget"),
66
- "the second ground, and the one that makes removal an actual regression rather than a wash");
67
- });
68
-
69
- // The negative half. Before the watchdog, this comment closed by saying the
70
- // gap was still open and named the issue that would close it. That sentence is
71
- // now false, and false in the most expensive direction: it would send the next
72
- // reader off to implement the watchdog that the same comment block introduces.
73
- test("net_git's comment no longer defers the bound to a ticket net.sh now carries", () => {
74
- const text = transportRationale();
75
- assert.doesNotMatch(text, phrase("Closing that needs a bound outside git"),
76
- "the bound is no longer needed, it is present — this wording describes the tree as it stood before the watchdog");
77
- assert.doesNotMatch(text, /can still hold a fleet slot/,
78
- "an https origin cannot: the watchdog bounds it whatever the transport does, which is what inflight.test.mjs measures against a silent listener");
79
- });
@@ -1,211 +0,0 @@
1
- // Regression gate for net.sh, the fleet's bounded, prompt-suppressed git
2
- // transport: `node --test plugin/scripts/net.test.mjs`.
3
- //
4
- // The mechanism's END-TO-END cases live in inflight.test.mjs, against probe 2 —
5
- // the accept-then-silent listener, the slow-but-working transport that must NOT
6
- // be killed, the `ps`-shimmed degraded kill, the mktemp-less fallback. They
7
- // stayed there when the mechanism moved here (#347), because they exercise it
8
- // through a caller and a caller is what they measure. This file holds what has
9
- // no caller to reach it: the two closures that decide WHICH pids are signalled
10
- // and WHAT budget a call gets.
11
-
12
- import { test } from "node:test";
13
- import assert from "node:assert/strict";
14
- import { execFileSync, spawnSync } from "node:child_process";
15
- import { mkdtempSync, readFileSync } from "node:fs";
16
- import { tmpdir } from "node:os";
17
- import { join } from "node:path";
18
- import { slowTransport, SSH_URL } from "./slow-transport.mjs";
19
-
20
- const SCRIPT = join(import.meta.dirname, "net.sh");
21
-
22
- // net_kill_tree's awk closure has no other test at its own level: the cases
23
- // that reach it in inflight.test.mjs do so only by letting a real fetch hang,
24
- // which is slow and, worse, blind to the thing the `do { … } while (grew)` loop
25
- // exists for. Measured — collapsing that loop to a single pass still kills the
26
- // whole subtree when `ps` prints parents before children, which is what `ps -A`
27
- // does on an ordinary machine, so every end-to-end case there stays green on the
28
- // mutant.
29
- //
30
- // What discriminates is NOT the ROW order of the canned table. `for (p in
31
- // parent)` reads awk's hash order, and the input order does not set it:
32
- // measured, the same key set fed parents-first and children-first iterated
33
- // identically, and a child-ahead-of-parent table stays green on the single-pass
34
- // mutant here. What reds it is a chain whose pids DESCEND from root to leaf —
35
- // the shape pid wraparound produces — and that is the case below. Measured
36
- // against the single-pass mutant on every awk reachable from here: one-true-awk
37
- // 20200816 (darwin's /usr/bin/awk), mawk 1.3.4 (what ubuntu-latest runs) and
38
- // gawk 5.4.1, red on all three.
39
- //
40
- // Ceiling: this is a measurement on three awks, not a proof over all of them.
41
- // An implementation that iterated these keys leaf-last would survive the mutant
42
- // here — the ASCENDING chain is the live example of exactly that, green on the
43
- // mutant under gawk because gawk walks those keys in ascending order, which is
44
- // already topological. So the descending shape is load-bearing, not cosmetic,
45
- // and an awk not named above is untested rather than covered.
46
- //
47
- // The function is lifted out of net.sh by its own braces rather than
48
- // re-typed, so this cannot drift into testing a copy. `kill` has to be a
49
- // shell FUNCTION because it is a builtin and a file on PATH is never
50
- // consulted; `ps` is not a builtin, but it is shadowed the same way here
51
- // rather than written to PATH as a stub executable. A freshly written
52
- // executable's FIRST execution pays an OS scan cost that has nothing to do
53
- // with net_kill_tree — measured 1.1-2.1s idle, sometimes 10s+ — and this
54
- // helper used to pay it five times per test run against a 10s per-spawn
55
- // timeout, which is what made the test load-sensitive (#1099). A shell
56
- // function has none of that cost and takes precedence over PATH the same
57
- // way. The `-9` escalation is dropped on the floor — the set is what is
58
- // under test, and it is the same set both signals go to.
59
- const killTreeOn = (table, root) => {
60
- const body = readFileSync(SCRIPT, "utf8").match(/^net_kill_tree\(\) \{\n[\s\S]*?^\}$/m);
61
- assert.ok(body, "net_kill_tree() is no longer a top-level function in net.sh — update this test");
62
-
63
- const r = spawnSync("sh", ["-c",
64
- `kill() { [ "$1" = -9 ] || printf '%s\\n' "$*"; }\nps() { printf '%s' '${table}'; }\n${body[0]}\nnet_kill_tree ${root}`],
65
- { encoding: "utf8", timeout: 10_000 });
66
- assert.equal(r.status, 0, `net_kill_tree exited non-zero: ${JSON.stringify(r)}`);
67
- return r.stdout.trim().split(/\s+/).filter(Boolean).sort((a, b) => a - b);
68
- };
69
-
70
- test("net_kill_tree signals the whole subtree, however the snapshot is ordered", () => {
71
- assert.deepEqual(killTreeOn("100 1\n200 100\n300 200\n400 1\n", 100), ["100", "200", "300"],
72
- "a chain two levels deep, parents first");
73
- assert.deepEqual(killTreeOn("800 900\n700 800\n600 700\n500 600\n400 1\n", 900),
74
- ["500", "600", "700", "800", "900"],
75
- "a chain whose pids DESCEND from root to leaf — the case a single-pass walk gets wrong, and the only case here that reds the collapsed fixpoint");
76
- assert.deepEqual(killTreeOn("500 400\n300 100\n200 100\n100 1\n400 1\n", 100), ["100", "200", "300"],
77
- "branching, and an unrelated tree that must not be swept in");
78
- assert.deepEqual(killTreeOn("100 1\n200 1\n", 100), ["100"],
79
- "a root with no descendants is still signalled");
80
- assert.deepEqual(killTreeOn("200 1\n300 200\n", 999), ["999"],
81
- "a root absent from the snapshot falls back to itself, never to nothing");
82
- });
83
-
84
-
85
- // net_budget is the one piece of net.sh that every caller reaches on its
86
- // healthy path, so a mistake in it is not a stalled-transport edge case — it
87
- // silently changes the bound on all four fetches and the two ls-remotes. The
88
- // three cases inflight.test.mjs drives end-to-end (a value that shortens, one
89
- // that would lengthen, one too large for the shell's integer) are the ones a
90
- // caller can express; the rest are only reachable here.
91
- //
92
- // Sourced rather than re-typed, for the same reason net_kill_tree is lifted by
93
- // its braces: a copy of the rule would go on passing after the rule changed.
94
- // `sh -c` with `set -eu`, because that is what every caller runs under and a
95
- // `$1` this function forgot to default would abort there rather than here.
96
- const budget = (dflt, override) => {
97
- const r = spawnSync("sh", ["-c",
98
- `set -eu\n. '${SCRIPT}'\nnet_budget ${dflt} '${override}'`],
99
- { encoding: "utf8", timeout: 10_000 });
100
- assert.equal(r.status, 0, `net_budget exited non-zero: ${JSON.stringify(r)}`);
101
- assert.equal(r.stderr, "", `net_budget wrote to stderr: ${r.stderr}`);
102
- return r.stdout;
103
- };
104
-
105
- test("net_budget takes an override only when it SHORTENS", () => {
106
- assert.equal(budget(30, ""), "30", "no override: the default stands");
107
- assert.equal(budget(30, "5"), "5", "below the default: the override is the bound");
108
- assert.equal(budget(30, "600"), "30",
109
- "above the default: refused. A knob that could lengthen the budget is one more way for configuration to remove the bound, which is the defect the ssh half of #346 reports");
110
- assert.equal(budget(30, "30"), "30",
111
- "equal to the default is not shorter, so nothing changes — and the value reported is still a real one");
112
- });
113
-
114
- test("net_budget treats an unusable override as no override, in silence", () => {
115
- assert.equal(budget(30, "0"), "30", "zero is not a bound, it is a call that may not run at all");
116
- assert.equal(budget(30, "-5"), "30", "a negative reaches the `*[!0-9]*` arm, never `[ -lt ]`");
117
- assert.equal(budget(30, "abc"), "30", "so does a word");
118
- assert.equal(budget(30, "5.5"), "30", "and so does a decimal — `[` reads integers only");
119
- assert.equal(budget(30, " 5"), "30", "and a value with a space in it, which `[` would otherwise take as 5");
120
- assert.equal(budget(30, "99999999999999999999"), "30",
121
- "a digit string too large for the shell's integer takes the `??????*` arm rather than reaching `[`, which on darwin says `integer expression expected` and on the dash that is CI's /bin/sh says `Illegal number` — the assertion on stderr above is what holds that, and it is why both platforms are named");
122
- assert.equal(budget(30, "029"), "029",
123
- "five digits or fewer still reach `[`, zero-padded ones included, so 029 IS taken as a bound — and it comes back with its zero on, since the value is echoed rather than renormalised. `sleep 029` and a reported `within 029s` are both the caller asking for 29 seconds and getting them; this pins that the padding is cosmetic, not that it is normalised away");
124
- });
125
-
126
- // The control, and the reason this whole mechanism is not simply "kill it
127
- // sooner": a bound that turns a working slow fetch into exit 2 is worse than
128
- // the hang it replaces, because exit 2 is a verdict the controller acts on.
129
- // inflight.test.mjs holds this pair for the `ls-remote` #346 bounded; #347's
130
- // four new callers are FETCHES, which move objects rather than refs and so are
131
- // the ones a budget can plausibly cut short. verify-sha.sh stands in for them
132
- // here — the smallest of the four, and the only one whose contract separates
133
- // `no` (exit 1) from `could not answer` (exit 2), so a false failure cannot
134
- // hide inside the verdict it would corrupt.
135
- //
136
- // The transport is REAL: an ssh stub that sleeps and then serves the fixture's
137
- // own bare repo through `git upload-pack`, so refs genuinely come back. Paired
138
- // with its sensitivity control below, and neither is worth much alone — an
139
- // accept-only case passes just as well against a watchdog that never fires,
140
- // which is to say against no watchdog at all.
141
- const ENV = {
142
- ...process.env,
143
- GIT_DIR: undefined, GIT_WORK_TREE: undefined, GIT_TEMPLATE_DIR: undefined, GIT_INDEX_FILE: undefined,
144
- GIT_AUTHOR_NAME: "t", GIT_AUTHOR_EMAIL: "t@example.com",
145
- GIT_COMMITTER_NAME: "t", GIT_COMMITTER_EMAIL: "t@example.com",
146
- GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_SYSTEM: "/dev/null",
147
- };
148
- const git = (cwd, ...args) => execFileSync("git", args, { cwd, env: ENV, encoding: "utf8" }).trim();
149
-
150
- /**
151
- * Bare origin + clone with one commit on main, reached through the shared
152
- * slow-but-working ssh stub: a real transport serving this fixture's own refs
153
- * from behind a delay. `slow-transport.mjs` owns that delay, and the two
154
- * budgets this pair of cases is built on are chosen against it.
155
- */
156
- function slowRepo(t) {
157
- const root = mkdtempSync(join(tmpdir(), "net-slow-"));
158
- t.after(() => execFileSync("rm", ["-rf", root]));
159
- const origin = join(root, "origin.git");
160
- const w = join(root, "w");
161
- execFileSync("git", ["-c", "init.defaultBranch=main", "init", "-q", "--bare", origin], { env: ENV });
162
- execFileSync("git", ["clone", "-q", origin, w], { env: ENV });
163
- git(w, "commit", "-q", "--allow-empty", "-m", "root");
164
- git(w, "branch", "-M", "main");
165
- git(w, "push", "-q", "-u", "origin", "main");
166
- const head = git(w, "rev-parse", "HEAD");
167
-
168
- const sshCommand = slowTransport(origin);
169
- git(w, "remote", "set-url", "origin", SSH_URL);
170
- return { w, head, sshCommand };
171
- }
172
-
173
- test("a fetch that is slow but WORKING keeps its ordinary verdict — the budget is not a stopwatch on success", (t) => {
174
- const { w, head, sshCommand } = slowRepo(t);
175
- const r = spawnSync("sh", [join(import.meta.dirname, "verify-sha.sh"), "main", head], {
176
- cwd: w, encoding: "utf8", timeout: 60_000,
177
- env: { ...ENV, GIT_SSH_COMMAND: sshCommand, FLEET_NET_TIMEOUT: "20" },
178
- });
179
-
180
- assert.equal(r.error, undefined, `the run did not come back: ${JSON.stringify(r)}`);
181
- assert.equal(r.status, 0,
182
- `the sha really is on the branch and the transport really returned it, so the verdict is `
183
- + `reachable — exit 2 here would be an outage invented on a link that worked: ${JSON.stringify(r)}`);
184
- assert.equal(JSON.parse(r.stdout).reachable, true, "and the payload is the one an unbounded fetch produced");
185
- assert.doesNotMatch(r.stderr, /did not finish within/,
186
- "and nothing claims a budget elapsed, which is the wording the failure path owns");
187
- });
188
-
189
- test("the budget is what spares the slow fetch, not the absence of a watchdog", (t) => {
190
- const { w, head, sshCommand } = slowRepo(t);
191
- const r = spawnSync("sh", [join(import.meta.dirname, "verify-sha.sh"), "main", head], {
192
- cwd: w, encoding: "utf8", timeout: 60_000,
193
- env: { ...ENV, GIT_SSH_COMMAND: sshCommand, FLEET_NET_TIMEOUT: "1" },
194
- });
195
-
196
- assert.equal(r.error, undefined, `the run did not come back: ${JSON.stringify(r)}`);
197
- assert.equal(r.status, 2,
198
- "under the delay the same transport is cut off, and the answer is `could not answer` — never exit 1, which would report a sha that IS on the branch as missing from it");
199
- assert.match(r.stderr, /did not finish within 1s and was killed/,
200
- "and it says the budget elapsed rather than blaming the fetch, which is the one thing the exit status alone cannot distinguish");
201
- assert.equal(r.stdout, "", "no payload: nothing was answered");
202
- assert.doesNotMatch(r.stderr, /(Terminated|Killed):/,
203
- "and the shell's own notice for the job it reaped stays OFF the caller's stderr, above the caller's own reason — "
204
- + "without the `2>/dev/null` on net.sh's `wait` it leaks instead. The regex takes EITHER signal because "
205
- + "net_kill_tree sends TERM then KILL with no pause, so which one reaps the job is a race, not something "
206
- + "either shell decides — the shell only fixes the FORM: bash-as-sh names the job (the long form), dash's "
207
- + "notice is bare. Measured for #1042 by replaying net_git's own mechanism against a plain `sleep`: on "
208
- + "this machine, `/bin/sh` (bash 3.2.57) and `/bin/dash` both gave TERM, every run — a quiet-system "
209
- + "sample, not a signal either shell is owed, which is why this regex accepts both rather than pinning "
210
- + "one. Capitalised, so the script's own `and was killed` is not what this matches");
211
- });
@@ -1,108 +0,0 @@
1
- // #286. The `no-ci` FINISHER GATE — the label rests on the reviewer's own
2
- // verified suite run, and without one nobody labels — was stated at four sites
3
- // across three documents and pinned in none of them. What already exists pins a
4
- // different clause of the same bullet: review-path-default.test.mjs anchors the
5
- // Phase 3 no-ci edge's outstanding-ruling condition (`never while you still owe
6
- // it a ruling`). The gate itself was free to rot in any of the four.
7
- //
8
- // Three sites remain, and they word it differently ON PURPOSE, so this pins the
9
- // invariant each one must keep rather than a shared sentence:
10
- // - run-team/SKILL.md Phase 3 edge — the CONTROLLER's dispatch condition.
11
- // - run-team/SKILL.md finisher gate — the FINISHER's own two-facts verdict.
12
- // - review-and-fix.md step 6 — the REVIEWER's attestation, off its own step 3.
13
- // All three can refuse to label, so all three carry the refusal half. The
14
- // fourth, run-merge-bot.md step 3 reading the label back out, left the prose
15
- // with #1806: `merge-gate.mjs` passes `--declare-no-ci` on every call itself,
16
- // behind its own label check, so no bot-facing sentence states it any more.
17
- //
18
- // DELIBERATELY UNPINNED: references/ci-and-staleness.md. It states the SCRIPT
19
- // contract (`no-ci` alone exits 1, exit 0 comes only with `--declare-no-ci`, the
20
- // flag verifies nothing) and then explicitly hands the gate off — "SKILL.md's
21
- // `no-ci` edge therefore dispatches the finisher off the reviewer's final
22
- // verdict instead — that edge, not this file, carries the conditions on it".
23
- // Pinning a finisher gate there would pin a duty that file disclaims, and would
24
- // redden the moment someone correctly declines to restate it.
25
- //
26
- // THE CEILING, shared with every prose pin here: these prove the clause is
27
- // PRESENT in the smallest slice that can hold it. None can prove a sentence
28
- // added beside it does not negate it, and none runs anything — ci-state.test.mjs
29
- // owns `ci-state.mjs`'s behavior, and the gate is executed by an agent reading
30
- // this prose. Read each assertion as "not vacuous to REWORDING", never as "this
31
- // rule cannot be subverted".
32
- import { test } from "node:test";
33
- import assert from "node:assert/strict";
34
- import { readFileSync } from "node:fs";
35
- import { join } from "node:path";
36
- import { bullet } from "./prose-pin.mjs";
37
-
38
- const REPO = join(import.meta.dirname, "..");
39
- const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
40
- const REVIEW_AND_FIX = readFileSync(join(REPO, "commands", "review-and-fix.md"), "utf8");
41
-
42
- // Reflow-safety: these documents hard-wrap, so a pinned phrase spans a newline
43
- // plus indent and an exact-adjacency regex reports a clause that is right there
44
- // as missing. Paragraphs are split off FIRST — that bound is what keeps a
45
- // positive pin from being satisfied by a neighbouring paragraph — and only then
46
- // is whitespace inside each one flattened.
47
- const flat = (s) => s.replace(/\s+/g, " ").trim();
48
- const paragraphs = (text) => text.split(/\n\s*\n/).map(flat);
49
-
50
- // Anchored on what the paragraph SAYS, never on where it sits, and never on the
51
- // clause under test: an ordinal re-rots the moment anyone inserts ahead of it,
52
- // and an anchor that IS the assertion turns a deleted clause into "update this
53
- // test" instead of a gate failure.
54
- function paragraphSaying(text, anchor, label) {
55
- const hits = paragraphs(text).filter((p) => p.includes(anchor));
56
- assert.equal(hits.length, 1, `${label}: '${anchor}' matched ${hits.length} paragraphs, expected 1 — update this test`);
57
- return hits[0];
58
- }
59
-
60
- // SKILL.md's Phase 3 edge cannot use paragraphSaying: the whole event-loop
61
- // bullet list is one blank-line-free paragraph (~3.6k chars), and a regex over
62
- // that is satisfied by a neighbouring edge — vacuous. It gets prose-pin.mjs's
63
- // `bullet` instead, on the SAME anchor pair review-path-default.test.mjs already
64
- // uses for this bullet, so this file adds no new anchor to that document. That
65
- // clamps at the next sibling bullet, not only at the fixed end anchor, so a
66
- // sibling edge inserted between the two cannot carry a pin the real edge lost
67
- // (#747).
68
-
69
- const SITES = [
70
- [
71
- "run-team Phase 3 no-ci edge",
72
- () => flat(bullet(RUN_TEAM, '- **`ci-state.mjs --pr <N>` reads `verdict: "no-ci"`**', "**Every wake ends in the tick.**", "run-team no-ci edge")),
73
- /label off the reviewer's (own )?verified suite run/i,
74
- /without it, do not label/i,
75
- ],
76
- [
77
- "run-team finisher gate",
78
- () => paragraphSaying(RUN_TEAM, "no verified suite run on record", "run-team finisher gate"),
79
- /rests on the reviewer's (own )?suite run, not on CI/i,
80
- /add no label/i,
81
- ],
82
- [
83
- "review-and-fix step 6",
84
- () => paragraphSaying(REVIEW_AND_FIX, "this repo has no `check` job to gate on at all", "review-and-fix step 6"),
85
- /label off step 3's own green `testCmd` run/i,
86
- /run on record → do not label/i,
87
- ],
88
- ];
89
-
90
- test("every no-ci site rests the label on the reviewer's own verified suite run", () => {
91
- for (const [label, slice, rests] of SITES) {
92
- assert.match(
93
- slice(),
94
- rests,
95
- `${label}: no longer says the no-ci label rests on the reviewer's own verified suite run — the gate becomes the \`--declare-no-ci\` flag, which is caller-side and confirms only that the caller passed it`,
96
- );
97
- }
98
- });
99
-
100
- test("every no-ci site that can label carries the refusal when no such run exists", () => {
101
- for (const [label, slice, , refusal] of SITES) {
102
- assert.match(
103
- slice(),
104
- refusal,
105
- `${label}: lost the refusal — absence of CI now reads as a pass, which is exactly the misconfigured-repo case the declaration exists to rule out`,
106
- );
107
- }
108
- });