@intentius/chant 0.124.88 → 0.124.90

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 (377) hide show
  1. package/dist/actor.d.ts +36 -1
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +39 -1
  4. package/dist/chant-install.d.ts.map +1 -1
  5. package/dist/chant-install.js +1 -2
  6. package/dist/ci-base.d.ts +30 -0
  7. package/dist/ci-base.d.ts.map +1 -0
  8. package/dist/ci-base.js +33 -0
  9. package/dist/ci-comment-commands.d.ts +193 -0
  10. package/dist/ci-comment-commands.d.ts.map +1 -0
  11. package/dist/ci-comment-commands.js +353 -0
  12. package/dist/ci-comment-replies.d.ts +40 -0
  13. package/dist/ci-comment-replies.d.ts.map +1 -0
  14. package/dist/ci-comment-replies.js +59 -0
  15. package/dist/ci-evidence-from-job.d.ts +25 -0
  16. package/dist/ci-evidence-from-job.d.ts.map +1 -1
  17. package/dist/ci-evidence-from-job.js +43 -2
  18. package/dist/ci-evidence-jobs.d.ts +30 -1
  19. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  20. package/dist/ci-evidence-jobs.js +46 -3
  21. package/dist/ci-image.d.ts +21 -4
  22. package/dist/ci-image.d.ts.map +1 -1
  23. package/dist/ci-image.js +62 -10
  24. package/dist/ci-job-guard.d.ts +42 -45
  25. package/dist/ci-job-guard.d.ts.map +1 -1
  26. package/dist/ci-job-guard.js +206 -3
  27. package/dist/ci-note-commands.d.ts +104 -4
  28. package/dist/ci-note-commands.d.ts.map +1 -1
  29. package/dist/ci-note-commands.js +131 -38
  30. package/dist/ci-product-words.d.ts +42 -0
  31. package/dist/ci-product-words.d.ts.map +1 -1
  32. package/dist/ci-product-words.js +25 -0
  33. package/dist/ci-product.d.ts +72 -1
  34. package/dist/ci-product.d.ts.map +1 -1
  35. package/dist/ci-product.js +73 -6
  36. package/dist/cli/commands/build.d.ts.map +1 -1
  37. package/dist/cli/commands/build.js +29 -2
  38. package/dist/cli/handlers/approve.d.ts.map +1 -1
  39. package/dist/cli/handlers/approve.js +2 -1
  40. package/dist/cli/handlers/ci-check.d.ts +1 -1
  41. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  42. package/dist/cli/handlers/ci-check.js +17 -7
  43. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  44. package/dist/cli/handlers/ci-evidence.js +33 -7
  45. package/dist/cli/handlers/components.d.ts.map +1 -1
  46. package/dist/cli/handlers/components.js +3 -1
  47. package/dist/cli/handlers/generated-check.d.ts +8 -0
  48. package/dist/cli/handlers/generated-check.d.ts.map +1 -1
  49. package/dist/cli/handlers/generated-check.js +31 -1
  50. package/dist/cli/handlers/lock.d.ts.map +1 -1
  51. package/dist/cli/handlers/lock.js +121 -4
  52. package/dist/cli/handlers/pr-comment.d.ts +33 -0
  53. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  54. package/dist/cli/handlers/pr-comment.js +201 -0
  55. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  56. package/dist/cli/handlers/pr-env.js +6 -3
  57. package/dist/cli/handlers/pr-notes.d.ts.map +1 -1
  58. package/dist/cli/handlers/pr-notes.js +23 -1
  59. package/dist/cli/handlers/pr.d.ts +23 -1
  60. package/dist/cli/handlers/pr.d.ts.map +1 -1
  61. package/dist/cli/handlers/pr.js +71 -23
  62. package/dist/cli/handlers/promote.d.ts.map +1 -1
  63. package/dist/cli/handlers/promote.js +2 -1
  64. package/dist/cli/handlers/release.d.ts.map +1 -1
  65. package/dist/cli/handlers/release.js +11 -2
  66. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  67. package/dist/cli/handlers/run-wave.js +180 -4
  68. package/dist/cli/handlers/run.d.ts.map +1 -1
  69. package/dist/cli/handlers/run.js +2 -1
  70. package/dist/cli/main.d.ts.map +1 -1
  71. package/dist/cli/main.js +41 -2
  72. package/dist/cli/parse-args.d.ts.map +1 -1
  73. package/dist/cli/parse-args.js +31 -0
  74. package/dist/cli/registry.d.ts +19 -1
  75. package/dist/cli/registry.d.ts.map +1 -1
  76. package/dist/components/auto-release.d.ts.map +1 -1
  77. package/dist/components/auto-release.js +2 -1
  78. package/dist/components/pr-checks.d.ts +97 -6
  79. package/dist/components/pr-checks.d.ts.map +1 -1
  80. package/dist/components/pr-checks.js +107 -13
  81. package/dist/components/pr-pipeline.d.ts +19 -14
  82. package/dist/components/pr-pipeline.d.ts.map +1 -1
  83. package/dist/components/pr-pipeline.js +7 -13
  84. package/dist/components/product-pipeline.d.ts +96 -3
  85. package/dist/components/product-pipeline.d.ts.map +1 -1
  86. package/dist/components/product-pipeline.js +120 -14
  87. package/dist/components/product-plan.d.ts +203 -6
  88. package/dist/components/product-plan.d.ts.map +1 -1
  89. package/dist/components/product-plan.js +250 -43
  90. package/dist/drift-record.d.ts +7 -0
  91. package/dist/drift-record.d.ts.map +1 -1
  92. package/dist/drift-record.js +19 -0
  93. package/dist/floor-table.data.d.ts.map +1 -1
  94. package/dist/floor-table.data.js +63 -31
  95. package/dist/forge-check/contract.d.ts +11 -1
  96. package/dist/forge-check/contract.d.ts.map +1 -1
  97. package/dist/forge-check/contract.js +4 -1
  98. package/dist/forge-check/index.d.ts +2 -0
  99. package/dist/forge-check/index.d.ts.map +1 -1
  100. package/dist/forge-check/index.js +2 -0
  101. package/dist/gate-resume-run.d.ts +9 -1
  102. package/dist/gate-resume-run.d.ts.map +1 -1
  103. package/dist/gate-resume-run.js +26 -3
  104. package/dist/generated-check.d.ts +18 -4
  105. package/dist/generated-check.d.ts.map +1 -1
  106. package/dist/generated-check.js +37 -5
  107. package/dist/image-pins.d.ts +26 -0
  108. package/dist/image-pins.d.ts.map +1 -0
  109. package/dist/image-pins.js +19 -0
  110. package/dist/lexicon.d.ts +93 -4
  111. package/dist/lexicon.d.ts.map +1 -1
  112. package/dist/lifecycle/gate-applied.d.ts +9 -0
  113. package/dist/lifecycle/gate-applied.d.ts.map +1 -1
  114. package/dist/lifecycle/git.d.ts +11 -0
  115. package/dist/lifecycle/git.d.ts.map +1 -1
  116. package/dist/lifecycle/git.js +30 -3
  117. package/dist/lifecycle/publish-npm.d.ts +11 -0
  118. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  119. package/dist/lifecycle/publish-npm.js +27 -1
  120. package/dist/lifecycle/reach-locks.d.ts +131 -0
  121. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  122. package/dist/lifecycle/reach-locks.js +118 -0
  123. package/dist/lifecycle/release-cut.d.ts +3 -1
  124. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  125. package/dist/lifecycle/release-cut.js +15 -0
  126. package/dist/lifecycle/release-images.d.ts.map +1 -1
  127. package/dist/lifecycle/release-images.js +1 -2
  128. package/dist/notify-product.d.ts +12 -3
  129. package/dist/notify-product.d.ts.map +1 -1
  130. package/dist/notify-product.js +10 -6
  131. package/dist/op/activities/source-release.d.ts.map +1 -1
  132. package/dist/op/activities/source-release.js +2 -1
  133. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  134. package/dist/op/activities/source-rollback.js +2 -1
  135. package/dist/op/apply-status.d.ts +84 -0
  136. package/dist/op/apply-status.d.ts.map +1 -0
  137. package/dist/op/apply-status.js +106 -0
  138. package/dist/op/before-merge-decide.d.ts +102 -0
  139. package/dist/op/before-merge-decide.d.ts.map +1 -0
  140. package/dist/op/before-merge-decide.js +142 -0
  141. package/dist/op/before-merge-done.d.ts +56 -0
  142. package/dist/op/before-merge-done.d.ts.map +1 -0
  143. package/dist/op/before-merge-done.js +69 -0
  144. package/dist/op/before-merge-store.d.ts +20 -0
  145. package/dist/op/before-merge-store.d.ts.map +1 -0
  146. package/dist/op/before-merge-store.js +48 -0
  147. package/dist/op/before-merge.d.ts +150 -0
  148. package/dist/op/before-merge.d.ts.map +1 -0
  149. package/dist/op/before-merge.js +207 -0
  150. package/dist/op/follow-on-run.d.ts +117 -0
  151. package/dist/op/follow-on-run.d.ts.map +1 -0
  152. package/dist/op/follow-on-run.js +154 -0
  153. package/dist/op/follow-on-store.d.ts +17 -0
  154. package/dist/op/follow-on-store.d.ts.map +1 -0
  155. package/dist/op/follow-on-store.js +54 -0
  156. package/dist/op/gate.d.ts +6 -0
  157. package/dist/op/gate.d.ts.map +1 -1
  158. package/dist/op/gate.js +10 -1
  159. package/dist/op/index.d.ts +5 -1
  160. package/dist/op/index.d.ts.map +1 -1
  161. package/dist/op/index.js +2 -0
  162. package/dist/op/op-waves-after-plan.d.ts +13 -0
  163. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  164. package/dist/op/op-waves-evidence-jobs.d.ts +10 -2
  165. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  166. package/dist/op/op-waves-evidence-jobs.js +19 -5
  167. package/dist/op/op-waves-follow-on.d.ts +162 -0
  168. package/dist/op/op-waves-follow-on.d.ts.map +1 -0
  169. package/dist/op/op-waves-follow-on.js +355 -0
  170. package/dist/op/op-waves-render-spec.d.ts +100 -0
  171. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  172. package/dist/op/op-waves-render-spec.js +162 -0
  173. package/dist/op/op-waves-run.d.ts +148 -6
  174. package/dist/op/op-waves-run.d.ts.map +1 -1
  175. package/dist/op/op-waves-run.js +873 -100
  176. package/dist/op/op-waves-split.d.ts +122 -0
  177. package/dist/op/op-waves-split.d.ts.map +1 -0
  178. package/dist/op/op-waves-split.js +166 -0
  179. package/dist/op/op-waves.d.ts +24 -0
  180. package/dist/op/op-waves.d.ts.map +1 -1
  181. package/dist/op/op-waves.js +18 -1
  182. package/dist/op/schedule-overdue.d.ts +15 -1
  183. package/dist/op/schedule-overdue.d.ts.map +1 -1
  184. package/dist/op/schedule-overdue.js +77 -5
  185. package/dist/op/stage-hooks.d.ts +36 -1
  186. package/dist/op/stage-hooks.d.ts.map +1 -1
  187. package/dist/op/stage-hooks.js +17 -3
  188. package/dist/op/wave-stop.d.ts +67 -0
  189. package/dist/op/wave-stop.d.ts.map +1 -0
  190. package/dist/op/wave-stop.js +129 -0
  191. package/dist/planned-files.d.ts +76 -0
  192. package/dist/planned-files.d.ts.map +1 -0
  193. package/dist/planned-files.js +108 -0
  194. package/dist/pr-forge-job.d.ts +22 -0
  195. package/dist/pr-forge-job.d.ts.map +1 -0
  196. package/dist/pr-forge-job.js +46 -0
  197. package/dist/pr-loop.d.ts +3 -6
  198. package/dist/pr-loop.d.ts.map +1 -1
  199. package/dist/pr-loop.js +4 -81
  200. package/dist/pr-plan-note.d.ts +97 -0
  201. package/dist/pr-plan-note.d.ts.map +1 -1
  202. package/dist/pr-plan-note.js +94 -1
  203. package/dist/pr-post.d.ts +28 -3
  204. package/dist/pr-post.d.ts.map +1 -1
  205. package/dist/pr-post.js +146 -13
  206. package/dist/pr-status.d.ts +16 -0
  207. package/dist/pr-status.d.ts.map +1 -0
  208. package/dist/pr-status.js +90 -0
  209. package/dist/ref-gate-init.d.ts +16 -2
  210. package/dist/ref-gate-init.d.ts.map +1 -1
  211. package/dist/ref-gate-init.js +24 -13
  212. package/dist/release-floors.d.ts +39 -1
  213. package/dist/release-floors.d.ts.map +1 -1
  214. package/dist/release-floors.js +63 -25
  215. package/dist/render-module.d.ts +15 -0
  216. package/dist/render-module.d.ts.map +1 -0
  217. package/dist/render-module.js +73 -0
  218. package/dist/state-migration.d.ts.map +1 -1
  219. package/dist/state-migration.js +1 -2
  220. package/dist/wave-blocked.d.ts +7 -1
  221. package/dist/wave-blocked.d.ts.map +1 -1
  222. package/dist/wave-blocked.js +7 -2
  223. package/dist/wave-runtime.mjs +366 -350
  224. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  225. package/dist/workspace/ci-green-cli.js +3 -2
  226. package/dist/workspace/release-train.d.ts.map +1 -1
  227. package/dist/workspace/release-train.js +2 -1
  228. package/dist/workspace/release-workflow.d.ts +4 -3
  229. package/dist/workspace/release-workflow.d.ts.map +1 -1
  230. package/dist/workspace/release-workflow.js +10 -7
  231. package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
  232. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  233. package/dist/workspace/trust/check-evidence-report.js +15 -8
  234. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  235. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  236. package/dist/workspace/trust/ref-gate-cli.js +30 -10
  237. package/dist/workspace/workspace-run.d.ts.map +1 -1
  238. package/dist/workspace/workspace-run.js +2 -1
  239. package/package.json +1 -1
  240. package/src/actor.test.ts +68 -2
  241. package/src/actor.ts +61 -1
  242. package/src/chant-install.test.ts +2 -3
  243. package/src/chant-install.ts +1 -2
  244. package/src/ci-base.test.ts +41 -0
  245. package/src/ci-base.ts +43 -0
  246. package/src/ci-comment-commands.test.ts +439 -0
  247. package/src/ci-comment-commands.ts +428 -0
  248. package/src/ci-comment-replies.ts +78 -0
  249. package/src/ci-commit.test.ts +2 -3
  250. package/src/ci-evidence-from-job.test.ts +18 -0
  251. package/src/ci-evidence-from-job.ts +58 -2
  252. package/src/ci-evidence-jobs.ts +50 -5
  253. package/src/ci-image.test.ts +130 -10
  254. package/src/ci-image.ts +85 -12
  255. package/src/ci-job-guard.before-merge.test.ts +148 -0
  256. package/src/ci-job-guard.follow-on-record.test.ts +137 -0
  257. package/src/ci-job-guard.follow-on.test.ts +144 -0
  258. package/src/ci-job-guard.ts +221 -3
  259. package/src/ci-note-commands.test.ts +76 -1
  260. package/src/ci-note-commands.ts +198 -46
  261. package/src/ci-product-words.ts +59 -0
  262. package/src/ci-product.ts +90 -6
  263. package/src/cli/commands/build.test.ts +41 -0
  264. package/src/cli/commands/build.ts +27 -2
  265. package/src/cli/handlers/approve.ts +2 -1
  266. package/src/cli/handlers/ci-check.ts +19 -7
  267. package/src/cli/handlers/ci-evidence.ts +29 -8
  268. package/src/cli/handlers/components.ts +3 -1
  269. package/src/cli/handlers/generated-check.ts +31 -1
  270. package/src/cli/handlers/lock-reach.test.ts +103 -0
  271. package/src/cli/handlers/lock.ts +100 -4
  272. package/src/cli/handlers/pr-comment.ts +187 -0
  273. package/src/cli/handlers/pr-env.ts +6 -3
  274. package/src/cli/handlers/pr-notes.ts +30 -6
  275. package/src/cli/handlers/pr-record.test.ts +1 -1
  276. package/src/cli/handlers/pr.ts +64 -21
  277. package/src/cli/handlers/promote.ts +2 -1
  278. package/src/cli/handlers/release.e2e.test.ts +35 -0
  279. package/src/cli/handlers/release.ts +14 -2
  280. package/src/cli/handlers/run-wave.ts +170 -4
  281. package/src/cli/handlers/run.ts +2 -1
  282. package/src/cli/main.ts +41 -2
  283. package/src/cli/parse-args.ts +23 -0
  284. package/src/cli/registry.ts +19 -1
  285. package/src/components/auto-release.ts +2 -1
  286. package/src/components/pr-checks.ts +165 -17
  287. package/src/components/pr-pipeline.ts +22 -18
  288. package/src/components/product-pipeline.apply-status.test.ts +50 -0
  289. package/src/components/product-pipeline.ts +204 -17
  290. package/src/components/product-plan.test.ts +60 -4
  291. package/src/components/product-plan.ts +367 -50
  292. package/src/drift-record.test.ts +20 -0
  293. package/src/drift-record.ts +16 -0
  294. package/src/floor-table.data.ts +63 -31
  295. package/src/forge-check/contract.ts +12 -1
  296. package/src/forge-check/forge-check.test.ts +17 -0
  297. package/src/forge-check/index.ts +2 -0
  298. package/src/gate-resume-run.ts +27 -3
  299. package/src/generated-check.e2e.test.ts +21 -1
  300. package/src/generated-check.test.ts +66 -0
  301. package/src/generated-check.ts +51 -10
  302. package/src/image-pins.ts +31 -0
  303. package/src/lexicon.ts +89 -1
  304. package/src/lifecycle/gate-applied.ts +7 -0
  305. package/src/lifecycle/git.test.ts +48 -0
  306. package/src/lifecycle/git.ts +27 -4
  307. package/src/lifecycle/publish-npm.ts +31 -1
  308. package/src/lifecycle/reach-locks.test.ts +87 -0
  309. package/src/lifecycle/reach-locks.ts +169 -0
  310. package/src/lifecycle/release-cut.ts +17 -1
  311. package/src/lifecycle/release-images.test.ts +56 -0
  312. package/src/lifecycle/release-images.ts +1 -2
  313. package/src/notify-product.ts +19 -8
  314. package/src/op/activities/source-release.ts +2 -1
  315. package/src/op/activities/source-rollback.ts +2 -1
  316. package/src/op/apply-status.test.ts +83 -0
  317. package/src/op/apply-status.ts +132 -0
  318. package/src/op/before-merge-decide.ts +190 -0
  319. package/src/op/before-merge-done.ts +99 -0
  320. package/src/op/before-merge-store.ts +44 -0
  321. package/src/op/before-merge.test.ts +201 -0
  322. package/src/op/before-merge.ts +266 -0
  323. package/src/op/follow-on-run.ts +206 -0
  324. package/src/op/follow-on-store.ts +54 -0
  325. package/src/op/gate-resume.test.ts +27 -0
  326. package/src/op/gate.ts +16 -1
  327. package/src/op/index.ts +15 -0
  328. package/src/op/op-waves-after-plan.ts +13 -0
  329. package/src/op/op-waves-evidence-jobs.ts +21 -7
  330. package/src/op/op-waves-follow-on-record.test.ts +152 -0
  331. package/src/op/op-waves-follow-on.test.ts +247 -0
  332. package/src/op/op-waves-follow-on.ts +385 -0
  333. package/src/op/op-waves-notify-words.test.ts +18 -0
  334. package/src/op/op-waves-render-spec.test.ts +159 -0
  335. package/src/op/op-waves-render-spec.ts +171 -0
  336. package/src/op/op-waves-run.ts +973 -94
  337. package/src/op/op-waves-split-product.test.ts +288 -0
  338. package/src/op/op-waves-split-step.test.ts +298 -0
  339. package/src/op/op-waves-split.test.ts +196 -0
  340. package/src/op/op-waves-split.ts +189 -0
  341. package/src/op/op-waves.ts +31 -3
  342. package/src/op/schedule-overdue.test.ts +72 -1
  343. package/src/op/schedule-overdue.ts +84 -6
  344. package/src/op/stage-hooks.ts +52 -4
  345. package/src/op/wave-stop.test.ts +72 -0
  346. package/src/op/wave-stop.ts +139 -0
  347. package/src/planned-files.test.ts +80 -0
  348. package/src/planned-files.ts +134 -0
  349. package/src/pr-forge-job.test.ts +53 -0
  350. package/src/pr-forge-job.ts +46 -0
  351. package/src/pr-loop-narrowed.test.ts +2 -1
  352. package/src/pr-loop-words.test.ts +2 -1
  353. package/src/pr-loop.test.ts +1 -2
  354. package/src/pr-loop.ts +4 -80
  355. package/src/pr-plan-note.ts +155 -3
  356. package/src/pr-post-replan.test.ts +144 -0
  357. package/src/pr-post-subject.test.ts +230 -0
  358. package/src/pr-post.test.ts +2 -1
  359. package/src/pr-post.ts +151 -15
  360. package/src/pr-status.ts +91 -0
  361. package/src/ref-gate-init.ts +30 -11
  362. package/src/release-floors.ts +81 -25
  363. package/src/render-module.ts +73 -0
  364. package/src/state-migration-record.test.ts +2 -3
  365. package/src/state-migration.ts +1 -2
  366. package/src/wave-blocked.ts +9 -4
  367. package/src/workspace/ci-green-cli.ts +3 -2
  368. package/src/workspace/ci-green-workflow.test.ts +32 -1
  369. package/src/workspace/release-train.ts +2 -1
  370. package/src/workspace/release-workflow.test.ts +36 -5
  371. package/src/workspace/release-workflow.ts +10 -7
  372. package/src/workspace/trust/check-evidence-report.ts +15 -8
  373. package/src/workspace/trust/check-evidence.test.ts +5 -0
  374. package/src/workspace/trust/ref-gate-cli.ts +30 -8
  375. package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
  376. package/src/workspace/trust/ref-gate.test.ts +10 -0
  377. package/src/workspace/workspace-run.ts +2 -1
