@intentius/chant-lexicon-pulumi 0.124.97 → 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/change-set.ts DELETED
@@ -1,508 +0,0 @@
1
- /**
2
- * The change-set adapter for a Pulumi member (#4453): `pulumi preview --json`
3
- * into an `@intentius/chant/change-set` part, planner `pulumi`.
4
- *
5
- * ## Steps to entries
6
- *
7
- * The preview prints one step per resource the program registered, `same`
8
- * included, and a replace as two or three steps on one URN
9
- * (`create-replacement`, `replace`, `delete-replaced`). The adapter keeps one
10
- * entry per URN, at the URN, so `node` comes from the one URN rule
11
- * (`@intentius/chant/pulumi-urn`, #4456):
12
- *
13
- * | step op | action | disruption |
14
- * |---|---|---|
15
- * | `create` | create | |
16
- * | `update` | update | in-place |
17
- * | `delete` | delete | destroy |
18
- * | `replace`, `create-replacement`, `delete-replaced` | replace | replace, or destroy when the delete comes first (`deleteBeforeReplace`) |
19
- * | `same` | no-op | |
20
- * | `read`, `read-replacement`, `refresh` | read | |
21
- * | `import` | no-op, importing | |
22
- * | `import-replacement` | replace, importing | replace |
23
- * | `discard`, `remove-pending-replace` | forget | |
24
- *
25
- * An op the table does not hold is a hole on the member, never a guess.
26
- *
27
- * Attributes are top-level inputs, as the change set wants them. A create
28
- * writes every input. An update or replace writes the keys `detailedDiff`
29
- * and `diffReasons` name, and every input whose new value holds an unknown.
30
- * `replaceReasons` and a `detailedDiff` kind ending in `-replace` mark
31
- * `forcesReplacement`. An input that holds Pulumi's unknown sentinel is
32
- * `unknown: true` with no `after`: a resource that reads an output of one
33
- * being created shows its dependent input as unknown. A value that holds a
34
- * secret is `sensitive: true` with neither side.
35
- *
36
- * ## What preview cannot list: `mayAppear`
37
- *
38
- * A program may register resources inside an `apply()`. At preview an
39
- * `apply()` whose input is unknown does not run, so what it would register
40
- * is never in the steps. Dropping it would make the set look smaller than
41
- * the apply, so the adapter marks it `mayAppear` instead, on two signals:
42
- *
43
- * 1. A component (a step whose state is `custom: false`, not the root stack)
44
- * whose subtree in the preview holds an unknown, in any input or output,
45
- * or a create or replace, whose outputs are unknown until apply. Its code
46
- * may be waiting on that value to register children. It gets one entry
47
- * at `pulumiMayAppearAddress(<component urn>)`, action `create`, type
48
- * `unknown`, no attributes, on the component's node.
49
- * 2. With the last deployment's `pulumi stack export` (`prior`): a resource
50
- * the export holds and the preview has no step for gets an `update`
51
- * entry with disruption `unknown`, since a full preview lists every
52
- * registered resource and only an `apply()` that did not run leaves one
53
- * out. A `delete` step for a resource under a component signal 1 marks
54
- * keeps its `delete` and gets `mayAppear`, since the `apply()` may
55
- * register it again. A preview narrowed with `--target` (`targeted`)
56
- * lists only its targets, and a failed one stops part way, so signal 2's
57
- * first half is off for both.
58
- *
59
- * A resource registered inside an `apply()` directly under the stack, with
60
- * no export that holds it, has no component to stand under and is not
61
- * detected. When the export does hold it and its input is unknown, the
62
- * preview prints a `delete` for it, which reads as a plain delete. Those are
63
- * the two cases left out.
64
- *
65
- * ## The digest
66
- *
67
- * {@link pulumiPreviewDigest}: `computePlanDigest("pulumi-preview", …)` over
68
- * each step's op, URN, provider, id, inputs before and after, `diffReasons`,
69
- * `replaceReasons` and `detailedDiff`, sorted by URN and op. It leaves out
70
- * `config`, `duration`, `diagnostics` and `changeSummary`, and the states'
71
- * outputs, which at preview are the last deployment's or unknown. It also
72
- * leaves out what the engine makes up while planning a create or a
73
- * replacement (plywood#56): an autoname such as `events-3f45941` is drawn
74
- * again by every preview, so it reads as {@link PULUMI_GENERATED}. See
75
- * {@link pulumiPlannedInputs}. Unknowns already print as one fixed string. For a
76
- * member on the resource lock grain the `pulumi-up` capability passes
77
- * `changedOnly` (#4541, ruling B), which leaves `same` and `read` steps out.
78
- *
79
- * The fixtures under `testdata/pulumi-preview` are recorded from pulumi
80
- * 3.272.0 against the plunge corpus's aws-ts program on floci (#4475). What
81
- * the recording showed: `preview --json` lists no unchanged resource unless
82
- * `--show-sames` is passed, which chant's argv does, since signal 2 reads a
83
- * missing resource as one an `apply()` may register; a replace is one
84
- * `replace` step at preview, not three; the stack's step carries no planned
85
- * outputs; a secret is the blinded string `"[secret]"`; and a resource
86
- * registered inside an `apply()` directly under the stack whose input is
87
- * unknown (the corpus's `vpc-id` parameter, named after a VPC being
88
- * replaced) is printed as a `delete`, which this adapter keeps as a plain
89
- * delete since nothing tells it apart from a removed resource.
90
- *
91
- * ## The import graph
92
- *
93
- * Like the terraform lexicon's `change-set`, this imports chant's
94
- * `change-set` types, `lifecycle/plan-digest`, `pulumi-urn` and `./values`,
95
- * so it bundles without TypeScript, node's process modules or zod (#3421).
96
- */
97
-
98
- import type {
99
- ChangeSetAction,
100
- ChangeSetAttribute,
101
- ChangeSetDisruption,
102
- ChangeSetEntry,
103
- ChangeSetHole,
104
- ChangeSetPart,
105
- } from "@intentius/chant/change-set";
106
- import { computePlanDigest } from "@intentius/chant/lifecycle/plan-digest";
107
- import { isPulumiNodeless, parsePulumiUrn, pulumiMayAppearAddress, PULUMI_STACK_TYPE } from "@intentius/chant/pulumi-urn";
108
- import { holdsSecret, holdsUnknown, isObject, isUnknown, propertyKeys, topLevelKey, type Json } from "./values";
109
-
110
- /** One resource state on a preview step, `apitype.ResourceV3`, as far as the adapter reads it. */
111
- export interface PulumiStepState {
112
- urn?: string;
113
- custom?: boolean;
114
- delete?: boolean;
115
- id?: string;
116
- type?: string;
117
- parent?: string;
118
- inputs?: Json;
119
- outputs?: Json;
120
- }
121
-
122
- /** One step of `pulumi preview --json` or `pulumi refresh --preview-only --json`. */
123
- export interface PulumiStep {
124
- op?: string;
125
- urn?: string;
126
- provider?: string;
127
- oldState?: PulumiStepState;
128
- newState?: PulumiStepState;
129
- diffReasons?: string[];
130
- replaceReasons?: string[];
131
- detailedDiff?: Record<string, { kind?: string; inputDiff?: boolean }> | null;
132
- }
133
-
134
- /** The steps of a preview or refresh document, or undefined when it has none. */
135
- export function pulumiSteps(doc: unknown): PulumiStep[] | undefined {
136
- if (!isObject(doc) || !Array.isArray(doc.steps)) return undefined;
137
- return (doc.steps as unknown[]).filter((s): s is PulumiStep => isObject(s) && typeof s.urn === "string");
138
- }
139
-
140
- /** One resource of a `pulumi stack export`, as far as the adapter reads it. */
141
- export interface PulumiExportedResource {
142
- urn: string;
143
- type: string;
144
- custom?: boolean;
145
- id?: string;
146
- parent?: string;
147
- }
148
-
149
- /** The resources of a `pulumi stack export` document (`deployment.resources`). Not one: an empty list. */
150
- export function pulumiExportResources(doc: unknown): PulumiExportedResource[] {
151
- const deployment = isObject(doc) && isObject(doc.deployment) ? doc.deployment : undefined;
152
- const list = deployment && Array.isArray(deployment.resources) ? deployment.resources : [];
153
- return list.filter((r): r is PulumiExportedResource => isObject(r) && typeof r.urn === "string" && typeof r.type === "string");
154
- }
155
-
156
- const byString = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);
157
-
158
- /** Step ops that change nothing: what {@link PulumiPreviewDigestOptions.changedOnly} leaves out of the digest. */
159
- export const PULUMI_UNCHANGED_OPS: ReadonlySet<string> = new Set(["same", "read"]);
160
-
161
- export interface PulumiPreviewDigestOptions {
162
- /**
163
- * Leave `same` and `read` steps out (#4541, ruling B): set for a member on
164
- * the resource lock grain, so a pull request that lands on other resources
165
- * of the stack does not move this one's digest. plunge's plan stamp still
166
- * refuses a moved record among the steps that change.
167
- */
168
- changedOnly?: boolean;
169
- }
170
-
171
- /** What stands in a digest for an input the engine made up while planning (plywood#56). */
172
- export const PULUMI_GENERATED = "<generated at plan time>";
173
-
174
- /** Pulumi's autonaming: the logical name, a dash and seven random hex characters. */
175
- const AUTONAME = /^(.+)-[0-9a-f]{7}$/;
176
-
177
- /** The step's resource name: the last part of its URN. */
178
- function logicalName(urn: string | undefined): string {
179
- const at = urn?.lastIndexOf("::") ?? -1;
180
- return urn && at >= 0 ? urn.slice(at + 2) : (urn ?? "");
181
- }
182
-
183
- /**
184
- * The inputs a step would write, with the values the engine made up while
185
- * planning replaced by {@link PULUMI_GENERATED} (plywood#56). Two previews of
186
- * one create draw different autonames (`events-3f45941`, then
187
- * `events-9c01d2e`), and a digest over them could never match a later plan of
188
- * the same change.
189
- *
190
- * Only a create or a replacement draws a name: an update's inputs keep the one
191
- * the resource was created with, and that stays in `before` and `after`. A
192
- * value counts as generated when the engine lists its key in `__defaults`
193
- * (the inputs the provider filled in, not the program) and it reads as an
194
- * autoname of this resource: its logical name, or the start of it when the
195
- * provider shortened it, then a dash and seven hex characters. An engine that
196
- * prints no `__defaults` is held to the exact logical name. Every other input
197
- * stays in, the defaults that are plain values included, so a changed input
198
- * still changes the digest. `before` is the recorded state and is never masked.
199
- */
200
- export function pulumiPlannedInputs(step: PulumiStep): Json | null {
201
- const inputs = step.newState?.inputs;
202
- if (!isObject(inputs)) return inputs ?? null;
203
- const draws = step.oldState === undefined || step.op === "create" || step.op === "create-replacement" || step.op === "replace";
204
- if (!draws) return inputs;
205
- const name = logicalName(step.urn).toLowerCase();
206
- const filled = Array.isArray(inputs.__defaults) ? new Set(inputs.__defaults.filter((k): k is string => typeof k === "string")) : undefined;
207
- const out: Json = {};
208
- for (const [key, value] of Object.entries(inputs)) {
209
- const stem = typeof value === "string" ? AUTONAME.exec(value)?.[1]?.toLowerCase() : undefined;
210
- const generated = stem !== undefined && name !== "" && (filled ? filled.has(key) && (name.startsWith(stem) || stem.startsWith(name)) : stem === name);
211
- out[key] = generated ? PULUMI_GENERATED : value;
212
- }
213
- return out;
214
- }
215
-
216
- /** One step as a digest sees it: what it proposes, without the values the engine made up. */
217
- function digestStep(s: PulumiStep) {
218
- return {
219
- op: s.op ?? null,
220
- urn: s.urn ?? null,
221
- provider: s.provider ?? null,
222
- // A replacement's new id is one the engine made up for this preview, so the recorded id comes first.
223
- id: s.oldState?.id ?? s.newState?.id ?? null,
224
- before: s.oldState?.inputs ?? null,
225
- after: pulumiPlannedInputs(s),
226
- diffReasons: [...(s.diffReasons ?? [])].sort(),
227
- replaceReasons: [...(s.replaceReasons ?? [])].sort(),
228
- detailedDiff: s.detailedDiff ?? null,
229
- };
230
- }
231
-
232
- const byStep = (a: { urn: string | null; op: string | null }, b: { urn: string | null; op: string | null }): number =>
233
- byString(`${a.urn}\u0000${a.op}`, `${b.urn}\u0000${b.op}`);
234
-
235
- /**
236
- * The member's plan digest: `computePlanDigest("pulumi-preview", …)` over
237
- * what each step proposes, sorted by URN and op, so two renderings of one
238
- * preview agree. See the module comment for what it leaves out, and
239
- * {@link pulumiPlannedInputs} for the values the engine made up that it leaves
240
- * out of a create. With `changedOnly`, `same` and `read` steps are left out
241
- * too, under the label `pulumi-preview-changed`, so the two digests never
242
- * collide.
243
- */
244
- export function pulumiPreviewDigest(preview: unknown, opts: PulumiPreviewDigestOptions = {}): string {
245
- const steps = (pulumiSteps(preview) ?? [])
246
- .filter((s) => !opts.changedOnly || !PULUMI_UNCHANGED_OPS.has(s.op ?? ""))
247
- .map(digestStep)
248
- .sort(byStep);
249
- return computePlanDigest(opts.changedOnly ? "pulumi-preview-changed" : "pulumi-preview", steps);
250
- }
251
-
252
- /**
253
- * The digest of each resource the preview changes, by URN (plywood#55): the
254
- * steps of that URN (a replace is several), as {@link pulumiPreviewDigest}
255
- * reads them, with the values the engine made up left out. A `same`, `read` or `refresh` step is not in it whatever the lock grain,
256
- * so what a pull request left alone never makes its plan differ from a plan
257
- * made after another change landed on it.
258
- */
259
- export function pulumiResourceDigests(preview: unknown): Record<string, string> {
260
- const byUrn = new Map<string, ReturnType<typeof digestStep>[]>();
261
- for (const s of pulumiSteps(preview) ?? []) {
262
- // plywood#55: plunge prints a `refresh` step for each resource it reads and leaves alone, which a pull request did not change either.
263
- if (PULUMI_UNCHANGED_OPS.has(s.op ?? "") || s.op === "refresh") continue;
264
- const list = byUrn.get(s.urn!) ?? [];
265
- list.push(digestStep(s));
266
- byUrn.set(s.urn!, list);
267
- }
268
- return Object.fromEntries([...byUrn].sort(([a], [b]) => byString(a, b)).map(([urn, steps]) => [urn, computePlanDigest("pulumi-resource", steps.sort(byStep))]));
269
- }
270
-
271
- const REPLACE_OPS = new Set(["replace", "create-replacement", "delete-replaced"]);
272
-
273
- /** The action and disruption one URN's steps mean, or undefined for an op the change set has no action for. */
274
- export function pulumiStepsAction(steps: PulumiStep[]): { action: ChangeSetAction; disruption?: ChangeSetDisruption; importing?: true } | undefined {
275
- return actionOf(steps);
276
- }
277
-
278
- function actionOf(steps: PulumiStep[]): { action: ChangeSetAction; disruption?: ChangeSetDisruption; importing?: true } | undefined {
279
- const ops = steps.map((s) => s.op ?? "");
280
- if (ops.includes("import-replacement")) return { action: "replace", disruption: "replace", importing: true };
281
- if (ops.some((o) => REPLACE_OPS.has(o))) {
282
- const del = ops.indexOf("delete-replaced");
283
- const create = ops.indexOf("create-replacement");
284
- return { action: "replace", disruption: del >= 0 && create >= 0 && del < create ? "destroy" : "replace" };
285
- }
286
- if (ops.length !== 1) return undefined;
287
- switch (ops[0]) {
288
- case "create": return { action: "create" };
289
- case "update": return { action: "update", disruption: "in-place" };
290
- case "delete": return { action: "delete", disruption: "destroy" };
291
- case "same": return { action: "no-op" };
292
- case "read": case "read-replacement": case "refresh": return { action: "read" };
293
- case "import": return { action: "no-op", importing: true };
294
- case "discard": case "remove-pending-replace": return { action: "forget" };
295
- default: return undefined;
296
- }
297
- }
298
-
299
- /** The state before and after across one URN's steps: the first old state and the last new one. */
300
- function statesOf(steps: PulumiStep[]): { before?: PulumiStepState; after?: PulumiStepState } {
301
- const before = steps.find((s) => isObject(s.oldState))?.oldState;
302
- const after = [...steps].reverse().find((s) => isObject(s.newState) && s.op !== "delete-replaced" && s.op !== "delete")?.newState;
303
- return { ...(before ? { before } : {}), ...(after ? { after } : {}) };
304
- }
305
-
306
- function attributesOf(steps: PulumiStep[], action: ChangeSetAction, states: { before?: PulumiStepState; after?: PulumiStepState }): ChangeSetAttribute[] {
307
- if (action !== "create" && action !== "update" && action !== "replace") return [];
308
- const before = isObject(states.before?.inputs) ? states.before!.inputs! : {};
309
- const after = isObject(states.after?.inputs) ? states.after!.inputs! : {};
310
- const forcing = new Set<string>();
311
- const named = new Set<string>();
312
- for (const s of steps) {
313
- for (const k of s.replaceReasons ?? []) forcing.add(topLevelKey(k));
314
- for (const k of s.diffReasons ?? []) named.add(topLevelKey(k));
315
- for (const [path, d] of Object.entries(s.detailedDiff ?? {})) {
316
- named.add(topLevelKey(path));
317
- if (typeof d?.kind === "string" && d.kind.endsWith("-replace")) forcing.add(topLevelKey(path));
318
- }
319
- }
320
- const keys =
321
- action === "create"
322
- ? propertyKeys(after)
323
- : [...new Set([...named, ...propertyKeys(after).filter((k) => holdsUnknown(after[k]))])].filter((k) => !k.startsWith("__"));
324
- const beforeOut = isObject(states.before?.outputs) ? states.before!.outputs! : {};
325
- const afterOut = isObject(states.after?.outputs) ? states.after!.outputs! : {};
326
- const present = (v: unknown): boolean => v !== undefined && v !== null;
327
- const out: ChangeSetAttribute[] = [];
328
- for (const k of keys.sort()) {
329
- let b: unknown = before[k];
330
- let a: unknown = after[k];
331
- let unknown = holdsUnknown(a);
332
- // On an update a key the diff names is listed even when both sides read the same: the provider said it changes.
333
- if (action === "create" && !present(a) && !unknown) continue;
334
- // A key the diff names with no input on either side is an output the provider computes (an SSM parameter's
335
- // `version`, recorded, #4475): before is the last deployment's output, after the planned output, which a
336
- // preview leaves empty when the value is known only after apply.
337
- if (action !== "create" && !present(b) && !present(a) && !unknown && named.has(k)) {
338
- b = beforeOut[k];
339
- a = afterOut[k];
340
- unknown = !present(a) || holdsUnknown(a);
341
- }
342
- const hasBefore = action !== "create" && present(b);
343
- const hasAfter = present(a);
344
- const sensitive = holdsSecret(b) || holdsSecret(a);
345
- out.push({
346
- path: k,
347
- ...(sensitive
348
- ? { sensitive: true as const }
349
- : {
350
- ...(hasBefore ? { before: b } : {}),
351
- ...(hasAfter && !unknown ? { after: a } : {}),
352
- }),
353
- ...(unknown ? { unknown: true as const } : {}),
354
- ...(forcing.has(k) ? { forcesReplacement: true as const } : {}),
355
- });
356
- }
357
- return out;
358
- }
359
-
360
- const knownId = (id: unknown): string | undefined => (typeof id === "string" && id !== "" && !isUnknown(id) ? id : undefined);
361
-
362
- export interface PulumiPreviewPartInput {
363
- /** The workspace member's name, which names its graph nodes (`<member>/<key>`). */
364
- member: string;
365
- /** `pulumi preview --json`, parsed. */
366
- preview: unknown;
367
- /** The stack the preview ran against, recorded as `scope`. */
368
- stack?: string;
369
- /**
370
- * The last deployment, as `pulumi stack export` prints it: the member's
371
- * checked-in `stack-export.json`. With it, a resource the preview leaves
372
- * out is a `mayAppear` entry rather than silence.
373
- */
374
- prior?: unknown;
375
- /** The preview was narrowed with `--target`, so it lists only its targets. */
376
- targeted?: boolean;
377
- /** The preview failed: the member is failed with this error, and keeps whatever steps it printed. */
378
- error?: string;
379
- /** Digest options (#4541, ruling B): `changedOnly` for a member on the resource lock grain. */
380
- digest?: PulumiPreviewDigestOptions;
381
- }
382
-
383
- /**
384
- * A Pulumi member's part, from its `pulumi preview --json`. Throws when the
385
- * document has no `steps` and no `error` says why.
386
- */
387
- export function pulumiPreviewPart(input: PulumiPreviewPartInput): ChangeSetPart {
388
- const steps = pulumiSteps(input.preview);
389
- if (steps === undefined && input.error === undefined) throw new Error('not a pulumi preview --json document: no top-level "steps"');
390
- const scope = input.stack ? { scope: input.stack } : {};
391
- const base = { member: input.member, lexicon: "pulumi", planner: "pulumi" as const };
392
-
393
- // One URN's steps, in the order the preview printed them.
394
- const byUrn = new Map<string, PulumiStep[]>();
395
- for (const s of steps ?? []) {
396
- const list = byUrn.get(s.urn!) ?? [];
397
- list.push(s);
398
- byUrn.set(s.urn!, list);
399
- }
400
-
401
- const entries: ChangeSetEntry[] = [];
402
- const holes: ChangeSetHole[] = [];
403
- const actions = new Map<string, ChangeSetAction>();
404
- const states = new Map<string, { before?: PulumiStepState; after?: PulumiStepState }>();
405
- for (const [urn, list] of byUrn) {
406
- const parsed = parsePulumiUrn(urn);
407
- const st = statesOf(list);
408
- states.set(urn, st);
409
- const type = st.after?.type ?? st.before?.type ?? parsed?.type ?? "unknown";
410
- const mapped = actionOf(list);
411
- if (!mapped) {
412
- holes.push({ address: urn, type, reason: `pulumi printed ${list.map((s) => s.op ?? "no op").join(", ")} for the URN, which the change set has no action for` });
413
- continue;
414
- }
415
- actions.set(urn, mapped.action);
416
- const id = knownId(st.after?.id) ?? knownId(st.before?.id);
417
- entries.push({
418
- ...base,
419
- address: urn,
420
- type,
421
- ...(parsed ? { name: parsed.name } : {}),
422
- ...(id ? { id } : {}),
423
- action: mapped.action,
424
- ...(mapped.importing ? { importing: true as const } : {}),
425
- ...(mapped.disruption ? { disruption: mapped.disruption } : {}),
426
- ...scope,
427
- attributes: attributesOf(list, mapped.action, st),
428
- });
429
- }
430
-
431
- // Signal 1: components whose subtree waits on a value preview does not know.
432
- const parentOf = new Map<string, string>();
433
- for (const [urn, st] of states) {
434
- const parent = st.after?.parent ?? st.before?.parent;
435
- if (typeof parent === "string") parentOf.set(urn, parent);
436
- }
437
- const isComponent = (urn: string): boolean => {
438
- const st = states.get(urn);
439
- const state = st?.after ?? st?.before;
440
- const type = state?.type ?? parsePulumiUrn(urn)?.type ?? "";
441
- return state?.custom === false && type !== PULUMI_STACK_TYPE && !isPulumiNodeless(type);
442
- };
443
- const waits = (urn: string): boolean => {
444
- const action = actions.get(urn);
445
- if (action === "create" || action === "replace") return true;
446
- const st = states.get(urn);
447
- return holdsUnknown(st?.after?.inputs) || holdsUnknown(st?.after?.outputs);
448
- };
449
- const flagged = new Set<string>();
450
- for (const urn of byUrn.keys()) {
451
- if (actions.get(urn) === "delete" || !waits(urn)) continue;
452
- // The resource and every component above it, up to the stack.
453
- const seen = new Set<string>();
454
- for (let at: string | undefined = urn; at !== undefined && !seen.has(at); at = parentOf.get(at)) {
455
- seen.add(at);
456
- if (isComponent(at) && actions.get(at) !== "delete") flagged.add(at);
457
- }
458
- }
459
- for (const component of [...flagged].sort()) {
460
- entries.push({ ...base, address: pulumiMayAppearAddress(component), type: "unknown", action: "create", mayAppear: true, ...scope, attributes: [] });
461
- }
462
- const underFlagged = (urn: string): boolean => {
463
- const seen = new Set<string>();
464
- for (let at = parentOf.get(urn); at !== undefined && !seen.has(at); at = parentOf.get(at)) {
465
- seen.add(at);
466
- if (flagged.has(at)) return true;
467
- }
468
- return false;
469
- };
470
- for (const e of entries) {
471
- if (e.action === "delete" && e.mayAppear !== true && underFlagged(e.address)) e.mayAppear = true;
472
- }
473
-
474
- // Signal 2: what the last deployment holds and the preview never listed.
475
- // A failed preview stopped part way, so what it did not list says nothing.
476
- if (input.prior !== undefined && !input.targeted && input.error === undefined) {
477
- for (const r of pulumiExportResources(input.prior)) {
478
- if (byUrn.has(r.urn) || isPulumiNodeless(r.type)) continue;
479
- const parsed = parsePulumiUrn(r.urn);
480
- const id = knownId(r.id);
481
- entries.push({
482
- ...base,
483
- address: r.urn,
484
- type: r.type,
485
- ...(parsed ? { name: parsed.name } : {}),
486
- ...(id ? { id } : {}),
487
- action: "update",
488
- disruption: "unknown",
489
- mayAppear: true,
490
- ...scope,
491
- attributes: [],
492
- });
493
- }
494
- }
495
-
496
- const failed = input.error !== undefined;
497
- return {
498
- member: {
499
- ...base,
500
- ...scope,
501
- status: failed ? "failed" : "planned",
502
- ...(failed ? { error: input.error } : {}),
503
- planDigest: failed ? null : pulumiPreviewDigest(input.preview, input.digest),
504
- holes,
505
- },
506
- entries,
507
- };
508
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * The stacks a change touched (INTENTIUS/plywood#22): plywood's bench edits
3
- * `Pulumi.dev.yaml` in a pull request, and `chant components pr-plan`
4
- * selected nothing because no lexicon claimed the file. Fixture repositories
5
- * on disk; nothing here runs Pulumi or git.
6
- */
7
- import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
8
- import { tmpdir } from "node:os";
9
- import { dirname, join } from "node:path";
10
- import { describe, expect, test } from "vitest";
11
- import { pulumiChangedUnits, pulumiStackUnit } from "./changed-units";
12
- import { pulumiPlugin } from "./plugin";
13
-
14
- function repo(files: Record<string, string>): string {
15
- const root = mkdtempSync(join(tmpdir(), "pulumi-changed-units-"));
16
- for (const [f, text] of Object.entries(files)) {
17
- mkdirSync(dirname(join(root, f)), { recursive: true });
18
- writeFileSync(join(root, f), text);
19
- }
20
- return root;
21
- }
22
-
23
- /** plywood's bench shop: one project at the root with four stacks, and a nested project. */
24
- const SHOP = {
25
- "Pulumi.yaml": "name: shop\nruntime: nodejs\n",
26
- "Pulumi.dev.yaml": "config: {}\n",
27
- "Pulumi.staging.yaml": "config: {}\n",
28
- "Pulumi.prod-us.yaml": "config: {}\n",
29
- "Pulumi.prod-eu.yaml": "config: {}\n",
30
- "index.ts": "export {};\n",
31
- "package.json": "{}\n",
32
- "plywood.yml": "stacks: {}\n",
33
- ".forgejo/workflows/plywood.yml": "name: plywood\n",
34
- "net/Pulumi.yaml": "name: net\nruntime: nodejs\n",
35
- "net/Pulumi.qa.yaml": "config: {}\n",
36
- "net/vpc.ts": "export {};\n",
37
- "docs/notes.md": "x\n",
38
- };
39
-
40
- describe("pulumiChangedUnits", () => {
41
- test("a changed stack config touches that stack alone: the PR-2 case from the bench", () => {
42
- const root = repo(SHOP);
43
- expect(pulumiChangedUnits(root, ["Pulumi.dev.yaml"])).toEqual(["dev"]);
44
- expect(pulumiChangedUnits(root, ["Pulumi.prod-us.yaml", "Pulumi.prod-eu.yaml"])).toEqual(["prod-eu", "prod-us"]);
45
- expect(pulumiChangedUnits(root, ["net/Pulumi.qa.yaml"])).toEqual(["net/qa"]);
46
- });
47
-
48
- test("a program file touches every stack of its project, and only that project", () => {
49
- const root = repo(SHOP);
50
- expect(pulumiChangedUnits(root, ["index.ts"])).toEqual(["dev", "prod-eu", "prod-us", "staging"]);
51
- expect(pulumiChangedUnits(root, ["Pulumi.yaml"])).toEqual(["dev", "prod-eu", "prod-us", "staging"]);
52
- // The nested project owns its files; the root project does not reach into it.
53
- expect(pulumiChangedUnits(root, ["net/vpc.ts"])).toEqual(["net/qa"]);
54
- // A file under the root project's tree but in no nested project is the root project's program.
55
- expect(pulumiChangedUnits(root, ["docs/notes.md"])).toEqual(["dev", "prod-eu", "prod-us", "staging"]);
56
- });
57
-
58
- test("dot directories, node_modules and files outside the project root are not the program", () => {
59
- const root = repo(SHOP);
60
- expect(pulumiChangedUnits(root, [".forgejo/workflows/plywood.yml", ".chant/op-waves/pulumi-up.spec.json", "node_modules/x/index.js", "../shared/lib.ts"])).toEqual([]);
61
- });
62
-
63
- test("a deleted stack config still names its stack, and a program change reaches it", () => {
64
- const root = repo(SHOP);
65
- expect(pulumiChangedUnits(root, ["Pulumi.old.yaml"])).toEqual(["old"]);
66
- expect(pulumiChangedUnits(root, ["index.ts", "Pulumi.old.yaml"])).toEqual(["dev", "old", "prod-eu", "prod-us", "staging"]);
67
- });
68
-
69
- test("a deleted Pulumi.yaml still names its project", () => {
70
- const root = repo({ "app/Pulumi.dev.yaml": "config: {}\n", "app/index.ts": "export {};\n" });
71
- expect(pulumiChangedUnits(root, ["app/Pulumi.yaml", "app/index.ts"])).toEqual(["app/dev"]);
72
- });
73
-
74
- test("a file in no Pulumi project touches nothing", () => {
75
- const root = repo({ "README.md": "x\n", "tf/main.tf": "\n" });
76
- expect(pulumiChangedUnits(root, ["README.md", "tf/main.tf"])).toEqual([]);
77
- });
78
-
79
- test("units are named as core names a pulumi-up step's deploy unit", () => {
80
- expect([pulumiStackUnit(".", "dev"), pulumiStackUnit("./infra/", "dev"), pulumiStackUnit("apps\\web", "qa")]).toEqual(["dev", "infra/dev", "apps/web/qa"]);
81
- });
82
-
83
- test("the plugin answers changedUnits from the changed files", async () => {
84
- const root = repo(SHOP);
85
- expect(await pulumiPlugin.changedUnits!({ projectRoot: root, config: {}, changedFiles: ["Pulumi.dev.yaml"] })).toEqual(["dev"]);
86
- });
87
- });