@feigi/fleet-ctl 3.23.36 → 3.23.38

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 (205) hide show
  1. package/package.json +1 -1
  2. package/scripts/cell-readout.mjs +38 -11
  3. package/scripts/main-checkout.mjs +1 -1
  4. package/scripts/member-write-guard.mjs +1 -1
  5. package/scripts/repo-root.mjs +1 -1
  6. package/skills/run-team/references/reaping.md +1 -1
  7. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  8. package/scripts/agent-test.test.mjs +0 -1640
  9. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  10. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  11. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  12. package/scripts/apply-ruleset.test.mjs +0 -421
  13. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  14. package/scripts/arg.test.mjs +0 -1354
  15. package/scripts/board-cli.test.mjs +0 -710
  16. package/scripts/board-identity.test.mjs +0 -429
  17. package/scripts/board-liveness-banner.test.mjs +0 -119
  18. package/scripts/board-prev-shape.test.mjs +0 -228
  19. package/scripts/board-tryparse-null.test.mjs +0 -119
  20. package/scripts/board.test.mjs +0 -3121
  21. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  22. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  23. package/scripts/candidates.test.mjs +0 -2312
  24. package/scripts/caveat-unification-prose.test.mjs +0 -98
  25. package/scripts/cell-readout.test.mjs +0 -615
  26. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  27. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  28. package/scripts/ci-state-prose.test.mjs +0 -113
  29. package/scripts/ci-state.test.mjs +0 -1933
  30. package/scripts/ci-vacuous-green.test.mjs +0 -368
  31. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  32. package/scripts/claim-lifecycle.test.mjs +0 -187
  33. package/scripts/claim-ticket.test.mjs +0 -1122
  34. package/scripts/closing-keyword-prose.test.mjs +0 -193
  35. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  36. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  37. package/scripts/compute-board.test.mjs +0 -1214
  38. package/scripts/compute-spend.test.mjs +0 -517
  39. package/scripts/consumer-technology-prose.test.mjs +0 -126
  40. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  41. package/scripts/cwd-isolation-pins.mjs +0 -83
  42. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  43. package/scripts/delete-merged-branch.test.mjs +0 -576
  44. package/scripts/derive-testcmd.test.mjs +0 -595
  45. package/scripts/diff-stats.test.mjs +0 -404
  46. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  47. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  48. package/scripts/dispositions-check.test.mjs +0 -936
  49. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  50. package/scripts/drop-merged-label.test.mjs +0 -479
  51. package/scripts/exec-stub.mjs +0 -93
  52. package/scripts/exec-stub.test.mjs +0 -69
  53. package/scripts/expected-jobs-prose.test.mjs +0 -80
  54. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  55. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  56. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  57. package/scripts/finisher-died-prose.test.mjs +0 -31
  58. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  59. package/scripts/finisher-halt-prose.test.mjs +0 -106
  60. package/scripts/finisher-name-prose.test.mjs +0 -134
  61. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  62. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  63. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  64. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  65. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  66. package/scripts/fleet-bootstrap.test.mjs +0 -75
  67. package/scripts/fleet-heartbeat.test.mjs +0 -450
  68. package/scripts/fleet-provenance.test.mjs +0 -138
  69. package/scripts/fleet-run.test.mjs +0 -90
  70. package/scripts/fleet-state.test.mjs +0 -460
  71. package/scripts/fleet-tick-prose.test.mjs +0 -300
  72. package/scripts/fleet-tick.test.mjs +0 -2444
  73. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  74. package/scripts/frontmatter-check.test.mjs +0 -436
  75. package/scripts/git-env.test.mjs +0 -149
  76. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  77. package/scripts/gone-walk.test.mjs +0 -213
  78. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  79. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  80. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  81. package/scripts/implementer-model-tier.test.mjs +0 -235
  82. package/scripts/inflight-citation-prose.test.mjs +0 -144
  83. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  84. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  85. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  86. package/scripts/inflight.test.mjs +0 -2882
  87. package/scripts/injection-control-prose.test.mjs +0 -404
  88. package/scripts/install-root-audit.test.mjs +0 -464
  89. package/scripts/instrument-check-prose.test.mjs +0 -235
  90. package/scripts/instruments.test.mjs +0 -787
  91. package/scripts/is-cli.test.mjs +0 -99
  92. package/scripts/issue-tracker-prose.test.mjs +0 -71
  93. package/scripts/json.test.mjs +0 -364
  94. package/scripts/ledger-dispatch.test.mjs +0 -927
  95. package/scripts/ledger-grammar.test.mjs +0 -227
  96. package/scripts/ledger-read-require-file.test.mjs +0 -197
  97. package/scripts/ledger-rotate.test.mjs +0 -142
  98. package/scripts/ledger.test.mjs +0 -3436
  99. package/scripts/line-distance-prose.test.mjs +0 -245
  100. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  101. package/scripts/locale-pin-prose.test.mjs +0 -189
  102. package/scripts/main-checkout.test.mjs +0 -332
  103. package/scripts/member-outcome-prose.test.mjs +0 -167
  104. package/scripts/member-outcomes-header.test.mjs +0 -129
  105. package/scripts/member-outcomes-prose.test.mjs +0 -63
  106. package/scripts/member-outcomes.test.mjs +0 -638
  107. package/scripts/member-prompt-prose.test.mjs +0 -165
  108. package/scripts/member-record.test.mjs +0 -541
  109. package/scripts/member-write-guard.test.mjs +0 -214
  110. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  111. package/scripts/merge-gate.test.mjs +0 -613
  112. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  113. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  114. package/scripts/net-watchdog-prose.test.mjs +0 -79
  115. package/scripts/net.test.mjs +0 -211
  116. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  117. package/scripts/no-undo-audit.test.mjs +0 -3961
  118. package/scripts/no-wave.test.mjs +0 -138
  119. package/scripts/node-floor-sweep.test.mjs +0 -611
  120. package/scripts/pointer-target-prose.test.mjs +0 -186
  121. package/scripts/pr-cost.test.mjs +0 -521
  122. package/scripts/pr-overlap.test.mjs +0 -692
  123. package/scripts/printf-die-sweep.test.mjs +0 -384
  124. package/scripts/prompt-renderer.mjs +0 -40
  125. package/scripts/prompt-renderer.test.mjs +0 -68
  126. package/scripts/prose-pin.mjs +0 -807
  127. package/scripts/prose-pin.test.mjs +0 -1034
  128. package/scripts/prove-merge.test.mjs +0 -995
  129. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  130. package/scripts/quiet-payload-prose.test.mjs +0 -222
  131. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  132. package/scripts/reap.test.mjs +0 -4432
  133. package/scripts/reaping-prose.test.mjs +0 -239
  134. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  135. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  136. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  137. package/scripts/recipe-prove.test.mjs +0 -1042
  138. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  139. package/scripts/release-label-required-prose.test.mjs +0 -71
  140. package/scripts/release-label-split-prose.test.mjs +0 -184
  141. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  142. package/scripts/release-ticket.test.mjs +0 -5099
  143. package/scripts/renovate-release-contract.test.mjs +0 -379
  144. package/scripts/repo-root.test.mjs +0 -873
  145. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  146. package/scripts/review-agent-report-only.test.mjs +0 -49
  147. package/scripts/review-core-booking.test.mjs +0 -35
  148. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  149. package/scripts/review-core-reads.test.mjs +0 -478
  150. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  151. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  152. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  153. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  154. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  155. package/scripts/review-core-testcmd.test.mjs +0 -335
  156. package/scripts/review-core-unrun.test.mjs +0 -566
  157. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  158. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  159. package/scripts/review-host-fixture.mjs +0 -89
  160. package/scripts/review-in-run-retry.test.mjs +0 -211
  161. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  162. package/scripts/review-path-default.test.mjs +0 -796
  163. package/scripts/review-runner-spawns.test.mjs +0 -95
  164. package/scripts/review-runner.test.mjs +0 -166
  165. package/scripts/review-tier-audit.test.mjs +0 -140
  166. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  167. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  168. package/scripts/run-team-local-hook.test.mjs +0 -442
  169. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  170. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  171. package/scripts/section-between-guard-prose.test.mjs +0 -379
  172. package/scripts/select-dimensions.test.mjs +0 -674
  173. package/scripts/shared-refusal.test.mjs +0 -388
  174. package/scripts/shell-traps-prose.test.mjs +0 -504
  175. package/scripts/shortlist.test.mjs +0 -380
  176. package/scripts/slow-transport.mjs +0 -72
  177. package/scripts/snapshot-repo.test.mjs +0 -1006
  178. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  179. package/scripts/spend-view.test.mjs +0 -312
  180. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  181. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  182. package/scripts/staleness.test.mjs +0 -893
  183. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  184. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  185. package/scripts/strip-comments.mjs +0 -44
  186. package/scripts/temp-dir.mjs +0 -47
  187. package/scripts/ticket-router.test.mjs +0 -981
  188. package/scripts/tier-check.test.mjs +0 -828
  189. package/scripts/tier-outcomes-header.test.mjs +0 -518
  190. package/scripts/tier-outcomes.test.mjs +0 -572
  191. package/scripts/tier-roles.test.mjs +0 -535
  192. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  193. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  194. package/scripts/unattended-git-sweep.test.mjs +0 -142
  195. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  196. package/scripts/verify-sha.test.mjs +0 -692
  197. package/scripts/watcher-degraded-block.test.mjs +0 -369
  198. package/scripts/watcher-key-prose.test.mjs +0 -106
  199. package/scripts/within-run-pair-prose.test.mjs +0 -212
  200. package/scripts/worktree-audit.test.mjs +0 -1408
  201. package/scripts/worktree-head-prose.test.mjs +0 -276
  202. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  203. package/scripts/worktree-model-prose.test.mjs +0 -216
  204. package/scripts/worktree-porcelain.mjs +0 -35
  205. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,149 +0,0 @@
