@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
@@ -1,54 +0,0 @@
1
- /**
2
- * A plunge `up` that fails outright keeps its per-resource timings (#4579):
3
- * `pulumi-up` throws `PulumiUpFailedError` with the stream's summary, which
4
- * `./trace-facts.ts` reads off the error for the run record and the trace.
5
- * The fixture `testdata/pulumi-stream/up-failed-plunge.ndjson` is written by
6
- * hand (see its README). No engine runs.
7
- */
8
- import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
9
- import { tmpdir } from "node:os";
10
- import { join } from "node:path";
11
- import { describe, expect, test } from "vitest";
12
- import type { DeployContext } from "@intentius/chant/components/capability";
13
- import { createPulumiUpCapability, failedUpSummary, PulumiUpFailedError, type PulumiUpArtifact } from "./pulumi-up";
14
- import { pulumiTraceFacts } from "./trace-facts";
15
- import type { PulumiRunner } from "./run";
16
-
17
- const testdata = join(import.meta.dirname, "testdata");
18
- const dir = join(testdata, "pulumi-preview");
19
- const stream = readFileSync(join(testdata, "pulumi-stream", "preview-stream.ndjson"), "utf-8");
20
- const failedUp = readFileSync(join(testdata, "pulumi-stream", "up-failed-plunge.ndjson"), "utf-8");
21
- const ctx: DeployContext = { env: "prod", component: "site" };
22
- const member = "corpus-aws-ts/floci";
23
- const queue = "urn:pulumi:floci::corpus-aws-ts::aws:sqs/queue:Queue::events";
24
- const bucket = "urn:pulumi:floci::corpus-aws-ts::aws:s3/bucketV2:BucketV2::docs";
25
-
26
- const plunge: PulumiRunner = async (args) => {
27
- const save = args.indexOf("--save-plan");
28
- if (save >= 0) writeFileSync(args[save + 1]!, "{}\n");
29
- if (args[0] === "up") throw Object.assign(new Error("exit 1"), { code: 1, stdout: failedUp });
30
- return { stdout: stream };
31
- };
32
-
33
- describe("a failed plunge up (#4579)", () => {
34
- test("the summary holds the timings of what ran when the stream has no summaryEvent", () => {
35
- const summary = failedUpSummary(failedUp);
36
- expect(summary).toMatchObject({ result: "failed", resourceChanges: {} });
37
- expect(Object.keys(summary!.timings!).sort()).toEqual([bucket, queue]);
38
- expect(summary!.timings![queue]).toEqual([{ kind: "provider", call: "update", startedAt: "2026-10-27T12:00:00.800000000Z", durationMs: 41, failed: true }]);
39
- expect(failedUpSummary("")).toBeUndefined();
40
- });
41
-
42
- test("run throws PulumiUpFailedError carrying the summary, and the trace facts read it", async () => {
43
- const cap = createPulumiUpCapability({ plunge, env: {}, tmp: mkdtempSync(join(tmpdir(), "up-failed-")), snapshots: null });
44
- const step = { dir, stack: "floci", engine: "plunge" as const };
45
- const artifact = (await cap.plan!(ctx, step)).artifact as PulumiUpArtifact;
46
- const err = await cap.run({ ...ctx, plans: { [member]: artifact } }, step).catch((e: unknown) => e);
47
- expect(err).toBeInstanceOf(PulumiUpFailedError);
48
- expect((err as PulumiUpFailedError).message).toMatch(/plunge up failed \(exit 1\).*InvalidAttributeValue/);
49
- expect((err as PulumiUpFailedError).summary?.timings?.[queue]?.[0]?.failed).toBe(true);
50
- const facts = pulumiTraceFacts(step, { error: err });
51
- expect(facts.attributes).toMatchObject({ member, "up.result": "failed" });
52
- expect(facts.spans?.length ?? 0).toBeGreaterThan(0);
53
- });
54
- });
@@ -1,87 +0,0 @@
1
- /**
2
- * The pull-request note over a recorded preview (#4548): a resource a
3
- * component registers inside an `apply()` that preview could not run gets a
4
- * row of its own, naming the component.
5
- *
6
- * `testdata/pulumi-preview/preview-create.json` is recorded (#4475; see its
7
- * README): the first preview of the plunge corpus's aws-ts program on floci,
8
- * where the `corpus:index:Site` component `docs` creates children, so an
9
- * `apply()` inside it may be waiting on a value preview does not know.
10
- * Nothing here runs Pulumi.
11
- */
12
- import { readFileSync } from "node:fs";
13
- import { join } from "node:path";
14
- import { describe, expect, test } from "vitest";
15
- import { composeChangeSet } from "@intentius/chant/change-set";
16
- import { memberCounts, prMayAppearRows, prMayAppearText, prOp, PR_REPORT_SCHEMA_ID, renderPrNote, type PrReport } from "@intentius/chant/pr-loop";
17
- import { pulumiMayAppearAddress } from "@intentius/chant/pulumi-urn";
18
- import { pulumiPreviewPart } from "./change-set";
19
-
20
- const dir = join(import.meta.dirname, "testdata", "pulumi-preview");
21
- const created = JSON.parse(readFileSync(join(dir, "preview-create.json"), "utf-8"));
22
- const urn = (type: string, name: string) => `urn:pulumi:floci::corpus-aws-ts::${type}::${name}`;
23
- const DOCS = urn("corpus:index:Site", "docs");
24
-
25
- const doc = composeChangeSet([pulumiPreviewPart({ member: "site", preview: created, stack: "floci" })]);
26
-
27
- const report: PrReport = {
28
- $schema: PR_REPORT_SCHEMA_ID,
29
- contract: 1,
30
- stage: "plan",
31
- pr: 7,
32
- env: "floci",
33
- base: "1".repeat(40),
34
- head: "2".repeat(40),
35
- op: prOp(7),
36
- gate: "pr-apply",
37
- digest: doc.digest,
38
- status: "planned",
39
- approval: { status: "pending" },
40
- selection: { changed: ["site"], dependents: [], unclaimed: [], indeterminate: [], waves: [["site"]] },
41
- members: [{ member: "site", component: "site", planDigest: doc.members[0].planDigest, status: "planned", counts: memberCounts(doc, "site") }],
42
- changeSet: doc,
43
- };
44
-
45
- describe("may-appear rows in the pull-request note (#4548)", () => {
46
- test("the recorded preview's stand-in entry is a row naming its component", () => {
47
- expect(prMayAppearRows(doc)).toEqual([{ member: "site", component: "corpus:index:Site docs", action: "create" }]);
48
- expect(doc.entries.find((e) => e.address === pulumiMayAppearAddress(DOCS))?.mayAppear).toBe(true);
49
- });
50
-
51
- test("the note shows the row, with the parent component's name, in chant's words and in a product's", () => {
52
- const note = renderPrNote(report);
53
- expect(note).toContain("Registered inside an `apply()` the preview could not run, so known only at apply:");
54
- expect(note).toContain("| `site` | `corpus:index:Site docs` | any resource it registers | may register at apply |");
55
- expect(renderPrNote(report, { applyWord: "up" })).toContain("| `site` | `corpus:index:Site docs` | any resource it registers | may register at up |");
56
- });
57
-
58
- test("the digest stays as it was: the rows read the document, never write it", () => {
59
- const before = doc.digest;
60
- renderPrNote(report);
61
- expect(doc.digest).toBe(before);
62
- expect(composeChangeSet([pulumiPreviewPart({ member: "site", preview: created, stack: "floci" })]).digest).toBe(before);
63
- });
64
-
65
- test("a delete or a missing resource under a flagged component names that component", () => {
66
- const child = urn("corpus:index:Site$aws:s3/bucketObject:BucketObject", "docs-index");
67
- const lone = urn("aws:ssm/parameter:Parameter", "vpc-id");
68
- const base = { member: "site", lexicon: "pulumi", planner: "pulumi" as const, mayAppear: true as const, attributes: [] };
69
- const rows = prMayAppearRows({
70
- entries: [
71
- { ...base, address: pulumiMayAppearAddress(DOCS), type: "unknown", action: "create" },
72
- { ...base, address: child, type: "aws:s3/bucketObject:BucketObject", action: "delete", disruption: "destroy" },
73
- { ...base, address: lone, type: "aws:ssm/parameter:Parameter", action: "update", disruption: "unknown" },
74
- ],
75
- });
76
- expect(rows).toEqual([
77
- { member: "site", component: "corpus:index:Site docs", action: "create" },
78
- { member: "site", component: "corpus:index:Site docs", resource: "aws:s3/bucketObject:BucketObject docs-index", action: "delete" },
79
- { member: "site", component: "the stack", resource: "aws:ssm/parameter:Parameter vpc-id", action: "update" },
80
- ]);
81
- expect(rows.map((r) => prMayAppearText(r, "up"))).toEqual([
82
- "may register at up",
83
- "planned to delete, and may register again at up",
84
- "missing from the preview, and may register at up",
85
- ]);
86
- });
87
- });
@@ -1,124 +0,0 @@
1
- /**
2
- * Values the engine makes up while planning stay out of the digest (plywood#56).
3
- * `testdata/pulumi-preview/preview-create.json` is a recorded first preview:
4
- * its queues carry autonames (`events-3f45941`, `worker-0-84f29f5`) the
5
- * provider filled in, listed in each step's `__defaults`.
6
- */
7
- import { readFileSync } from "node:fs";
8
- import { join } from "node:path";
9
- import { describe, expect, test } from "vitest";
10
- import { PULUMI_GENERATED, pulumiPlannedInputs, pulumiPreviewDigest, pulumiResourceDigests, type PulumiStep } from "./change-set";
11
-
12
- const created = JSON.parse(readFileSync(join(import.meta.dirname, "testdata", "pulumi-preview", "preview-create.json"), "utf-8")) as { steps: PulumiStep[] };
13
- const copy = () => JSON.parse(JSON.stringify(created)) as typeof created;
14
- const stepOf = (doc: typeof created, name: string) => doc.steps.find((s) => s.urn?.endsWith(`::${name}`))!;
15
- const inputsOf = (doc: typeof created, name: string) => stepOf(doc, name).newState!.inputs as Record<string, unknown>;
16
-
17
- /** The same preview drawn again: every autoname gets another suffix. */
18
- function replanned(): typeof created {
19
- const doc = copy();
20
- for (const s of doc.steps) {
21
- const inputs = s.newState?.inputs as Record<string, unknown> | undefined;
22
- if (!inputs || !Array.isArray(inputs.__defaults)) continue;
23
- for (const key of inputs.__defaults as string[]) {
24
- const v = inputs[key];
25
- if (typeof v === "string" && /-[0-9a-f]{7}$/.test(v)) inputs[key] = v.replace(/[0-9a-f]{7}$/, "0123abc");
26
- }
27
- }
28
- return doc;
29
- }
30
-
31
- describe("a create's digest leaves out what the engine drew while planning", () => {
32
- test("the recorded preview holds autonames, and a second draw gives the same digest", () => {
33
- expect(inputsOf(created, "events").name).toBe("events-3f45941");
34
- expect(inputsOf(replanned(), "events").name).toBe("events-0123abc");
35
- expect(pulumiPreviewDigest(replanned())).toBe(pulumiPreviewDigest(created));
36
- expect(pulumiPreviewDigest(replanned(), { changedOnly: true })).toBe(pulumiPreviewDigest(created, { changedOnly: true }));
37
- });
38
-
39
- test("the name is replaced by one marker, and the rest of the inputs are kept", () => {
40
- const planned = pulumiPlannedInputs(stepOf(created, "events")) as Record<string, unknown>;
41
- expect(planned.name).toBe(PULUMI_GENERATED);
42
- expect(planned.messageRetentionSeconds).toBe(3600);
43
- expect(planned.maxMessageSize).toBe(262144);
44
- expect(planned.tags).toEqual({ "corpus-owner": "plunge", "corpus-program": "aws-ts" });
45
- });
46
-
47
- test("two creates that differ in an input a reviewer saw still differ", () => {
48
- for (const change of [
49
- (d: typeof created) => { inputsOf(d, "events").messageRetentionSeconds = 7200; },
50
- (d: typeof created) => { (inputsOf(d, "worker-0").tags as Record<string, string>)["corpus-index"] = "9"; },
51
- // a default that is a plain value counts: it decides what gets applied
52
- (d: typeof created) => { inputsOf(d, "events").maxMessageSize = 1024; },
53
- // a name the program set is not a draw, and a changed one is a change
54
- (d: typeof created) => { inputsOf(d, "app-role").name = "rec-ts-other"; },
55
- ]) {
56
- const other = replanned();
57
- change(other);
58
- expect(pulumiPreviewDigest(other)).not.toBe(pulumiPreviewDigest(created));
59
- }
60
- });
61
-
62
- test("a different logical name or a new resource changes the digest", () => {
63
- const renamed = replanned();
64
- stepOf(renamed, "events").urn = stepOf(renamed, "events").urn!.replace("::events", "::journal");
65
- expect(pulumiPreviewDigest(renamed)).not.toBe(pulumiPreviewDigest(created));
66
- const extra = replanned();
67
- extra.steps.push({ ...stepOf(extra, "docs-notify"), urn: stepOf(extra, "docs-notify").urn!.replace("::docs-notify", "::more-notify") });
68
- expect(pulumiPreviewDigest(extra)).not.toBe(pulumiPreviewDigest(created));
69
- });
70
-
71
- test("a string that only looks like a suffix is kept unless the engine filled it in", () => {
72
- const doc = copy();
73
- const step = stepOf(doc, "events");
74
- (step.newState!.inputs as Record<string, unknown>).description = "events-3f45941";
75
- expect((pulumiPlannedInputs(step) as Record<string, unknown>).description).toBe("events-3f45941");
76
- // a name the program wrote is not listed in __defaults
77
- (step.newState!.inputs as Record<string, unknown>).__defaults = [];
78
- expect((pulumiPlannedInputs(step) as Record<string, unknown>).name).toBe("events-3f45941");
79
- });
80
-
81
- test("an engine that prints no __defaults is held to the exact logical name", () => {
82
- const step: PulumiStep = { op: "create", urn: "urn:pulumi:dev::p::aws:sqs/queue:Queue::events", newState: { inputs: { name: "events-3f45941", other: "worker-3f45941" } } };
83
- expect(pulumiPlannedInputs(step)).toEqual({ name: PULUMI_GENERATED, other: "worker-3f45941" });
84
- });
85
-
86
- test("an update keeps its inputs, since it draws no name", () => {
87
- const update: PulumiStep = {
88
- op: "update",
89
- urn: "urn:pulumi:dev::p::aws:sqs/queue:Queue::events",
90
- oldState: { inputs: { name: "events-3f45941", messageRetentionSeconds: 60 } },
91
- newState: { inputs: { __defaults: ["name"], name: "events-3f45941", messageRetentionSeconds: 7200 } },
92
- };
93
- expect(pulumiPlannedInputs(update)).toBe(update.newState!.inputs);
94
- const other = JSON.parse(JSON.stringify(update)) as PulumiStep;
95
- (other.oldState!.inputs as Record<string, unknown>).name = "events-aaaaaaa";
96
- (other.newState!.inputs as Record<string, unknown>).name = "events-aaaaaaa";
97
- expect(pulumiPreviewDigest({ steps: [other] })).not.toBe(pulumiPreviewDigest({ steps: [update] }));
98
- });
99
-
100
- test("a replacement draws a new name too", () => {
101
- const replace = (suffix: string): PulumiStep => ({
102
- op: "replace",
103
- urn: "urn:pulumi:dev::p::aws:sqs/queue:Queue::events",
104
- oldState: { inputs: { name: "events-1111111", fifoQueue: false } },
105
- newState: { inputs: { __defaults: ["name"], name: `events-${suffix}`, fifoQueue: true } },
106
- replaceReasons: ["fifoQueue"],
107
- });
108
- expect(pulumiPreviewDigest({ steps: [replace("2222222")] })).toBe(pulumiPreviewDigest({ steps: [replace("3333333")] }));
109
- const flipped = replace("2222222");
110
- (flipped.newState!.inputs as Record<string, unknown>).fifoQueue = false;
111
- expect(pulumiPreviewDigest({ steps: [flipped] })).not.toBe(pulumiPreviewDigest({ steps: [replace("2222222")] }));
112
- });
113
- });
114
-
115
- describe("pulumiResourceDigests and plunge's refresh steps (plywood#55)", () => {
116
- test("a resource plunge only refreshed is not one the preview changes", () => {
117
- const doc = copy();
118
- const urn = doc.steps[0]!.urn!;
119
- const refreshed = { ...doc, steps: [...doc.steps, { op: "refresh", urn: "urn:pulumi:dev::shop::aws:sqs/queue:Queue::events" } as PulumiStep] };
120
- const digests = pulumiResourceDigests(refreshed);
121
- expect(Object.keys(digests)).not.toContain("urn:pulumi:dev::shop::aws:sqs/queue:Queue::events");
122
- expect(digests[urn]).toBe(pulumiResourceDigests(doc)[urn]);
123
- });
124
- });
@@ -1,134 +0,0 @@
1
- /**
2
- * Preview tips (#4634) over the recorded preview stream
3
- * (`testdata/pulumi-stream`, converted from the #4475 recording) and over
4
- * copies of its steps edited in the test to show each pattern. No engine
5
- * runs.
6
- */
7
- import { readFileSync } from "node:fs";
8
- import { join } from "node:path";
9
- import { describe, expect, test } from "vitest";
10
- import { withProductWords } from "@intentius/chant/ci-product-words";
11
- import { pulumiPreviewPart, type PulumiStep } from "./change-set";
12
- import { pulumiStreamPreview } from "./engine-events";
13
- import { pulumiPlugin } from "./plugin";
14
- import { nameStem, pulumiPreviewTips, pulumiTipsDetail } from "./preview-tips";
15
-
16
- const TESTDATA = join(import.meta.dirname, "testdata");
17
- const stream = readFileSync(join(TESTDATA, "pulumi-stream", "preview-stream.ndjson"), "utf8");
18
- const prior = JSON.parse(readFileSync(join(TESTDATA, "pulumi-preview", "stack-export.json"), "utf8")) as unknown;
19
- const recorded = (): PulumiStep[] => structuredClone(pulumiStreamPreview(stream).steps);
20
-
21
- const part = (steps: PulumiStep[]) => pulumiPreviewPart({ member: "app", preview: { steps }, prior });
22
- const doc = (steps: PulumiStep[]) => ({ entries: part(steps).entries });
23
-
24
- const BUCKET = "urn:pulumi:floci::corpus-aws-ts::aws:s3/bucket:Bucket::site-bucket";
25
- const ROLE = "urn:pulumi:floci::corpus-aws-ts::aws:iam/role:Role::app-role";
26
-
27
- /** The recorded steps with site-bucket deleted and site-bucket-v2 created in its place, as a rename with no alias previews. */
28
- function renamed(): PulumiStep[] {
29
- const steps = recorded();
30
- const at = steps.findIndex((s) => s.urn === BUCKET);
31
- const bucket = steps[at]!;
32
- const created: PulumiStep = { op: "create", urn: BUCKET.replace(/site-bucket$/, "site-bucket-v2"), newState: { ...bucket.newState!, urn: BUCKET.replace(/site-bucket$/, "site-bucket-v2") } };
33
- steps[at] = { op: "delete", urn: BUCKET, oldState: bucket.oldState! };
34
- steps.push(created);
35
- return steps;
36
- }
37
-
38
- describe("the recorded preview", () => {
39
- test("shows no tip: worker-2's delete has no create of its type and stem, and neither replace is forced by a name", () => {
40
- const entries = part(recorded()).entries;
41
- expect(entries.some((e) => e.action === "delete" && e.name === "worker-2")).toBe(true);
42
- expect(pulumiPreviewTips(entries)).toEqual([]);
43
- expect(pulumiTipsDetail({ member: "app", changeSet: { entries } })).toBeUndefined();
44
- });
45
- });
46
-
47
- describe("rename-without-aliases", () => {
48
- test("a delete and a create of one type and stem", () => {
49
- expect(pulumiPreviewTips(doc(renamed()).entries)).toEqual([
50
- { id: "rename-without-aliases", member: "app", address: BUCKET, type: "aws:s3/bucket:Bucket", name: "site-bucket", created: { address: BUCKET.replace(/site-bucket$/, "site-bucket-v2"), name: "site-bucket-v2" } },
51
- ]);
52
- });
53
-
54
- test("the same name under a new parent", () => {
55
- const steps = recorded();
56
- const at = steps.findIndex((s) => s.urn === BUCKET);
57
- const bucket = steps[at]!;
58
- const moved = "urn:pulumi:floci::corpus-aws-ts::corpus:index:Site$aws:s3/bucket:Bucket::site-bucket";
59
- steps[at] = { op: "delete", urn: BUCKET, oldState: bucket.oldState! };
60
- steps.push({ op: "create", urn: moved, newState: { ...bucket.newState!, urn: moved } });
61
- expect(pulumiPreviewTips(doc(steps).entries).map((t) => [t.id, t.created?.address])).toEqual([["rename-without-aliases", moved]]);
62
- });
63
-
64
- test("a different type, or a different stem, is no rename", () => {
65
- const steps = recorded();
66
- const bucket = steps.find((s) => s.urn === BUCKET)!;
67
- const other = "urn:pulumi:floci::corpus-aws-ts::aws:s3/bucket:Bucket::logs";
68
- steps.push({ op: "create", urn: other, newState: { ...bucket.newState!, urn: other } });
69
- expect(pulumiPreviewTips(doc(steps).entries)).toEqual([]);
70
- expect(nameStem("Site-Bucket_v2")).toBe("site");
71
- });
72
- });
73
-
74
- describe("replace-on-name", () => {
75
- test("a create-before-delete replace forced by name", () => {
76
- const steps = recorded();
77
- const at = steps.findIndex((s) => s.urn === ROLE);
78
- const role = steps[at]!;
79
- steps[at] = {
80
- ...role,
81
- op: "replace",
82
- newState: { ...role.newState!, inputs: { ...(role.newState!.inputs as object), name: "app-role-2" } },
83
- replaceReasons: ["name"],
84
- diffReasons: ["name"],
85
- detailedDiff: { name: { kind: "update-replace", inputDiff: true } },
86
- };
87
- const tips = pulumiPreviewTips(doc(steps).entries);
88
- expect(tips).toEqual([expect.objectContaining({ id: "replace-on-name", name: "app-role", inputs: ["name"] })]);
89
- });
90
-
91
- test("a delete-before-replace already deletes first", () => {
92
- const steps = recorded();
93
- const at = steps.findIndex((s) => s.urn === ROLE);
94
- const role = steps[at]!;
95
- steps.splice(at, 1, { ...role, op: "delete-replaced", replaceReasons: ["name"] }, { ...role, op: "create-replacement", replaceReasons: ["name"] });
96
- expect(pulumiPreviewTips(doc(steps).entries)).toEqual([]);
97
- });
98
- });
99
-
100
- describe("unknown-in-apply", () => {
101
- test("a component whose child waits on an unknown may register more at up", () => {
102
- const steps = recorded();
103
- const child = steps.find((s) => s.urn?.endsWith("Site$aws:s3/bucket:Bucket::docs-assets"))!;
104
- child.op = "update";
105
- child.newState = { ...child.newState!, inputs: { ...(child.newState!.inputs as object), tags: "04da6b54-80e4-46f7-96ec-b56ff0331ba9" } };
106
- child.diffReasons = ["tags"];
107
- const tips = pulumiPreviewTips(doc(steps).entries);
108
- expect(tips.map((t) => t.id)).toEqual(["unknown-in-apply"]);
109
- expect(tips[0]!.address).toContain("corpus:index:Site$*::docs");
110
- });
111
- });
112
-
113
- describe("the note", () => {
114
- test("one row per tip with its id, and the product's tips command", () => {
115
- const detail = pulumiTipsDetail({ member: "app", changeSet: doc(renamed()), words: { product: "plywood", noun: ["stack", "stacks"] } });
116
- expect(detail).toEqual({
117
- title: "Tips for stack `app` (1)",
118
- lines: [
119
- "| Tip | Resource | Preview |",
120
- "|---|---|---|",
121
- "| `rename-without-aliases` | `aws:s3/bucket:Bucket` `site-bucket` | deleted, and `site-bucket-v2` of the same type created, with no alias between them |",
122
- "",
123
- "`plywood tips rename-without-aliases` prints the fix.",
124
- ],
125
- });
126
- });
127
-
128
- test("the plugin renders it at plan, in the active product's words", async () => {
129
- const changeSet = doc(renamed()) as never;
130
- const detail = await withProductWords({ product: "plywood", noun: ["stack", "stacks"] }, async () => pulumiPlugin.prNoteDetail!({ member: "app", changeSet, stage: "plan" }));
131
- expect(detail?.lines.at(-1)).toBe("`plywood tips rename-without-aliases` prints the fix.");
132
- expect(await pulumiPlugin.prNoteDetail!({ member: "app", changeSet, stage: "apply" })).toBeUndefined();
133
- });
134
- });
@@ -1,128 +0,0 @@
1
- /**
2
- * Preview tips from a Pulumi member's change set (#4634). A tip names a
3
- * pattern in a preview that usually wants a fix before the update: the
4
- * product holds each tip's words and fix (plywood's `src/tips.ts` and
5
- * `plywood tips <id>`), and this module finds the pattern in the change set
6
- * the preview became (`./change-set.ts`). The note shows each tip as a row
7
- * with its id, through the lexicon's `prNoteDetail`.
8
- *
9
- * | id | found when |
10
- * |---|---|
11
- * | `rename-without-aliases` | the preview deletes a resource and creates one of the same type whose name has the same stem, or the same name under another parent |
12
- * | `replace-on-name` | a replace that creates before it deletes, forced by a name input (`name`, `<x>Name`, `bucket`) |
13
- * | `unknown-in-apply` | an entry the preview could not list (`mayAppear`): something registers inside an `apply()` |
14
- *
15
- * A rename with `aliases` is not a delete and a create: Pulumi follows the
16
- * alias and the preview shows the resource under its new URN as `same` or
17
- * `update`. So a delete and a create of one type and stem in one preview is
18
- * the rename without them. The stem is the name up to its first `-`, `_`,
19
- * `.`, `:` or `/`, lowercased, so `assets` and `assets-v2` pair, and so
20
- * does `worker-2` with a new `worker-3`; each delete pairs with one create
21
- * at most.
22
- *
23
- * Tips plywood lists that a change set cannot show are left out:
24
- * `secret-in-plain-config` reads stack config, which no preview step holds,
25
- * and `no-protect-on-data` reads `protect`, which the change set does not
26
- * carry.
27
- */
28
- import type { ChangeSetDocument, ChangeSetEntry } from "@intentius/chant/change-set";
29
-
30
- /** The tip ids this module finds, as plywood's tips page names them. */
31
- export const PULUMI_PREVIEW_TIP_IDS = ["rename-without-aliases", "replace-on-name", "unknown-in-apply"] as const;
32
-
33
- export type PulumiPreviewTipId = (typeof PULUMI_PREVIEW_TIP_IDS)[number];
34
-
35
- /** One tip found in a member's change set. */
36
- export interface PulumiPreviewTip {
37
- id: PulumiPreviewTipId;
38
- member: string;
39
- /** The entry's address (a URN, or a may-appear address). */
40
- address: string;
41
- type: string;
42
- name?: string;
43
- /** For a rename: the created resource's address and name. */
44
- created?: { address: string; name?: string };
45
- /** For a replace: the name inputs that force it. */
46
- inputs?: string[];
47
- }
48
-
49
- /** The stem a rename keeps: the name up to its first separator, lowercased. */
50
- export function nameStem(name: string): string {
51
- return name.toLowerCase().split(/[-_.:/]/)[0] ?? "";
52
- }
53
-
54
- /** A name input: `name`, `<x>Name`, `<x>_name`, or an S3 bucket's `bucket`. */
55
- const NAME_INPUT = /^(name|bucket|[a-z][A-Za-z0-9]*Name|[a-z0-9_]+_name)$/;
56
-
57
- /** The tips in `entries`, in order: renames, then replaces, then what may register at up. Only pulumi entries are read. */
58
- export function pulumiPreviewTips(entries: readonly ChangeSetEntry[]): PulumiPreviewTip[] {
59
- const mine = entries.filter((e) => e.lexicon === "pulumi");
60
- const tips: PulumiPreviewTip[] = [];
61
- const base = (e: ChangeSetEntry) => ({ member: e.member, address: e.address, type: e.type, ...(e.name !== undefined ? { name: e.name } : {}) });
62
-
63
- // rename-without-aliases
64
- const creates = mine.filter((e) => e.action === "create" && e.mayAppear !== true && e.name !== undefined);
65
- const taken = new Set<string>();
66
- for (const del of mine) {
67
- if (del.action !== "delete" || del.mayAppear === true || del.name === undefined) continue;
68
- const stem = nameStem(del.name);
69
- if (!stem) continue;
70
- const match = creates.find((c) => !taken.has(c.address) && c.member === del.member && c.type === del.type && c.address !== del.address && nameStem(c.name!) === stem);
71
- if (!match) continue;
72
- taken.add(match.address);
73
- tips.push({ id: "rename-without-aliases", ...base(del), created: { address: match.address, ...(match.name !== undefined ? { name: match.name } : {}) } });
74
- }
75
-
76
- // replace-on-name
77
- for (const e of mine) {
78
- if (e.action !== "replace" || e.disruption === "destroy") continue;
79
- const inputs = e.attributes.filter((a) => a.forcesReplacement === true && NAME_INPUT.test(a.path)).map((a) => a.path);
80
- if (inputs.length > 0) tips.push({ id: "replace-on-name", ...base(e), inputs });
81
- }
82
-
83
- // unknown-in-apply
84
- for (const e of mine) {
85
- if (e.mayAppear === true) tips.push({ id: "unknown-in-apply", ...base(e) });
86
- }
87
- return tips;
88
- }
89
-
90
- const code = (s: string): string => "`" + s.replace(/`/g, "'") + "`";
91
-
92
- /** What the row says the preview showed. */
93
- function seen(t: PulumiPreviewTip): string {
94
- switch (t.id) {
95
- case "rename-without-aliases":
96
- return `deleted, and ${code(t.created?.name ?? t.created?.address ?? "?")} of the same type created, with no alias between them`;
97
- case "replace-on-name":
98
- return `replaced because ${t.inputs!.map(code).join(", ")} changed, creating the new one before deleting the old`;
99
- case "unknown-in-apply":
100
- return "may register at up: the preview could not list it";
101
- }
102
- }
103
-
104
- /** The words the detail section reads: the product's name and its noun. */
105
- export interface PulumiTipWords {
106
- product: string;
107
- noun: [string, string];
108
- }
109
-
110
- /**
111
- * The note's detail section for one member's tips (`prNoteDetail`), or
112
- * undefined when it has none. One row per tip, with its id first. A product
113
- * other than chant gets a closing line naming `<product> tips <id>`, the
114
- * command its words give the fix with.
115
- */
116
- export function pulumiTipsDetail(input: { member: string; changeSet: Pick<ChangeSetDocument, "entries">; words?: PulumiTipWords }): { title: string; lines: string[] } | undefined {
117
- const tips = pulumiPreviewTips(input.changeSet.entries.filter((e) => e.member === input.member));
118
- if (tips.length === 0) return undefined;
119
- const words = input.words ?? { product: "chant", noun: ["member", "members"] };
120
- const lines = ["| Tip | Resource | Preview |", "|---|---|---|"];
121
- for (const t of tips) lines.push(`| ${code(t.id)} | ${code(t.type)} ${code(t.name ?? t.address)} | ${seen(t)} |`);
122
- if (words.product !== "chant") {
123
- const ids = [...new Set(tips.map((t) => t.id))];
124
- lines.push("", `${ids.map((id) => code(`${words.product} tips ${id}`)).join(", ")} ${ids.length === 1 ? "prints the fix" : "print the fixes"}.`);
125
- }
126
- const noun = words.noun[0];
127
- return { title: `Tips for ${noun} ${code(input.member)} (${tips.length})`, lines };
128
- }