@intentius/chant-lexicon-pulumi 0.124.98 → 0.124.99

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 (316) hide show
  1. package/dist/adopt.d.ts +0 -1
  2. package/dist/capability-plugin.d.ts +0 -1
  3. package/dist/change-set.d.ts +0 -1
  4. package/dist/changed-units.d.ts +0 -1
  5. package/dist/check-step.d.ts +0 -1
  6. package/dist/ci-setup.d.ts +0 -1
  7. package/dist/codegen/docs-cli.d.ts +0 -1
  8. package/dist/codegen/docs.d.ts +0 -1
  9. package/dist/codegen/package.d.ts +0 -1
  10. package/dist/composites/pulumi-adopt-op.d.ts +0 -1
  11. package/dist/composites/pulumi-watch-op.d.ts +0 -1
  12. package/dist/config.d.ts +0 -1
  13. package/dist/describe-resources.d.ts +0 -1
  14. package/dist/drift-read.d.ts +0 -1
  15. package/dist/drift-record.d.ts +0 -1
  16. package/dist/engine-events.d.ts +0 -1
  17. package/dist/engine-graph.d.ts +0 -1
  18. package/dist/exit-codes.d.ts +0 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/init-templates.d.ts +0 -1
  21. package/dist/integrity.json +2 -2
  22. package/dist/lint/audit-catalog.d.ts +0 -1
  23. package/dist/lint/post-synth/index.d.ts +0 -1
  24. package/dist/lint/post-synth/member-read-helpers.d.ts +0 -1
  25. package/dist/lint/post-synth/pul001.d.ts +0 -1
  26. package/dist/lint/post-synth/pul002.d.ts +0 -1
  27. package/dist/lint/post-synth/pul003.d.ts +0 -1
  28. package/dist/lint/post-synth/pul004.d.ts +0 -1
  29. package/dist/lint/post-synth/pul005.d.ts +0 -1
  30. package/dist/lint/post-synth/pul006.d.ts +0 -1
  31. package/dist/lint/post-synth/pul007.d.ts +0 -1
  32. package/dist/lint/post-synth/pul008.d.ts +0 -1
  33. package/dist/lint/post-synth/pul009.d.ts +0 -1
  34. package/dist/lint/post-synth/pul010.d.ts +0 -1
  35. package/dist/lint/post-synth/pul011.d.ts +0 -1
  36. package/dist/lint/post-synth/pul012.d.ts +0 -1
  37. package/dist/lint/post-synth/pul013.d.ts +0 -1
  38. package/dist/lint/post-synth/pul014.d.ts +0 -1
  39. package/dist/lint/post-synth/pul015.d.ts +0 -1
  40. package/dist/lint/rules/index.d.ts +0 -1
  41. package/dist/lint/rules/member-dir-absolute.d.ts +0 -1
  42. package/dist/lock-rows.d.ts +0 -1
  43. package/dist/lsp/completions.d.ts +0 -1
  44. package/dist/lsp/documents.d.ts +0 -1
  45. package/dist/lsp/hover.d.ts +0 -1
  46. package/dist/lsp/keys.d.ts +0 -1
  47. package/dist/lsp/object-path.d.ts +0 -1
  48. package/dist/lsp/yaml-cursor.d.ts +0 -1
  49. package/dist/manifest.json +1 -1
  50. package/dist/member-engine.d.ts +0 -1
  51. package/dist/member-outputs.d.ts +0 -1
  52. package/dist/op/activities/index.d.ts +0 -1
  53. package/dist/op/activities/pulumi-adopt.d.ts +0 -1
  54. package/dist/op/activities/pulumi.d.ts +0 -1
  55. package/dist/op/activity-contracts.d.ts +0 -1
  56. package/dist/op/builders.d.ts +0 -1
  57. package/dist/package-cli.d.ts +0 -1
  58. package/dist/plan-shape.d.ts +0 -1
  59. package/dist/planned-output-changes.d.ts +0 -1
  60. package/dist/plugin.d.ts +0 -1
  61. package/dist/plunge-timings.d.ts +0 -1
  62. package/dist/preview-tips.d.ts +0 -1
  63. package/dist/pulumi-up.d.ts +0 -1
  64. package/dist/release-copy.d.ts +0 -1
  65. package/dist/review-stack.d.ts +0 -1
  66. package/dist/run.d.ts +0 -1
  67. package/dist/serializer.d.ts +0 -1
  68. package/dist/stack-export-snapshot.d.ts +0 -1
  69. package/dist/stack-ops.d.ts +0 -1
  70. package/dist/stack-outputs.d.ts +0 -1
  71. package/dist/stack-references.d.ts +0 -1
  72. package/dist/trace-facts.d.ts +0 -1
  73. package/dist/values.d.ts +0 -1
  74. package/dist/workspace-member.d.ts +0 -1
  75. package/package.json +3 -4
  76. package/dist/adopt.d.ts.map +0 -1
  77. package/dist/capability-plugin.d.ts.map +0 -1
  78. package/dist/change-set.d.ts.map +0 -1
  79. package/dist/changed-units.d.ts.map +0 -1
  80. package/dist/check-step.d.ts.map +0 -1
  81. package/dist/ci-setup.d.ts.map +0 -1
  82. package/dist/codegen/docs-cli.d.ts.map +0 -1
  83. package/dist/codegen/docs.d.ts.map +0 -1
  84. package/dist/codegen/package.d.ts.map +0 -1
  85. package/dist/composites/pulumi-adopt-op.d.ts.map +0 -1
  86. package/dist/composites/pulumi-watch-op.d.ts.map +0 -1
  87. package/dist/config.d.ts.map +0 -1
  88. package/dist/describe-resources.d.ts.map +0 -1
  89. package/dist/drift-read.d.ts.map +0 -1
  90. package/dist/drift-record.d.ts.map +0 -1
  91. package/dist/engine-events.d.ts.map +0 -1
  92. package/dist/engine-graph.d.ts.map +0 -1
  93. package/dist/exit-codes.d.ts.map +0 -1
  94. package/dist/index.d.ts.map +0 -1
  95. package/dist/init-templates.d.ts.map +0 -1
  96. package/dist/lint/audit-catalog.d.ts.map +0 -1
  97. package/dist/lint/post-synth/index.d.ts.map +0 -1
  98. package/dist/lint/post-synth/member-read-helpers.d.ts.map +0 -1
  99. package/dist/lint/post-synth/pul001.d.ts.map +0 -1
  100. package/dist/lint/post-synth/pul002.d.ts.map +0 -1
  101. package/dist/lint/post-synth/pul003.d.ts.map +0 -1
  102. package/dist/lint/post-synth/pul004.d.ts.map +0 -1
  103. package/dist/lint/post-synth/pul005.d.ts.map +0 -1
  104. package/dist/lint/post-synth/pul006.d.ts.map +0 -1
  105. package/dist/lint/post-synth/pul007.d.ts.map +0 -1
  106. package/dist/lint/post-synth/pul008.d.ts.map +0 -1
  107. package/dist/lint/post-synth/pul009.d.ts.map +0 -1
  108. package/dist/lint/post-synth/pul010.d.ts.map +0 -1
  109. package/dist/lint/post-synth/pul011.d.ts.map +0 -1
  110. package/dist/lint/post-synth/pul012.d.ts.map +0 -1
  111. package/dist/lint/post-synth/pul013.d.ts.map +0 -1
  112. package/dist/lint/post-synth/pul014.d.ts.map +0 -1
  113. package/dist/lint/post-synth/pul015.d.ts.map +0 -1
  114. package/dist/lint/rules/index.d.ts.map +0 -1
  115. package/dist/lint/rules/member-dir-absolute.d.ts.map +0 -1
  116. package/dist/lock-rows.d.ts.map +0 -1
  117. package/dist/lsp/completions.d.ts.map +0 -1
  118. package/dist/lsp/documents.d.ts.map +0 -1
  119. package/dist/lsp/hover.d.ts.map +0 -1
  120. package/dist/lsp/keys.d.ts.map +0 -1
  121. package/dist/lsp/object-path.d.ts.map +0 -1
  122. package/dist/lsp/yaml-cursor.d.ts.map +0 -1
  123. package/dist/member-engine.d.ts.map +0 -1
  124. package/dist/member-outputs.d.ts.map +0 -1
  125. package/dist/op/activities/index.d.ts.map +0 -1
  126. package/dist/op/activities/pulumi-adopt.d.ts.map +0 -1
  127. package/dist/op/activities/pulumi.d.ts.map +0 -1
  128. package/dist/op/activity-contracts.d.ts.map +0 -1
  129. package/dist/op/builders.d.ts.map +0 -1
  130. package/dist/package-cli.d.ts.map +0 -1
  131. package/dist/plan-shape.d.ts.map +0 -1
  132. package/dist/planned-output-changes.d.ts.map +0 -1
  133. package/dist/plugin.d.ts.map +0 -1
  134. package/dist/plunge-timings.d.ts.map +0 -1
  135. package/dist/preview-tips.d.ts.map +0 -1
  136. package/dist/pulumi-up.d.ts.map +0 -1
  137. package/dist/release-copy.d.ts.map +0 -1
  138. package/dist/review-stack.d.ts.map +0 -1
  139. package/dist/run.d.ts.map +0 -1
  140. package/dist/serializer.d.ts.map +0 -1
  141. package/dist/stack-export-snapshot.d.ts.map +0 -1
  142. package/dist/stack-ops.d.ts.map +0 -1
  143. package/dist/stack-outputs.d.ts.map +0 -1
  144. package/dist/stack-references.d.ts.map +0 -1
  145. package/dist/trace-facts.d.ts.map +0 -1
  146. package/dist/values.d.ts.map +0 -1
  147. package/dist/workspace-member.d.ts.map +0 -1
  148. package/src/adopt.ts +0 -202
  149. package/src/capability-plugin.ts +0 -34
  150. package/src/change-set.test.ts +0 -245
  151. package/src/change-set.ts +0 -508
  152. package/src/changed-units.test.ts +0 -87
  153. package/src/changed-units.ts +0 -96
  154. package/src/check-step.test.ts +0 -191
  155. package/src/check-step.ts +0 -316
  156. package/src/ci-setup.test.ts +0 -234
  157. package/src/ci-setup.ts +0 -224
  158. package/src/codegen/docs-cli.ts +0 -4
  159. package/src/codegen/docs.ts +0 -58
  160. package/src/codegen/package.ts +0 -63
  161. package/src/composites/pulumi-adopt-op.test.ts +0 -258
  162. package/src/composites/pulumi-adopt-op.ts +0 -193
  163. package/src/composites/pulumi-watch-op.test.ts +0 -42
  164. package/src/composites/pulumi-watch-op.ts +0 -85
  165. package/src/config.ts +0 -43
  166. package/src/describe-resources.test.ts +0 -112
  167. package/src/describe-resources.ts +0 -118
  168. package/src/drift-read.test.ts +0 -178
  169. package/src/drift-read.ts +0 -94
  170. package/src/drift-record.test.ts +0 -197
  171. package/src/drift-record.ts +0 -326
  172. package/src/engine-events.test.ts +0 -160
  173. package/src/engine-events.ts +0 -395
  174. package/src/engine-graph.test.ts +0 -141
  175. package/src/engine-graph.ts +0 -149
  176. package/src/exit-codes.test.ts +0 -21
  177. package/src/exit-codes.ts +0 -71
  178. package/src/index.ts +0 -139
  179. package/src/init-templates.ts +0 -85
  180. package/src/lint/audit-catalog.test.ts +0 -33
  181. package/src/lint/audit-catalog.ts +0 -174
  182. package/src/lint/post-synth/index.ts +0 -35
  183. package/src/lint/post-synth/member-read-helpers.ts +0 -122
  184. package/src/lint/post-synth/post-synth.test.ts +0 -245
  185. package/src/lint/post-synth/pul001.ts +0 -38
  186. package/src/lint/post-synth/pul002.ts +0 -38
  187. package/src/lint/post-synth/pul003.ts +0 -43
  188. package/src/lint/post-synth/pul004.ts +0 -32
  189. package/src/lint/post-synth/pul005.ts +0 -31
  190. package/src/lint/post-synth/pul006.ts +0 -31
  191. package/src/lint/post-synth/pul007.ts +0 -35
  192. package/src/lint/post-synth/pul008.ts +0 -35
  193. package/src/lint/post-synth/pul009.ts +0 -32
  194. package/src/lint/post-synth/pul010.ts +0 -42
  195. package/src/lint/post-synth/pul011.ts +0 -38
  196. package/src/lint/post-synth/pul012.ts +0 -35
  197. package/src/lint/post-synth/pul013.ts +0 -35
  198. package/src/lint/post-synth/pul014.ts +0 -32
  199. package/src/lint/post-synth/pul015.ts +0 -39
  200. package/src/lint/rules/index.ts +0 -7
  201. package/src/lint/rules/member-dir-absolute.test.ts +0 -37
  202. package/src/lint/rules/member-dir-absolute.ts +0 -83
  203. package/src/lock-rows.test.ts +0 -60
  204. package/src/lock-rows.ts +0 -56
  205. package/src/lsp/completions.test.ts +0 -69
  206. package/src/lsp/completions.ts +0 -119
  207. package/src/lsp/documents.ts +0 -48
  208. package/src/lsp/hover.test.ts +0 -56
  209. package/src/lsp/hover.ts +0 -83
  210. package/src/lsp/keys.ts +0 -169
  211. package/src/lsp/object-path.ts +0 -71
  212. package/src/lsp/yaml-cursor.ts +0 -85
  213. package/src/member-engine.test.ts +0 -112
  214. package/src/member-engine.ts +0 -97
  215. package/src/member-outputs.test.ts +0 -339
  216. package/src/member-outputs.ts +0 -157
  217. package/src/op/activities/index.ts +0 -36
  218. package/src/op/activities/pulumi-adopt.ts +0 -345
  219. package/src/op/activities/pulumi.ts +0 -136
  220. package/src/op/activity-contracts.ts +0 -129
  221. package/src/op/builders.ts +0 -67
  222. package/src/package-cli.ts +0 -14
  223. package/src/plan-shape.test.ts +0 -91
  224. package/src/plan-shape.ts +0 -105
  225. package/src/planned-output-changes.test.ts +0 -85
  226. package/src/planned-output-changes.ts +0 -141
  227. package/src/plugin.test.ts +0 -96
  228. package/src/plugin.ts +0 -272
  229. package/src/plunge-timings.test.ts +0 -241
  230. package/src/plunge-timings.ts +0 -115
  231. package/src/plunge-up-failed.test.ts +0 -54
  232. package/src/pr-note.test.ts +0 -87
  233. package/src/preview-generated.test.ts +0 -124
  234. package/src/preview-tips.test.ts +0 -134
  235. package/src/preview-tips.ts +0 -128
  236. package/src/pulumi-up.test.ts +0 -581
  237. package/src/pulumi-up.ts +0 -1102
  238. package/src/pulumi-urn-node.test.ts +0 -94
  239. package/src/release-copy.test.ts +0 -162
  240. package/src/release-copy.ts +0 -223
  241. package/src/review-stack.test.ts +0 -254
  242. package/src/review-stack.ts +0 -266
  243. package/src/run-plan-flags.test.ts +0 -53
  244. package/src/run.test.ts +0 -540
  245. package/src/run.ts +0 -1129
  246. package/src/serializer.test.ts +0 -9
  247. package/src/serializer.ts +0 -15
  248. package/src/skills/chant-pulumi-plunge.md +0 -51
  249. package/src/skills/chant-pulumi-stack-export.md +0 -54
  250. package/src/skills/chant-pulumi.md +0 -83
  251. package/src/stack-export-snapshot.test.ts +0 -192
  252. package/src/stack-export-snapshot.ts +0 -312
  253. package/src/stack-ops.fake-binary.test.ts +0 -323
  254. package/src/stack-ops.test.ts +0 -511
  255. package/src/stack-ops.ts +0 -1082
  256. package/src/stack-outputs.ts +0 -66
  257. package/src/stack-references.test.ts +0 -96
  258. package/src/stack-references.ts +0 -110
  259. package/src/testdata/plunge-drift/README.md +0 -10
  260. package/src/testdata/plunge-drift/assets-drifted.ndjson +0 -3
  261. package/src/testdata/plunge-drift/component-unsupported.ndjson +0 -3
  262. package/src/testdata/plunge-drift/role-in-sync.ndjson +0 -3
  263. package/src/testdata/plunge-drift/settled-empty.ndjson +0 -2
  264. package/src/testdata/plunge-graph/Pulumi.yaml +0 -4
  265. package/src/testdata/plunge-graph/README.md +0 -12
  266. package/src/testdata/plunge-graph/engine-graph.json +0 -158
  267. package/src/testdata/plunge-graph/stack-export.json +0 -49
  268. package/src/testdata/plunge-member/Pulumi.yaml +0 -4
  269. package/src/testdata/plunge-member/README.md +0 -3
  270. package/src/testdata/plunge-member/stack-export.json +0 -480
  271. package/src/testdata/plunge-outputs/Pulumi.yaml +0 -9
  272. package/src/testdata/plunge-outputs/README.md +0 -7
  273. package/src/testdata/plunge-outputs/stack-export.json +0 -2003
  274. package/src/testdata/plunge-outputs/stack-output.json +0 -19
  275. package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
  276. package/src/testdata/pulumi-member/README.md +0 -50
  277. package/src/testdata/pulumi-member/recording/Pulumi.dev.yaml +0 -19
  278. package/src/testdata/pulumi-member/recording/Pulumi.yaml +0 -7
  279. package/src/testdata/pulumi-member/recording/index.js +0 -47
  280. package/src/testdata/pulumi-member/recording/package-lock.json +0 -2707
  281. package/src/testdata/pulumi-member/recording/package.json +0 -9
  282. package/src/testdata/pulumi-member/stack-export.json +0 -746
  283. package/src/testdata/pulumi-outputs/Pulumi.yaml +0 -7
  284. package/src/testdata/pulumi-outputs/README.md +0 -9
  285. package/src/testdata/pulumi-outputs/preview-replaced.json +0 -2894
  286. package/src/testdata/pulumi-outputs/preview-settled.json +0 -2894
  287. package/src/testdata/pulumi-outputs/stack-export.json +0 -1919
  288. package/src/testdata/pulumi-outputs/stack-output.json +0 -19
  289. package/src/testdata/pulumi-preview/Pulumi.yaml +0 -7
  290. package/src/testdata/pulumi-preview/README.md +0 -9
  291. package/src/testdata/pulumi-preview/preview-create.json +0 -992
  292. package/src/testdata/pulumi-preview/preview.json +0 -2894
  293. package/src/testdata/pulumi-preview/stack-export.json +0 -1919
  294. package/src/testdata/pulumi-refresh/Pulumi.yaml +0 -7
  295. package/src/testdata/pulumi-refresh/README.md +0 -14
  296. package/src/testdata/pulumi-refresh/all.json +0 -3742
  297. package/src/testdata/pulumi-refresh/bucket-edited.json +0 -468
  298. package/src/testdata/pulumi-refresh/policy-deleted.json +0 -95
  299. package/src/testdata/pulumi-refresh/queue-edited.json +0 -250
  300. package/src/testdata/pulumi-refresh/role-same.json +0 -242
  301. package/src/testdata/pulumi-refresh/secret-edited.json +0 -247
  302. package/src/testdata/pulumi-refresh/stack-export.json +0 -1907
  303. package/src/testdata/pulumi-stream/README.md +0 -16
  304. package/src/testdata/pulumi-stream/preview-stream.ndjson +0 -42
  305. package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +0 -5
  306. package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
  307. package/src/testdata/pulumi-urn-node/Pulumi.yaml +0 -7
  308. package/src/testdata/pulumi-urn-node/README.md +0 -9
  309. package/src/testdata/pulumi-urn-node/preview.json +0 -2894
  310. package/src/testdata/pulumi-urn-node/stack-export.json +0 -1919
  311. package/src/trace-facts.test.ts +0 -38
  312. package/src/trace-facts.ts +0 -83
  313. package/src/values.ts +0 -147
  314. package/src/workspace-kinds.test.ts +0 -47
  315. package/src/workspace-member.test.ts +0 -127
  316. package/src/workspace-member.ts +0 -304
