@intentius/chant 0.124.30 → 0.124.32

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 (346) hide show
  1. package/bin/chant +7 -2
  2. package/dist/cli/commands/check-lexicon-plugin.d.ts +7 -4
  3. package/dist/cli/commands/check-lexicon-plugin.d.ts.map +1 -1
  4. package/dist/cli/commands/check-lexicon-plugin.js +10 -7
  5. package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
  6. package/dist/cli/commands/check-lexicon.js +18 -12
  7. package/dist/cli/commands/import.d.ts +10 -0
  8. package/dist/cli/commands/import.d.ts.map +1 -1
  9. package/dist/cli/commands/import.js +37 -0
  10. package/dist/cli/commands/init-lexicon/templates/project.d.ts.map +1 -1
  11. package/dist/cli/commands/init-lexicon/templates/project.js +4 -3
  12. package/dist/cli/commands/onboard.d.ts.map +1 -1
  13. package/dist/cli/commands/onboard.js +8 -4
  14. package/dist/cli/commands/update.d.ts.map +1 -1
  15. package/dist/cli/commands/update.js +2 -1
  16. package/dist/cli/dependencies.d.ts +18 -0
  17. package/dist/cli/dependencies.d.ts.map +1 -0
  18. package/dist/cli/dependencies.js +120 -0
  19. package/dist/cli/handlers/build.d.ts.map +1 -1
  20. package/dist/cli/handlers/build.js +23 -4
  21. package/dist/cli/handlers/fan-out.d.ts.map +1 -1
  22. package/dist/cli/handlers/fan-out.js +12 -4
  23. package/dist/cli/handlers/graph.d.ts.map +1 -1
  24. package/dist/cli/handlers/graph.js +16 -6
  25. package/dist/cli/handlers/lint.d.ts.map +1 -1
  26. package/dist/cli/handlers/lint.js +6 -0
  27. package/dist/cli/handlers/operator.d.ts +2 -2
  28. package/dist/cli/handlers/operator.js +3 -3
  29. package/dist/cli/handlers/pr.d.ts +14 -0
  30. package/dist/cli/handlers/pr.d.ts.map +1 -1
  31. package/dist/cli/handlers/pr.js +488 -32
  32. package/dist/cli/handlers/promote.d.ts.map +1 -1
  33. package/dist/cli/handlers/promote.js +3 -1
  34. package/dist/cli/handlers/run.d.ts +13 -1
  35. package/dist/cli/handlers/run.d.ts.map +1 -1
  36. package/dist/cli/handlers/run.js +38 -15
  37. package/dist/cli/main.d.ts.map +1 -1
  38. package/dist/cli/main.js +74 -12
  39. package/dist/cli/parse-args.d.ts.map +1 -1
  40. package/dist/cli/parse-args.js +65 -0
  41. package/dist/cli/registry.d.ts +29 -2
  42. package/dist/cli/registry.d.ts.map +1 -1
  43. package/dist/cli/registry.js +6 -2
  44. package/dist/codegen/generate-post-synth-barrel.js +2 -2
  45. package/dist/codegen/lexicon-regen.d.ts +4 -0
  46. package/dist/codegen/lexicon-regen.d.ts.map +1 -1
  47. package/dist/codegen/lexicon-regen.js +1 -1
  48. package/dist/codegen/pinned-upgrade.js +2 -2
  49. package/dist/components/capability.d.ts +44 -3
  50. package/dist/components/capability.d.ts.map +1 -1
  51. package/dist/components/capability.js +21 -0
  52. package/dist/components/changed-files.d.ts +7 -1
  53. package/dist/components/changed-files.d.ts.map +1 -1
  54. package/dist/components/changed-files.js +9 -1
  55. package/dist/components/driver.d.ts +38 -0
  56. package/dist/components/driver.d.ts.map +1 -1
  57. package/dist/components/driver.js +47 -6
  58. package/dist/components/fan-out-record.d.ts +6 -1
  59. package/dist/components/fan-out-record.d.ts.map +1 -1
  60. package/dist/components/fan-out-record.js +24 -0
  61. package/dist/components/fan-out-run.d.ts +20 -0
  62. package/dist/components/fan-out-run.d.ts.map +1 -1
  63. package/dist/components/fan-out-run.js +21 -1
  64. package/dist/components/pr-pipeline.d.ts +65 -2
  65. package/dist/components/pr-pipeline.d.ts.map +1 -1
  66. package/dist/components/pr-pipeline.js +107 -15
  67. package/dist/components/pr-run.d.ts +127 -29
  68. package/dist/components/pr-run.d.ts.map +1 -1
  69. package/dist/components/pr-run.js +290 -70
  70. package/dist/components/wave-plan.d.ts +5 -2
  71. package/dist/components/wave-plan.d.ts.map +1 -1
  72. package/dist/components/wave-plan.js +12 -1
  73. package/dist/discovery/fold-import.d.ts.map +1 -1
  74. package/dist/discovery/fold-import.js +16 -6
  75. package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
  76. package/dist/discovery/sandbox/bundle.js +6 -0
  77. package/dist/discovery/specifier-resolve.d.ts.map +1 -1
  78. package/dist/discovery/specifier-resolve.js +8 -2
  79. package/dist/fold/fold.d.ts.map +1 -1
  80. package/dist/fold/fold.js +68 -1
  81. package/dist/fold/subset.d.ts +37 -0
  82. package/dist/fold/subset.d.ts.map +1 -1
  83. package/dist/fold/subset.js +88 -0
  84. package/dist/lexicon-module.d.ts +10 -0
  85. package/dist/lexicon-module.d.ts.map +1 -1
  86. package/dist/lexicon-module.js +53 -8
  87. package/dist/lexicon-plugin-helpers.d.ts.map +1 -1
  88. package/dist/lexicon-plugin-helpers.js +6 -4
  89. package/dist/lexicon.d.ts +2 -0
  90. package/dist/lexicon.d.ts.map +1 -1
  91. package/dist/lifecycle/affected.d.ts.map +1 -1
  92. package/dist/lifecycle/affected.js +7 -1
  93. package/dist/lifecycle/release-ledger.d.ts +21 -0
  94. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  95. package/dist/lifecycle/release-ledger.js +24 -0
  96. package/dist/lifecycle/work-dir.d.ts +45 -0
  97. package/dist/lifecycle/work-dir.d.ts.map +1 -0
  98. package/dist/lifecycle/work-dir.js +78 -0
  99. package/dist/lint/discover.d.ts +17 -9
  100. package/dist/lint/discover.d.ts.map +1 -1
  101. package/dist/lint/discover.js +62 -54
  102. package/dist/module-source.d.ts +57 -0
  103. package/dist/module-source.d.ts.map +1 -0
  104. package/dist/module-source.js +104 -0
  105. package/dist/op/activities/factory.js +1 -1
  106. package/dist/op/discover.d.ts.map +1 -1
  107. package/dist/op/discover.js +13 -3
  108. package/dist/op/gate.d.ts.map +1 -1
  109. package/dist/op/gate.js +3 -0
  110. package/dist/op/local-executor.d.ts +12 -0
  111. package/dist/op/local-executor.d.ts.map +1 -1
  112. package/dist/op/local-executor.js +22 -3
  113. package/dist/op/op-waves-run.d.ts.map +1 -1
  114. package/dist/op/op-waves-run.js +20 -5
  115. package/dist/op/operator.d.ts +2 -2
  116. package/dist/op/operator.js +2 -2
  117. package/dist/op/redact.d.ts +34 -0
  118. package/dist/op/redact.d.ts.map +1 -0
  119. package/dist/op/redact.js +94 -0
  120. package/dist/op/step-console.d.ts +2 -0
  121. package/dist/op/step-console.d.ts.map +1 -1
  122. package/dist/op/step-console.js +5 -2
  123. package/dist/op/steward.d.ts +6 -4
  124. package/dist/op/steward.d.ts.map +1 -1
  125. package/dist/op/steward.js +5 -3
  126. package/dist/op/work-lease-run.d.ts +20 -7
  127. package/dist/op/work-lease-run.d.ts.map +1 -1
  128. package/dist/op/work-lease-run.js +56 -12
  129. package/dist/pr-forge.d.ts +27 -0
  130. package/dist/pr-forge.d.ts.map +1 -1
  131. package/dist/pr-forge.js +51 -6
  132. package/dist/pr-loop.d.ts +141 -4
  133. package/dist/pr-loop.d.ts.map +1 -1
  134. package/dist/pr-loop.js +122 -6
  135. package/dist/pr-report-url.d.ts +10 -2
  136. package/dist/pr-report-url.d.ts.map +1 -1
  137. package/dist/pr-report-url.js +52 -6
  138. package/dist/ts-loader.d.ts +38 -4
  139. package/dist/ts-loader.d.ts.map +1 -1
  140. package/dist/ts-loader.js +190 -16
  141. package/dist/wave-runtime.mjs +208 -208
  142. package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts +34 -0
  143. package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts.map +1 -0
  144. package/dist/workspace/chant-migrations/fountain-retired-kinds.js +176 -0
  145. package/dist/workspace/chant-migrations.d.ts.map +1 -1
  146. package/dist/workspace/chant-migrations.js +2 -0
  147. package/dist/workspace/checks/boxes.d.ts +6 -6
  148. package/dist/workspace/checks/boxes.js +9 -9
  149. package/dist/workspace/ci-green-forge.d.ts +6 -4
  150. package/dist/workspace/ci-green-forge.d.ts.map +1 -1
  151. package/dist/workspace/ci-green.d.ts +28 -12
  152. package/dist/workspace/ci-green.d.ts.map +1 -1
  153. package/dist/workspace/ci-green.js +49 -21
  154. package/dist/workspace/ci-list.schema.json +12 -6
  155. package/dist/workspace/ci-report-url.d.ts +18 -0
  156. package/dist/workspace/ci-report-url.d.ts.map +1 -0
  157. package/dist/workspace/ci-report-url.js +33 -0
  158. package/dist/workspace/ci-run-index.d.ts +108 -0
  159. package/dist/workspace/ci-run-index.d.ts.map +1 -0
  160. package/dist/workspace/ci-run-index.js +164 -0
  161. package/dist/workspace/ci-run-index.schema.json +52 -0
  162. package/dist/workspace/ci-run.d.ts +159 -9
  163. package/dist/workspace/ci-run.d.ts.map +1 -1
  164. package/dist/workspace/ci-run.js +419 -50
  165. package/dist/workspace/ci-runner-key.d.ts +133 -0
  166. package/dist/workspace/ci-runner-key.d.ts.map +1 -0
  167. package/dist/workspace/ci-runner-key.js +237 -0
  168. package/dist/workspace/ci-secrets.d.ts +65 -0
  169. package/dist/workspace/ci-secrets.d.ts.map +1 -0
  170. package/dist/workspace/ci-secrets.js +211 -0
  171. package/dist/workspace/ci-serve.d.ts +67 -4
  172. package/dist/workspace/ci-serve.d.ts.map +1 -1
  173. package/dist/workspace/ci-serve.js +240 -35
  174. package/dist/workspace/declaration.d.ts +8 -0
  175. package/dist/workspace/declaration.d.ts.map +1 -1
  176. package/dist/workspace/declaration.js +11 -2
  177. package/dist/workspace/declaration.schema.json +7 -2
  178. package/dist/workspace/export.d.ts +1 -1
  179. package/dist/workspace/export.d.ts.map +1 -1
  180. package/dist/workspace/export.js +7 -3
  181. package/dist/workspace/ls.d.ts +6 -1
  182. package/dist/workspace/ls.d.ts.map +1 -1
  183. package/dist/workspace/ls.js +1 -0
  184. package/dist/workspace/ls.schema.json +7 -1
  185. package/dist/workspace/pin-integrity.d.ts.map +1 -1
  186. package/dist/workspace/pin-integrity.js +3 -2
  187. package/dist/workspace/pr-report.schema.json +74 -7
  188. package/dist/workspace/reason-codes.d.ts +7 -3
  189. package/dist/workspace/reason-codes.d.ts.map +1 -1
  190. package/dist/workspace/reason-codes.js +9 -4
  191. package/dist/workspace/run-event.schema.json +3 -1
  192. package/dist/workspace/status.schema.json +3 -1
  193. package/dist/workspace/trust/trust-write.d.ts +109 -0
  194. package/dist/workspace/trust/trust-write.d.ts.map +1 -0
  195. package/dist/workspace/trust/trust-write.js +320 -0
  196. package/dist/workspace/trust-write.schema.json +265 -0
  197. package/dist/workspace/write-scope.d.ts +9 -0
  198. package/dist/workspace/write-scope.d.ts.map +1 -1
  199. package/dist/workspace/write-scope.js +11 -1
  200. package/package.json +1 -1
  201. package/src/__fixtures__/pr-loop/pr-apply-wave-waiting.note.golden.md +48 -0
  202. package/src/cli/commands/__fixtures__/init-lexicon-output/package.json +3 -3
  203. package/src/cli/commands/audit.test.ts +2 -2
  204. package/src/cli/commands/check-lexicon-plugin.test.ts +9 -0
  205. package/src/cli/commands/check-lexicon-plugin.ts +11 -8
  206. package/src/cli/commands/check-lexicon.test.ts +1 -1
  207. package/src/cli/commands/check-lexicon.ts +16 -11
  208. package/src/cli/commands/import.ts +40 -0
  209. package/src/cli/commands/init-lexicon/templates/project.ts +4 -3
  210. package/src/cli/commands/init-lexicon.test.ts +8 -5
  211. package/src/cli/commands/onboard.test.ts +45 -0
  212. package/src/cli/commands/onboard.ts +8 -4
  213. package/src/cli/commands/update.test.ts +6 -0
  214. package/src/cli/commands/update.ts +4 -1
  215. package/src/cli/compiled-cli.e2e.test.ts +76 -11
  216. package/src/cli/dependencies.e2e.test.ts +101 -0
  217. package/src/cli/dependencies.test.ts +93 -0
  218. package/src/cli/dependencies.ts +122 -0
  219. package/src/cli/handlers/build.test.ts +69 -0
  220. package/src/cli/handlers/build.ts +20 -4
  221. package/src/cli/handlers/fan-out.test.ts +73 -0
  222. package/src/cli/handlers/fan-out.ts +11 -4
  223. package/src/cli/handlers/graph.test.ts +76 -0
  224. package/src/cli/handlers/graph.ts +19 -12
  225. package/src/cli/handlers/lint.test.ts +42 -0
  226. package/src/cli/handlers/lint.ts +6 -0
  227. package/src/cli/handlers/operator.ts +3 -3
  228. package/src/cli/handlers/pr-waves.test.ts +449 -0
  229. package/src/cli/handlers/pr.test.ts +134 -0
  230. package/src/cli/handlers/pr.ts +523 -31
  231. package/src/cli/handlers/promote.test.ts +26 -1
  232. package/src/cli/handlers/promote.ts +3 -2
  233. package/src/cli/handlers/run-components-exit.test.ts +99 -0
  234. package/src/cli/handlers/run-signer.test.ts +79 -0
  235. package/src/cli/handlers/run.ts +34 -16
  236. package/src/cli/main.test.ts +19 -0
  237. package/src/cli/main.ts +73 -12
  238. package/src/cli/parse-args.ts +48 -0
  239. package/src/cli/registry.ts +35 -4
  240. package/src/codegen/generate-post-synth-barrel.ts +2 -2
  241. package/src/codegen/lexicon-regen.ts +1 -1
  242. package/src/codegen/pinned-upgrade.ts +2 -2
  243. package/src/codegen/post-synth-barrel-guards.test.ts +6 -11
  244. package/src/components/capability.ts +51 -3
  245. package/src/components/changed-files.test.ts +16 -1
  246. package/src/components/changed-files.ts +9 -1
  247. package/src/components/driver.test.ts +36 -1
  248. package/src/components/driver.ts +76 -4
  249. package/src/components/fan-out-record.ts +29 -1
  250. package/src/components/fan-out-run.test.ts +35 -0
  251. package/src/components/fan-out-run.ts +40 -1
  252. package/src/components/pr-pipeline.test.ts +100 -0
  253. package/src/components/pr-pipeline.ts +132 -17
  254. package/src/components/pr-run.test.ts +323 -18
  255. package/src/components/pr-run.ts +354 -75
  256. package/src/components/wave-plan.ts +16 -4
  257. package/src/discovery/fold-host-method.test.ts +87 -0
  258. package/src/discovery/fold-import.ts +15 -5
  259. package/src/discovery/fold-package-composite.test.ts +27 -0
  260. package/src/discovery/fold-specifiers.test.ts +8 -0
  261. package/src/discovery/sandbox/bundle.ts +6 -0
  262. package/src/discovery/specifier-resolve.ts +8 -2
  263. package/src/fold/fold.test.ts +72 -0
  264. package/src/fold/fold.ts +71 -0
  265. package/src/fold/subset.test.ts +31 -0
  266. package/src/fold/subset.ts +99 -0
  267. package/src/lexicon-dist.e2e.test.ts +254 -0
  268. package/src/lexicon-module.test.ts +47 -0
  269. package/src/lexicon-module.ts +49 -7
  270. package/src/lexicon-plugin-helpers.ts +6 -4
  271. package/src/lexicon.ts +2 -0
  272. package/src/lifecycle/affected.test.ts +7 -0
  273. package/src/lifecycle/affected.ts +6 -1
  274. package/src/lifecycle/release-ledger.ts +34 -0
  275. package/src/lifecycle/work-dir.test.ts +77 -0
  276. package/src/lifecycle/work-dir.ts +82 -0
  277. package/src/lint/discover.test.ts +46 -2
  278. package/src/lint/discover.ts +55 -49
  279. package/src/module-source.test.ts +85 -0
  280. package/src/module-source.ts +112 -0
  281. package/src/op/activities/factory.ts +1 -1
  282. package/src/op/discover-root.test.ts +31 -2
  283. package/src/op/discover.ts +14 -4
  284. package/src/op/gate.test.ts +30 -0
  285. package/src/op/gate.ts +3 -0
  286. package/src/op/local-executor.ts +31 -3
  287. package/src/op/op-waves-run.ts +20 -5
  288. package/src/op/op-waves.test.ts +49 -0
  289. package/src/op/operator.ts +2 -2
  290. package/src/op/redact.ts +93 -0
  291. package/src/op/step-console.ts +7 -2
  292. package/src/op/steward.ts +6 -4
  293. package/src/op/work-lease-run.test.ts +88 -2
  294. package/src/op/work-lease-run.ts +52 -12
  295. package/src/pr-forge-bundle.test.ts +2 -2
  296. package/src/pr-forge.test.ts +71 -0
  297. package/src/pr-forge.ts +70 -6
  298. package/src/pr-loop-bundle.test.ts +2 -1
  299. package/src/pr-loop.test.ts +117 -1
  300. package/src/pr-loop.ts +252 -10
  301. package/src/pr-report-url.ts +58 -6
  302. package/src/terraform/__fixtures__/advise.test.ts +21 -2
  303. package/src/ts-loader.test.ts +89 -1
  304. package/src/ts-loader.ts +180 -13
  305. package/src/workspace/changes.test.ts +1 -1
  306. package/src/workspace/chant-migrations/fountain-retired-kinds.test.ts +33 -0
  307. package/src/workspace/chant-migrations/fountain-retired-kinds.ts +190 -0
  308. package/src/workspace/chant-migrations.e2e.test.ts +5 -0
  309. package/src/workspace/chant-migrations.ts +2 -0
  310. package/src/workspace/checks/boxes.ts +9 -9
  311. package/src/workspace/ci-green-forge.ts +6 -4
  312. package/src/workspace/ci-green-runs.test.ts +53 -11
  313. package/src/workspace/ci-green.test.ts +1 -1
  314. package/src/workspace/ci-green.ts +50 -22
  315. package/src/workspace/ci-list.schema.json +12 -6
  316. package/src/workspace/ci-report-url.test.ts +220 -0
  317. package/src/workspace/ci-report-url.ts +33 -0
  318. package/src/workspace/ci-run-index.schema.json +52 -0
  319. package/src/workspace/ci-run-index.test.ts +392 -0
  320. package/src/workspace/ci-run-index.ts +206 -0
  321. package/src/workspace/ci-run.test.ts +520 -42
  322. package/src/workspace/ci-run.ts +483 -51
  323. package/src/workspace/ci-runner-key.test.ts +204 -0
  324. package/src/workspace/ci-runner-key.ts +275 -0
  325. package/src/workspace/ci-secrets.test.ts +106 -0
  326. package/src/workspace/ci-secrets.ts +213 -0
  327. package/src/workspace/ci-serve.test.ts +282 -39
  328. package/src/workspace/ci-serve.ts +231 -34
  329. package/src/workspace/declaration.schema.json +7 -2
  330. package/src/workspace/declaration.test.ts +23 -0
  331. package/src/workspace/declaration.ts +19 -3
  332. package/src/workspace/export.ts +6 -3
  333. package/src/workspace/ls.schema.json +7 -1
  334. package/src/workspace/ls.ts +7 -2
  335. package/src/workspace/pin-integrity.test.ts +5 -0
  336. package/src/workspace/pin-integrity.ts +3 -2
  337. package/src/workspace/pr-report.schema.json +74 -7
  338. package/src/workspace/reason-codes.test.ts +2 -0
  339. package/src/workspace/reason-codes.ts +9 -4
  340. package/src/workspace/run-event.schema.json +3 -1
  341. package/src/workspace/status.schema.json +3 -1
  342. package/src/workspace/trust/trust-write.test.ts +179 -0
  343. package/src/workspace/trust/trust-write.ts +377 -0
  344. package/src/workspace/trust-write.schema.json +265 -0
  345. package/src/workspace/write-scope.test.ts +29 -1
  346. package/src/workspace/write-scope.ts +12 -1
