@intentius/chant 0.124.87 → 0.124.89

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 (483) hide show
  1. package/dist/action-pins.d.ts +1 -0
  2. package/dist/action-pins.d.ts.map +1 -1
  3. package/dist/action-pins.js +2 -0
  4. package/dist/actor.d.ts +47 -0
  5. package/dist/actor.d.ts.map +1 -0
  6. package/dist/actor.js +56 -0
  7. package/dist/bundle-check.d.ts +20 -5
  8. package/dist/bundle-check.d.ts.map +1 -1
  9. package/dist/bundle-check.js +20 -5
  10. package/dist/chant-install.d.ts +98 -0
  11. package/dist/chant-install.d.ts.map +1 -1
  12. package/dist/chant-install.js +203 -2
  13. package/dist/ci-base.d.ts +30 -0
  14. package/dist/ci-base.d.ts.map +1 -0
  15. package/dist/ci-base.js +33 -0
  16. package/dist/ci-comment-commands.d.ts +177 -0
  17. package/dist/ci-comment-commands.d.ts.map +1 -0
  18. package/dist/ci-comment-commands.js +325 -0
  19. package/dist/ci-comment-replies.d.ts +40 -0
  20. package/dist/ci-comment-replies.d.ts.map +1 -0
  21. package/dist/ci-comment-replies.js +59 -0
  22. package/dist/ci-commit.d.ts +1 -1
  23. package/dist/ci-commit.d.ts.map +1 -1
  24. package/dist/ci-commit.js +1 -2
  25. package/dist/ci-control.d.ts +1 -1
  26. package/dist/ci-control.d.ts.map +1 -1
  27. package/dist/ci-control.js +1 -1
  28. package/dist/ci-evidence-claims.d.ts +59 -0
  29. package/dist/ci-evidence-claims.d.ts.map +1 -0
  30. package/dist/ci-evidence-claims.js +87 -0
  31. package/dist/ci-evidence-from-job.d.ts +128 -0
  32. package/dist/ci-evidence-from-job.d.ts.map +1 -0
  33. package/dist/ci-evidence-from-job.js +203 -0
  34. package/dist/ci-evidence-jobs.d.ts +68 -4
  35. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  36. package/dist/ci-evidence-jobs.js +82 -5
  37. package/dist/ci-handover.d.ts +12 -0
  38. package/dist/ci-handover.d.ts.map +1 -1
  39. package/dist/ci-handover.js +15 -3
  40. package/dist/ci-identity.d.ts +32 -6
  41. package/dist/ci-identity.d.ts.map +1 -1
  42. package/dist/ci-identity.js +40 -8
  43. package/dist/ci-image.d.ts +65 -10
  44. package/dist/ci-image.d.ts.map +1 -1
  45. package/dist/ci-image.js +101 -22
  46. package/dist/ci-jobs.d.ts +1 -1
  47. package/dist/ci-jobs.d.ts.map +1 -1
  48. package/dist/ci-jobs.js +7 -2
  49. package/dist/ci-login.d.ts +75 -13
  50. package/dist/ci-login.d.ts.map +1 -1
  51. package/dist/ci-login.js +89 -37
  52. package/dist/ci-note-commands.d.ts +63 -3
  53. package/dist/ci-note-commands.d.ts.map +1 -1
  54. package/dist/ci-note-commands.js +69 -35
  55. package/dist/ci-product-words.d.ts +62 -1
  56. package/dist/ci-product-words.d.ts.map +1 -1
  57. package/dist/ci-product-words.js +52 -1
  58. package/dist/ci-product.d.ts +52 -2
  59. package/dist/ci-product.d.ts.map +1 -1
  60. package/dist/ci-product.js +51 -2
  61. package/dist/cli/commands/build.d.ts.map +1 -1
  62. package/dist/cli/commands/build.js +29 -2
  63. package/dist/cli/handlers/approve-confirm.d.ts +14 -0
  64. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
  65. package/dist/cli/handlers/approve-confirm.js +46 -0
  66. package/dist/cli/handlers/approve.d.ts.map +1 -1
  67. package/dist/cli/handlers/approve.js +2 -1
  68. package/dist/cli/handlers/build.d.ts +1 -1
  69. package/dist/cli/handlers/build.d.ts.map +1 -1
  70. package/dist/cli/handlers/build.js +22 -1
  71. package/dist/cli/handlers/ci-check.d.ts +1 -1
  72. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  73. package/dist/cli/handlers/ci-check.js +37 -7
  74. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  75. package/dist/cli/handlers/ci-evidence.js +255 -20
  76. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
  77. package/dist/cli/handlers/ci-forge-check.js +34 -17
  78. package/dist/cli/handlers/components.d.ts.map +1 -1
  79. package/dist/cli/handlers/components.js +3 -1
  80. package/dist/cli/handlers/generated-check.d.ts +11 -0
  81. package/dist/cli/handlers/generated-check.d.ts.map +1 -0
  82. package/dist/cli/handlers/generated-check.js +71 -0
  83. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  84. package/dist/cli/handlers/lifecycle.js +3 -0
  85. package/dist/cli/handlers/local-chant.d.ts +13 -0
  86. package/dist/cli/handlers/local-chant.d.ts.map +1 -1
  87. package/dist/cli/handlers/local-chant.js +42 -1
  88. package/dist/cli/handlers/lock.d.ts.map +1 -1
  89. package/dist/cli/handlers/lock.js +121 -4
  90. package/dist/cli/handlers/pr-comment.d.ts +21 -0
  91. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  92. package/dist/cli/handlers/pr-comment.js +112 -0
  93. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  94. package/dist/cli/handlers/pr-env.js +6 -3
  95. package/dist/cli/handlers/pr.d.ts +23 -1
  96. package/dist/cli/handlers/pr.d.ts.map +1 -1
  97. package/dist/cli/handlers/pr.js +97 -14
  98. package/dist/cli/handlers/promote.d.ts.map +1 -1
  99. package/dist/cli/handlers/promote.js +2 -1
  100. package/dist/cli/handlers/release.d.ts.map +1 -1
  101. package/dist/cli/handlers/release.js +11 -2
  102. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  103. package/dist/cli/handlers/run-wave.js +36 -2
  104. package/dist/cli/handlers/run.d.ts.map +1 -1
  105. package/dist/cli/handlers/run.js +2 -1
  106. package/dist/cli/main.d.ts.map +1 -1
  107. package/dist/cli/main.js +60 -4
  108. package/dist/cli/parse-args.d.ts.map +1 -1
  109. package/dist/cli/parse-args.js +82 -0
  110. package/dist/cli/registry.d.ts +35 -0
  111. package/dist/cli/registry.d.ts.map +1 -1
  112. package/dist/components/auto-release.d.ts.map +1 -1
  113. package/dist/components/auto-release.js +2 -1
  114. package/dist/components/check-hooks.d.ts +10 -0
  115. package/dist/components/check-hooks.d.ts.map +1 -1
  116. package/dist/components/check-hooks.js +18 -0
  117. package/dist/components/pr-checks.d.ts +169 -0
  118. package/dist/components/pr-checks.d.ts.map +1 -0
  119. package/dist/components/pr-checks.js +180 -0
  120. package/dist/components/pr-pipeline.d.ts +38 -0
  121. package/dist/components/pr-pipeline.d.ts.map +1 -1
  122. package/dist/components/pr-pipeline.js +6 -1
  123. package/dist/components/product-pipeline.d.ts +58 -2
  124. package/dist/components/product-pipeline.d.ts.map +1 -1
  125. package/dist/components/product-pipeline.js +76 -9
  126. package/dist/components/product-plan.d.ts +445 -7
  127. package/dist/components/product-plan.d.ts.map +1 -1
  128. package/dist/components/product-plan.js +426 -15
  129. package/dist/config.d.ts +10 -6
  130. package/dist/config.d.ts.map +1 -1
  131. package/dist/config.js +11 -6
  132. package/dist/control/consumers.d.ts +6 -0
  133. package/dist/control/consumers.d.ts.map +1 -1
  134. package/dist/control/consumers.js +6 -0
  135. package/dist/dead-guards.d.ts.map +1 -1
  136. package/dist/dead-guards.js +9 -6
  137. package/dist/discovery/files.d.ts +1 -1
  138. package/dist/discovery/files.js +1 -1
  139. package/dist/drift-issue.d.ts +20 -3
  140. package/dist/drift-issue.d.ts.map +1 -1
  141. package/dist/drift-issue.js +16 -0
  142. package/dist/drift-record.d.ts +52 -5
  143. package/dist/drift-record.d.ts.map +1 -1
  144. package/dist/drift-record.js +46 -6
  145. package/dist/floor-table.d.ts +6 -6
  146. package/dist/floor-table.d.ts.map +1 -1
  147. package/dist/floor-table.data.d.ts.map +1 -1
  148. package/dist/floor-table.data.js +81 -21
  149. package/dist/floor-table.js +10 -7
  150. package/dist/forge-check/contract.d.ts +19 -1
  151. package/dist/forge-check/contract.d.ts.map +1 -1
  152. package/dist/forge-check/contract.js +8 -2
  153. package/dist/forge-check/index.d.ts +4 -0
  154. package/dist/forge-check/index.d.ts.map +1 -1
  155. package/dist/forge-check/index.js +4 -0
  156. package/dist/forge-flags.d.ts +10 -0
  157. package/dist/forge-flags.d.ts.map +1 -1
  158. package/dist/forge-flags.js +31 -0
  159. package/dist/forge-remote.d.ts +47 -0
  160. package/dist/forge-remote.d.ts.map +1 -0
  161. package/dist/forge-remote.js +69 -0
  162. package/dist/gate-resume-run.d.ts +9 -1
  163. package/dist/gate-resume-run.d.ts.map +1 -1
  164. package/dist/gate-resume-run.js +26 -3
  165. package/dist/generated-check.d.ts +88 -0
  166. package/dist/generated-check.d.ts.map +1 -0
  167. package/dist/generated-check.js +248 -0
  168. package/dist/image-pins.d.ts +26 -0
  169. package/dist/image-pins.d.ts.map +1 -0
  170. package/dist/image-pins.js +19 -0
  171. package/dist/lexicon.d.ts +27 -0
  172. package/dist/lexicon.d.ts.map +1 -1
  173. package/dist/lifecycle/git.d.ts +11 -0
  174. package/dist/lifecycle/git.d.ts.map +1 -1
  175. package/dist/lifecycle/git.js +30 -3
  176. package/dist/lifecycle/publish-npm.d.ts +26 -0
  177. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  178. package/dist/lifecycle/publish-npm.js +76 -4
  179. package/dist/lifecycle/reach-locks.d.ts +131 -0
  180. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  181. package/dist/lifecycle/reach-locks.js +118 -0
  182. package/dist/lifecycle/release-cut.d.ts +3 -1
  183. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  184. package/dist/lifecycle/release-cut.js +15 -0
  185. package/dist/lifecycle/release-images.d.ts +22 -1
  186. package/dist/lifecycle/release-images.d.ts.map +1 -1
  187. package/dist/lifecycle/release-images.js +26 -3
  188. package/dist/lifecycle/release-ledger.d.ts +4 -3
  189. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  190. package/dist/lifecycle/release-ledger.js +3 -2
  191. package/dist/local-chant.d.ts +57 -3
  192. package/dist/local-chant.d.ts.map +1 -1
  193. package/dist/local-chant.js +122 -13
  194. package/dist/notify-product.d.ts +12 -3
  195. package/dist/notify-product.d.ts.map +1 -1
  196. package/dist/notify-product.js +10 -6
  197. package/dist/op/activities/source-release.d.ts.map +1 -1
  198. package/dist/op/activities/source-release.js +2 -1
  199. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  200. package/dist/op/activities/source-rollback.js +2 -1
  201. package/dist/op/index.d.ts +2 -0
  202. package/dist/op/index.d.ts.map +1 -1
  203. package/dist/op/index.js +1 -0
  204. package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
  205. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
  206. package/dist/op/op-waves-evidence-jobs.js +118 -0
  207. package/dist/op/op-waves-evidence.d.ts +12 -1
  208. package/dist/op/op-waves-evidence.d.ts.map +1 -1
  209. package/dist/op/op-waves-evidence.js +23 -2
  210. package/dist/op/op-waves-render-spec.d.ts +100 -0
  211. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  212. package/dist/op/op-waves-render-spec.js +162 -0
  213. package/dist/op/op-waves-run.d.ts +14 -1
  214. package/dist/op/op-waves-run.d.ts.map +1 -1
  215. package/dist/op/op-waves-run.js +56 -4
  216. package/dist/op/op-waves.d.ts +12 -0
  217. package/dist/op/op-waves.d.ts.map +1 -1
  218. package/dist/op/op-waves.js +14 -1
  219. package/dist/op/schedule-overdue.d.ts +39 -2
  220. package/dist/op/schedule-overdue.d.ts.map +1 -1
  221. package/dist/op/schedule-overdue.js +148 -10
  222. package/dist/op/wave-stop.d.ts +64 -0
  223. package/dist/op/wave-stop.d.ts.map +1 -0
  224. package/dist/op/wave-stop.js +127 -0
  225. package/dist/planned-files.d.ts +76 -0
  226. package/dist/planned-files.d.ts.map +1 -0
  227. package/dist/planned-files.js +108 -0
  228. package/dist/pr-forge-job.d.ts +22 -0
  229. package/dist/pr-forge-job.d.ts.map +1 -0
  230. package/dist/pr-forge-job.js +46 -0
  231. package/dist/pr-forge-reads.d.ts +21 -1
  232. package/dist/pr-forge-reads.d.ts.map +1 -1
  233. package/dist/pr-forge-reads.js +19 -1
  234. package/dist/pr-forge.d.ts +7 -1
  235. package/dist/pr-forge.d.ts.map +1 -1
  236. package/dist/pr-forge.js +7 -2
  237. package/dist/pr-loop.d.ts +3 -6
  238. package/dist/pr-loop.d.ts.map +1 -1
  239. package/dist/pr-loop.js +4 -81
  240. package/dist/pr-plan-note.d.ts +121 -0
  241. package/dist/pr-plan-note.d.ts.map +1 -1
  242. package/dist/pr-plan-note.js +104 -1
  243. package/dist/pr-plan-record.d.ts +47 -0
  244. package/dist/pr-plan-record.d.ts.map +1 -0
  245. package/dist/pr-plan-record.js +89 -0
  246. package/dist/pr-post.d.ts +68 -3
  247. package/dist/pr-post.d.ts.map +1 -1
  248. package/dist/pr-post.js +218 -13
  249. package/dist/pr-requires.d.ts +8 -0
  250. package/dist/pr-requires.d.ts.map +1 -1
  251. package/dist/pr-requires.js +3 -1
  252. package/dist/pr-status.d.ts +16 -0
  253. package/dist/pr-status.d.ts.map +1 -0
  254. package/dist/pr-status.js +90 -0
  255. package/dist/ref-gate-init.d.ts +90 -0
  256. package/dist/ref-gate-init.d.ts.map +1 -0
  257. package/dist/ref-gate-init.js +155 -0
  258. package/dist/ref-gate-rules.d.ts +19 -0
  259. package/dist/ref-gate-rules.d.ts.map +1 -0
  260. package/dist/ref-gate-rules.js +17 -0
  261. package/dist/release-floors.d.ts +100 -16
  262. package/dist/release-floors.d.ts.map +1 -1
  263. package/dist/release-floors.js +101 -17
  264. package/dist/render-module.d.ts +15 -0
  265. package/dist/render-module.d.ts.map +1 -0
  266. package/dist/render-module.js +73 -0
  267. package/dist/state-migration.d.ts +24 -1
  268. package/dist/state-migration.d.ts.map +1 -1
  269. package/dist/state-migration.js +39 -4
  270. package/dist/state-unlock.d.ts +32 -1
  271. package/dist/state-unlock.d.ts.map +1 -1
  272. package/dist/state-unlock.js +31 -0
  273. package/dist/wave-runtime.mjs +307 -297
  274. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  275. package/dist/workspace/ci-green-cli.js +15 -8
  276. package/dist/workspace/drift-cli.d.ts +1 -1
  277. package/dist/workspace/drift-cli.d.ts.map +1 -1
  278. package/dist/workspace/drift-cli.js +5 -12
  279. package/dist/workspace/forge-work.d.ts +3 -2
  280. package/dist/workspace/forge-work.d.ts.map +1 -1
  281. package/dist/workspace/forge-work.js +7 -17
  282. package/dist/workspace/lexicon-outputs.js +2 -2
  283. package/dist/workspace/release-train.d.ts.map +1 -1
  284. package/dist/workspace/release-train.js +2 -1
  285. package/dist/workspace/release-workflow.d.ts +27 -3
  286. package/dist/workspace/release-workflow.d.ts.map +1 -1
  287. package/dist/workspace/release-workflow.js +52 -7
  288. package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
  289. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  290. package/dist/workspace/trust/check-evidence-report.js +28 -8
  291. package/dist/workspace/trust/check-evidence.d.ts +13 -1
  292. package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
  293. package/dist/workspace/trust/check-evidence.js +8 -3
  294. package/dist/workspace/trust/evidence.d.ts +5 -0
  295. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  296. package/dist/workspace/trust/evidence.js +5 -0
  297. package/dist/workspace/trust/open-evidence.d.ts +67 -0
  298. package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
  299. package/dist/workspace/trust/open-evidence.js +92 -0
  300. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  301. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  302. package/dist/workspace/trust/ref-gate-cli.js +93 -11
  303. package/dist/workspace/trust/ref-gate.d.ts +61 -2
  304. package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
  305. package/dist/workspace/trust/ref-gate.js +72 -7
  306. package/dist/workspace/workspace-run.d.ts.map +1 -1
  307. package/dist/workspace/workspace-run.js +2 -1
  308. package/package.json +1 -1
  309. package/src/action-pins.ts +2 -0
  310. package/src/actor.test.ts +78 -0
  311. package/src/actor.ts +79 -0
  312. package/src/bundle-check.test.ts +22 -0
  313. package/src/bundle-check.ts +33 -5
  314. package/src/chant-install.test.ts +108 -1
  315. package/src/chant-install.ts +242 -2
  316. package/src/ci-base.test.ts +41 -0
  317. package/src/ci-base.ts +43 -0
  318. package/src/ci-comment-commands.test.ts +376 -0
  319. package/src/ci-comment-commands.ts +389 -0
  320. package/src/ci-comment-replies.ts +78 -0
  321. package/src/ci-commit.test.ts +51 -6
  322. package/src/ci-commit.ts +1 -2
  323. package/src/ci-control.ts +1 -0
  324. package/src/ci-evidence-claims.ts +102 -0
  325. package/src/ci-evidence-from-job.test.ts +165 -0
  326. package/src/ci-evidence-from-job.ts +251 -0
  327. package/src/ci-evidence-jobs.ts +88 -6
  328. package/src/ci-handover.ts +16 -3
  329. package/src/ci-identity.test.ts +3 -3
  330. package/src/ci-identity.ts +51 -11
  331. package/src/ci-image.test.ts +187 -16
  332. package/src/ci-image.ts +157 -25
  333. package/src/ci-jobs.ts +7 -2
  334. package/src/ci-login.test.ts +131 -3
  335. package/src/ci-login.token-drop.test.ts +204 -0
  336. package/src/ci-login.ts +137 -39
  337. package/src/ci-note-commands.ts +104 -41
  338. package/src/ci-product-words.ts +89 -0
  339. package/src/ci-product.ts +62 -1
  340. package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
  341. package/src/cli/commands/build.test.ts +41 -0
  342. package/src/cli/commands/build.ts +27 -2
  343. package/src/cli/handlers/approve-confirm.test.ts +35 -0
  344. package/src/cli/handlers/approve-confirm.ts +44 -0
  345. package/src/cli/handlers/approve.ts +2 -1
  346. package/src/cli/handlers/build-source-dir.test.ts +4 -0
  347. package/src/cli/handlers/build.ts +20 -2
  348. package/src/cli/handlers/ci-check.ts +37 -7
  349. package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
  350. package/src/cli/handlers/ci-evidence.ts +233 -18
  351. package/src/cli/handlers/ci-forge-check.ts +22 -9
  352. package/src/cli/handlers/components.ts +3 -1
  353. package/src/cli/handlers/generated-check.ts +69 -0
  354. package/src/cli/handlers/lifecycle.test.ts +20 -0
  355. package/src/cli/handlers/lifecycle.ts +4 -0
  356. package/src/cli/handlers/local-chant.ts +39 -1
  357. package/src/cli/handlers/lock-reach.test.ts +103 -0
  358. package/src/cli/handlers/lock.ts +100 -4
  359. package/src/cli/handlers/pr-comment.ts +104 -0
  360. package/src/cli/handlers/pr-env.ts +6 -3
  361. package/src/cli/handlers/pr-record.test.ts +1 -1
  362. package/src/cli/handlers/pr.ts +93 -15
  363. package/src/cli/handlers/promote.ts +2 -1
  364. package/src/cli/handlers/release.e2e.test.ts +35 -0
  365. package/src/cli/handlers/release.ts +14 -2
  366. package/src/cli/handlers/run-wave.ts +35 -2
  367. package/src/cli/handlers/run.ts +2 -1
  368. package/src/cli/main.ts +60 -4
  369. package/src/cli/parse-args.ts +58 -0
  370. package/src/cli/registry.ts +35 -0
  371. package/src/components/auto-release.ts +2 -1
  372. package/src/components/check-hooks.ts +22 -0
  373. package/src/components/check-report-summary.test.ts +78 -0
  374. package/src/components/pr-checks.ts +254 -0
  375. package/src/components/pr-pipeline.ts +43 -1
  376. package/src/components/product-pipeline.ts +113 -9
  377. package/src/components/product-plan.test.ts +140 -1
  378. package/src/components/product-plan.ts +707 -20
  379. package/src/config.ts +13 -8
  380. package/src/control/consumers.ts +7 -0
  381. package/src/dead-guards.test.ts +27 -5
  382. package/src/dead-guards.ts +9 -6
  383. package/src/discovery/files.ts +1 -1
  384. package/src/drift-issue.test.ts +29 -1
  385. package/src/drift-issue.ts +28 -3
  386. package/src/drift-record.test.ts +45 -0
  387. package/src/drift-record.ts +71 -6
  388. package/src/floor-table.data.ts +81 -21
  389. package/src/floor-table.ts +12 -9
  390. package/src/forge-check/contract.ts +23 -2
  391. package/src/forge-check/forge-check.test.ts +25 -0
  392. package/src/forge-check/index.ts +4 -0
  393. package/src/forge-flags.test.ts +25 -1
  394. package/src/forge-flags.ts +34 -0
  395. package/src/forge-remote.test.ts +37 -0
  396. package/src/forge-remote.ts +79 -0
  397. package/src/gate-resume-run.ts +27 -3
  398. package/src/generated-check.e2e.test.ts +118 -0
  399. package/src/generated-check.test.ts +170 -0
  400. package/src/generated-check.ts +310 -0
  401. package/src/image-pins.ts +31 -0
  402. package/src/lexicon.ts +28 -0
  403. package/src/lifecycle/git.test.ts +48 -0
  404. package/src/lifecycle/git.ts +27 -4
  405. package/src/lifecycle/publish-npm.ts +87 -4
  406. package/src/lifecycle/reach-locks.test.ts +87 -0
  407. package/src/lifecycle/reach-locks.ts +169 -0
  408. package/src/lifecycle/release-catalog.test.ts +2 -2
  409. package/src/lifecycle/release-cut.ts +17 -1
  410. package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
  411. package/src/lifecycle/release-images.test.ts +100 -0
  412. package/src/lifecycle/release-images.ts +38 -3
  413. package/src/lifecycle/release-ledger.ts +4 -3
  414. package/src/local-chant.e2e.test.ts +81 -6
  415. package/src/local-chant.test.ts +22 -3
  416. package/src/local-chant.ts +130 -13
  417. package/src/notify-product.ts +19 -8
  418. package/src/op/activities/source-release.ts +2 -1
  419. package/src/op/activities/source-rollback.ts +2 -1
  420. package/src/op/gate-resume.test.ts +27 -0
  421. package/src/op/index.ts +10 -0
  422. package/src/op/op-waves-evidence-jobs.ts +140 -0
  423. package/src/op/op-waves-evidence.test.ts +36 -3
  424. package/src/op/op-waves-evidence.ts +23 -3
  425. package/src/op/op-waves-notify-words.test.ts +18 -0
  426. package/src/op/op-waves-render-spec.test.ts +160 -0
  427. package/src/op/op-waves-render-spec.ts +171 -0
  428. package/src/op/op-waves-run.ts +59 -3
  429. package/src/op/op-waves.ts +16 -2
  430. package/src/op/schedule-overdue.test.ts +126 -1
  431. package/src/op/schedule-overdue.ts +164 -12
  432. package/src/op/wave-stop.test.ts +72 -0
  433. package/src/op/wave-stop.ts +137 -0
  434. package/src/planned-files.test.ts +80 -0
  435. package/src/planned-files.ts +134 -0
  436. package/src/pr-forge-job.test.ts +53 -0
  437. package/src/pr-forge-job.ts +46 -0
  438. package/src/pr-forge-reads-compare.test.ts +2 -1
  439. package/src/pr-forge-reads.ts +37 -1
  440. package/src/pr-forge.ts +14 -3
  441. package/src/pr-loop-narrowed.test.ts +2 -1
  442. package/src/pr-loop-words.test.ts +2 -1
  443. package/src/pr-loop.test.ts +1 -2
  444. package/src/pr-loop.ts +4 -80
  445. package/src/pr-plan-note.ts +184 -3
  446. package/src/pr-plan-record.test.ts +75 -0
  447. package/src/pr-plan-record.ts +101 -0
  448. package/src/pr-post-plan-note.test.ts +60 -0
  449. package/src/pr-post-replan.test.ts +144 -0
  450. package/src/pr-post-subject.test.ts +230 -0
  451. package/src/pr-post.test.ts +32 -1
  452. package/src/pr-post.ts +254 -15
  453. package/src/pr-requires.test.ts +20 -0
  454. package/src/pr-requires.ts +10 -1
  455. package/src/pr-status.ts +91 -0
  456. package/src/ref-gate-init.ts +208 -0
  457. package/src/ref-gate-rules.ts +26 -0
  458. package/src/release-floors.ts +139 -17
  459. package/src/render-module.ts +73 -0
  460. package/src/state-migration-record.test.ts +89 -0
  461. package/src/state-migration.test.ts +1 -1
  462. package/src/state-migration.ts +52 -4
  463. package/src/state-unlock.test.ts +33 -1
  464. package/src/state-unlock.ts +49 -1
  465. package/src/workspace/ci-green-cli.ts +14 -7
  466. package/src/workspace/ci-green-workflow.test.ts +32 -1
  467. package/src/workspace/drift-cli.ts +6 -18
  468. package/src/workspace/forge-work.ts +7 -14
  469. package/src/workspace/lexicon-outputs.ts +2 -2
  470. package/src/workspace/release-train.ts +2 -1
  471. package/src/workspace/release-workflow.test.ts +104 -3
  472. package/src/workspace/release-workflow.ts +60 -9
  473. package/src/workspace/trust/check-evidence-report.ts +39 -8
  474. package/src/workspace/trust/check-evidence.test.ts +5 -0
  475. package/src/workspace/trust/check-evidence.ts +17 -5
  476. package/src/workspace/trust/evidence.ts +5 -0
  477. package/src/workspace/trust/open-evidence.ts +129 -0
  478. package/src/workspace/trust/ref-gate-cli.ts +88 -10
  479. package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
  480. package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
  481. package/src/workspace/trust/ref-gate.test.ts +10 -0
  482. package/src/workspace/trust/ref-gate.ts +87 -6
  483. package/src/workspace/workspace-run.ts +2 -1