package/src/run.test.ts DELETED
@@ -1,540 +0,0 @@
1
- /**
2
- * Running pulumi for a Pulumi member (#4453): the argv chant passes, the
3
- * allow-list from the ruling on #4450, and what a failed run becomes. The
4
- * runner is a fake that returns the fixtures recorded for #4475 (pulumi
5
- * 3.272.0 and plunge against the plunge corpus on floci); no pulumi binary
6
- * runs here.
7
- */
8
- import { readFileSync } from "node:fs";
9
- import { join } from "node:path";
10
- import { describe, expect, test } from "vitest";
11
- import {
12
- engineEnv,
13
- PLUNGE_GRAPH_COMMANDS,
14
- plungeAdoptArgs,
15
- plungeGraphArgs,
16
- plungeMoveArgs,
17
- pulumiActionPreviewArgs,
18
- pulumiActionUpArgs,
19
- pulumiCancelArgs,
20
- pulumiStateMoveArgs,
21
- runGatedPlunge,
22
- runGatedPulumi,
23
- plungeMemberGraph,
24
- previewPulumiMember,
25
- PULUMI_ALLOWED_COMMANDS,
26
- pulumiMemberEngine,
27
- pulumiExportStack,
28
- pulumiPreviewArgs,
29
- refreshPulumiMember,
30
- runAdoptPlunge,
31
- runAllowedPlunge,
32
- runAllowedPulumi,
33
- runApplyPlunge,
34
- runApplyPulumi,
35
- plungeUpArgs,
36
- pulumiUpArgs,
37
- pulumiUpPreviewArgs,
38
- PULUMI_APPLY_COMMANDS,
39
- type PulumiRunner,
40
- } from "./run";
41
-
42
- const testdata = join(import.meta.dirname, "testdata");
43
- const text = (...path: string[]) => readFileSync(join(testdata, ...path), "utf-8");
44
- const urn = (type: string, name: string) => `urn:pulumi:floci::corpus-aws-ts::${type}::${name}`;
45
-
46
- function fake(answer: (args: string[]) => string | Error): { run: PulumiRunner; calls: { args: string[]; cwd: string }[] } {
47
- const calls: { args: string[]; cwd: string }[] = [];
48
- const run: PulumiRunner = async (args, opts) => {
49
- calls.push({ args, cwd: opts.cwd });
50
- const out = answer(args);
51
- if (out instanceof Error) throw out;
52
- return { stdout: out };
53
- };
54
- return { run, calls };
55
- }
56
-
57
- function failure(message: string, fields: { code?: string; stdout?: string; stderr?: string }): Error {
58
- return Object.assign(new Error(message), fields);
59
- }
60
-
61
- describe("gated stack operations (#4578)", () => {
62
- const u = "urn:pulumi:net::shop::aws:s3/bucketV2:BucketV2::logs";
63
- test("each fixed form reaches its runner", async () => {
64
- const { run, calls } = fake(() => "{}");
65
- await runGatedPulumi(run, pulumiCancelArgs({ stack: "dev" }), "/tmp");
66
- await runGatedPulumi(run, pulumiStateMoveArgs({ source: "net", dest: "app", urns: [u] }), "/tmp");
67
- await runAllowedPlunge(run, plungeMoveArgs({ source: "net", dest: "app", urns: [u] }), "/tmp");
68
- await runGatedPlunge(run, plungeMoveArgs({ source: "net", dest: "app", urns: [u], yes: true }), "/tmp");
69
- expect(calls.map((c) => c.args)).toEqual([
70
- ["cancel", "--yes", "--stack", "dev"],
71
- ["state", "move", "--source", "net", "--dest", "app", "--yes", u],
72
- ["stack", "move", "--stack", "net", "--dest", "app", u, "--json"],
73
- ["stack", "move", "--stack", "net", "--dest", "app", u, "--json", "--yes"],
74
- ]);
75
- });
76
-
77
- test("no other form gets through, and the read entry points refuse the writes", async () => {
78
- const { run, calls } = fake(() => "{}");
79
- for (const args of [
80
- ["cancel", "--stack", "dev"],
81
- ["cancel", "--yes", "--stack", "dev", "--force"],
82
- ["state", "move", "--source", "net", "--dest", "app", "--yes", "--include-parents", u],
83
- ["state", "move", "--source", "net", "--dest", "app", u],
84
- ["state", "move", "--source", "net", "--dest", "app", "--yes"],
85
- ["state", "delete", u],
86
- ["stack", "import", "--file", "x.json"],
87
- ]) {
88
- await expect(runGatedPulumi(run, args, "/tmp")).rejects.toThrow(/gated Pulumi stack operation only as/);
89
- }
90
- await expect(runGatedPlunge(run, plungeMoveArgs({ source: "net", dest: "app", urns: [u] }), "/tmp")).rejects.toThrow(/moves plunge resources only as/);
91
- await expect(runGatedPlunge(run, ["stack", "move", "--dest", "app", u, "--json", "--yes"], "/tmp")).rejects.toThrow(/moves plunge resources only as/);
92
- await expect(runAllowedPlunge(run, plungeMoveArgs({ source: "net", dest: "app", urns: [u], yes: true }), "/tmp")).rejects.toThrow(/not plunge stack move/);
93
- await expect(runAllowedPulumi(run, pulumiCancelArgs({ stack: "dev" }), "/tmp")).rejects.toThrow(/not pulumi cancel/);
94
- expect(calls).toEqual([]);
95
- });
96
- });
97
-
98
- describe("a stack action's forms (#4654)", () => {
99
- const u = "urn:pulumi:prod-us::shop::command:local:Command::rotate";
100
- const other = "urn:pulumi:prod-us::shop::command:local:Command::flush";
101
- test("the preview is a read; the update passes the gated entry points only", async () => {
102
- const { run, calls } = fake(() => "{}");
103
- await runAllowedPulumi(run, pulumiActionPreviewArgs({ stack: "prod-us", urn: u }), "/tmp");
104
- await runAllowedPlunge(run, pulumiActionPreviewArgs({ stack: "prod-us", urn: u }), "/tmp");
105
- await runGatedPulumi(run, pulumiActionUpArgs({ stack: "prod-us", urn: u }), "/tmp");
106
- await runGatedPlunge(run, pulumiActionUpArgs({ stack: "prod-us", urn: u }), "/tmp");
107
- const up = ["up", "--yes", "--target", u, "--replace", u, "--stack", "prod-us"];
108
- expect(calls.map((c) => c.args)).toEqual([
109
- ["preview", "--json", "--target", u, "--replace", u, "--stack", "prod-us"],
110
- ["preview", "--json", "--target", u, "--replace", u, "--stack", "prod-us"],
111
- up,
112
- up,
113
- ]);
114
- });
115
-
116
- test("no other update form gets through", async () => {
117
- const { run, calls } = fake(() => "{}");
118
- const up = pulumiActionUpArgs({ stack: "prod-us", urn: u });
119
- await expect(runAllowedPulumi(run, up, "/tmp")).rejects.toThrow(/not pulumi up/);
120
- await expect(runApplyPulumi(run, up, "/tmp")).rejects.toThrow();
121
- for (const args of [
122
- ["up", "--yes", "--target", u, "--replace", other, "--stack", "prod-us"],
123
- ["up", "--yes", "--replace", u, "--stack", "prod-us"],
124
- ["up", "--yes", "--target", u, "--replace", u, "--stack", "prod-us", "--skip-preview"],
125
- ["up", "--target", u, "--replace", u, "--stack", "prod-us"],
126
- ["up", "--yes", "--target", "rotate", "--replace", "rotate", "--stack", "prod-us"],
127
- ["up", "--yes", "--target", u, "--replace", u, "--stack", "--json"],
128
- ]) {
129
- await expect(runGatedPulumi(run, args, "/tmp")).rejects.toThrow(/gated Pulumi stack operation only as/);
130
- await expect(runGatedPlunge(run, args, "/tmp")).rejects.toThrow(/plunge stack action only as/);
131
- }
132
- expect(calls).toEqual([]);
133
- });
134
- });
135
-
136
- describe("plunge stack adopt (#4562)", () => {
137
- test("the preview form passes runAllowedPlunge, and only runAdoptPlunge runs --yes", async () => {
138
- const { run, calls } = fake(() => "{}");
139
- await runAllowedPlunge(run, plungeAdoptArgs({ stack: "dev" }), "/tmp");
140
- await runAllowedPlunge(run, plungeAdoptArgs({ stack: "dev", file: "/tmp/s.json" }), "/tmp");
141
- await runAdoptPlunge(run, plungeAdoptArgs({ stack: "dev", yes: true }), "/tmp");
142
- await runAdoptPlunge(run, plungeAdoptArgs({ stack: "dev", yes: true, file: "/tmp/s.json" }), "/tmp");
143
- expect(calls.map((c) => c.args)).toEqual([
144
- ["stack", "adopt", "--json", "--stack", "dev"],
145
- ["stack", "adopt", "--json", "--stack", "dev", "--file", "/tmp/s.json"],
146
- ["stack", "adopt", "--json", "--yes", "--stack", "dev"],
147
- ["stack", "adopt", "--json", "--yes", "--stack", "dev", "--file", "/tmp/s.json"],
148
- ]);
149
- });
150
-
151
- test("--yes through the read entry point, the adopt-file route, other flags and stock pulumi are refused", async () => {
152
- const { run, calls } = fake(() => "{}");
153
- await expect(runAllowedPlunge(run, plungeAdoptArgs({ stack: "dev", yes: true }), "/tmp")).rejects.toThrow(/not plunge stack adopt --json --yes/);
154
- await expect(runAllowedPulumi(run, plungeAdoptArgs({ stack: "dev" }), "/tmp")).rejects.toThrow(/not pulumi stack adopt/);
155
- for (const args of [
156
- ["stack", "adopt", "--json", "--stack", "dev", "--adopt", "a.yaml"],
157
- ["stack", "adopt", "--json", "--yes", "--stack", "dev", "--index-store", "/x"],
158
- ["stack", "adopt", "--yes", "--stack", "dev"],
159
- ["stack", "adopt", "--json", "--yes", "--stack", "--file"],
160
- ["stack", "adopt", "--json", "--stack", "dev"],
161
- ]) {
162
- await expect(runAdoptPlunge(run, args, "/tmp")).rejects.toThrow(/chant adopts a stack onto plunge only as/);
163
- }
164
- expect(calls).toEqual([]);
165
- });
166
- });
167
-
168
- describe("stack export (#4546)", () => {
169
- test("exactly stack export --stack <stack> reaches either runner", async () => {
170
- const { run, calls } = fake(() => "{}");
171
- await runAllowedPulumi(run, ["stack", "export", "--stack", "dev"], "/tmp");
172
- await runAllowedPlunge(run, ["stack", "export", "--stack", "dev"], "/tmp");
173
- expect(calls.map((c) => c.args)).toEqual([
174
- ["stack", "export", "--stack", "dev"],
175
- ["stack", "export", "--stack", "dev"],
176
- ]);
177
- });
178
-
179
- test("--file, --show-secrets, --version, no stack and a flag for a stack are refused before the runner", async () => {
180
- const { run, calls } = fake(() => "{}");
181
- for (const args of [
182
- ["stack", "export"],
183
- ["stack", "export", "--stack", "dev", "--file", "stack-export.json"],
184
- ["stack", "export", "--stack", "dev", "--show-secrets"],
185
- ["stack", "export", "--stack", "dev", "--version", "3"],
186
- ["stack", "export", "--stack", "--show-secrets"],
187
- ["stack", "export", "--file", "x", "--stack", "dev"],
188
- ]) {
189
- await expect(runAllowedPulumi(run, args, "/tmp")).rejects.toThrow(/pulumi stack export --stack <stack>/);
190
- await expect(runAllowedPlunge(run, args, "/tmp")).rejects.toThrow(/plunge stack export --stack <stack>/);
191
- }
192
- expect(calls).toEqual([]);
193
- });
194
- });
195
-
196
- describe("the allow-list (ruling on #4450)", () => {
197
- test("only preview and refresh --preview-only reach the runner", async () => {
198
- const { run, calls } = fake(() => "{}");
199
- for (const args of [["up", "--yes"], ["destroy"], ["refresh", "--json"], ["stack", "export"], ["import", "aws:s3/bucket:Bucket", "x", "y"]]) {
200
- await expect(runAllowedPulumi(run, args, "/tmp")).rejects.toThrow(/only pulumi preview and pulumi refresh --preview-only/);
201
- }
202
- expect(calls).toEqual([]);
203
- await runAllowedPulumi(run, ["preview", "--json"], "/tmp");
204
- await runAllowedPulumi(run, ["refresh", "--preview-only", "--json"], "/tmp");
205
- expect(calls.map((c) => c.args[0])).toEqual(["preview", "refresh"]);
206
- });
207
-
208
- test("--stack <name> passes, and a --stack with no name or a flag for one is refused before the runner (#4514)", async () => {
209
- const { run, calls } = fake(() => "{}");
210
- for (const args of [
211
- ["preview", "--json", "--stack"],
212
- ["preview", "--json", "--stack", "--yes"],
213
- ["refresh", "--preview-only", "--json", "--stack", "-y"],
214
- ["preview", "--json", "--stack", ""],
215
- ]) {
216
- await expect(runAllowedPulumi(run, args, "/tmp")).rejects.toThrow(/only pulumi preview and pulumi refresh --preview-only/);
217
- }
218
- for (const args of [["preview", "--json", "--stack", "--yes"], ["drift", "--resource", "x", "--stream", "--stack", "--member"]]) {
219
- await expect(runAllowedPlunge(run, args, "/tmp")).rejects.toThrow(/only plunge drift --resource <urn> --stream/);
220
- }
221
- expect(calls).toEqual([]);
222
- await runAllowedPulumi(run, ["preview", "--json", "--show-sames", "--stack", "floci"], "/tmp");
223
- await runAllowedPulumi(run, ["refresh", "--preview-only", "--json", "--stack", "floci", "--target", "u"], "/tmp");
224
- await runAllowedPlunge(run, ["preview", "--json", "--show-sames", "--stack", "floci"], "/tmp");
225
- await runAllowedPlunge(run, ["drift", "--resource", "u", "--stream", "--stack", "floci", "--member", "site"], "/tmp");
226
- expect(calls.map((c) => c.args[0])).toEqual(["preview", "refresh", "preview", "drift"]);
227
- });
228
- });
229
-
230
- describe("previewPulumiMember", () => {
231
- const dir = join(testdata, "pulumi-preview");
232
-
233
- test("runs pulumi preview --json --show-sames in the member's directory and reads its export as the last deployment", async () => {
234
- const { run, calls } = fake(() => text("pulumi-preview", "preview.json"));
235
- const part = await previewPulumiMember({ member: "site", dir, stack: "floci", run });
236
- expect(calls).toEqual([{ args: ["preview", "--json", "--show-sames", "--stack", "floci"], cwd: dir }]);
237
- expect(part.member).toMatchObject({ member: "site", planner: "pulumi", status: "planned", scope: "floci" });
238
- // --show-sames lists every resource the checked-in export holds, so nothing reads as may-appear.
239
- expect(part.entries.filter((e) => e.mayAppear === true)).toEqual([]);
240
- // Without --show-sames the same export would mark every unchanged resource may-appear.
241
- const doc = JSON.parse(text("pulumi-preview", "preview.json")) as { steps: { op: string; urn: string }[] };
242
- const sameless = JSON.stringify({ ...doc, steps: doc.steps.filter((s) => s.op !== "same" || s.urn.includes("pulumi:pulumi:Stack")) });
243
- const without = await previewPulumiMember({ member: "site", dir, run: fake(() => sameless).run });
244
- expect(without.entries.find((e) => e.address === urn("aws:iam/role:Role", "app-role"))?.mayAppear).toBe(true);
245
- });
246
-
247
- test("the engine's environment drops PULUMI_SKIP_CONFIRMATIONS, which refresh --preview-only refuses", () => {
248
- expect(engineEnv({ PATH: "/bin", PULUMI_SKIP_CONFIRMATIONS: "true" })).toEqual({ PATH: "/bin", PULUMI_SKIP_UPDATE_CHECK: "true" });
249
- });
250
-
251
- test("a targeted preview passes --target per URN and marks nothing it left out", async () => {
252
- const { run, calls } = fake(() => text("pulumi-preview", "preview.json"));
253
- const target = urn("aws:sqs/queue:Queue", "events");
254
- const one = JSON.parse(text("pulumi-preview", "preview.json")) as { steps: { urn: string }[] };
255
- const { run: targetedRun, calls: targetedCalls } = fake(() => JSON.stringify({ ...one, steps: one.steps.filter((s) => s.urn === target) }));
256
- const part = await previewPulumiMember({ member: "site", dir, targets: [target], run: targetedRun });
257
- // No stack declared: the one the export's URNs name (#4514).
258
- expect(targetedCalls[0].args).toEqual(pulumiPreviewArgs({ stack: "floci", targets: [target] }));
259
- expect(targetedCalls[0].args).toEqual(["preview", "--json", "--show-sames", "--stack", "floci", "--target", target]);
260
- expect(part.entries.map((e) => e.address)).toEqual([target]);
261
- expect(calls).toEqual([]);
262
- });
263
-
264
- test("with no declared stack, the preview passes the stack the export's URNs name (#4514)", async () => {
265
- const { run, calls } = fake(() => text("pulumi-preview", "preview.json"));
266
- const part = await previewPulumiMember({ member: "site", dir, run });
267
- expect(calls).toEqual([{ args: ["preview", "--json", "--show-sames", "--stack", "floci"], cwd: dir }]);
268
- expect(part.member.scope).toBe("floci");
269
- });
270
-
271
- test("with no export and no declared stack, a targeted preview passes the stack its targets name, an untargeted one none (#4514)", async () => {
272
- const unexported = join(testdata, "pulumi-unexported");
273
- const asked = "urn:pulumi:qa::app::aws:s3/bucket:Bucket::logs";
274
- const { run, calls } = fake(() => JSON.stringify({ steps: [] }));
275
- await previewPulumiMember({ member: "site", dir: unexported, targets: [asked], run });
276
- await previewPulumiMember({ member: "site", dir: unexported, run });
277
- expect(calls.map((c) => c.args)).toEqual([
278
- ["preview", "--json", "--show-sames", "--stack", "qa", "--target", asked],
279
- ["preview", "--json", "--show-sames"],
280
- ]);
281
- });
282
-
283
- test("no pulumi binary is a failed member that says so", async () => {
284
- const { run } = fake(() => failure("spawn pulumi ENOENT", { code: "ENOENT" }));
285
- const part = await previewPulumiMember({ member: "site", dir, run });
286
- expect(part.member).toMatchObject({ status: "failed", planDigest: null, error: expect.stringMatching(/pulumi binary was not found/) });
287
- expect(part.entries).toEqual([]);
288
- });
289
-
290
- test("a preview that fails keeps the error diagnostic and the steps it printed", async () => {
291
- const printed = JSON.stringify({
292
- steps: [{ op: "same", urn: urn("corpus:index:Site", "docs"), newState: { urn: urn("corpus:index:Site", "docs"), custom: false, type: "corpus:index:Site" } }],
293
- diagnostics: [{ severity: "error", message: "error: aws:s3/bucket:Bucket resource 'logs' has a problem: bucket name taken\n" }],
294
- });
295
- const { run } = fake(() => failure("Command failed: pulumi preview --json", { stdout: printed, stderr: "" }));
296
- const part = await previewPulumiMember({ member: "site", dir, run });
297
- expect(part.member).toMatchObject({ status: "failed", planDigest: null, error: "error: aws:s3/bucket:Bucket resource 'logs' has a problem: bucket name taken" });
298
- expect(part.entries.map((e) => e.address)).toContain(urn("corpus:index:Site", "docs"));
299
- });
300
- });
301
-
302
- describe("refreshPulumiMember", () => {
303
- test("one --target'ed refresh per URN, run in order, each read on its own", async () => {
304
- const assets = urn("aws:s3/bucket:Bucket", "site-bucket");
305
- const role = urn("aws:iam/role:Role", "app-role");
306
- const broken = urn("aws:sqs/queue:Queue", "worker-0");
307
- const { run, calls } = fake((args) => {
308
- const target = args[args.indexOf("--target") + 1];
309
- if (target === assets) return text("pulumi-refresh", "bucket-edited.json");
310
- if (target === role) return text("pulumi-refresh", "role-same.json");
311
- return failure("Command failed", { stderr: "error: No valid credential sources found for AWS Provider." });
312
- });
313
- const records = await refreshPulumiMember({ member: "site", dir: join(testdata, "pulumi-preview"), stack: "floci", urns: [assets, role, broken], observedAt: "2026-10-25T12:00:00Z", run });
314
- expect(calls.map((c) => c.args)).toEqual([assets, role, broken].map((u) => ["refresh", "--preview-only", "--json", "--stack", "floci", "--target", u]));
315
- expect(records.map((r) => [r.address, r.status])).toEqual([
316
- [role, "in-sync"],
317
- [assets, "drifted"],
318
- [broken, "not-observed"],
319
- ].sort((a, b) => (a[0] < b[0] ? -1 : 1)));
320
- expect(records.find((r) => r.address === broken)!.unobserved?.reason).toBe("no-credentials");
321
- });
322
-
323
- test("with no URNs given, the export's resources are read, providers and the stack left out", async () => {
324
- const dir = join(testdata, "pulumi-member");
325
- const { run, calls } = fake(() => JSON.stringify({ steps: [] }));
326
- const records = await refreshPulumiMember({ member: "infra", dir, observedAt: "2026-10-25T12:00:00Z", run });
327
- const targets = calls.map((c) => c.args[c.args.indexOf("--target") + 1]);
328
- expect(targets.some((t) => t.includes("pulumi:providers:") || t.includes("pulumi:pulumi:Stack"))).toBe(false);
329
- expect(targets).toContain("urn:pulumi:dev::app::aws:s3/bucket:Bucket::assets");
330
- // No stack declared: the one the export's URNs name (#4496).
331
- expect(calls.every((c) => c.args[c.args.indexOf("--stack") + 1] === "dev")).toBe(true);
332
- expect(records.every((r) => r.status === "not-observed" && r.unobserved?.reason === "not-reached")).toBe(true);
333
- });
334
-
335
- test("with no export and no declared stack, the stack the URNs asked for name (#4496)", async () => {
336
- const asked = "urn:pulumi:qa::site::aws:s3/bucket:Bucket::site-bucket";
337
- const { run, calls } = fake(() => text("pulumi-refresh", "bucket-edited.json"));
338
- await refreshPulumiMember({ member: "site", dir: join(testdata, "pulumi-unexported"), urns: [asked], observedAt: "2026-10-25T12:00:00Z", run });
339
- expect(calls.map((c) => c.args)).toEqual([["refresh", "--preview-only", "--json", "--stack", "qa", "--target", asked]]);
340
- });
341
-
342
- test("pulumiExportStack names the export's one stack, and none when its URNs disagree (#4496)", () => {
343
- const exported = (...urns: string[]) => ({ deployment: { resources: urns.map((u) => ({ urn: u, type: "aws:s3/bucket:Bucket" })) } });
344
- expect(pulumiExportStack(exported("urn:pulumi:dev::app::aws:s3/bucket:Bucket::a"))).toBe("dev");
345
- expect(pulumiExportStack(exported("urn:pulumi:dev::app::aws:s3/bucket:Bucket::a", "urn:pulumi:prod::app::aws:s3/bucket:Bucket::b"))).toBeUndefined();
346
- expect(pulumiExportStack(undefined)).toBeUndefined();
347
- });
348
-
349
- test("with no export, one untargeted refresh", async () => {
350
- const { run, calls } = fake(() => text("pulumi-refresh", "bucket-edited.json"));
351
- const records = await refreshPulumiMember({ member: "site", dir: join(testdata, "pulumi-unexported"), observedAt: "2026-10-25T12:00:00Z", run });
352
- expect(calls.map((c) => c.args)).toEqual([["refresh", "--preview-only", "--json"]]);
353
- expect(records.map((r) => r.status)).toEqual(["drifted"]);
354
- });
355
- });
356
-
357
- describe("a member on plunge (#4453)", () => {
358
- const dir = join(testdata, "plunge-member");
359
-
360
- test("the engine: the config first, then a plunge backend URL in Pulumi.yaml, else pulumi", () => {
361
- expect(pulumiMemberEngine(dir, undefined, { env: {} })).toEqual({
362
- engine: "plunge",
363
- because: "Pulumi.yaml names the plunge backend plunge+file:///var/lib/plunge/site",
364
- source: "Pulumi.yaml",
365
- });
366
- expect(pulumiMemberEngine(dir, "pulumi").engine).toBe("pulumi");
367
- expect(pulumiMemberEngine(join(testdata, "pulumi-member"), undefined, { env: {} }).engine).toBe("pulumi");
368
- expect(pulumiMemberEngine(join(testdata, "pulumi-member"), "plunge").engine).toBe("plunge");
369
- });
370
-
371
- test("only plunge drift --resource <urn> --stream reaches the plunge runner", async () => {
372
- const { run, calls } = fake(() => "");
373
- for (const args of [["up"], ["drift", "--resource", "x"], ["state", "delete", "x"]]) {
374
- await expect(runAllowedPlunge(run, args, dir)).rejects.toThrow(/only plunge drift --resource <urn> --stream/);
375
- }
376
- expect(calls).toEqual([]);
377
- });
378
-
379
- test("refresh reads each resource with plunge drift, never pulumi", async () => {
380
- const pulumi = fake(() => failure("pulumi must not run for a plunge member", {}));
381
- const answers: Record<string, string> = {
382
- [urn("aws:iam/role:Role", "app-role")]: "role-in-sync.ndjson",
383
- [urn("corpus:index:Site", "docs")]: "component-unsupported.ndjson",
384
- [urn("corpus:index:Site$aws:s3/bucket:Bucket", "docs-assets")]: "assets-drifted.ndjson",
385
- };
386
- const plunge = fake((args) => text("plunge-drift", answers[args[2]]));
387
- const records = await refreshPulumiMember({ member: "site", dir, stack: "floci", observedAt: "2026-10-25T12:00:00Z", run: pulumi.run, plunge: plunge.run });
388
- expect(pulumi.calls).toEqual([]);
389
- expect(plunge.calls.map((c) => c.args)).toEqual(Object.keys(answers).map((u) => ["drift", "--resource", u, "--stream", "--stack", "floci", "--member", "site"]));
390
- expect(records.map((r) => [r.engine, r.status])).toEqual([
391
- // Sorted by address: the role, then the component's child ("$" sorts before "::"), then the component.
392
- ["plunge", "in-sync"],
393
- ["plunge", "drifted"],
394
- ["plunge", "not-observed"],
395
- ]);
396
- });
397
- });
398
-
399
- describe("plunge graph (#4529, ruled on #4520 Q4 and Q6)", () => {
400
- const dir = join(testdata, "plunge-graph");
401
- const allowed = [
402
- ["graph", "--json"],
403
- ["graph", "--json", "--stack", "dev"],
404
- ["graph", "--json", "--versions"],
405
- ["graph", "--json", "--stack", "dev", "--versions"],
406
- ];
407
-
408
- test("each of the four argv reaches the plunge runner", async () => {
409
- for (const args of allowed) {
410
- const { run, calls } = fake(() => "{}");
411
- await runAllowedPlunge(run, args, dir);
412
- expect(calls).toEqual([{ args, cwd: dir }]);
413
- }
414
- expect(PLUNGE_GRAPH_COMMANDS).toEqual(["plunge graph --json", "plunge graph --json --stack <stack>", "plunge graph --json --versions", "plunge graph --json --stack <stack> --versions"]);
415
- });
416
-
417
- test.each([
418
- ["without --json, which plunge refuses too", ["graph"]],
419
- ["--versions without --json", ["graph", "--versions"]],
420
- ["--show-secrets", ["graph", "--json", "--show-secrets"]],
421
- ["--show-secrets=false", ["graph", "--json", "--show-secrets=false"]],
422
- ["--show-secrets with a stack", ["graph", "--json", "--stack", "dev", "--show-secrets"]],
423
- ["--outputs", ["graph", "--json", "--outputs"]],
424
- ["--show-outputs", ["graph", "--json", "--stack", "dev", "--versions", "--show-outputs"]],
425
- ["--stack with no name", ["graph", "--json", "--stack"]],
426
- ["--stack with a flag for a name", ["graph", "--json", "--stack", "--versions"]],
427
- ["--stack with an empty name", ["graph", "--json", "--stack", ""]],
428
- ["-s for --stack", ["graph", "--json", "-s", "dev"]],
429
- ["two stacks", ["graph", "--json", "--stack", "dev", "--stack", "prod"]],
430
- ["--versions before --stack", ["graph", "--json", "--versions", "--stack", "dev"]],
431
- ["--json after --stack", ["graph", "--stack", "dev", "--json"]],
432
- ["--json twice", ["graph", "--json", "--json"]],
433
- ["--versions twice", ["graph", "--json", "--versions", "--versions"]],
434
- ["a positional argument", ["graph", "--json", "dev"]],
435
- ["--versions=true", ["graph", "--json", "--versions=true"]],
436
- ["upstream's stack graph", ["stack", "graph", "--json"]],
437
- ])("refused before the runner: %s", async (_why, args) => {
438
- const { run, calls } = fake(() => "{}");
439
- await expect(runAllowedPlunge(run, args, dir)).rejects.toThrow(/only plunge drift --resource <urn> --stream/);
440
- expect(calls).toEqual([]);
441
- });
442
-
443
- test("the refusal names the four argv", async () => {
444
- const { run } = fake(() => "{}");
445
- const refused = await runAllowedPlunge(run, ["graph", "--json", "--show-secrets"], dir).catch((e: Error) => e.message);
446
- for (const command of PLUNGE_GRAPH_COMMANDS) expect(refused).toContain(command);
447
- expect(refused).toMatch(/not plunge graph --json --show-secrets$/);
448
- });
449
-
450
- test("stock pulumi gets no graph argv, and its list is unchanged", async () => {
451
- const { run, calls } = fake(() => "{}");
452
- for (const args of allowed) await expect(runAllowedPulumi(run, args, dir)).rejects.toThrow(/only pulumi preview/);
453
- expect(calls).toEqual([]);
454
- expect(PULUMI_ALLOWED_COMMANDS).toEqual([["preview"], ["refresh", "--preview-only"], ["stack", "output"], ["stack", "export"]]);
455
- });
456
-
457
- test("plungeGraphArgs builds each of the four, in the allowed order", () => {
458
- expect(plungeGraphArgs()).toEqual(allowed[0]);
459
- expect(plungeGraphArgs({ stack: "dev" })).toEqual(allowed[1]);
460
- expect(plungeGraphArgs({ versions: true })).toEqual(allowed[2]);
461
- expect(plungeGraphArgs({ stack: "dev", versions: true })).toEqual(allowed[3]);
462
- });
463
-
464
- test("plungeMemberGraph passes the stack the export names, and no --versions unless asked", async () => {
465
- const { run, calls } = fake(() => text("plunge-graph", "engine-graph.json"));
466
- const read = await plungeMemberGraph({ dir, plunge: run });
467
- expect(calls).toEqual([{ args: ["graph", "--json", "--stack", "dev"], cwd: dir }]);
468
- expect(read).toMatchObject({ ok: true, command: "plunge graph --json --stack dev", stack: "dev" });
469
- await plungeMemberGraph({ dir, stack: "qa", versions: true, plunge: run });
470
- expect(calls[1].args).toEqual(["graph", "--json", "--stack", "qa", "--versions"]);
471
- });
472
-
473
- test("a plunge without the command, a missing binary, and no JSON each say why", async () => {
474
- const old = fake(() => failure("Command failed: plunge graph --json --stack dev", { stderr: 'error: unknown command "graph" for "plunge"\n' }));
475
- expect(await plungeMemberGraph({ dir, plunge: old.run })).toMatchObject({ ok: false, reason: "read-failed", detail: expect.stringMatching(/no `plunge graph` \(INTENTIUS\/plunge#40\)/) });
476
- const missing = fake(() => failure("spawn plunge ENOENT", { code: "ENOENT" }));
477
- expect(await plungeMemberGraph({ dir, plunge: missing.run })).toMatchObject({ ok: false, detail: "the plunge binary was not found on PATH" });
478
- const blank = fake(() => "");
479
- expect(await plungeMemberGraph({ dir, plunge: blank.run })).toMatchObject({ ok: false, detail: "plunge graph --json --stack dev printed no JSON" });
480
- });
481
- });
482
-
483
- describe("the apply entry points (#4541)", () => {
484
- const tail = { configFile: "/tmp/c/Pulumi.floci.yaml", targets: ["urn:a", "urn:b"], policyPacks: [{ dir: "/packs/org", config: "/packs/org.json" }, { dir: "/packs/team" }] };
485
-
486
- test("the read entry points still refuse up", async () => {
487
- const { run, calls } = fake(() => "{}");
488
- await expect(runAllowedPulumi(run, pulumiUpArgs({ stack: "floci" }), "/tmp")).rejects.toThrow(/only pulumi preview/);
489
- await expect(runAllowedPlunge(run, plungeUpArgs({ plan: "/tmp/p.json", stack: "floci" }), "/tmp")).rejects.toThrow(/only plunge drift/);
490
- expect(calls).toEqual([]);
491
- });
492
-
493
- test("the fixed forms pass, with the tail in its order", async () => {
494
- const { run, calls } = fake(() => "");
495
- await runApplyPulumi(run, pulumiUpArgs({ stack: "floci", ...tail }), "/tmp");
496
- await runApplyPlunge(run, plungeUpArgs({ plan: "/tmp/p.json", stack: "floci", ...tail }), "/tmp");
497
- expect(calls.map((c) => c.args)).toEqual([
498
- ["up", "--yes", "--json", "--stack", "floci", "--config-file", "/tmp/c/Pulumi.floci.yaml", "--target", "urn:a", "--target", "urn:b", "--policy-pack", "/packs/org", "--policy-pack-config", "/packs/org.json", "--policy-pack", "/packs/team"],
499
- ["up", "--plan", "/tmp/p.json", "--yes", "--json", "--stack", "floci", "--config-file", "/tmp/c/Pulumi.floci.yaml", "--target", "urn:a", "--target", "urn:b", "--policy-pack", "/packs/org", "--policy-pack-config", "/packs/org.json", "--policy-pack", "/packs/team"],
500
- ]);
501
- expect(PULUMI_APPLY_COMMANDS).toHaveLength(2);
502
- });
503
-
504
- test("anything off the list is refused before the runner", async () => {
505
- const { run, calls } = fake(() => "");
506
- const base = pulumiUpArgs({ stack: "floci" });
507
- for (const extra of [["--skip-preview"], ["--show-secrets"], ["--replace", "urn:a"], ["--target-replace", "urn:a"], ["--target-dependents"], ["--exclude", "urn:a"], ["--remote"], ["--continue-on-error"], ["--config", "k=v"], ["--plan", "/tmp/p.json"]]) {
508
- await expect(runApplyPulumi(run, [...base, ...extra], "/tmp")).rejects.toThrow(/applies a Pulumi stack only as/);
509
- }
510
- for (const args of [
511
- ["up", "--json", "--yes", "--stack", "floci"],
512
- ["up", "--yes", "--json"],
513
- ["up", "--yes", "--json", "--stack", "--yes"],
514
- ["up", "--yes", "--json", "--stack", "floci", "--target"],
515
- ["up", "--yes", "--json", "--stack", "floci", "--target", "urn:a", "--config-file", "/tmp/c"],
516
- ["destroy", "--yes", "--json", "--stack", "floci"],
517
- ]) {
518
- await expect(runApplyPulumi(run, args, "/tmp")).rejects.toThrow(/applies a Pulumi stack only as/);
519
- }
520
- for (const args of [
521
- ["up", "--yes", "--json", "--stack", "floci"],
522
- ["up", "--plan", "--yes", "--json", "--stack", "floci"],
523
- ["up", "--plan", "/tmp/p.json", "--yes", "--json", "--stack", "floci", "--skip-preview"],
524
- ]) {
525
- await expect(runApplyPlunge(run, args, "/tmp")).rejects.toThrow(/applies a plunge stack only as/);
526
- }
527
- expect(calls).toEqual([]);
528
- });
529
-
530
- test("a preview with --show-secrets or --import-file is refused; --save-plan and the tail pass", async () => {
531
- const { run, calls } = fake(() => "");
532
- for (const extra of [["--show-secrets"], ["--show-secrets=true"], ["--import-file", "/tmp/i.json"], ["--import-file=/tmp/i.json"]]) {
533
- await expect(runAllowedPulumi(run, ["preview", "--json", ...extra], "/tmp")).rejects.toThrow(/only pulumi preview/);
534
- await expect(runAllowedPlunge(run, ["preview", "--json", ...extra], "/tmp")).rejects.toThrow(/only plunge drift/);
535
- }
536
- expect(calls).toEqual([]);
537
- await runAllowedPlunge(run, pulumiUpPreviewArgs({ stack: "floci", savePlan: "/tmp/p.json", ...tail }), "/tmp", { PULUMI_ENABLE_STREAMING_JSON_PREVIEW: "true" });
538
- expect(calls[0].args.slice(0, 7)).toEqual(["preview", "--json", "--show-sames", "--stack", "floci", "--save-plan", "/tmp/p.json"]);
539
- });
540
- });