package/dist/pr-loop.d.ts CHANGED
@@ -28,6 +28,16 @@
28
28
  * and decides the gate against the new digest. The same plan applies; a moved
29
29
  * plan stops with both digests named and nothing applied.
30
30
  *
31
+ * ## A gate per wave on merge
32
+ *
33
+ * With `--wave-gate <gate>` (#4003) the apply runs a wave at a time, and
34
+ * plans each wave after the one before it applied. Wave 1 applies under the
35
+ * pull request's approval. A later wave whose new plan the approved change
36
+ * set covers (`planCoveredBy`) applies under that approval too; one whose
37
+ * plan moved waits at `<gate>-wave-<k>`, under the same op, for an approval
38
+ * of its new plan. The report's `waves` says which wave applied under which
39
+ * approval.
40
+ *
31
41
  * ## Inside a workspace member
32
42
  *
33
43
  * Each workspace member that generates the pipeline (#3465) runs its own
@@ -43,6 +53,14 @@ export declare const PR_REPORT_SCHEMA_ID = "https://intentius.io/chant/schemas/w
43
53
  export declare const PR_REPORT_CONTRACT = 1;
44
54
  /** The first chant whose report can carry `deployedOutputs` (#4104). */
45
55
  export declare const PR_REPORT_DEPLOYED_OUTPUTS_FLOOR = "0.124.30";
56
+ /** The first chant whose report can carry `waveGate` and `waves` (#4003). */
57
+ export declare const PR_REPORT_WAVES_FLOOR = "0.124.32";
58
+ /**
59
+ * The first chant whose report can carry `plannedOutputs`, `rounds`, a
60
+ * member's `unknownInputs`, `buildInputs`, `round` and `held`, and the `waiting` statuses
61
+ * (#3999).
62
+ */
63
+ export declare const PR_REPORT_PLANNED_OUTPUTS_FLOOR = "0.124.32";
46
64
  /** The gate a pull request's apply waits on, unless the pipeline names another. */
47
65
  export declare const PR_APPLY_GATE = "pr-apply";
48
66
  /**
@@ -50,6 +68,13 @@ export declare const PR_APPLY_GATE = "pr-apply";
50
68
  * `pr-<number>-<member>` for a workspace member's pipeline (#3465).
51
69
  */
52
70
  export declare function prOp(pr: number, member?: string): string;
71
+ /**
72
+ * The gate a round of an apply waits on (#3999): the pull request's own
73
+ * gate for the first, and `<gate>-round-<n>` for each one planned after an
74
+ * upstream applied. A workspace's `identity.gates` entry for `gate` covers
75
+ * every round.
76
+ */
77
+ export declare function prRoundGate(gate: string, round: number): string;
53
78
  /** Whether `op` is a pull request's gate op, with or without a member. Member names follow the declaration's name pattern. */
54
79
  export declare const PR_GATE_OP: RegExp;
55
80
  /** The hidden line that marks the pull request's note, one per environment and, in a workspace, per member. */
@@ -79,7 +104,13 @@ export type PrMemberStatus =
79
104
  /** The apply failed. */
80
105
  | "failed"
81
106
  /** Not applied because a member it depends on failed. */
82
- | "blocked";
107
+ | "blocked"
108
+ /**
109
+ * Apply stage (#3999): held back because its plan read an upstream output
110
+ * that applied as another value, or was known only after apply. It waits
111
+ * on an approval of the plan the apply made for it afterwards (`rounds`).
112
+ */
113
+ | "waiting";
83
114
  export interface PrMember {
84
115
  /** The member's name in the change set: a root, for a terraform-family step. */
85
116
  member: string;
@@ -93,9 +124,47 @@ export interface PrMember {
93
124
  /**
94
125
  * Components this one depends on whose outputs changed when they applied
95
126
  * (apply stage). Its applied plan read the values from before, so the next
96
- * run plans it again.
127
+ * run plans it again. Not written since #3999, which holds such a member
128
+ * back and plans it again in the same apply (`held`, `round`).
97
129
  */
98
130
  inputsMoved?: string[];
131
+ /**
132
+ * The upstream outputs its plan read that the change's plans could not
133
+ * say (#3999), as `<component>.<output>`, sorted: known only after that
134
+ * upstream applies. The approval does not cover what this member does
135
+ * with them; the apply plans it again once they are known.
136
+ */
137
+ unknownInputs?: string[];
138
+ /**
139
+ * The published artifact identities its plan read from a build in the
140
+ * same change (#3999), as `<component>.publish.<field>`, sorted: an image
141
+ * digest, say. Known only after the build runs, but never approved again:
142
+ * the build's provenance and attestation bind the digest, so the member
143
+ * applies without a later round.
144
+ */
145
+ buildInputs?: string[];
146
+ /** Apply stage (#3999): the round whose plan it applied or waits on, when not the first. */
147
+ round?: number;
148
+ /** Apply stage (#3999): why the first round's plan did not apply. */
149
+ held?: string;
150
+ }
151
+ /** A round of plans an apply made after an upstream applied (#3999), the report's `rounds`. */
152
+ export interface PrRound {
153
+ /** 2 for the first plan made after an upstream applied, and on. */
154
+ round: number;
155
+ /** The gate it waits on: {@link prRoundGate}. */
156
+ gate: string;
157
+ /** The change-set digest of what the round planned. What its gate binds. */
158
+ digest: string;
159
+ /** The components planned again, in apply order. */
160
+ components: string[];
161
+ approval: PrApproval;
162
+ /** `waiting`: no approval stands for `digest`. `plan-failed`: a member failed to plan, so the round did not apply. */
163
+ status: "applied" | "failed" | "waiting" | "plan-failed";
164
+ /** With `waiting`: why an approval that stands does not count (`--require-review`). */
165
+ message?: string;
166
+ /** The change-set document the round planned. */
167
+ changeSet: ChangeSetDocument;
99
168
  }
100
169
  /** Where the approval stands for the planned digest. */
101
170
  export interface PrApproval {
@@ -122,8 +191,19 @@ export type PrStatus =
122
191
  | "applied"
123
192
  /** Apply stage: a member failed to apply. Its dependents did not run. */
124
193
  | "failed"
194
+ /**
195
+ * Apply stage with `--wave-gate` and `--wave` (#4003): this wave applied,
196
+ * and a later wave of the change is still to run.
197
+ */
198
+ | "wave-applied"
125
199
  /** Apply stage: nothing applied, see `refusal`. */
126
- | "refused";
200
+ | "refused"
201
+ /**
202
+ * Apply stage (#3999): the approved plans applied, except members held
203
+ * back after an upstream applied. They wait on the approval of the plan
204
+ * the last of `rounds` made.
205
+ */
206
+ | "waiting";
127
207
  /** Why an apply refused. */
128
208
  export type PrRefusal =
129
209
  /** No approval stands for any plan of this pull request. */
@@ -132,8 +212,44 @@ export type PrRefusal =
132
212
  | "plan-changed"
133
213
  /** The approval names someone who has not approved the pull request on the forge. */
134
214
  | "not-a-reviewer"
215
+ /** The approval names the pull request's author, or an author or committer of one of its commits (#4000). */
216
+ | "author-approved"
135
217
  /** No pull request merged this commit, so there is no approval to read. */
136
- | "no-pull-request";
218
+ | "no-pull-request"
219
+ /** `--wave-gate` (#4003): the wave's new plan is not one the pull request approved, and no approval stands for it. */
220
+ | "wave-not-approved"
221
+ /** `--wave-gate`: an approval of the wave's gate stands for another digest, so its plan moved since. */
222
+ | "wave-plan-changed"
223
+ /** `--wave-gate` with `--wave <k>`: an earlier wave has work left, or no record says it applied. */
224
+ | "earlier-wave";
225
+ /**
226
+ * One wave of an apply with `--wave-gate` (#4003): what it planned, where it
227
+ * got to, and which approval it applied or waits under.
228
+ */
229
+ export interface PrWave {
230
+ /** 1-based, from the derivation (`selection.waves`). */
231
+ wave: number;
232
+ /** The components planned in it on the run that reached it. */
233
+ components: string[];
234
+ /** `applied`; `failed` or `plan-failed`; or `waiting` at its gate. */
235
+ status: "applied" | "failed" | "plan-failed" | "waiting";
236
+ /**
237
+ * `pull-request`: the approved change set covers the wave's plan, so it
238
+ * applies under the pull request's approval. `wave`: its plan moved, so it
239
+ * needs an approval of its own gate.
240
+ */
241
+ approval: "pull-request" | "wave";
242
+ /** The gate it applied or waits under: the pull request's, or `<wave gate>-wave-<k>`. */
243
+ gate: string;
244
+ /** The digest that gate binds: the pull request's change set, or the wave's new plan. */
245
+ digest: string;
246
+ /** Who approved that digest. */
247
+ approvedBy?: string[];
248
+ /** Waiting: an approval of the wave's gate stands for this other digest. */
249
+ approved?: string;
250
+ /** Why the approved change set does not cover the wave's plan, one line per member. */
251
+ moved?: string[];
252
+ }
137
253
  /**
138
254
  * The document `pr-plan` and `pr-apply` write (`pr-report.schema.json`).
139
255
  * The terragucci plan report (#3349) reads it; fields are only ever added.
@@ -175,7 +291,28 @@ export interface PrReport {
175
291
  * {@link PR_REPORT_DEPLOYED_OUTPUTS_FLOOR}.
176
292
  */
177
293
  deployedOutputs?: Record<string, string[]>;
294
+ /**
295
+ * Per dependency in the change that a member was planned against (#3999),
296
+ * the names of the outputs its plan knows, sorted. An output it reads that
297
+ * is not here is known only after apply (a member's `unknownInputs`).
298
+ * Absent when no member read one. Added within contract 1 by chant
299
+ * {@link PR_REPORT_PLANNED_OUTPUTS_FLOOR}.
300
+ */
301
+ plannedOutputs?: Record<string, string[]>;
302
+ /**
303
+ * Apply stage (#3999): the rounds planned after an upstream applied, in
304
+ * order, each with its own gate and digest. Absent when nothing was held.
305
+ */
306
+ rounds?: PrRound[];
178
307
  approval: PrApproval;
308
+ /**
309
+ * The wave gate's base name with `--wave-gate` (#4003): wave k waits on
310
+ * `<waveGate>-wave-<k>` when its plan moved. Added within contract 1 by
311
+ * chant {@link PR_REPORT_WAVES_FLOOR}.
312
+ */
313
+ waveGate?: string;
314
+ /** With `waveGate`: each wave reached so far, in order. */
315
+ waves?: PrWave[];
179
316
  /** Component names: which changed, which run because they depend on one, and what the change touched that no component deploys. */
180
317
  selection: {
181
318
  changed: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"pr-loop.d.ts","sourceRoot":"","sources":["../src/pr-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGvE,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,oFAAoF,CAAC;AAErH,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,wEAAwE;AACxE,eAAO,MAAM,gCAAgC,aAAa,CAAC;AAE3D,mFAAmF;AACnF,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,8HAA8H;AAC9H,eAAO,MAAM,UAAU,QAAqC,CAAC;AAE7D,+GAA+G;AAC/G,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB;aAAK,IAAI,EAAE,YAAY;aAAE,KAAK,EAAE,aAAa;CAAW,CAAC;AAExF,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MA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AED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,QAAQ,SAAU,GAAG,MAAM,CAE7G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAMzG;AAoGD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAiF1G;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAiD5D;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAKjF"}
package/dist/pr-loop.js CHANGED
@@ -28,6 +28,16 @@
28
28
  * and decides the gate against the new digest. The same plan applies; a moved
29
29
  * plan stops with both digests named and nothing applied.
30
30
  *
31
+ * ## A gate per wave on merge
32
+ *
33
+ * With `--wave-gate <gate>` (#4003) the apply runs a wave at a time, and
34
+ * plans each wave after the one before it applied. Wave 1 applies under the
35
+ * pull request's approval. A later wave whose new plan the approved change
36
+ * set covers (`planCoveredBy`) applies under that approval too; one whose
37
+ * plan moved waits at `<gate>-wave-<k>`, under the same op, for an approval
38
+ * of its new plan. The report's `waves` says which wave applied under which
39
+ * approval.
40
+ *
31
41
  * ## Inside a workspace member
32
42
  *
33
43
  * Each workspace member that generates the pipeline (#3465) runs its own
@@ -43,6 +53,14 @@ export const PR_REPORT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace
43
53
  export const PR_REPORT_CONTRACT = 1;
44
54
  /** The first chant whose report can carry `deployedOutputs` (#4104). */
45
55
  export const PR_REPORT_DEPLOYED_OUTPUTS_FLOOR = "0.124.30";
56
+ /** The first chant whose report can carry `waveGate` and `waves` (#4003). */
57
+ export const PR_REPORT_WAVES_FLOOR = "0.124.32";
58
+ /**
59
+ * The first chant whose report can carry `plannedOutputs`, `rounds`, a
60
+ * member's `unknownInputs`, `buildInputs`, `round` and `held`, and the `waiting` statuses
61
+ * (#3999).
62
+ */
63
+ export const PR_REPORT_PLANNED_OUTPUTS_FLOOR = "0.124.32";
46
64
  /** The gate a pull request's apply waits on, unless the pipeline names another. */
47
65
  export const PR_APPLY_GATE = "pr-apply";
48
66
  /**
@@ -52,6 +70,15 @@ export const PR_APPLY_GATE = "pr-apply";
52
70
  export function prOp(pr, member) {
53
71
  return member ? `pr-${pr}-${member}` : `pr-${pr}`;
54
72
  }
73
+ /**
74
+ * The gate a round of an apply waits on (#3999): the pull request's own
75
+ * gate for the first, and `<gate>-round-<n>` for each one planned after an
76
+ * upstream applied. A workspace's `identity.gates` entry for `gate` covers
77
+ * every round.
78
+ */
79
+ export function prRoundGate(gate, round) {
80
+ return round <= 1 ? gate : `${gate}-round-${round}`;
81
+ }
55
82
  /** Whether `op` is a pull request's gate op, with or without a member. Member names follow the declaration's name pattern. */
56
83
  export const PR_GATE_OP = /^pr-\d+(?:-[a-z0-9][a-z0-9-]*)?$/;
57
84
  /** The hidden line that marks the pull request's note, one per environment and, in a workspace, per member. */
@@ -101,6 +128,7 @@ const STATUS_WORDS = {
101
128
  applied: "applied",
102
129
  failed: "apply failed",
103
130
  blocked: "blocked",
131
+ waiting: "waiting on its new plan",
104
132
  };
105
133
  function headline(report) {
106
134
  const n = report.members.length;
@@ -116,10 +144,47 @@ function headline(report) {
116
144
  return `Applied ${members}.`;
117
145
  case "failed":
118
146
  return `The apply failed: ${report.members.filter((m) => m.status === "failed").length} failed, ${report.members.filter((m) => m.status === "applied").length} applied.`;
119
- case "refused":
120
- return "The apply refused.";
147
+ case "wave-applied": {
148
+ const applied = (report.waves ?? []).filter((w) => w.status === "applied").map((w) => w.wave);
149
+ const total = report.selection.waves.length;
150
+ return `Applied wave ${applied.at(-1) ?? "?"} of ${total}. The next wave runs in its own job.`;
151
+ }
152
+ case "refused": {
153
+ const waiting = report.waves?.find((w) => w.status === "waiting");
154
+ return waiting ? `Wave ${waiting.wave} waits at its gate ${code(waiting.gate)}; nothing in it applied.` : "The apply refused.";
155
+ }
156
+ case "waiting":
157
+ return `Applied ${report.members.filter((m) => m.status === "applied").length} of ${members}; ${report.members.filter((m) => m.status === "waiting").length} wait on an approval of the plan made after their upstream applied.`;
121
158
  }
122
159
  }
160
+ /** Who a wave applied or waits under, as a table cell. */
161
+ function waveApproval(w) {
162
+ const whose = w.approval === "pull-request" ? "the pull request's" : "its own";
163
+ const by = w.approvedBy?.length ? ` by ${w.approvedBy.map(code).join(", ")}` : w.status === "waiting" ? ", not approved yet" : "";
164
+ return `${whose} ${code(w.gate)}${by}`;
165
+ }
166
+ /**
167
+ * The waves of an apply with `--wave-gate` (#4003): a row per wave reached,
168
+ * saying which approval it applied under, then for a wave that waits the
169
+ * reason its plan moved and the approve command for its new plan.
170
+ */
171
+ function waveLines(report, approver) {
172
+ const waves = report.waves ?? [];
173
+ if (waves.length === 0)
174
+ return [];
175
+ const out = ["", "| Wave | Components | Status | Approval |", "|---:|---|---|---|"];
176
+ for (const w of waves)
177
+ out.push(`| ${w.wave} | ${w.components.map(code).join(", ")} | ${w.status} | ${waveApproval(w)} |`);
178
+ for (const w of waves.filter((x) => x.status === "waiting")) {
179
+ out.push("", `Wave ${w.wave} was planned after the waves before it applied, and the approved plan does not cover it:`, "");
180
+ for (const why of w.moved ?? [])
181
+ out.push(`- ${why}`);
182
+ if (w.approved)
183
+ out.push("", `An approval of ${code(w.gate)} stands for ${code(w.approved)}, not for the plan now.`);
184
+ out.push("", `Read wave ${w.wave}'s plan, ${code(w.digest)}, and approve it with:`, "", "```", prApproveCommand({ op: report.op, gate: w.gate, digest: w.digest }, approver), "```", "", "Then run the wave's apply job again.");
185
+ }
186
+ return out;
187
+ }
123
188
  function approvalLines(report, approver) {
124
189
  const a = report.approval;
125
190
  if (report.status === "nothing")
@@ -170,6 +235,7 @@ export function renderPrNote(report, options = {}) {
170
235
  out.push("", "A member whose inputs moved applied the plan it was approved with. The next run plans it against the new values.");
171
236
  }
172
237
  }
238
+ out.push(...waveLines(report, options.approver ?? "<you>"));
173
239
  if (report.selection.unclaimed.length > 0) {
174
240
  out.push("", `Changed, and deployed by no component: ${report.selection.unclaimed.map(code).join(", ")}.`);
175
241
  }
@@ -178,9 +244,39 @@ export function renderPrNote(report, options = {}) {
178
244
  const each = deployed.map(([dep, names]) => `${code(dep)} (${names.length > 0 ? names.map(code).join(", ") : "none yet"})`);
179
245
  out.push("", `Planned against outputs read from the deployed estate: ${each.join("; ")}.`);
180
246
  }
247
+ const planned = Object.entries(report.plannedOutputs ?? {});
248
+ if (planned.length > 0) {
249
+ const each = planned.map(([dep, names]) => `${code(dep)} (${names.length > 0 ? names.map(code).join(", ") : "none known"})`);
250
+ out.push("", `Planned against the outputs this change's plans say its upstreams will have: ${each.join("; ")}.`);
251
+ }
252
+ const unknown = [...new Set(report.members.flatMap((m) => (m.unknownInputs ?? []).map((ref) => `${code(m.component)} reads ${code(ref)}`)))];
253
+ if (unknown.length > 0) {
254
+ out.push("", `Known only after apply: ${unknown.join("; ")}. This approval does not cover what those members do with them. ` +
255
+ "The apply plans them again once their upstream applied and asks for an approval of that plan.");
256
+ }
257
+ const fromBuild = [...new Set(report.members.flatMap((m) => (m.buildInputs ?? []).map((ref) => `${code(m.component)} reads ${code(ref)}`)))];
258
+ if (fromBuild.length > 0) {
259
+ out.push("", `From this pull request's build: ${fromBuild.join("; ")}. The image digest comes from this pull request's build, whose provenance binds it, ` +
260
+ "so those members apply with it once the build ran, without a second approval.");
261
+ }
262
+ for (const r of report.rounds ?? []) {
263
+ const what = `Round ${r.round} planned ${r.components.map(code).join(", ")} again after their upstream applied, digest ${code(r.digest)}`;
264
+ if (r.status === "waiting") {
265
+ if (r.message)
266
+ out.push("", `> ${r.message}`);
267
+ out.push("", `${what}. Not approved yet. Approve it, then run the apply again with the same \`--resume\` record:`, "", "```", prApproveCommand({ op: report.op, gate: r.gate, digest: r.digest }, options.approver ?? "<you>"), "```");
268
+ }
269
+ else {
270
+ out.push("", `${what}: ${r.status === "applied" ? `applied, approved by ${(r.approval.approvedBy ?? []).map(code).join(", ")}` : r.status === "plan-failed" ? "a member failed to plan" : "the apply failed"}.`);
271
+ }
272
+ }
181
273
  if (report.status !== "nothing") {
182
274
  out.push("", `Plan digest: ${code(report.digest)}`, "", ...approvalLines(report, options.approver ?? "<you>"));
183
275
  }
276
+ // #4003: with a gate per wave, a later wave's plan on merge may differ from this one.
277
+ if (report.stage === "plan" && report.status === "planned" && report.waveGate) {
278
+ out.push("", `On merge each wave after the first is planned again once the waves before it apply, and a wave whose plan moved stops at its own gate, ${code(`${report.waveGate}-wave-<k>`)}, for approval.`);
279
+ }
184
280
  const head = out.join("\n") + "\n";
185
281
  if (report.status === "nothing" || report.changeSet.members.length === 0)
186
282
  return head;
@@ -210,20 +306,40 @@ export function prStatusDescription(report) {
210
306
  case "applied":
211
307
  text = `applied ${n} member${n === 1 ? "" : "s"}${digest}`;
212
308
  break;
309
+ case "wave-applied": {
310
+ const last = (report.waves ?? []).filter((w) => w.status === "applied").at(-1);
311
+ text = `applied wave ${last?.wave ?? "?"} of ${report.selection.waves.length}${last ? ` under ${last.approval === "pull-request" ? "the pull request's approval" : `${last.gate}`}` : ""}`;
312
+ break;
313
+ }
213
314
  case "failed":
214
315
  text = `apply failed for ${report.members.filter((m) => m.status === "failed").map((m) => m.member).join(", ")}`;
215
316
  break;
216
- case "refused":
217
- text = `refused: ${report.refusal === "plan-changed" ? "the plan changed after review" : report.refusal === "not-a-reviewer" ? "the approver has not approved the pull request" : report.refusal === "no-pull-request" ? "no pull request merged this commit" : "the plan is not approved"}`;
317
+ case "waiting":
318
+ text = `waiting: ${report.members.filter((m) => m.status === "waiting").map((m) => m.member).join(", ")} planned again after an upstream applied, not approved yet`;
218
319
  break;
320
+ case "refused": {
321
+ const waiting = report.waves?.find((w) => w.status === "waiting");
322
+ if (waiting && (report.refusal === "wave-not-approved" || report.refusal === "wave-plan-changed")) {
323
+ text = `wave ${waiting.wave} waits at ${waiting.gate}: ${report.refusal === "wave-plan-changed" ? "its plan changed after its approval" : "its plan moved, approve it"}`;
324
+ break;
325
+ }
326
+ if (report.refusal === "earlier-wave") {
327
+ text = "refused: an earlier wave has not applied";
328
+ break;
329
+ }
330
+ text = `refused: ${report.refusal === "plan-changed" ? "the plan changed after review" : report.refusal === "not-a-reviewer" ? "the approver has not approved the pull request" : report.refusal === "author-approved" ? "the approver wrote the change" : report.refusal === "no-pull-request" ? "no pull request merged this commit" : "the plan is not approved"}`;
331
+ break;
332
+ }
219
333
  }
220
334
  return text.length > 140 ? text.slice(0, 137) + "..." : text;
221
335
  }
222
336
  /** The commit status state for a report: success, failure, or pending while it waits on approval. */
223
337
  export function prStatusState(report) {
224
- if (report.status === "planned" || report.status === "applied" || report.status === "nothing")
338
+ if (report.status === "planned" || report.status === "applied" || report.status === "wave-applied" || report.status === "nothing")
225
339
  return "success";
226
- if (report.status === "refused" && report.refusal === "not-approved")
340
+ if (report.status === "refused" && (report.refusal === "not-approved" || report.refusal === "wave-not-approved"))
341
+ return "pending";
342
+ if (report.status === "waiting")
227
343
  return "pending";
228
344
  return "failure";
229
345
  }
@@ -44,8 +44,8 @@ export type ReportTarget = {
44
44
  bucket: string;
45
45
  prefix: string;
46
46
  };
47
- /** `--report-url` read, or why it can't be. */
48
- export declare function parseReportUrl(raw: string): ReportTarget | {
47
+ /** `--report-url` read, or why it can't be. `name` is what the error calls the value: the flag, or `ci.reportUrl` (#4160). */
48
+ export declare function parseReportUrl(raw: string, name?: string): ReportTarget | {
49
49
  error: string;
50
50
  };
51
51
  /** The key a stage's files are kept under, below the URL: `<pr>/<commit>[/<member>]`. */
@@ -60,6 +60,14 @@ export type AwsCli = (args: string[], stdin: string) => Promise<void>;
60
60
  export declare const realAwsCli: AwsCli;
61
61
  /** A put for `target`. `aws` replaces the AWS CLI in a test. */
62
62
  export declare function reportPut(target: ReportTarget, aws?: AwsCli): ReportPut;
63
+ /** Reads one object: `key` below the URL. Resolves null for an object that is not there, and rejects with a line a person can read for any other failure. */
64
+ export type ReportGet = (key: string) => Promise<string | null>;
65
+ /** Runs the AWS CLI with `args` and resolves its stdout, rejecting with its error line on a non-zero exit. */
66
+ export type AwsRead = (args: string[]) => Promise<string>;
67
+ /** The AWS CLI on PATH, read for the body `aws s3 cp <s3 url> -` prints. */
68
+ export declare const realAwsRead: AwsRead;
69
+ /** A get for `target`. `aws` replaces the AWS CLI in a test. */
70
+ export declare function reportGet(target: ReportTarget, aws?: AwsRead): ReportGet;
63
71
  /** A stage's upload: its events as they are written, and its files at the end. */
64
72
  export interface PrReportUpload {
65
73
  /** The folder the stage's files go to: `<url>/<key>`. */
@@ -1 +1 @@
1
- {"version":3,"file":"pr-report-url.d.ts","sourceRoot":"","sources":["../src/pr-report-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAOH,mCAAmC;AACnC,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAkB5E;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG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,6JAA6J;AAC7J,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAEhE,8GAA8G;AAC9G,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE1D,4EAA4E;AAC5E,eAAO,MAAM,WAAW,EAAE,OAiBtB,CAAC;AAKL,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,GAAE,OAAqB,GAAG,SAAS,CAoBrF;AAED,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oGAAoG;IACpG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8EAA8E;IAC9E,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,+FAA+F;IAC/F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAQD,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,GAAG,cAAc,CA6DjB"}
@@ -34,11 +34,11 @@
34
34
  * CLI's own error line.
35
35
  */
36
36
  import { spawn } from "node:child_process";
37
- import { mkdirSync, renameSync, writeFileSync } from "node:fs";
37
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
38
38
  import { dirname, isAbsolute, join } from "node:path";
39
39
  import { fileURLToPath } from "node:url";
40
- /** `--report-url` read, or why it can't be. */
41
- export function parseReportUrl(raw) {
40
+ /** `--report-url` read, or why it can't be. `name` is what the error calls the value: the flag, or `ci.reportUrl` (#4160). */
41
+ export function parseReportUrl(raw, name = "--report-url") {
42
42
  const url = raw.trim();
43
43
  if (url.startsWith("file://")) {
44
44
  let dir;
@@ -46,10 +46,10 @@ export function parseReportUrl(raw) {
46
46
  dir = fileURLToPath(url);
47
47
  }
48
48
  catch (err) {
49
- return { error: `--report-url ${url}: ${err instanceof Error ? err.message : String(err)}` };
49
+ return { error: `${name} ${url}: ${err instanceof Error ? err.message : String(err)}` };
50
50
  }
51
51
  if (!isAbsolute(dir))
52
- return { error: `--report-url ${url}: a file URL names an absolute directory` };
52
+ return { error: `${name} ${url}: a file URL names an absolute directory` };
53
53
  return { scheme: "file", url: url.replace(/\/+$/, ""), dir };
54
54
  }
55
55
  const s3 = /^s3:\/\/([^/]+)\/?(.*)$/.exec(url);
@@ -57,7 +57,7 @@ export function parseReportUrl(raw) {
57
57
  const prefix = s3[2].replace(/\/+$/, "");
58
58
  return { scheme: "s3", url: `s3://${s3[1]}${prefix ? `/${prefix}` : ""}`, bucket: s3[1], prefix };
59
59
  }
60
- return { error: `--report-url ${url}: takes an s3://<bucket>/<prefix> or file://<directory> URL` };
60
+ return { error: `${name} ${url}: takes an s3://<bucket>/<prefix> or file://<directory> URL` };
61
61
  }
62
62
  /** The key a stage's files are kept under, below the URL: `<pr>/<commit>[/<member>]`. */
63
63
  export function reportKey(pr, commit, member) {
@@ -102,6 +102,52 @@ export function reportPut(target, aws = realAwsCli) {
102
102
  return aws(["s3", "cp", "-", object, "--content-type", contentType, "--only-show-errors"], body);
103
103
  };
104
104
  }
105
+ /** The AWS CLI on PATH, read for the body `aws s3 cp <s3 url> -` prints. */
106
+ export const realAwsRead = (args) => new Promise((resolveRead, reject) => {
107
+ const child = spawn(AWS_BINARY, args, { stdio: ["ignore", "pipe", "pipe"] });
108
+ const out = [];
109
+ let stderr = "";
110
+ child.stdout.on("data", (chunk) => out.push(chunk));
111
+ child.stderr.on("data", (chunk) => {
112
+ if (stderr.length < 4096)
113
+ stderr += chunk.toString("utf8");
114
+ });
115
+ child.on("error", (err) => reject(new Error(err.code === "ENOENT" ? "the AWS CLI (aws) is not on PATH; an s3 report URL is read with it" : err.message)));
116
+ child.on("close", (code) => {
117
+ if (code === 0)
118
+ return resolveRead(Buffer.concat(out).toString("utf8"));
119
+ const line = stderr.trim().split("\n").filter(Boolean).at(-1) ?? "";
120
+ reject(new Error(`aws s3 cp exited ${code}${line ? `: ${line.slice(0, 300)}` : ""}`));
121
+ });
122
+ });
123
+ /** What the AWS CLI says about an object that does not exist. */
124
+ const S3_ABSENT = /\(404\)|Not Found|NoSuchKey|does not exist/i;
125
+ /** A get for `target`. `aws` replaces the AWS CLI in a test. */
126
+ export function reportGet(target, aws = realAwsRead) {
127
+ if (target.scheme === "file") {
128
+ return async (key) => {
129
+ try {
130
+ return readFileSync(join(target.dir, ...key.split("/")), "utf-8");
131
+ }
132
+ catch (err) {
133
+ if (err.code === "ENOENT")
134
+ return null;
135
+ throw err;
136
+ }
137
+ };
138
+ }
139
+ return async (key) => {
140
+ const object = `s3://${target.bucket}/${target.prefix ? `${target.prefix}/` : ""}${key}`;
141
+ try {
142
+ return await aws(["s3", "cp", object, "-", "--only-show-errors"]);
143
+ }
144
+ catch (err) {
145
+ if (S3_ABSENT.test(messageOf(err)))
146
+ return null;
147
+ throw err;
148
+ }
149
+ };
150
+ }
105
151
  const UPLOAD_ON = new Set(["wave-settle", "component-settle", "run-settle"]);
106
152
  const NDJSON = "application/x-ndjson";
107
153
  const JSON_TYPE = "application/json";
@@ -18,14 +18,31 @@
18
18
  *
19
19
  * Run from source (the repository's `bin/chant` through tsx, vitest), this
20
20
  * module is itself TypeScript, the TypeScript loader is already there, and
21
- * both functions do nothing.
21
+ * both functions do nothing, except that {@link installCompiledCli} resolves
22
+ * chant's packages to their source (#3981, {@link installSourceResolution}).
22
23
  */
23
24
  /**
24
25
  * Called once by the CLI's `main()`. Compiled, it records that TypeScript
25
- * loads lazily and installs the `src/*.ts` to `dist/*.js` redirect; from
26
- * source it does nothing.
26
+ * loads lazily and installs the `src/*.ts` to `dist/*.js` redirect. From
27
+ * source it installs {@link installSourceResolution}.
27
28
  */
28
29
  export declare function installCompiledCli(): void;
30
+ /**
31
+ * #3981 — the compiled module for a lexicon's `src/*.ts`: `<lexicon>/dist/*.js`
32
+ * when it exists, as a URL, else `undefined`. A lexicon ships both, and its
33
+ * exports name the compiled one; fold reads a composite from the source, and
34
+ * an import that source makes must land on the module the plugin and the
35
+ * project already loaded, with no TypeScript loader.
36
+ */
37
+ export declare function lexiconCompiledTwin(url: string): string | undefined;
38
+ /**
39
+ * #3981 — the `development` target a chant package's `exports` give
40
+ * `specifier`, found from `parentPath`'s directory up through each
41
+ * `node_modules`, or `undefined` when there is none or its file does not
42
+ * exist. Reads exact keys and single-`*` patterns, the shapes chant's
43
+ * packages use; anything else is left to Node.
44
+ */
45
+ export declare function chantPackageSourceTarget(specifier: string, parentPath: string): string | undefined;
29
46
  /**
30
47
  * Register tsx for the ESM and CommonJS loaders, once, before importing
31
48
  * anything that may be TypeScript. A no-op from source, where tsx (or vitest)
@@ -34,13 +51,30 @@ export declare function installCompiledCli(): void;
34
51
  * CommonJS hook from source knows not to add a second one.
35
52
  */
36
53
  export declare function ensureTypeScriptLoader(): boolean;
54
+ /**
55
+ * #3981 — register tsx only when the module about to be imported is not
56
+ * JavaScript. `pathOrUrl` is the resolved module, a path or a file URL. A
57
+ * compiled lexicon (`dist/*.js`) imports with plain node, so a command that
58
+ * loads only compiled modules never pays for tsx's hooks thread. A `.ts`
59
+ * module, or one with no extension, registers tsx as before. Returns what
60
+ * {@link ensureTypeScriptLoader} does, or whether tsx is already registered
61
+ * when the module is JavaScript.
62
+ */
63
+ export declare function ensureTypeScriptLoaderFor(pathOrUrl: string): boolean;
64
+ /**
65
+ * #3981 — whether a caller about to import a module of unknown kind should
66
+ * resolve it first: true only in the compiled CLI before tsx is registered.
67
+ * From source, and once tsx is in, every module loads either way.
68
+ */
69
+ export declare function typeScriptLoaderPending(): boolean;
37
70
  /**
38
71
  * The source directory for a module of chant's own: `dirname` of `moduleUrl`
39
72
  * from source, and the matching directory under `<package>/src` when the
40
73
  * module runs from `<package>/dist`. The sandbox drivers hand chant's own
41
74
  * modules to esbuild by path, and must name the TypeScript source the
42
75
  * project's own `@intentius/chant/*` imports resolve to. String arithmetic
43
- * only: no filesystem access, so it is safe inside a sandboxed child.
76
+ * only: no filesystem access, so it is safe inside a sandboxed child. The
77
+ * same mapping as {@link moduleSourceDir}, which lexicons use.
44
78
  */
45
79
  export declare function chantSourceDir(moduleUrl: string): string;
46
80
  //# sourceMappingURL=ts-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ts-loader.d.ts","sourceRoot":"","sources":["../src/ts-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAoCH;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAwBzC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAShD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOxD"}
1
+ {"version":3,"file":"ts-loader.d.ts","sourceRoot":"","sources":["../src/ts-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAqCH;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CA+BzC;AAkCD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnE;AAID;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA0ClG;AAoCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAShD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAGpE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD"}