@@ -33,7 +33,19 @@
33
33
  *
34
34
  * The commit is the one the plan job checked out and every other status of
35
35
  * the loop names: `github.sha` on GitHub and Forgejo, `CI_COMMIT_SHA` in a
36
- * GitLab merge request pipeline.
36
+ * GitLab merge request pipeline. On a GitHub `pull_request` run that is the
37
+ * merge preview, and the status goes on the pull request's head, where the
38
+ * forge shows and requires it (#4964, ../pr-forge-job.ts).
39
+ *
40
+ * #4964: a workspace member's pipeline takes all three. The check job runs
41
+ * in the member's directory, the product's own service containers,
42
+ * variables, lines and report directory come with `PrCheckJobOptions`, and
43
+ * a product's own workflow renders the jobs through the lexicons'
44
+ * `productCheckJobs`.
45
+ *
46
+ * #4988: on GitLab the check job keeps a product's own files beside the
47
+ * report (`artifacts: { paths, reports }`), such as a lint hook's code
48
+ * quality report, so a product's lint job can move onto chant's.
37
49
  */
38
50
 
39
51
  import type { ForgeKind } from "../pr-forge";
@@ -56,15 +68,81 @@ export const PR_CHECK_REPORT_DIR = ".chant/check";
56
68
  /** The artifact the check report is kept as. */
57
69
  export const PR_CHECK_ARTIFACT = "chant-pr-check";
58
70
 
71
+ /**
72
+ * A service container the check job starts beside it (#4964), such as a
73
+ * throwaway database its hooks replay into. The job reaches it by `name`.
74
+ * GitHub and Forgejo hold the job's steps until `health` passes; GitLab
75
+ * does not wait, so a check job there waits in its `before` lines.
76
+ */
77
+ export interface PrCheckService {
78
+ /** The service's host name on the job's network: lower-case letters, digits, `.`, `_` and `-`. */
79
+ name: string;
80
+ image: string;
81
+ /** The service container's environment. */
82
+ env?: Record<string, string>;
83
+ /** A command the forge runs in the service container until it passes (GitHub's and Forgejo's `--health-cmd`). */
84
+ health?: string;
85
+ }
86
+
87
+ /**
88
+ * The check job's own settings (#4964), as a product passes them in
89
+ * `checkJob: { ... }`. `true` is all of them left out.
90
+ */
91
+ export interface PrCheckJobOptions {
92
+ /** Service containers beside the job. */
93
+ services?: PrCheckService[];
94
+ /** Variables of the check step, such as a service's URL. No forge token, runner key or `BASE_SHA`. */
95
+ env?: Record<string, string>;
96
+ /** Lines the check step runs before `chant ci check`, after the tokens are dropped, such as a wait for a service. */
97
+ before?: string[];
98
+ /** The report directory, repository-relative from the job's directory: `chant ci check --output <dir>`. Default `.chant/check`. */
99
+ dir?: string;
100
+ /** Arguments after `--base` (and `--output`), each one word, quoted where the shell needs it: `--summary <file>` and the targets a `perRun` hook runs for. */
101
+ args?: string[];
102
+ /**
103
+ * GitLab only (#4988): files the check job keeps beside its report, such
104
+ * as a hook's code quality report. See {@link PrCheckArtifacts}.
105
+ */
106
+ artifacts?: PrCheckArtifacts;
107
+ }
108
+
109
+ /**
110
+ * What a GitLab check job keeps besides its report directory (#4988),
111
+ * relative to the job's directory as `dir` is: `paths`, more files or
112
+ * directories for `artifacts:paths`, and `reports`, GitLab's
113
+ * `artifacts:reports` by report type, such as `{ codequality:
114
+ * "gl-code-quality-report.json" }`, so a merge request shows a hook's
115
+ * findings. Kept when the check fails too, as the report is.
116
+ *
117
+ * GitHub and Forgejo take none: the check step is the job's last step
118
+ * (#4295), so no upload step can follow it, and a hook there shows its
119
+ * findings as annotations in the log (`--format forge`).
120
+ */
121
+ export interface PrCheckArtifacts {
122
+ paths?: string[];
123
+ reports?: Record<string, string | string[]>;
124
+ }
125
+
126
+ /** One shell word: as it is when it needs no quoting, else in single quotes. */
127
+ function shellWord(word: string): string {
128
+ return /^[A-Za-z0-9._\/=:@+,-]+$/.test(word) ? word : `'${word.replace(/'/g, `'\\''`)}'`;
129
+ }
130
+
59
131
  /** The check job (#4935): its command and the values it reads. */
60
132
  export interface PrCheckJob {
61
133
  jobName: string;
62
- /** `chant ci check --base "$BASE_SHA"`, through the words' bin. */
134
+ /** `chant ci check --base "$BASE_SHA"`, through the words' bin, with `--output <dir>` for a directory of the product's own. */
63
135
  command: string;
64
- /** `BASE_SHA`, as the forge spells it. */
136
+ /** `BASE_SHA`, as the forge spells it, and the product's own variables (#4964). */
65
137
  env: Record<string, string>;
66
138
  /** The report directory it writes and hands on. */
67
139
  dir: string;
140
+ /** The service containers beside it (#4964). */
141
+ services?: PrCheckService[];
142
+ /** The lines before the command (#4964). */
143
+ before?: string[];
144
+ /** GitLab: the files kept beside the report (#4988). */
145
+ artifacts?: PrCheckArtifacts;
68
146
  /**
69
147
  * With `evidence`: the signing job's lines and variables. GitHub and
70
148
  * Forgejo run them in `check-evidence` after taking the report back;
@@ -77,16 +155,79 @@ export interface PrCheckJob {
77
155
  evidence?: { jobName: string; lines: string[]; env: Record<string, string>; dir?: string; idToken?: true; idTokens?: Record<string, { aud: string }> };
78
156
  }
79
157
 
80
- /** The check job for `forge` (#4935), with the check evidence job when `evidence` names a runner identity. */
81
- export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: PipelineEvidence; noForks?: boolean } = {}): PrCheckJob {
158
+ /** The variables a check job's own `env` may not set: the ones the job and its handover read, and the credentials it drops. */
159
+ const CHECK_RESERVED_ENV = /^(BASE_SHA|HEAD_SHA|CHECK_RESULT|CHANT_RUNNER_KEY|CHANT_RUNNER_IDENTITY|CHANT_LOCAL_EVIDENCE_KEY|CHANT_CHECKOUT_TOKEN|GITHUB_TOKEN|GH_TOKEN|FORGEJO_TOKEN|GITLAB_TOKEN|CI_JOB_TOKEN|CHANT_FORGE_TOKEN|ACTIONS_ID_TOKEN_REQUEST_(URL|TOKEN))$/;
160
+
161
+ /** A relative path inside the checkout: no leading `/`, no `..`, and with `glob` GitLab's `*` wildcards. */
162
+ function insideCheckout(path: string, glob = false): boolean {
163
+ return (glob ? /^[A-Za-z0-9._*][A-Za-z0-9._*\/-]*$/ : /^[A-Za-z0-9._][A-Za-z0-9._\/-]*$/).test(path) && !path.split("/").includes("..");
164
+ }
165
+
166
+ /** The check job's extra artifacts (#4988), or undefined when they name nothing; refused off GitLab and for a path outside the checkout. */
167
+ function checkArtifacts(forge: ForgeKind, artifacts: PrCheckArtifacts | undefined): PrCheckArtifacts | undefined {
168
+ const paths = artifacts?.paths ?? [];
169
+ const reports = Object.entries(artifacts?.reports ?? {});
170
+ if (paths.length === 0 && reports.length === 0) return undefined;
171
+ if (forge !== "gitlab") throw new Error("the check job's artifacts are GitLab's artifacts:paths and artifacts:reports; on GitHub and Forgejo the check is the job's last step, so leave artifacts out there");
172
+ for (const p of paths) {
173
+ if (!insideCheckout(p, true)) throw new Error(`the check job's artifact path ${JSON.stringify(p)} is not a relative path inside the checkout`);
174
+ }
175
+ for (const [type, value] of reports) {
176
+ if (!/^[a-z][a-z_]*$/.test(type)) throw new Error(`the check job's artifact report ${JSON.stringify(type)} is not a GitLab report type`);
177
+ if (type === "coverage_report") throw new Error("the check job's artifact reports take a path for each report type, and GitLab's coverage_report takes a format besides; keep it in a job of the product's own");
178
+ const list = Array.isArray(value) ? value : [value];
179
+ if (list.length === 0 || list.some((p) => !insideCheckout(p, true))) throw new Error(`the check job's ${type} report ${JSON.stringify(value)} is not a relative path inside the checkout`);
180
+ }
181
+ return { ...(paths.length > 0 ? { paths } : {}), ...(reports.length > 0 ? { reports: Object.fromEntries(reports) } : {}) };
182
+ }
183
+
184
+ /** Refuse check job settings no job could hold (#4964). */
185
+ function assertCheckJobOptions(opts: PrCheckJobOptions): void {
186
+ if (opts.dir !== undefined && !insideCheckout(opts.dir)) {
187
+ throw new Error(`the check job's report directory ${JSON.stringify(opts.dir)} is not a relative path inside the checkout`);
188
+ }
189
+ for (const a of opts.args ?? []) {
190
+ if (a === "" || /[\0\n]/.test(a) || a === "--base" || a === "--output" || a === "-o") throw new Error(`the check job's argument ${JSON.stringify(a)} is not one it takes: --base and --output are its own`);
191
+ }
192
+ const names = new Set<string>();
193
+ for (const s of opts.services ?? []) {
194
+ if (!/^[a-z0-9][a-z0-9._-]*$/.test(s.name)) throw new Error(`the check job's service name ${JSON.stringify(s.name)} is not a host name: lower-case letters, digits, . _ -`);
195
+ if (names.has(s.name)) throw new Error(`the check job names service ${s.name} twice`);
196
+ names.add(s.name);
197
+ if (!s.image.trim() || /\s/.test(s.image)) throw new Error(`the check job's service ${s.name} needs an image reference`);
198
+ }
199
+ for (const name of Object.keys(opts.env ?? {})) {
200
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new Error(`the check job's variable ${JSON.stringify(name)} is not a variable name`);
201
+ if (CHECK_RESERVED_ENV.test(name)) throw new Error(`the check job sets ${name} itself, or drops it before the hooks run, so checkJob.env cannot name it`);
202
+ }
203
+ }
204
+
205
+ /**
206
+ * The check job for `forge` (#4935), with the check evidence job when
207
+ * `evidence` names a runner identity. #4964: the product's services,
208
+ * variables, lines and report directory (`PrCheckJobOptions`), and for a
209
+ * workspace member's GitLab file (`member`) the jobs named
210
+ * `<member>-check` and `<member>-check-evidence`, with the report read from
211
+ * the artifact at the member's `reportPath`, as GitLab includes every
212
+ * member's file in one pipeline. On GitHub and Forgejo a member's workflow
213
+ * is a file of its own, and the jobs keep their names.
214
+ */
215
+ export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: PipelineEvidence; noForks?: boolean; member?: { name: string; reportPath: string } } & PrCheckJobOptions = {}): PrCheckJob {
82
216
  assertPipelineEvidence(opts.evidence);
217
+ assertCheckJobOptions(opts);
218
+ const artifacts = checkArtifacts(forge, opts.artifacts);
83
219
  const gitlab = forge === "gitlab";
84
220
  const base = gitlab ? "$CI_MERGE_REQUEST_DIFF_BASE_SHA" : "${{ github.event.pull_request.base.sha }}";
221
+ const dir = opts.dir ?? PR_CHECK_REPORT_DIR;
222
+ const named = (job: string) => (gitlab && opts.member ? `${opts.member.name}-${job}` : job);
85
223
  const job: PrCheckJob = {
86
- jobName: PR_CHECK_JOB,
87
- command: withProductBin('chant ci check --base "$BASE_SHA"', opts.bin),
88
- env: { BASE_SHA: base },
89
- dir: PR_CHECK_REPORT_DIR,
224
+ jobName: named(PR_CHECK_JOB),
225
+ command: withProductBin(`chant ci check --base "$BASE_SHA"${dir === PR_CHECK_REPORT_DIR ? "" : ` --output ${dir}`}${(opts.args ?? []).map((a) => ` ${shellWord(a)}`).join("")}`, opts.bin),
226
+ env: { BASE_SHA: base, ...opts.env },
227
+ dir,
228
+ ...(opts.services?.length ? { services: opts.services } : {}),
229
+ ...(opts.before?.length ? { before: opts.before } : {}),
230
+ ...(artifacts ? { artifacts } : {}),
90
231
  };
91
232
  const evidence = opts.evidence;
92
233
  if (!evidence) return job;
@@ -95,15 +236,15 @@ export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: Pi
95
236
  if (gitlab) {
96
237
  // #4914: the job runs in the target branch's plan notes pipeline and signs every open merge request's
97
238
  // settled check job from its artifact; no job of a merge request pipeline holds the key.
98
- const dir = gitlabOpenEvidenceDir(PR_CHECK_JOB);
239
+ const out = gitlabOpenEvidenceDir(job.jobName);
99
240
  return {
100
241
  ...job,
101
242
  evidence: {
102
- jobName: PR_CHECK_EVIDENCE_JOB,
243
+ jobName: named(PR_CHECK_EVIDENCE_JOB),
103
244
  // A fork's check job runs too, as it holds nothing; with noForks (a product plan's forks: "skip") its hooks are not signed for.
104
- lines: openEvidenceLines({ job: PR_CHECK_JOB, dir: PR_CHECK_REPORT_DIR, out: dir, ...bin, ...(opts.noForks ? { noForks: true } : {}) }),
245
+ lines: openEvidenceLines({ job: job.jobName, dir: opts.member?.reportPath ?? dir, out, ...bin, ...(opts.noForks ? { noForks: true } : {}) }),
105
246
  env: key,
106
- dir,
247
+ dir: out,
107
248
  ...(evidenceKeyless(evidence) ? { idTokens: evidenceIdTokens(evidence) } : {}),
108
249
  },
109
250
  };
@@ -112,7 +253,7 @@ export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: Pi
112
253
  ...job,
113
254
  evidence: {
114
255
  jobName: PR_CHECK_EVIDENCE_JOB,
115
- lines: planEvidenceLines({ dir: PR_CHECK_REPORT_DIR, at: '"$HEAD_SHA"', base: '"$BASE_SHA"', result: '"$CHECK_RESULT"', ...bin }),
256
+ lines: planEvidenceLines({ dir, at: '"$HEAD_SHA"', base: '"$BASE_SHA"', result: '"$CHECK_RESULT"', ...bin }),
116
257
  env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: base, CHECK_RESULT: `\${{ needs.${PR_CHECK_JOB}.result }}`, ...key },
117
258
  ...(evidenceKeyless(evidence) ? { idToken: true as const } : {}),
118
259
  },
@@ -134,12 +275,19 @@ export interface PrRefGateJob {
134
275
  * The ref gate's status job for `forge` (#4935). `branch` is the target
135
276
  * branch on GitHub and Forgejo (default `main`); GitLab's job runs in a
136
277
  * pipeline of the target branch and names it from `CI_COMMIT_BRANCH`.
278
+ *
279
+ * #4964: in a workspace member's GitLab file (`member`) the job is
280
+ * `<member>-ref-gate`. Each member's pipeline decides the whole update
281
+ * against the one rule and sets the one status, so the last job to run
282
+ * after the evidence it needs is in sets success; one that ran before
283
+ * another member's evidence was in set failure, and a re-run settles it.
284
+ * None sets success while a required check lacks evidence.
137
285
  */
138
- export function prRefGateJob(forge: ForgeKind, opts: { bin?: string; branch?: string } = {}): PrRefGateJob {
286
+ export function prRefGateJob(forge: ForgeKind, opts: { bin?: string; branch?: string; member?: string } = {}): PrRefGateJob {
139
287
  const notes = "'+refs/notes/chant/evidence:refs/notes/chant/evidence'";
140
288
  if (forge === "gitlab") {
141
289
  return {
142
- jobName: PR_REF_GATE_JOB,
290
+ jobName: opts.member ? `${opts.member}-${PR_REF_GATE_JOB}` : PR_REF_GATE_JOB,
143
291
  // The heads are fetched by the command, one merge request at a time.
144
292
  setup: [`git fetch --quiet --no-tags origin ${notes} || true`],
145
293
  command: withProductBin('chant workspace ref-gate status --open --ref "refs/heads/$CI_COMMIT_BRANCH" --base "$CI_COMMIT_SHA"', opts.bin),
@@ -156,4 +304,4 @@ export function prRefGateJob(forge: ForgeKind, opts: { bin?: string; branch?: st
156
304
  };
157
305
  }
158
306
 
159
- export { CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR } from "../release-floors";
307
+ export { CHECK_JOB_ARTIFACTS_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, MEMBER_SIGNED_CHECKS_FLOOR, PR_LOOP_EVIDENCE_FLOOR, PRODUCT_CHECK_JOBS_FLOOR, REF_GATE_STATUS_JOB_FLOOR } from "../release-floors";
@@ -102,6 +102,7 @@ import { CHANT_EXIT } from "../exit-codes";
102
102
  import type { ControlTarget } from "../control/dispatch";
103
103
  import { CI_RESPOND_ENV, respondList, type CiResponses } from "../ci-respond";
104
104
  import type { PipelineEvidence } from "../ci-evidence-jobs";
105
+ import type { PrCheckJobOptions } from "./pr-checks";
105
106
 
106
107
  /** The variable `chant ci run` reads its runner key from (`RUNNER_KEY_ENV` in ../workspace/ci-green.ts). */
107
108
  const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
@@ -401,35 +402,36 @@ export interface PrLoopPipelineOptions {
401
402
  * With `checkJob`, the `check-evidence` job signs each passed hook. Set
402
403
  * from `--evidence-runner-key-secret`, or `--evidence-identity oidc` with
403
404
  * an optional `--evidence-audience`. Absent: nothing is signed, and every
404
- * job is as before. Refused on a workspace member's pipeline: the checks
405
- * are the commit's, so one pipeline signs them.
405
+ * job is as before. #4964: a workspace member's pipeline plans that member
406
+ * alone, so it signs `plan:<member>` and `policy:<member>`
407
+ * (`memberEvidenceCheck`), which the `refs` rule names for each member.
406
408
  */
407
409
  evidence?: PipelineEvidence;
408
410
  /**
409
411
  * The check job (#4935, ./pr-checks.ts): `chant ci check --base <base>` on
410
412
  * the pull request's commit, with no forge token, runner key or OIDC token
411
- * while the hooks run. Set from `--check-job`. Refused on a member's
412
- * pipeline: the hooks are the workspace's.
413
+ * while the hooks run. Set from `--check-job`. #4964: an object gives the
414
+ * job service containers, variables, lines before the check and its own
415
+ * report directory (`PrCheckJobOptions`). In a workspace member's pipeline
416
+ * it runs in the member's directory: the top level's hooks and the
417
+ * member's, each signed by its own name, the same for every member that
418
+ * runs it.
413
419
  */
414
- checkJob?: boolean;
420
+ checkJob?: boolean | PrCheckJobOptions;
415
421
  /**
416
422
  * The ref gate's status job (#4935, ./pr-checks.ts): `chant workspace
417
423
  * ref-gate status` for the pull request's commit, after the note and the
418
424
  * check evidence, so `chant/ref-gate` can be a required status. Set from
419
- * `--ref-gate-status`. Refused on a member's pipeline.
425
+ * `--ref-gate-status`. #4964: in a member's pipeline it decides the whole
426
+ * update against the one rule, as the root's does, and sets the one
427
+ * status (`prRefGateJob`).
420
428
  */
421
429
  refGateStatus?: boolean;
422
430
  }
423
431
 
424
- /**
425
- * Refuse the loop's `evidence`, `checkJob` and `refGateStatus` (#4935) on a
426
- * workspace member's pipeline: a check and its evidence are the commit's,
427
- * so the root pipeline runs and signs them once.
428
- */
429
- export function assertRootChecks(options: Pick<PrLoopPipelineOptions, "evidence" | "checkJob" | "refGateStatus">, member: string | undefined): void {
430
- if (!member) return;
431
- const given = [...(options.evidence ? ["evidence"] : []), ...(options.checkJob ? ["checkJob"] : []), ...(options.refGateStatus ? ["refGateStatus"] : [])];
432
- if (given.length > 0) throw new Error(`${given.join(", ")} sign and judge the pull request's commit once, for the whole workspace, so give ${given.length === 1 ? "it" : "them"} on the root pipeline, not member ${member}'s`);
432
+ /** The check job's own settings from `checkJob` (#4964): undefined when there is no check job, `{}` for `true`. */
433
+ export function checkJobOptions(checkJob: boolean | PrCheckJobOptions | undefined): PrCheckJobOptions | undefined {
434
+ return checkJob === true ? {} : checkJob ? checkJob : undefined;
433
435
  }
434
436
 
435
437
  /** The `CHANT_RESPOND` value of `respond` (#4629), or undefined when every event is at its default. Throws on a description check with no decide service. */
@@ -1035,15 +1037,17 @@ export const PR_STALE_JOB = "stale-notes";
1035
1037
  * `staleNotes`: on a push to the target branch, at its commit, `pr-post
1036
1038
  * --stale` marks each open pull request's note posted against another
1037
1039
  * commit stale and sets its plan status back to pending. It names the plan
1038
- * comment with `previewComment`. Undefined without `staleNotes`.
1040
+ * comment with `previewComment`. Undefined without `staleNotes`. A list
1041
+ * of members (#4987, a product plan's targets) marks each one's note.
1039
1042
  */
1040
- export function prStaleJob(forge: ForgeKind, env: string, options: Pick<PrLoopPipelineOptions, "staleNotes" | "previewComment" | "branch" | "words"> = {}, member?: string): { command: string; env: Record<string, string> } | undefined {
1043
+ export function prStaleJob(forge: ForgeKind, env: string, options: Pick<PrLoopPipelineOptions, "staleNotes" | "previewComment" | "branch" | "words"> = {}, member?: string | readonly string[]): { command: string; env: Record<string, string> } | undefined {
1041
1044
  if (!options.staleNotes) return undefined;
1042
1045
  const words = resolveProductWords(options.words);
1046
+ const members = member === undefined ? [] : typeof member === "string" ? [member] : [...member];
1043
1047
  const command = [
1044
1048
  "chant", "components", "pr-post", "--stale", "--tip", '"$TIP_SHA"', "--env", env, "--forge", forge,
1045
1049
  ...(options.branch ? ["--branch", JSON.stringify(options.branch)] : []),
1046
- ...(member ? ["--member", member] : []),
1050
+ ...members.flatMap((m) => ["--member", m]),
1047
1051
  ...(options.previewComment ? ["--preview-comment"] : []),
1048
1052
  ].join(" ");
1049
1053
  return {
@@ -0,0 +1,50 @@
1
+ /**
2
+ * #4987 in the product pipeline: `applyStatus` and a product plan's
3
+ * `staleNotes` come back in `waves.pipeline` for the generators, the stale
4
+ * marking with one `--member` per plan target, and each target's note
5
+ * carries the target branch's commit it was planned against.
6
+ */
7
+ import { describe, expect, test } from "vitest";
8
+ import type { OpWavesSpec } from "../op/op-waves";
9
+ import { productPipelineJobs } from "./product-pipeline";
10
+
11
+ const words = { product: "terragucci", noun: ["root", "roots"] as [string, string], commands: { plan: "plan" as const, apply: "apply" as const }, approval: "per-wave" as const, op: "tf-apply", bin: "npx --no-install terragucci" };
12
+ const waves: OpWavesSpec = { name: "tf-apply", op: "tf-apply", step: { kind: "terraform-apply", root: "{target}" }, waves: [{ name: "dev", runs: [{ target: "envs/dev" }] }] } as OpWavesSpec;
13
+ const productPlan = { command: "terragucci plan {target} --out {output}", workflow: "terragucci-pr", targets: [{ name: "dev" }, { name: "prod" }] };
14
+ const base = { words, waves, productPlan, staleNotes: true, applyStatus: true };
15
+
16
+ describe("the apply statuses and the stale notes in the product pipeline (#4987)", () => {
17
+ test.each(["github", "forgejo", "gitlab"] as const)("on %s, the waves get the status context and the stale marking per target", (forge) => {
18
+ const jobs = productPipelineJobs(forge, "default", base);
19
+ expect(jobs.waves!.pipeline.applyStatus).toEqual({ context: "terragucci/apply" });
20
+ const stale = jobs.waves!.pipeline.staleNotes!;
21
+ expect(stale.command).toBe(`npx --no-install terragucci components pr-post --stale --tip "$TIP_SHA" --env default --forge ${forge} --member dev --member prod`);
22
+ expect(stale.env.TIP_SHA).toBe(forge === "gitlab" ? "$CI_COMMIT_SHA" : "${{ github.sha }}");
23
+ // The pull request loop's own stale job is not the product plan's.
24
+ expect(jobs.stale).toBeUndefined();
25
+ // Each target's note carries the target branch's commit, so the push can tell it is stale.
26
+ for (const p of jobs.productPlan!) {
27
+ expect(p.post.command).toContain('--tip "$TIP_SHA"');
28
+ expect(p.post.env.TIP_SHA).toBe(forge === "gitlab" ? "$CI_COMMIT_SHA" : "${{ github.event.pull_request.base.sha }}");
29
+ }
30
+ });
31
+
32
+ test("the re-plan's note carries its tip too, and the stale line names the re-plan comment", () => {
33
+ const jobs = productPipelineJobs("github", "default", { ...base, productPlan: { ...productPlan, replan: true } });
34
+ const replan = jobs.productPlan![0]!.replan!;
35
+ expect(replan.post.command).toContain('--tip "$TIP_SHA"');
36
+ expect(replan.post.env.TIP_SHA).toBe("${{ github.sha }}");
37
+ expect(jobs.waves!.pipeline.staleNotes!.command).toContain("--preview-comment");
38
+ });
39
+
40
+ test("a member's status context, and nothing without the options", () => {
41
+ expect(productPipelineJobs("github", "default", { ...base, member: "net" }).waves!.pipeline.applyStatus).toEqual({ context: "terragucci/apply/net" });
42
+ expect(productPipelineJobs("github", "default", { words, waves, productPlan }).waves!.pipeline).toEqual({});
43
+ });
44
+
45
+ test("refused without waves", () => {
46
+ const planOnly = { ...words, commands: { plan: "plan" as const } };
47
+ expect(() => productPipelineJobs("github", "default", { words: planOnly, productPlan, applyStatus: true })).toThrow("applyStatus posts the waves' apply statuses, and there are none");
48
+ expect(() => productPipelineJobs("github", "default", { words: planOnly, productPlan, staleNotes: true })).toThrow("staleNotes with the product plan marks the notes from the waves workflow's push run");
49
+ });
50
+ });