1
- // #1802 (spec docs/specs/2026-09-24-slot-based-fleet-loop-design.md § 3 §4,
2
- // §8). The fix-applier now reads the review off `<scratch>/review-<pr>.json`
3
- // and owns every per-PR ruling the controller used to make before dispatch —
4
- // both mutual-exclusion scans, the suggested-fix re-derivation, `refuted=false`
5
- // ≠ apply, per-site measurement for a sibling-site extension, and reading
6
- // `testEnvironment`/`cwdAudit` before acting on a result of the shared test
7
- // run. Their new home is review-and-fix.md's `## The review result file`, which
8
- // is the copy the fix-applier reads. The controller-side copies in
9
- // run-team/SKILL.md are due to be retired once the controller stops making
10
- // these rulings (§ 8), and a retirement that loses the destination copy too
11
- // would leave the rulings made by nobody, with every pin that read SKILL.md
12
- // simply deleted alongside it.
13
- //
14
- // Two halves. The recipes half is not prose: a `jq` path naming a field the
15
- // result does not carry prints `null` at exit 0, which reads exactly like an
16
- // empty bucket — so every top-level field the recipes read is checked against
17
- // the keys the review really returns (DIGEST_KEYS + the bulk arrays, the order
18
- // review-in-run-retry.test.mjs holds both review bodies to by running them).
19
- import { test } from "node:test";
20
- import assert from "node:assert/strict";
21
- import { readFileSync } from "node:fs";
22
- import { join } from "node:path";
23
- import { between, paragraph, phrase } from "./prose-pin.mjs";
24
- import { DIGEST_KEYS } from "./review-core.mjs";
25
-
26
- const REPO = join(import.meta.dirname, "..");
27
- const DOC = readFileSync(join(REPO, "commands", "review-and-fix.md"), "utf8");
28
- const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
29
- const RESULT_KEYS = new Set([...DIGEST_KEYS, "snapshot", "survived", "refuted", "unverified"]);
30
-
31
- const section = () => between(DOC, "\n## The review result file\n", "\n## Specialists\n", "review-and-fix.md's result-file section");
32
- const ruling = (lead) => {
33
- // One paragraph per ruling: the document writes one line per paragraph, so
34
- // the paragraph is the line the bold lead-in opens.
35
- const line = section().split("\n").find((l) => l.startsWith(lead));
36
- assert.ok(line, `review-and-fix.md's result-file section no longer opens a paragraph with ${JSON.stringify(lead)}`);
37
- return line;
38
- };
39
-
40
- test("the fix-applier reads the review off the result file, at the path the runner and the controller write", () => {
41
- assert.match(section(), phrase("`<scratch>/review-<pr>.json`"));
42
- // Step 1's fix-applier branch is what sends a fix-applier here at all.
43
- const step1 = between(DOC, "1. Run the review yourself.", "\n2. Plan the actions.", "review-and-fix.md step 1");
44
- assert.match(step1, phrase("see **The review result file**"), "step 1 no longer points a fix-applier at the result file");
45
- });
46
-
47
- test("every top-level field the jq recipes read is a field the review returns", () => {
48
- const recipes = section().match(/^jq .*$/gm) ?? [];
49
- assert.ok(recipes.length >= 5, `found ${recipes.length} jq recipes — the section lost its reading recipes`);
50
- const read = new Set();
51
- for (const line of recipes) {
52
- const program = line.match(/'([^']*)'/)?.[1];
53
- assert.ok(program, `a jq recipe has no single-quoted program: ${line}`);
54
- // A projection `{a, b}` reads each name; otherwise the program's first
55
- // path segment is the field it reads (`.survived`, `[.unverified[] | ...`).
56
- const projection = program.match(/^\{([^}]*)\}$/);
57
- if (projection) for (const k of projection[1].split(",")) read.add(k.trim());
58
- else read.add(program.match(/\.(\w+)/)[1]);
59
- }
60
- for (const field of read) {
61
- assert.ok(RESULT_KEYS.has(field), `a jq recipe reads .${field}, which the review result does not carry — it would print null at exit 0`);
62
- }
63
- // Both inputs every other ruling depends on must actually be read.
64
- for (const field of ["survived", "unverified", "refuted", "counts", "testEnvironment", "cwdAudit", "dimensionsUnrun", "resume"]) {
65
- assert.ok(read.has(field), `no jq recipe reads .${field}`);
66
- }
67
- });
68
-
69
- test("the crash populations are told apart off refutersDispatched in the recipes, never off severity", () => {
70
- const recipes = (section().match(/^jq .*$/gm) ?? []).join("\n");
71
- assert.match(recipes, /select\(\.refutersDispatched > 0\)/);
72
- assert.match(recipes, /select\(\.refutersDispatched == 0\)/);
73
- });
74
-
75
- // The recipes' comments are prose no ruling paragraph's pin reads. The one on
76
- // the testEnvironment recipe says what that field is evidence about: the
77
- // review's one shared test run, which no specialist returns a copy of, so no
78
- // recipe comment names a specialist `test_run` field that no longer exists.
79
- test("the testEnvironment recipe calls it evidence about the shared test run, and no recipe comment names a test_run field", () => {
80
- const recipes = section().match(/^jq .*$/gm) ?? [];
81
- const line = recipes.find((l) => l.startsWith("jq -r '.testEnvironment' "));
82
- assert.ok(line, "the result-file section no longer has a `jq -r '.testEnvironment'` recipe");
83
- assert.match(line, phrase("# what the shared test run is evidence about"), "the testEnvironment recipe's comment no longer names the shared test run");
84
- // Every line of every fenced recipe block, not only the `jq ` ones: the `R=`
85
- // line and any other line the block grows carry comments too.
86
- const fenced = [...section().matchAll(/^```bash\n([\s\S]*?)^```$/gm)].flatMap((m) => m[1].split("\n"));
87
- assert.ok(fenced.length > 0, "the result-file section lost its fenced recipe block");
88
- for (const l of fenced) assert.doesNotMatch(l, /test_run/i, `a recipe line names the retired test_run field: ${l}`);
89
- });
90
-
91
- test("the fix-applier owns the mutual-exclusion scan, run twice, with a single refuter for a conflicting pair", () => {
92
- const p = ruling("**Scan the findings against each other for MUTUAL EXCLUSION");
93
- assert.match(p, phrase("run it twice"));
94
- assert.match(p, phrase("**Before you apply anything**"));
95
- assert.match(p, phrase("**Then as each refuter you dispatch reports**"));
96
- assert.match(p, phrase("**A conflicting pair goes to a SINGLE refuter, briefed with both claims**"));
97
- });
98
-
99
- test("the fix-applier owns the suggested-fix re-derivation, ordered so the tree to derive from exists", () => {
100
- const p = ruling("**A finding whose suggested fix quotes text another applied finding deletes");
101
- assert.match(p, phrase("**Re-derive, never copy:**"));
102
- assert.match(p, phrase("apply the finding that changes the text first"));
103
- });
104
-
105
- test("the fix-applier owns refuted=false ≠ apply, and per-site measurement for a sibling-site extension", () => {
106
- assert.match(ruling("**A `refuted=false` verdict is not an instruction to apply.**"), phrase("is a defer"));
107
- assert.match(
108
- ruling("**Extending a finding to sibling sites is a new claim at every added site"),
109
- phrase("never on a copied one"),
110
- );
111
- });
112
-
113
- test("the fix-applier reads testEnvironment and cwdAudit before acting on any result of the shared test run, and re-runs nothing", () => {
114
- const p = ruling("**Read `testEnvironment` and `cwdAudit` before you act on any result of the shared test run.**");
115
- assert.match(p, phrase("status --porcelain -uall"), "the cwdAudit check lost its explicit untracked mode");
116
- assert.match(p, phrase("never revert content you did not write"));
117
- assert.match(p, phrase("re-run nothing"), "a dimensionsUnrun entry now reads as an instruction to re-run the review");
118
- });
119
-
120
- // The two run-team/SKILL.md sentences that hand the fix-applier the same ruling
121
- // were reworded off the specialists' retired `test_run` field (#2374), and
122
- // nothing read either one. They go with the rest of the SKILL.md copies (§ 8).
123
- test("run-team's digest paragraph tells the controller the fix-applier reads testEnvironment before acting on any count from the shared test run", () => {
124
- const p = paragraph(
125
- RUN_TEAM,
126
- "`testEnvironment` says what the review's shared test run is evidence about",
127
- "run-team/SKILL.md's testEnvironment digest paragraph",
128
- { emphasisTolerant: true },
129
- );
130
- assert.match(
131
- p,
132
- phrase("fix-applier reads it before acting on any count from the shared test run"),
133
- "the digest paragraph no longer says the fix-applier reads testEnvironment before acting on a count from the shared test run",
134
- );
135
- });
136
-
137
- test("run-team's fix-applier dispatch hands it testEnvironment and cwdAudit before any result of the shared test run", () => {
138
- const p = between(
139
- RUN_TEAM,
140
- "\n**Then dispatch a fix-applier** — on `DISPATCH fix-pr PR#<M>`",
141
- "\n**A `DISPATCH fix-pr PR#<M>` on a conflict hold**",
142
- "run-team/SKILL.md's fix-applier dispatch paragraph",
143
- );
144
- assert.match(
145
- p,
146
- phrase("`testEnvironment`/`cwdAudit` before any result of the shared test run."),
147
- "the fix-applier dispatch paragraph no longer says to read testEnvironment/cwdAudit before a result of the shared test run",
148
- );
149
- });
@@ -1,75 +0,0 @@
1
- // fleet-bootstrap's checkout-vs-install decision (ADR 0003 point 4, ADR
2
- // 0021): it places `~/.fleet/bin/fleet-run` from its own sibling copy, and
3
- // only without `--from-checkout` when its own directory's parent IS the
4
- // realpath of `~/.omp/plugins/node_modules/@feigi/fleet-ctl`. Driven through
5
- // the real CLI — the script reads `__dirname` and `os.homedir()` and
6
- // `process.exit()`s — so the installed shape runs a copy placed inside a fake
7
- // install's scripts/.
8
- //
9
- // Every fixture's env is built from scratch (never `...process.env`), so
10
- // these tests are deterministic regardless of the box they run on.
11
- import { test } from "node:test";
12
- import assert from "node:assert/strict";
13
- import { spawnSync } from "node:child_process";
14
- import { copyFileSync, existsSync, mkdtempSync, mkdirSync, readFileSync, writeFileSync, symlinkSync } from "node:fs";
15
- import { tmpdir } from "node:os";
16
- import { join } from "node:path";
17
- import { fileURLToPath } from "node:url";
18
-
19
- const BOOTSTRAP = fileURLToPath(new URL("./fleet-bootstrap", import.meta.url));
20
- const CHECKOUT_RESOLVER = fileURLToPath(new URL("./fleet-run", import.meta.url));
21
-
22
- function runBootstrap(script, home, args = []) {
23
- return spawnSync(process.execPath, [script, ...args], {
24
- encoding: "utf8",
25
- env: { HOME: home, PATH: process.env.PATH },
26
- });
27
- }
28
-
29
- // A linked install (the dev-loop shape, and a marketplace install's): a
30
- // payload dir carrying fleet-bootstrap and a resolver in scripts/,
31
- // symlinked into node_modules/@feigi/fleet-ctl.
32
- function fakeInstall() {
33
- const home = mkdtempSync(join(tmpdir(), "fleet-bootstrap-home-"));
34
- const payload = join(home, "checkout", "plugin");
35
- mkdirSync(join(payload, "scripts"), { recursive: true });
36
- copyFileSync(BOOTSTRAP, join(payload, "scripts", "fleet-bootstrap"));
37
- writeFileSync(join(payload, "scripts", "fleet-run"), "installed resolver\n");
38
- const nm = join(home, ".omp", "plugins", "node_modules");
39
- mkdirSync(join(nm, "@feigi"), { recursive: true });
40
- symlinkSync(payload, join(nm, "@feigi", "fleet-ctl"));
41
- return { home, installedBootstrap: join(payload, "scripts", "fleet-bootstrap") };
42
- }
43
-
44
- const placed = (home) => join(home, ".fleet", "bin", "fleet-run");
45
-
46
- test("run from the install root it places the installed resolver with no flag and no exception notice", () => {
47
- const { home, installedBootstrap } = fakeInstall();
48
- const r = runBootstrap(installedBootstrap, home);
49
- assert.equal(r.status, 0, `expected the install run to proceed, got status ${r.status}: ${r.stderr}`);
50
- assert.doesNotMatch(r.stderr, /BOOTSTRAP EXCEPTION/);
51
- assert.equal(readFileSync(placed(home), "utf8"), "installed resolver\n");
52
- });
53
-
54
- test("run from a checkout that is not the install root without --from-checkout: exit 2, nothing placed", () => {
55
- const { home } = fakeInstall();
56
- const r = runBootstrap(BOOTSTRAP, home);
57
- assert.equal(r.status, 2, `expected a refusal, got status ${r.status}: ${r.stdout}${r.stderr}`);
58
- assert.match(r.stderr, /refusing to place .* which is not omp's resolved install root/);
59
- assert.equal(existsSync(placed(home)), false);
60
- });
61
-
62
- test("run from a checkout with no install at all: the refusal says omp is not installed", () => {
63
- const home = mkdtempSync(join(tmpdir(), "fleet-bootstrap-home-"));
64
- const r = runBootstrap(BOOTSTRAP, home);
65
- assert.equal(r.status, 2, `expected a refusal, got status ${r.status}: ${r.stdout}${r.stderr}`);
66
- assert.match(r.stderr, /omp: not installed/);
67
- });
68
-
69
- test("run from a checkout with --from-checkout: places the checkout's resolver and announces the exception", () => {
70
- const { home } = fakeInstall();
71
- const r = runBootstrap(BOOTSTRAP, home, ["--from-checkout"]);
72
- assert.equal(r.status, 0, `expected the licensed exception to proceed, got status ${r.status}: ${r.stderr}`);
73
- assert.match(r.stderr, /BOOTSTRAP EXCEPTION/);
74
- assert.deepEqual(readFileSync(placed(home)), readFileSync(CHECKOUT_RESOLVER));
75
- });