@@ -0,0 +1,87 @@
1
+ /**
2
+ * #4979: `chant lock --reach`, the targets a change reaches by the pipeline's
3
+ * reach line, after the pull request's head is fetched and checked, and
4
+ * GitLab's `--open` over every open merge request.
5
+ */
6
+ import { describe, expect, test } from "vitest";
7
+ import { pullRequestHeadRef, REACH_HEAD_REF, reachedTargets, reachOpen, type ReachRun } from "./reach-locks";
8
+
9
+ const HEAD = "c".repeat(40);
10
+ const BASE = "b".repeat(40);
11
+
12
+ /** A run that answers git and the reach line as given, and keeps what it was asked. */
13
+ function runs(o: { fetch?: number; head?: string; out?: string; status?: number; stderr?: string } = {}) {
14
+ const calls: Array<{ argv: string[]; env?: Record<string, string | undefined> }> = [];
15
+ const run: ReachRun = (argv, opts) => {
16
+ calls.push({ argv, ...(opts.env ? { env: opts.env } : {}) });
17
+ if (argv[1] === "fetch") return { status: o.fetch ?? 0, stdout: "", stderr: o.fetch ? "fatal: couldn't find remote ref" : "" };
18
+ if (argv[1] === "rev-parse") return { status: 0, stdout: `${o.head ?? HEAD}\n`, stderr: "" };
19
+ return { status: o.status ?? 0, stdout: o.out ?? "", stderr: o.stderr ?? "" };
20
+ };
21
+ return { run, calls };
22
+ }
23
+
24
+ describe("reachedTargets (#4979)", () => {
25
+ test("fetches the head, runs the line with BASE_SHA, HEAD_SHA and PR_NUMBER, and locks each name once, sorted", () => {
26
+ const r = runs({ out: "envs/prod/app\n\nenvs/dev/network\n envs/prod/app \n" });
27
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: "terragucci reached", env: { PATH: "/bin" }, run: r.run })).toEqual({ targets: ["envs/dev/network", "envs/prod/app"] });
28
+ expect(r.calls[0]!.argv).toEqual(["git", "fetch", "-q", "--no-tags", "origin", `+refs/pull/7/head:${REACH_HEAD_REF}`]);
29
+ expect(r.calls[2]!.argv).toEqual(["sh", "-c", "terragucci reached"]);
30
+ expect(r.calls[2]!.env).toEqual({ PATH: "/bin", BASE_SHA: BASE, HEAD_SHA: HEAD, PR_NUMBER: "7" });
31
+ });
32
+
33
+ test("GitLab's head is the merge request's ref", () => {
34
+ expect(pullRequestHeadRef("gitlab", 3)).toBe("refs/merge-requests/3/head");
35
+ expect(pullRequestHeadRef("forgejo", 3)).toBe("refs/pull/3/head");
36
+ });
37
+
38
+ test("a head that moved is left to its own run, and nothing is read", () => {
39
+ const r = runs({ head: "d".repeat(40) });
40
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: "x", run: r.run })).toEqual({ moved: "pull request 7 moved to dddddddddddd after cccccccccccc, so the run of that push locks it" });
41
+ expect(r.calls.map((c) => c.argv[0])).toEqual(["git", "git"]);
42
+ });
43
+
44
+ test("a fetch, a line that fails, or a name with a control character says why", () => {
45
+ expect(reachedTargets({ forge: "gitlab", pr: 7, head: HEAD, base: BASE, line: "x", run: runs({ fetch: 128 }).run })).toEqual({ error: "could not fetch merge request !7's head (fatal: couldn't find remote ref)" });
46
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: "x", run: runs({ status: 2, stderr: "no layers" }).run })).toEqual({ error: "the reach line exited 2: no layers" });
47
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: "x", run: runs({ out: "a\u001b[31mb\n" }).run })).toMatchObject({ error: expect.stringMatching(/is not a target name/) });
48
+ expect(reachedTargets({ forge: "github", pr: 7, head: "main", base: BASE, line: "x", run: runs().run })).toEqual({ error: '--head "main" is not a commit sha' });
49
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: " ", run: runs().run })).toEqual({ error: "the reach line in CHANT_LOCK_REACH is empty" });
50
+ });
51
+
52
+ test("a change that reaches nothing locks nothing", () => {
53
+ expect(reachedTargets({ forge: "github", pr: 7, head: HEAD, base: BASE, line: "x", run: runs({ out: "" }).run })).toEqual({ targets: [] });
54
+ });
55
+ });
56
+
57
+ describe("reachOpen, GitLab's lock job (#4979)", () => {
58
+ test("locks each open merge request from the project into the branch, skips a fork, and releases a closed holder's locks", async () => {
59
+ const took: Array<[number, string, string[]]> = [];
60
+ const released: number[] = [];
61
+ const got = await reachOpen({
62
+ forge: "gitlab",
63
+ base: BASE,
64
+ line: "x",
65
+ branch: "main",
66
+ run: runs({ out: "envs/dev\n" }).run,
67
+ open: [
68
+ { number: 1, headSha: HEAD, base: "main", fork: false },
69
+ { number: 2, headSha: HEAD, base: "main", fork: true },
70
+ { number: 3, headSha: HEAD, base: "release", fork: false },
71
+ { number: 4, headSha: HEAD, base: "main", fork: false },
72
+ ],
73
+ take: async (pr, head, targets) => {
74
+ took.push([pr, head, targets]);
75
+ return pr === 4 ? { ok: false, held: "envs/dev is locked by merge request !1, so merge request !4 is not locked" } : { ok: true, released: [] };
76
+ },
77
+ holders: async () => [1, 5, 6],
78
+ isOpen: async (pr) => pr === 6,
79
+ release: async (pr) => (released.push(pr), ["envs/old"]),
80
+ });
81
+ expect(took).toEqual([[1, HEAD, ["envs/dev"]], [4, HEAD, ["envs/dev"]]]);
82
+ expect(got.outcomes.map((o) => [o.pr, o.kind])).toEqual([[1, "locked"], [2, "skipped"], [3, "skipped"], [4, "held"]]);
83
+ // !5 is closed; !6 is open into another branch, so it keeps its locks.
84
+ expect(released).toEqual([5]);
85
+ expect(got.released).toEqual([{ pr: 5, targets: ["envs/old"] }]);
86
+ });
87
+ });
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Locks on what a change reaches (#4979): `chant lock --reach`.
3
+ *
4
+ * A pull request's plan locks (`ci.locks: plan`, #4293) come from what its
5
+ * plan selected, which the plan job, running the change's code, wrote. A
6
+ * product that knows from the change's files alone which of its targets a
7
+ * change reaches, such as terragucci's roots, units and instances, gives a
8
+ * reach line instead: one shell line, written in the pipeline at the target
9
+ * branch's commit, that prints the targets the change from `$BASE_SHA` to
10
+ * `$HEAD_SHA` reaches, one a line. It reads the change as data from git
11
+ * (`git diff`, `git show <sha>:<path>`) and runs none of its code.
12
+ *
13
+ * The lock job runs it in a checkout of the target branch's commit. chant
14
+ * first fetches the pull request's head from the forge (`refs/pull/<n>/head`,
15
+ * GitLab's `refs/merge-requests/<n>/head`) and checks it is still the commit
16
+ * the job was started for: a head that moved is left to the run of the push
17
+ * that moved it. The line's variables are `BASE_SHA`, `HEAD_SHA` and
18
+ * `PR_NUMBER`; it holds the job's environment, and the line is the
19
+ * pipeline's, so none of the change's code runs with the job's token.
20
+ *
21
+ * On GitLab a merge request's pipeline is built from the merge request's own
22
+ * files, so its lock job runs in the target branch's plan notes pipeline and
23
+ * locks every open merge request from the project (`--open`), and releases
24
+ * the locks of a merge request that is no longer open.
25
+ */
26
+
27
+ import { spawnSync } from "node:child_process";
28
+ import type { ForgeKind } from "../pr-forge";
29
+
30
+ /** The variable the reach line is in: the pipeline's, set as the step's variable so no shell quoting carries it (#4979). */
31
+ export const LOCK_REACH_ENV = "CHANT_LOCK_REACH";
32
+
33
+ /** Where chant fetches the pull request's head to before the reach line runs (#4979). */
34
+ export const REACH_HEAD_REF = "refs/remotes/chant/pull-request-head";
35
+
36
+ /** A target name a reach line may print: no control characters, at most 512 characters. */
37
+ const TARGET_LINE = /^[^\u0000-\u001f\u007f]{1,512}$/;
38
+ const SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
39
+
40
+ /** The forge's ref for pull request `pr`'s head. */
41
+ export function pullRequestHeadRef(forge: ForgeKind, pr: number): string {
42
+ return forge === "gitlab" ? `refs/merge-requests/${pr}/head` : `refs/pull/${pr}/head`;
43
+ }
44
+
45
+ /** A process run, as `spawnSync` answers it. */
46
+ export type ReachRun = (argv: string[], o: { cwd?: string; env?: Record<string, string | undefined> }) => { status: number | null; stdout: string; stderr: string };
47
+
48
+ const defaultRun: ReachRun = (argv, o) => {
49
+ const r = spawnSync(argv[0]!, argv.slice(1), { encoding: "utf8", ...(o.cwd ? { cwd: o.cwd } : {}), ...(o.env ? { env: o.env as NodeJS.ProcessEnv } : {}) });
50
+ return { status: r.status, stdout: r.stdout ?? "", stderr: r.error ? r.error.message : (r.stderr ?? "") };
51
+ };
52
+
53
+ /** What {@link reachedTargets} takes. */
54
+ export interface ReachInput {
55
+ forge: ForgeKind;
56
+ pr: number;
57
+ /** The head the job was started for. */
58
+ head: string;
59
+ /** The target branch's commit the change is measured from. */
60
+ base: string;
61
+ /** The reach line. */
62
+ line: string;
63
+ cwd?: string;
64
+ /** The line's environment, to which `BASE_SHA`, `HEAD_SHA` and `PR_NUMBER` are added. Default the process's. */
65
+ env?: Record<string, string | undefined>;
66
+ run?: ReachRun;
67
+ }
68
+
69
+ /** The targets a change reaches, sorted; or that its head moved; or why the line could not say. */
70
+ export type Reached = { targets: string[] } | { moved: string } | { error: string };
71
+
72
+ /**
73
+ * The targets the change of pull request `pr` reaches (#4979): fetch its
74
+ * head, check it is `head`, and run the reach line. Blank lines are left
75
+ * out; a line holding a control character fails the read, so a target name
76
+ * never carries one into the lock file.
77
+ */
78
+ export function reachedTargets(i: ReachInput): Reached {
79
+ const run = i.run ?? defaultRun;
80
+ const name = i.forge === "gitlab" ? `merge request !${i.pr}` : `pull request ${i.pr}`;
81
+ if (!SHA.test(i.head)) return { error: `--head ${JSON.stringify(i.head)} is not a commit sha` };
82
+ if (!SHA.test(i.base)) return { error: `--base ${JSON.stringify(i.base)} is not a commit sha` };
83
+ if (!i.line.trim()) return { error: `the reach line in ${LOCK_REACH_ENV} is empty` };
84
+ const fetched = run(["git", "fetch", "-q", "--no-tags", "origin", `+${pullRequestHeadRef(i.forge, i.pr)}:${REACH_HEAD_REF}`], { ...(i.cwd ? { cwd: i.cwd } : {}) });
85
+ if (fetched.status !== 0) return { error: `could not fetch ${name}'s head (${fetched.stderr.trim() || `git exited ${fetched.status}`})` };
86
+ const now = run(["git", "rev-parse", REACH_HEAD_REF], { ...(i.cwd ? { cwd: i.cwd } : {}) }).stdout.trim();
87
+ if (now !== i.head) return { moved: `${name} moved to ${now.slice(0, 12) || "another commit"} after ${i.head.slice(0, 12)}, so the run of that push locks it` };
88
+ const env = { ...(i.env ?? process.env), BASE_SHA: i.base, HEAD_SHA: i.head, PR_NUMBER: String(i.pr) };
89
+ const out = run(["sh", "-c", i.line], { ...(i.cwd ? { cwd: i.cwd } : {}), env });
90
+ if (out.status !== 0) return { error: `the reach line exited ${out.status ?? "on a signal"}${out.stderr.trim() ? `: ${out.stderr.trim().split("\n").slice(-3).join(" ")}` : ""}` };
91
+ const targets = new Set<string>();
92
+ for (const raw of out.stdout.split("\n")) {
93
+ const t = raw.trim();
94
+ if (t === "") continue;
95
+ if (!TARGET_LINE.test(t)) return { error: `the reach line printed ${JSON.stringify(t.slice(0, 80))}, which is not a target name: one a line, no control characters, at most 512 characters` };
96
+ targets.add(t);
97
+ }
98
+ return { targets: [...targets].sort() };
99
+ }
100
+
101
+ /** One open pull request as {@link reachOpen} locks it. */
102
+ export interface ReachOpenPull {
103
+ number: number;
104
+ headSha: string;
105
+ base: string;
106
+ fork: boolean;
107
+ }
108
+
109
+ /** What one open pull request's lock came to. */
110
+ export type ReachOpenOutcome =
111
+ | { pr: number; kind: "locked"; targets: string[]; released: string[] }
112
+ | { pr: number; kind: "held"; text: string }
113
+ | { pr: number; kind: "skipped"; text: string }
114
+ | { pr: number; kind: "failed"; text: string };
115
+
116
+ /** What {@link reachOpen} takes besides the reach input of each pull request. */
117
+ export interface ReachOpenInput extends Omit<ReachInput, "pr" | "head"> {
118
+ /** The branch the pull requests merge into. */
119
+ branch: string;
120
+ open: readonly ReachOpenPull[];
121
+ /** Take the locks of one pull request; `held` names what another holds. */
122
+ take(pr: number, head: string, targets: string[]): Promise<{ ok: true; released: string[] } | { ok: false; held: string }>;
123
+ /** The pull requests that hold a lock now. */
124
+ holders(): Promise<number[]>;
125
+ /** Whether a holder outside the open list is open still (one that merges into another branch). */
126
+ isOpen(pr: number): Promise<boolean>;
127
+ /** Release every lock of a pull request that is no longer open. */
128
+ release(pr: number): Promise<string[]>;
129
+ }
130
+
131
+ /**
132
+ * `chant lock --reach --open` (#4979), GitLab's lock job in the target
133
+ * branch's plan notes pipeline: lock what each open merge request from the
134
+ * project that merges into `branch` reaches, then release the locks of every
135
+ * holder that is not open any more. A fork's merge request takes no lock.
136
+ */
137
+ export async function reachOpen(i: ReachOpenInput): Promise<{ outcomes: ReachOpenOutcome[]; released: Array<{ pr: number; targets: string[] }> }> {
138
+ const outcomes: ReachOpenOutcome[] = [];
139
+ const open = new Set<number>();
140
+ for (const p of i.open) {
141
+ open.add(p.number);
142
+ if (p.fork) {
143
+ outcomes.push({ pr: p.number, kind: "skipped", text: `!${p.number} comes from a fork, so it takes no lock` });
144
+ continue;
145
+ }
146
+ if (p.base !== i.branch) {
147
+ outcomes.push({ pr: p.number, kind: "skipped", text: `!${p.number} merges into ${p.base}, not ${i.branch}` });
148
+ continue;
149
+ }
150
+ const r = reachedTargets({ ...i, pr: p.number, head: p.headSha });
151
+ if ("error" in r) {
152
+ outcomes.push({ pr: p.number, kind: "failed", text: r.error });
153
+ continue;
154
+ }
155
+ if ("moved" in r) {
156
+ outcomes.push({ pr: p.number, kind: "skipped", text: r.moved });
157
+ continue;
158
+ }
159
+ const took = await i.take(p.number, p.headSha, r.targets);
160
+ outcomes.push(took.ok ? { pr: p.number, kind: "locked", targets: r.targets, released: took.released } : { pr: p.number, kind: "held", text: took.held });
161
+ }
162
+ const released: Array<{ pr: number; targets: string[] }> = [];
163
+ for (const pr of await i.holders()) {
164
+ if (open.has(pr) || (await i.isOpen(pr))) continue;
165
+ const targets = await i.release(pr);
166
+ if (targets.length > 0) released.push({ pr, targets });
167
+ }
168
+ return { outcomes, released };
169
+ }
@@ -11,7 +11,7 @@ import { spawnSync } from "node:child_process";
11
11
  import { writeFileSync } from "node:fs";
12
12
  import { join } from "node:path";
13
13
  import schema from "../workspace/release-catalog.schema.json";
14
- import { appendReleaseRecord, InvalidReleaseRecordError, readReleaseLedger, RELEASE_VERSION_FLOOR, type ReleaseRecord } from "./release-ledger";
14
+ import { appendReleaseRecord, InvalidReleaseRecordError, readReleaseLedger, RELEASE_RECORD_VERSION_FLOOR, type ReleaseRecord } from "./release-ledger";
15
15
  import { parseReleaseLedger } from "./release-read";
16
16
  import {
17
17
  buildReleaseCatalog,
@@ -46,7 +46,7 @@ describe("release catalog schema", () => {
46
46
 
47
47
  test("its floors shipped in 0.124.55", () => {
48
48
  expect(RELEASE_CATALOG_FLOOR).toBe("0.124.55");
49
- expect(RELEASE_VERSION_FLOOR).toBe("0.124.55");
49
+ expect(RELEASE_RECORD_VERSION_FLOOR).toBe("0.124.55");
50
50
  });
51
51
  });
52
52
 
@@ -120,7 +120,10 @@ export type ReleaseCutCode =
120
120
  | "release-version-invalid"
121
121
  | "release-unsigned"
122
122
  | "release-signer-refused"
123
- | "declaration-invalid";
123
+ | "declaration-invalid"
124
+ /** #4941: the npm target's image check, run by the cut (./publish-npm.ts `checkPackageImages`). */
125
+ | "publish-npm-carries-image"
126
+ | "publish-npm-pack-failed";
124
127
 
125
128
  export class ReleaseCutError extends Error {
126
129
  constructor(
@@ -722,6 +725,19 @@ export async function cutRelease(req: CutRequest): Promise<CutResult> {
722
725
  }
723
726
  const { targets, templates } = targetsOf(compiled);
724
727
  const release = makeRelease({ member: p.member, commit, artifactDigests: artifacts, targets });
728
+ // #4941: an npm package that would carry an image archive stops the cut here, before anything is recorded or
729
+ // tagged, rather than the publish job once the label is spent. The check is the npm target's own plan check.
730
+ if (release.artifactDigests.some((a) => a.kind === "image" && a.path !== "")) {
731
+ const { loadChantConfig } = await import("../config");
732
+ const { checkDeclaredPackageImages } = await import("./publish-npm");
733
+ const { PublishTargetError } = await import("./release-publish");
734
+ try {
735
+ checkDeclaredPackageImages((await loadChantConfig(cwd)).config.release?.publish ?? [], release, cwd);
736
+ } catch (err) {
737
+ if (err instanceof PublishTargetError) throw new ReleaseCutError(err.code as ReleaseCutCode, `no release was cut: ${err.message}`, err.fix);
738
+ throw err;
739
+ }
740
+ }
725
741
  const timestamp = (req.now ?? (() => new Date()))().toISOString();
726
742
  const signed = { releaseDigest: release.releaseDigest, label: req.label, actor: req.actor, timestamp };
727
743
  let signature: string | null = null;
@@ -54,6 +54,26 @@ describe("a release.images entry that names a Dockerfile (#4819)", () => {
54
54
  );
55
55
  });
56
56
 
57
+ test("args go to the build as build arguments, so sql-yodeler's release-image.sh is a Dockerfile entry (#4908)", () => {
58
+ const entry = {
59
+ name: "sql-yodeler",
60
+ dockerfile: ".github/image/Dockerfile",
61
+ context: "dist/image-context",
62
+ prepare: "mkdir -p dist/image-context && npm pack --pack-destination dist/image-context",
63
+ args: { YODEL_PACKAGE: "/ctx/intentius-sql-yodeler-0.14.0.tgz", CHANT_PINS: "@intentius/chant@0.124.87 @intentius/chant-lexicon-sql@0.124.87" },
64
+ };
65
+ expect(releaseImageBuildCommand(entry, { versionArg: true })).toContain(
66
+ `--build-arg SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" --build-arg CHANT_RELEASE_LABEL="$CHANT_RELEASE_LABEL" --build-arg YODEL_PACKAGE=/ctx/intentius-sql-yodeler-0.14.0.tgz --build-arg 'CHANT_PINS=@intentius/chant@0.124.87 @intentius/chant-lexicon-sql@0.124.87' --output`,
67
+ );
68
+ expect(releaseImageBuildCommand(entry)).toContain(" -f .github/image/Dockerfile dist/image-context >&2");
69
+ expect(() => checkReleaseImages([entry])).not.toThrow();
70
+ expect(() => checkReleaseImages([{ ...entry, args: { "BAD-NAME": "x" } }])).toThrow(/not a build argument name/);
71
+ expect(() => checkReleaseImages([{ ...entry, args: { SOURCE_DATE_EPOCH: "0" } }])).toThrow(/chant passes itself/);
72
+ expect(() => checkReleaseImages([{ ...entry, args: { A: "x\ny" } }])).toThrow(/one-line/);
73
+ const parsed = ChantConfigSchema.safeParse({ release: { images: [entry] } });
74
+ expect(parsed.success).toBe(true);
75
+ });
76
+
57
77
  test("the archive defaults to dist/images/<name>.tar, and a build entry is as it was", () => {
58
78
  const images: ReleaseImageDeclaration[] = [
59
79
  { name: "pulumi", dockerfile: "images/plywood-pulumi/Dockerfile" },
@@ -21,6 +21,7 @@ import {
21
21
  pinnedDigests,
22
22
  readPins,
23
23
  releaseImageDigests,
24
+ releaseImagePlatforms,
24
25
  ReleaseImageError,
25
26
  unknownPins,
26
27
  writeReleaseDigests,
@@ -45,6 +46,13 @@ describe("release.images (#4657)", () => {
45
46
  expect(() => checkReleaseImages([{ name: "a", build: "x", archive: "../a.tar" }])).toThrow(/not a path inside the member/);
46
47
  });
47
48
 
49
+ test("the platforms the images build: a Dockerfile entry's or the default, and a command entry's own (#4876)", () => {
50
+ expect(releaseImagePlatforms([{ name: "a", dockerfile: "Dockerfile" }])).toEqual(["linux/amd64", "linux/arm64"]);
51
+ expect(releaseImagePlatforms([{ name: "a", dockerfile: "Dockerfile", platforms: ["linux/amd64"] }, { name: "b", build: "x", archive: "b.tar" }])).toEqual(["linux/amd64"]);
52
+ expect(releaseImagePlatforms([{ name: "b", build: "x", archive: "b.tar", platforms: ["linux/arm64", "linux/amd64"] }])).toEqual(["linux/amd64", "linux/arm64"]);
53
+ expect(() => checkReleaseImages([{ name: "b", build: "x", archive: "b.tar", platforms: ["arm64"] }])).toThrow(/os\/arch/);
54
+ });
55
+
48
56
  test("each build runs with SOURCE_DATE_EPOCH and the label, and its archive's top manifest digest is recorded", () => {
49
57
  const r = new TestRepo("release-images-build");
50
58
  repos.push(r);
@@ -240,3 +248,95 @@ test("the digests file is sorted JSON of name to digest", () => {
240
248
  expect(readFileSync(file, "utf-8")).toBe(`{\n "a": "${D("2")}",\n "z": "${D("1")}"\n}\n`);
241
249
  writeFileSync(file, "");
242
250
  });
251
+
252
+ describe("an npm package that would carry an image archive (#4934)", () => {
253
+ /** A member that is itself the package, as sql-yodeler's is, with the image archive under dist/images and `files` as given. */
254
+ const fixture = (name: string, files: string[]): { dir: string; release: Release } => {
255
+ const r = new TestRepo(name);
256
+ repos.push(r);
257
+ writePackage(r.dir, "@acme/app", "2.0.0");
258
+ const pkg = JSON.parse(readFileSync(join(r.dir, "package.json"), "utf-8")) as Record<string, unknown>;
259
+ writeFileSync(join(r.dir, "package.json"), JSON.stringify({ ...pkg, files }, null, 2));
260
+ mkdirSync(join(r.dir, "dist", "images"), { recursive: true });
261
+ writeFileSync(join(r.dir, "dist", "index.js"), "export {};\n");
262
+ writeFileSync(join(r.dir, "dist", "images", "app.tar"), "image bytes");
263
+ const image: ReleaseArtifact = { component: "app", kind: "image", path: "dist/images/app.tar", digest: D("a") };
264
+ return { dir: r.dir, release: { artifactDigests: [image] } as unknown as Release };
265
+ };
266
+ const planOf = async (dir: string, release: Release) => {
267
+ const [target] = await createPublishTargets([PublishDeclarationSchema.parse({ type: "npm", packages: ["."] })], {});
268
+ const env = { PATH: process.env.PATH ?? "", HOME: process.env.HOME ?? "" };
269
+ const ctx: PublishContext = { release, label: "v2", releaseTag: "release/v2", provenance: NO_OIDC, cwd: dir, tag: null, env, redactor: createRedactor(env), log: () => {} };
270
+ return target!.plan(ctx);
271
+ };
272
+
273
+ test("a package whose files takes the archive's directory is refused at plan time, naming the file and the files entry to add", async () => {
274
+ const { dir, release } = fixture("npm-carries-image", ["dist", "sbom.spdx.json"]);
275
+ const err = await planOf(dir, release).catch((e: unknown) => e);
276
+ expect(err).toBeInstanceOf(PublishTargetError);
277
+ expect((err as PublishTargetError).code).toBe("publish-npm-carries-image");
278
+ expect((err as PublishTargetError).message).toContain("would carry dist/images/app.tar");
279
+ expect((err as PublishTargetError).fix).toContain('Add "!dist/images/app.tar" to "files" in package.json');
280
+ });
281
+
282
+ test("the same package with the archive left out plans", async () => {
283
+ const { dir, release } = fixture("npm-leaves-image-out", ["dist", "!dist/images/app.tar", "sbom.spdx.json"]);
284
+ expect((await planOf(dir, release)).map((i) => i.name)).toEqual(["@acme/app@2.0.0"]);
285
+ });
286
+
287
+ /** #4941: a member whose release.publish has an npm target for the package at its root, cut with an image built into dist/images. */
288
+ const cutCarrying = async (name: string, files: string[]) => {
289
+ const r = new TestRepo(name);
290
+ repos.push(r);
291
+ r.write("chant.config.ts", `export default { environments: ["dev"], release: { publish: [{ type: "npm", packages: ["."] }] } };\n`);
292
+ r.write("package.json", JSON.stringify({ name: "@acme/app", version: "2.0.0", files }, null, 2));
293
+ r.write(".gitignore", "dist/\n");
294
+ const head = r.commit("init");
295
+ r.git(["tag", `ci/green/${head}`]);
296
+ const compiler: TargetCompiler = {
297
+ async compile(env): Promise<CompiledTarget> {
298
+ writeFileSync(join(r.dir, "dist", "index.js"), "export {};\n");
299
+ return { env, params: [], components: [], buildSteps: {}, buildInputs: {}, componentFiles: {}, templates: [{ component: null, path: "dist/out.json", content: "{}\n" }] };
300
+ },
301
+ async buildArtifacts(): Promise<ReleaseArtifact[]> {
302
+ return [];
303
+ },
304
+ };
305
+ const cut = cutRelease({
306
+ cwd: r.dir,
307
+ compiler,
308
+ label: "v2",
309
+ actor: "alice",
310
+ env: {},
311
+ buildImages: () =>
312
+ buildReleaseImages({
313
+ images: [{ name: "app", build: "build", archive: "dist/images/app.tar" }],
314
+ cwd: r.dir,
315
+ sourceDateEpoch: 1762473600,
316
+ label: "v2",
317
+ archiveDigest: ociArchiveDigest,
318
+ run: (_c, o) => {
319
+ writeOciLayout(join(o.cwd, "dist/images/app.tar"), "app layer");
320
+ return 0;
321
+ },
322
+ }),
323
+ });
324
+ return { r, cut };
325
+ };
326
+
327
+ test("#4941: a cut whose npm package would carry the image archive stops before it records anything, so the label is not spent", async () => {
328
+ const { r, cut } = await cutCarrying("cut-carries-image", ["dist"]);
329
+ const err = await cut.catch((e: unknown) => e);
330
+ expect(err).toBeInstanceOf(ReleaseCutError);
331
+ expect((err as ReleaseCutError).code).toBe("publish-npm-carries-image");
332
+ expect((err as ReleaseCutError).message).toMatch(/^no release was cut: @acme\/app \(\.\) would carry dist\/images\/app\.tar\//);
333
+ expect((err as ReleaseCutError).fix).toContain('Add "!dist/images/app.tar" to "files" in package.json');
334
+ expect(() => r.git(["rev-parse", "--verify", "--quiet", "refs/heads/chant/lifecycle"])).toThrow();
335
+ });
336
+
337
+ test("#4941: the same cut with the archive left out of the package records the release", async () => {
338
+ const { cut } = await cutCarrying("cut-leaves-image-out", ["dist", "!dist/images/app.tar"]);
339
+ const { release } = await cut;
340
+ expect(release.artifactDigests.map((a) => a.component)).toEqual(["app"]);
341
+ });
342
+ });
@@ -26,7 +26,7 @@
26
26
  * the reproducible build itself ({@link releaseImageBuildCommand}), a
27
27
  * `docker-container` buildx builder writing an OCI archive with timestamps
28
28
  * rewritten from `SOURCE_DATE_EPOCH` and no attestations, for every
29
- * platform. Its `prepare` command (the bundle the image carries, a packed
29
+ * platform, with the entry's own build arguments (`args`, #4908). Its `prepare` command (the bundle the image carries, a packed
30
30
  * package) runs first with no digests file named, so the image is the same
31
31
  * in the cut and the publish job. A product's package build turns the
32
32
  * digests file and its `{ name: reference }` into the table it bakes in with
@@ -54,6 +54,9 @@ export const RELEASE_IMAGES_FLOOR = "0.124.71";
54
54
  */
55
55
  export const RELEASE_IMAGE_DOCKERFILE_FLOOR = "0.124.78";
56
56
 
57
+ /** The first chant whose Dockerfile entry in `release.images` takes `args`, build arguments beside the two chant passes (#4908). */
58
+ export const RELEASE_IMAGE_ARGS_FLOOR = "0.124.88";
59
+
57
60
  /** One image a release builds in its cut with a command of the product's. */
58
61
  export interface ReleaseImageBuild {
59
62
  /** The image's name: its key in the digests file, and its artifact's `component` in the release. */
@@ -62,6 +65,12 @@ export interface ReleaseImageBuild {
62
65
  build: string;
63
66
  /** The OCI archive the command writes, a layout directory or a tar file, relative to the member. The `oci` target's `image`. */
64
67
  archive: string;
68
+ /**
69
+ * The platforms the command builds, such as `["linux/amd64", "linux/arm64"]`
70
+ * (#4876). chant does not pass them to the command; `chant release workflow`
71
+ * reads them to set up QEMU for those the runner can't run. Unset: none.
72
+ */
73
+ platforms?: string[];
65
74
  }
66
75
 
67
76
  /** One image chant builds from a Dockerfile (#4819). */
@@ -77,6 +86,13 @@ export interface ReleaseImageDockerfile {
77
86
  archive?: string;
78
87
  /** A command run once before the builds, with `CHANT_RELEASE_DIGESTS` unset: what the image copies in, such as the bundle or a packed package. */
79
88
  prepare?: string;
89
+ /**
90
+ * Build arguments beside `SOURCE_DATE_EPOCH` and `CHANT_RELEASE_LABEL`
91
+ * (#4908), such as the packed package's file and the chant packages the
92
+ * image installs beside it, as sql-yodeler's `release-image.sh` passed
93
+ * them. Values are literal; the config computes them.
94
+ */
95
+ args?: Record<string, string>;
80
96
  }
81
97
 
82
98
  /** One image a release builds in its cut. */
@@ -112,7 +128,9 @@ export function releaseImageBuildCommand(i: ReleaseImageDockerfile, o: { version
112
128
  `mkdir -p ${sh(posix.dirname(archive))}`,
113
129
  [
114
130
  `docker buildx build --builder ${b} --no-cache --platform ${sh((i.platforms ?? RELEASE_IMAGE_PLATFORMS).join(","))}`,
115
- `--provenance=false --sbom=false --build-arg SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH"${o.versionArg ? ' --build-arg CHANT_RELEASE_LABEL="$CHANT_RELEASE_LABEL"' : ""}`,
131
+ `--provenance=false --sbom=false --build-arg SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH"${o.versionArg ? ' --build-arg CHANT_RELEASE_LABEL="$CHANT_RELEASE_LABEL"' : ""}${Object.entries(i.args ?? {})
132
+ .map(([k, v]) => ` --build-arg ${sh(`${k}=${v}`)}`)
133
+ .join("")}`,
116
134
  `--output ${sh(`type=oci,dest=${archive},rewrite-timestamp=true`)} -f ${sh(i.dockerfile)} ${sh(i.context ?? ".")} >&2`,
117
135
  ].join(" "),
118
136
  ].join(" && ");
@@ -123,6 +141,15 @@ export function resolveReleaseImages(images: readonly ReleaseImageDeclaration[],
123
141
  return images.map((i) => (isDockerfile(i) ? { name: i.name, build: releaseImageBuildCommand(i, o), archive: archiveOf(i) } : i));
124
142
  }
125
143
 
144
+ /**
145
+ * Every platform the images build (#4876): a Dockerfile entry's, or
146
+ * {@link RELEASE_IMAGE_PLATFORMS} when it names none, and a command entry's
147
+ * `platforms`. Sorted, each once.
148
+ */
149
+ export function releaseImagePlatforms(images: readonly ReleaseImageDeclaration[]): string[] {
150
+ return [...new Set(images.flatMap((i) => (isDockerfile(i) ? (i.platforms ?? RELEASE_IMAGE_PLATFORMS) : (i.platforms ?? []))))].sort();
151
+ }
152
+
126
153
  export class ReleaseImageError extends Error {
127
154
  constructor(
128
155
  readonly code: string,
@@ -135,6 +162,9 @@ export class ReleaseImageError extends Error {
135
162
  }
136
163
 
137
164
  const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
165
+ const BUILD_ARG = /^[A-Za-z_][A-Za-z0-9_]*$/;
166
+ /** The build arguments chant passes itself, which an entry's `args` cannot set. */
167
+ const CHANT_BUILD_ARGS = ["SOURCE_DATE_EPOCH", "CHANT_RELEASE_LABEL"];
138
168
 
139
169
  const outside = (p: string): boolean => isAbsolute(p) || p.split(/[\\/]/).includes("..");
140
170
 
@@ -150,7 +180,12 @@ export function checkReleaseImages(images: readonly ReleaseImageDeclaration[]):
150
180
  for (const [what, p] of paths) {
151
181
  if (p !== undefined && outside(p)) throw new ReleaseImageError("release-image-archive-outside", `release.images "${i.name}": ${what} ${p} is not a path inside the member`);
152
182
  }
153
- if (isDockerfile(i) && i.platforms !== undefined && (i.platforms.length === 0 || !i.platforms.every((p) => PLATFORM.test(p)))) {
183
+ for (const [k, v] of Object.entries((isDockerfile(i) && i.args) || {})) {
184
+ if (!BUILD_ARG.test(k)) throw new ReleaseImageError("release-image-invalid", `release.images "${i.name}": args names ${JSON.stringify(k)}, which is not a build argument name`);
185
+ if (CHANT_BUILD_ARGS.includes(k)) throw new ReleaseImageError("release-image-invalid", `release.images "${i.name}": args sets ${k}, which chant passes itself`);
186
+ if (typeof v !== "string" || /[\r\n]/.test(v)) throw new ReleaseImageError("release-image-invalid", `release.images "${i.name}": args.${k} is not a one-line string`);
187
+ }
188
+ if (i.platforms !== undefined && (i.platforms.length === 0 || !i.platforms.every((p) => PLATFORM.test(p)))) {
154
189
  throw new ReleaseImageError("release-image-invalid", `release.images "${i.name}": platforms is a list of os/arch such as linux/amd64, not ${JSON.stringify(i.platforms)}`);
155
190
  }
156
191
  }
@@ -78,9 +78,10 @@ export const RUN_ORIGIN_JOB_FLOOR = "0.124.32";
78
78
  /**
79
79
  * The first chant that writes and reads `releaseVersion` on a release record
80
80
  * (#4595). A record from an older chant has none, and a reader lists it by
81
- * digest.
81
+ * digest. It was named `RELEASE_VERSION_FLOOR` until #4916 gave that name to
82
+ * ./release-version.ts alone, the floor of `release.version`.
82
83
  */
83
- export const RELEASE_VERSION_FLOOR = "0.124.55";
84
+ export const RELEASE_RECORD_VERSION_FLOOR = "0.124.55";
84
85
 
85
86
  /**
86
87
  * The gate resolution that admitted a deploy (#4020): the gate's address in the
@@ -291,7 +292,7 @@ export interface ReleaseRecord {
291
292
  * Optional: the version the publish gave this release (#4595), such as a
292
293
  * module's `1.4.0` or a package's `2.0.0-rc.1`, when the component has
293
294
  * versions of its own. `version` is taken by the record's schema version,
294
- * so the field has this name. Written from {@link RELEASE_VERSION_FLOOR};
295
+ * so the field has this name. Written from {@link RELEASE_RECORD_VERSION_FLOOR};
295
296
  * absent on older records and on deploys that name no version. The
296
297
  * release catalog (./release-catalog.ts) lists a version by it, and a
297
298
  * record without one by its digest.