@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
package/src/pr-loop.ts CHANGED
@@ -6,8 +6,9 @@
6
6
  * `chant components pr-plan` and `chant components pr-apply` run it, and the
7
7
  * generated CI for GitHub, GitLab and Forgejo calls them
8
8
  * (`components/pr-pipeline.ts`). This module holds the parts that need no
9
- * runner: the gate's names, the report both commands write, the pull-request
10
- * note rendered from it and the status line. terragucci reads the report and
9
+ * runner: the gate's names, the report both commands write and the
10
+ * pull-request note rendered from it; the status line is in `./pr-status.ts`
11
+ * (#4966), outside the bundle. terragucci reads the report and
11
12
  * renders the note from one bundled file with no TypeScript toolchain
12
13
  * (#3421), so this imports `./change-set` and `./plan-summary` and nothing
13
14
  * else; `pr-loop-bundle.test.ts` holds that.
@@ -1244,81 +1245,4 @@ function narrowedLines(report: PrReport, words: CiProductWords): string[] {
1244
1245
  return ["", `This ${words.verbs.plan[0]} was narrowed with \`--target\`: ${each}. The approval binds the narrowed plan. On merge each ${words.noun[0]} is ${words.verbs.plan[1]} whole.`];
1245
1246
  }
1246
1247
 
1247
- /** A commit status's description, at most 140 characters (GitHub's limit). */
1248
- export function prStatusDescription(report: PrReport, words: CiProductWords = activeProductWords()): string {
1249
- const n = report.members.length;
1250
- const many = (k: number): string => `${k} ${words.noun[k === 1 ? 0 : 1]}`;
1251
- const sum = report.members.reduce(
1252
- (acc, m) => ({ change: acc.change + m.counts.create + m.counts.update + m.counts.replace, destroy: acc.destroy + m.counts.delete + m.counts.replace }),
1253
- { change: 0, destroy: 0 },
1254
- );
1255
- const digest = report.digest ? `; plan ${report.digest.replace(/^(?:jcs1-)?sha256:/, "").slice(0, 12)}` : "";
1256
- let text: string;
1257
- switch (report.status) {
1258
- case "nothing":
1259
- text = "nothing to plan";
1260
- break;
1261
- case "planned": {
1262
- const unknown = report.members.filter((m) => memberHoleReasons(report, m.member).length > 0).length;
1263
- // #4626: a narrowed plan says so in its status.
1264
- const narrowed = Object.values(report.narrowed ?? {}).filter((a) => a.length > 0).length;
1265
- text = `${many(n)}${narrowed > 0 ? ` (${narrowed} narrowed with --target)` : ""}: ${sum.change} to change, ${sum.destroy} to destroy or replace${unknown > 0 ? `, ${unknown} with holes` : ""}${digest}`;
1266
- break;
1267
- }
1268
- case "plan-failed":
1269
- text = `a ${words.noun[0]} failed to ${words.verbs.plan[0]}${digest}`;
1270
- break;
1271
- case "recorded":
1272
- text = `recorded ${many(n)}: ${report.approval.status === "approved" ? "the approved plan" : report.approval.status === "changed" ? "the plan differs from the approved one" : "no approval for this plan"}${digest}`;
1273
- break;
1274
- case "applied":
1275
- text = `${words.verbs.apply[1]} ${many(n)}${digest}`;
1276
- break;
1277
- case "wave-applied": {
1278
- const last = (report.waves ?? []).filter((w) => w.status === "applied").at(-1);
1279
- text = `applied wave ${last?.wave ?? "?"} of ${report.selection.waves.length}${last ? ` under ${last.approval === "pull-request" ? "the pull request's approval" : `${last.gate}`}` : ""}`;
1280
- break;
1281
- }
1282
- case "failed":
1283
- text = `apply failed for ${report.members.filter((m) => m.status === "failed").map((m) => m.member).join(", ")}`;
1284
- break;
1285
- case "waiting":
1286
- text = `waiting: ${report.members.filter((m) => m.status === "waiting").map((m) => m.member).join(", ")} planned again after an upstream applied, not approved yet`;
1287
- break;
1288
- case "refused": {
1289
- const waiting = report.waves?.find((w) => w.status === "waiting");
1290
- if (waiting && (report.refusal === "wave-not-approved" || report.refusal === "wave-plan-changed")) {
1291
- text = `wave ${waiting.wave} waits at ${waiting.gate}: ${report.refusal === "wave-plan-changed" ? "its plan changed after its approval" : "its plan moved, approve it"}`;
1292
- break;
1293
- }
1294
- if (report.refusal === "earlier-wave") {
1295
- text = "refused: an earlier wave has not applied";
1296
- break;
1297
- }
1298
- if (report.refusal === "requires-unmet" || report.refusal === "before-merge-off") {
1299
- const unmet = (report.beforeMerge?.requires ?? []).filter((r) => !r.passed).map((r) => r.name);
1300
- text = report.refusal === "before-merge-off" ? "refused: this workspace does not apply before merge" : `refused: ${unmet.join(", ") || "a require"} unmet for an apply before merge`;
1301
- break;
1302
- }
1303
- if (report.refusal === "policy-denied" || report.refusal === "policy-error") {
1304
- text = report.refusal === "policy-denied" ? `refused: the policy denied the plan (${(report.policy?.rules ?? []).join(", ")})` : "refused: the policy could not be checked";
1305
- break;
1306
- }
1307
- text = `refused: ${report.refusal === "plan-changed" ? "the plan changed after review" : report.refusal === "not-a-reviewer" ? "the approver has not approved the pull request" : report.refusal === "author-approved" ? "the approver wrote the change" : report.refusal === "no-pull-request" ? "no pull request merged this commit" : report.refusal === "locked" ? "another pull request holds a target lock" : "the plan is not approved"}`;
1308
- break;
1309
- }
1310
- }
1311
- return text.length > 140 ? text.slice(0, 137) + "..." : text;
1312
- }
1313
-
1314
- /** The commit status state for a report: success, failure, or pending while it waits on approval. */
1315
- export function prStatusState(report: PrReport): "success" | "failure" | "pending" {
1316
- // #4168 decision 1: a merge whose plan differs from the approved one is recorded, and its status fails.
1317
- if (report.status === "recorded") return report.approval.status === "changed" ? "failure" : "success";
1318
- // #4294: a plan the policy denied, with no override, or one it could not check, fails at the plan stage as it would at the apply.
1319
- if (report.status === "planned" && report.policy && (report.policy.result === "error" || (report.policy.result === "denied" && !report.policy.override))) return "failure";
1320
- if (report.status === "planned" || report.status === "applied" || report.status === "wave-applied" || report.status === "nothing") return "success";
1321
- if (report.status === "refused" && (report.refusal === "not-approved" || report.refusal === "wave-not-approved")) return "pending";
1322
- if (report.status === "waiting") return "pending";
1323
- return "failure";
1324
- }
1248
+ // The commit status's description and state (`prStatusDescription`, `prStatusState`) are in ./pr-status.ts (#4966).
@@ -60,11 +60,112 @@ export interface PrPlanNoteHandoff {
60
60
  state: "success" | "failure" | "pending";
61
61
  description: string;
62
62
  note: PrPlanNote;
63
+ /**
64
+ * The product's own hidden line's body (#4931), such as terragucci's
65
+ * `roots=a,b`: `pr-post` writes `<!-- <productMarker> <marker> -->` on the
66
+ * note's second line, under chant's marker, when the pipeline's note words
67
+ * name a `productMarker`. Letters, digits and `_.,/@+=:-`, words split by
68
+ * one space, at most {@link PRODUCT_MARKER_LIMIT} characters.
69
+ */
70
+ marker?: string;
71
+ /**
72
+ * What the plan is taken over (#4972), such as sql-yodeler's plan digest
73
+ * and its subject's parts: `pr-post` compares it with the subject it kept
74
+ * in the previous note for the same environment and member, says what
75
+ * changed when its id differs, and keeps this one in the new note.
76
+ */
77
+ subject?: PrPlanSubject;
78
+ }
79
+
80
+ /**
81
+ * A plan's subject (#4972), as a plan verb hands it to the note job, which
82
+ * compares it with the previous note's, so the plan job needs no forge
83
+ * token to read the previous note on any forge. Both are the change's code,
84
+ * so each word is checked against {@link PLAN_SUBJECT_WORD}.
85
+ */
86
+ export interface PrPlanSubject {
87
+ /** The plan as one word, such as its digest: a different id is a changed plan. */
88
+ id: string;
89
+ /**
90
+ * The parts the id is taken over, each `<group>` or `<group>/<item>` to a
91
+ * word (a checksum, a list joined by commas): `pr-post` names the parts
92
+ * added, gone and changed, group by group, in the note words'
93
+ * `subjectParts`. Absent: the line says only that the plan changed.
94
+ */
95
+ parts?: Record<string, string>;
96
+ }
97
+
98
+ /** A word of a plan subject (#4972): letters, digits and `_.,:+=-`, at most 1024 characters, nothing that ends a comment or mentions anyone. */
99
+ export const PLAN_SUBJECT_WORD = /^[A-Za-z0-9_.,:+=-]{1,1024}$/;
100
+
101
+ /** A plan subject part's key (#4972): `<group>` or `<group>/<item>`. */
102
+ export const PLAN_SUBJECT_KEY = /^[A-Za-z0-9_.:+=-]{1,128}(\/[A-Za-z0-9_.,:+=-]{1,256})?$/;
103
+
104
+ /** The most characters the note's kept subject line holds (#4972); a subject with more parts is kept by its id alone. */
105
+ export const PLAN_SUBJECT_LIMIT = 16_384;
106
+
107
+ /** Why `subject` is not a {@link PrPlanSubject} (#4972), or undefined when it is one. */
108
+ export function planSubjectProblem(subject: unknown): string | undefined {
109
+ if (!subject || typeof subject !== "object" || Array.isArray(subject)) return "is not an object";
110
+ const s = subject as Record<string, unknown>;
111
+ if (typeof s.id !== "string" || !PLAN_SUBJECT_WORD.test(s.id)) return "has no id of letters, digits and _.,:+=-";
112
+ if (s.parts === undefined) return undefined;
113
+ if (!s.parts || typeof s.parts !== "object" || Array.isArray(s.parts)) return "has parts that are not an object";
114
+ for (const [k, v] of Object.entries(s.parts)) {
115
+ if (!PLAN_SUBJECT_KEY.test(k)) return `has a part ${JSON.stringify(k.slice(0, 64))} that is not <group> or <group>/<item>`;
116
+ if (typeof v !== "string" || !PLAN_SUBJECT_WORD.test(v)) return `has a part ${k} whose value is not a word of letters, digits and _.,:+=-`;
117
+ }
118
+ return undefined;
119
+ }
120
+
121
+ /** How the note words name one group's changes (#4972), each over `{group}` and `{items}`, the group's items as `item` writes them, joined by ", ". */
122
+ export interface PrPlanSubjectPartWords {
123
+ added?: string;
124
+ gone?: string;
125
+ changed?: string;
126
+ /** One item, over `{item}`, `{before}` and `{after}`. Default `{item}`, or for a part with no item `{before} -> {after}` (changed), `{after}` (added), `{before}` (gone). */
127
+ item?: string;
128
+ }
129
+
130
+ /**
131
+ * A product's plan note hand-off whose note is the product's own text
132
+ * (#4963), in place of a {@link PrPlanNote}: sql-yodeler's tenant set note,
133
+ * which chant's note cannot carry yet. `pr-post` checks it as it checks a
134
+ * {@link PrPlanNoteHandoff}, writes every `<!--` in `body` as `&lt;!--`,
135
+ * puts chant's marker and the product's line (`marker`) above it, adds the
136
+ * overdue Ops and the note job's notices under it, and cuts it to the
137
+ * forge's limit.
138
+ */
139
+ export interface PrPlanBodyHandoff extends Omit<PrPlanNoteHandoff, "note"> {
140
+ /** The note's markdown, at most {@link PLAN_BODY_LIMIT} characters. */
141
+ body: string;
142
+ }
143
+
144
+ /** The most characters a {@link PrPlanBodyHandoff.body} holds (#4963). */
145
+ export const PLAN_BODY_LIMIT = 1_000_000;
146
+
147
+ /** The hand-off for a product's own note text (#4963), as a plan verb writes it to {@link PR_PLAN_NOTE_FILE}. */
148
+ export function planBodyHandoff(body: string, at: { pr: number; head: string; env: string; member?: string; state: PrPlanNoteHandoff["state"]; description: string; marker?: string; subject?: PrPlanSubject }): PrPlanBodyHandoff {
149
+ return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: at.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, body, ...(at.marker !== undefined ? { marker: at.marker } : {}), ...(at.subject !== undefined ? { subject: at.subject } : {}) };
150
+ }
151
+
152
+ /** The most characters a hand-off's {@link PrPlanNoteHandoff.marker} holds (#4931). */
153
+ export const PRODUCT_MARKER_LIMIT = 4096;
154
+
155
+ /** What a hand-off's marker may hold (#4931): no `-->`, no `<` or `>`, nothing that ends the comment or starts another. */
156
+ export const PRODUCT_MARKER_BODY = /^[A-Za-z0-9_.,\/@+=:-]+( [A-Za-z0-9_.,\/@+=:-]+)*$/;
157
+
158
+ /** What a note words' {@link PrPlanNoteWords.productMarker} may be (#4931): a name such as `terragucci:plan`. */
159
+ export const PRODUCT_MARKER_NAME = /^[a-z][a-z0-9-]*(:[a-z][a-z0-9-]*)*$/;
160
+
161
+ /** The product's hidden line (#4931): `<!-- <name> <body> -->`, or `<!-- <name> -->` with an empty body. */
162
+ export function productMarkerLine(name: string, body: string): string {
163
+ return body ? `<!-- ${name} ${body} -->` : `<!-- ${name} -->`;
63
164
  }
64
165
 
65
166
  /** The hand-off for `note` (#4799), as a product's plan verb writes it to {@link PR_PLAN_NOTE_FILE}. */
66
- export function planNoteHandoff(note: PrPlanNote, at: { pr: number; env: string; member?: string; state: PrPlanNoteHandoff["state"]; description: string }): PrPlanNoteHandoff {
67
- return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: note.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, note };
167
+ export function planNoteHandoff(note: PrPlanNote, at: { pr: number; env: string; member?: string; state: PrPlanNoteHandoff["state"]; description: string; marker?: string; subject?: PrPlanSubject }): PrPlanNoteHandoff {
168
+ return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: note.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, note, ...(at.marker !== undefined ? { marker: at.marker } : {}), ...(at.subject !== undefined ? { subject: at.subject } : {}) };
68
169
  }
69
170
 
70
171
  /** One change line of a group, as chant's plan summary groups them. */
@@ -229,9 +330,89 @@ export interface PrPlanNoteWords {
229
330
  planFile?: string;
230
331
  /** The op an override is recorded under. */
231
332
  overrideOp?: string;
333
+ /**
334
+ * The name of the product's own hidden line (#4931), such as
335
+ * `terragucci:plan`: a hand-off's `marker` is kept as `<!-- <name>
336
+ * <marker> -->` on the note's second line, where the product finds its
337
+ * note by it. Absent: a hand-off's marker is dropped.
338
+ */
339
+ productMarker?: string;
340
+ /**
341
+ * The line `pr-post` adds when a hand-off's subject differs from the
342
+ * previous note's (#4972), over `{previous}` (the previous subject's id)
343
+ * and `{changes}` (what changed, part by part, joined by "; "). Default
344
+ * "Since the previous version of this note (`{previous}`): {changes}.".
345
+ */
346
+ sinceLast?: string;
347
+ /**
348
+ * The line when no part says what changed (#4972): the subject has no
349
+ * parts, or the previous note kept its id alone. Over `{previous}`.
350
+ * Default "The plan changed since the previous version of this note (`{previous}`).".
351
+ */
352
+ sinceLastOnly?: string;
353
+ /** How `{changes}` names each group of the subject's parts (#4972), by group. Default "{group}: {items} added" (gone, changed). */
354
+ subjectParts?: Record<string, PrPlanSubjectPartWords>;
355
+ }
356
+
357
+ /** The {@link PrPlanNoteWords.sinceLast} default (#4972). */
358
+ export const SINCE_LAST_LINE = "Since the previous version of this note (`{previous}`): {changes}.";
359
+ /** The {@link PrPlanNoteWords.sinceLastOnly} default (#4972). */
360
+ export const SINCE_LAST_ONLY_LINE = "The plan changed since the previous version of this note (`{previous}`).";
361
+
362
+ /**
363
+ * What changed from `before` to `after`, group by group (#4972): each
364
+ * group's added, gone and changed parts in the note words, groups in the
365
+ * order `after` names them, then those only `before` names.
366
+ */
367
+ export function subjectChanges(before: Record<string, string>, after: Record<string, string>, words: Record<string, PrPlanSubjectPartWords> = {}): string[] {
368
+ const groupOf = (k: string): [string, string] => {
369
+ const at = k.indexOf("/");
370
+ return at < 0 ? [k, ""] : [k.slice(0, at), k.slice(at + 1)];
371
+ };
372
+ const has = (o: object, k: string): boolean => Object.prototype.hasOwnProperty.call(o, k);
373
+ const groups: string[] = [];
374
+ for (const k of [...Object.keys(after), ...Object.keys(before)]) {
375
+ const [g] = groupOf(k);
376
+ if (!groups.includes(g)) groups.push(g);
377
+ }
378
+ const fill = (t: string, v: Record<string, string>): string => t.replace(/\{(group|items|item|before|after)\}/g, (_, n: string) => v[n] ?? "");
379
+ const out: string[] = [];
380
+ for (const group of groups) {
381
+ const w = has(words, group) ? words[group]! : {};
382
+ const kinds: Record<"added" | "gone" | "changed", string[]> = { added: [], gone: [], changed: [] };
383
+ const say = (kind: "added" | "gone" | "changed", item: string, b: string, a: string) => {
384
+ const dflt = item !== "" ? "{item}" : kind === "changed" ? "{before} -> {after}" : kind === "added" ? "{after}" : "{before}";
385
+ kinds[kind].push(fill(w.item ?? dflt, { item, before: b, after: a, group }));
386
+ };
387
+ for (const k of Object.keys(after)) {
388
+ const [g, item] = groupOf(k);
389
+ if (g !== group) continue;
390
+ if (!has(before, k)) say("added", item, "", after[k]!);
391
+ else if (before[k] !== after[k]) say("changed", item, before[k]!, after[k]!);
392
+ }
393
+ for (const k of Object.keys(before)) {
394
+ const [g, item] = groupOf(k);
395
+ if (g === group && !has(after, k)) say("gone", item, before[k]!, "");
396
+ }
397
+ for (const kind of ["added", "gone", "changed"] as const) {
398
+ if (kinds[kind].length > 0) out.push(fill(w[kind] ?? `{group}: {items} ${kind}`, { group, items: kinds[kind].join(", ") }));
399
+ }
400
+ }
401
+ return out;
402
+ }
403
+
404
+ /**
405
+ * The line for a plan whose subject is no longer `previous`'s (#4972), in
406
+ * the note words, or undefined when the ids are the same.
407
+ */
408
+ export function sinceLastLine(previous: PrPlanSubject, now: PrPlanSubject, words: Pick<PrPlanNoteWords, "sinceLast" | "sinceLastOnly" | "subjectParts"> = {}): string | undefined {
409
+ if (previous.id === now.id) return undefined;
410
+ const changes = previous.parts && now.parts ? subjectChanges(previous.parts, now.parts, words.subjectParts) : [];
411
+ const fill = (t: string): string => t.replace(/\{(previous|changes)\}/g, (_, n: string) => (n === "previous" ? previous.id : changes.join("; ")));
412
+ return changes.length > 0 ? fill(words.sinceLast ?? SINCE_LAST_LINE) : fill(words.sinceLastOnly ?? SINCE_LAST_ONLY_LINE);
232
413
  }
233
414
 
234
- const NOTE_WORDS: Required<Omit<PrPlanNoteWords, "marker">> = {
415
+ const NOTE_WORDS: Required<Omit<PrPlanNoteWords, "marker" | "productMarker" | "sinceLast" | "sinceLastOnly" | "subjectParts">> = {
235
416
  footer: "",
236
417
  page: "report.html",
237
418
  artifact: "chant-pr",
@@ -0,0 +1,75 @@
1
+ /**
2
+ * #4899: the product plan job's run record, written by the plan step's
3
+ * record line and read back as data by the note job; and #4935's pull
4
+ * request loop flags.
5
+ */
6
+ import { execFileSync } from "node:child_process";
7
+ import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
8
+ import { tmpdir } from "node:os";
9
+ import { join } from "node:path";
10
+ import { describe, expect, test } from "vitest";
11
+ import { PLAN_RECORD_JS, PLAN_RUN_RECORD_ENV, planVerbLines } from "./components/product-plan";
12
+ import { PLAN_RUN_RECORD_FILE, readPlanRunRecord } from "./pr-plan-record";
13
+ import { prLoopFlagsProblem } from "./cli/handlers/build";
14
+ import { prCheckJob, PR_CHECK_REPORT_DIR, prRefGateJob } from "./components/pr-checks";
15
+ import { CHECK_HOOKS_DIR } from "./components/check-hooks";
16
+
17
+ const HEAD = "a".repeat(40);
18
+ const config = JSON.stringify({ op: "pr-plan", env: "prod", labels: { Env: "prod", Pipeline: "pr", Job: "plan", Target: "staging" } });
19
+
20
+ function written(exit: number): string {
21
+ const dir = mkdtempSync(join(tmpdir(), "chant-plan-record-"));
22
+ execFileSync(process.execPath, ["-e", PLAN_RECORD_JS, dir], { cwd: dir, env: { ...process.env, [PLAN_RUN_RECORD_ENV]: config, CHANT_PLAN_EXIT: String(exit), CHANT_PLAN_STARTED: "2026-11-10T00:00:00Z" } });
23
+ return dir;
24
+ }
25
+
26
+ describe("the product plan job's run record (#4899)", () => {
27
+ test("the record line writes a record the note job keeps, its op, commit and origin its own", () => {
28
+ const dir = written(0);
29
+ const raw = JSON.parse(readFileSync(join(dir, PLAN_RUN_RECORD_FILE), "utf-8"));
30
+ expect(raw).toMatchObject({ op: "pr-plan", env: "prod", status: "ok", started: "2026-11-10T00:00:00.000Z" });
31
+ const read = readPlanRunRecord(dir, { env: "prod", head: HEAD, target: "staging", result: "success", origin: { forge: "github", jobId: "plan-staging" } });
32
+ expect(read && "record" in read ? read.record : read).toMatchObject({ id: raw.id, op: "pr-plan", status: "ok", gitSha: HEAD, runOrigin: { forge: "github", jobId: "plan-staging" }, labels: { Target: "staging" } });
33
+ });
34
+
35
+ test("a failed verb, or a failed job, records a failed run", () => {
36
+ const failed = readPlanRunRecord(written(3), { env: "prod", head: HEAD, target: "staging" });
37
+ expect(failed && "record" in failed ? failed.record.failure : failed).toEqual({ code: "command-failed", reason: "the plan verb exited 3", phase: "plan", exitCode: 3 });
38
+ const job = readPlanRunRecord(written(0), { env: "prod", head: HEAD, target: "staging", result: "failure" });
39
+ expect(job && "record" in job ? job.record.status : job).toBe("fail");
40
+ });
41
+
42
+ test("a record for another environment, target or commit is refused, and none is undefined", () => {
43
+ const dir = written(0);
44
+ expect(readPlanRunRecord(dir, { env: "dev", head: HEAD, target: "staging" })).toEqual({ refused: expect.stringMatching(/environment "prod", not dev/) });
45
+ expect(readPlanRunRecord(dir, { env: "prod", head: HEAD })).toEqual({ refused: expect.stringMatching(/target "staging"/) });
46
+ const forged = JSON.parse(readFileSync(join(dir, PLAN_RUN_RECORD_FILE), "utf-8"));
47
+ writeFileSync(join(dir, PLAN_RUN_RECORD_FILE), JSON.stringify({ ...forged, gitSha: "b".repeat(40) }));
48
+ expect(readPlanRunRecord(dir, { env: "prod", head: HEAD, target: "staging" })).toEqual({ refused: expect.stringMatching(/commit/) });
49
+ expect(readPlanRunRecord(mkdtempSync(join(tmpdir(), "chant-plan-record-")), { env: "prod", head: HEAD })).toBeUndefined();
50
+ });
51
+
52
+ test("the plan step's lines: the verb alone without record or report", () => {
53
+ expect(planVerbLines({ command: "yodel plan" })).toEqual(["yodel plan"]);
54
+ const lines = planVerbLines({ command: "yodel plan", record: { env: {} } });
55
+ expect(lines[0]).toMatch(/^chant_plan_started=/);
56
+ expect(lines.at(-1)).toBe('[ "$chant_plan_exit" -eq 0 ] || exit "$chant_plan_exit"');
57
+ });
58
+ });
59
+
60
+ describe("the pull request loop's evidence, check and ref gate flags (#4935)", () => {
61
+ test("they need --pr-loop and one runner identity", () => {
62
+ expect(prLoopFlagsProblem({ checkJob: true })).toMatch(/--check-job .*needs --pr-loop/);
63
+ expect(prLoopFlagsProblem({ prLoop: true, evidenceRunnerKeySecret: "K", evidenceIdentity: "oidc" })).toMatch(/give one of them/);
64
+ expect(prLoopFlagsProblem({ prLoop: true, evidenceAudience: "x" })).toMatch(/goes with --evidence-identity oidc/);
65
+ expect(prLoopFlagsProblem({ prLoop: true, evidenceRunnerKeySecret: "1K" })).toMatch(/secret name/);
66
+ expect(prLoopFlagsProblem({ prLoop: true, evidenceIdentity: "oidc", evidenceAudience: "sigstore", checkJob: true, refGateStatus: true })).toBeUndefined();
67
+ });
68
+
69
+ test("the descriptors: the check report directory is ci check's, and the gate's branch is checked", () => {
70
+ expect(PR_CHECK_REPORT_DIR).toBe(CHECK_HOOKS_DIR);
71
+ expect(prCheckJob("github").evidence).toBeUndefined();
72
+ expect(() => prCheckJob("github", { evidence: { runnerKeySecret: "not a name" } })).toThrow(/secret name/);
73
+ expect(() => prRefGateJob("github", { branch: "a b" })).toThrow(/not a branch name/);
74
+ });
75
+ });
@@ -0,0 +1,101 @@
1
+ /**
2
+ * A product plan job's run record (#4899), as the note job reads it from the
3
+ * hand-off and keeps it on `chant/lifecycle`.
4
+ *
5
+ * `chant ci run plan --in-place` records a `pr-plan` job as Op `pr-plan` in
6
+ * the run ledger (`<env>/runs__pr-plan.jsonl`). A product's plan verb runs
7
+ * without `ci run`, and its plan job holds no token to push with, so its plan
8
+ * step writes the record into `.chant/pr/run-record.json`
9
+ * (`PLAN_RECORD_JS` in ./components/product-plan.ts) and the note job,
10
+ * which holds the token, appends it (`pr-post --record-run <plan job>`).
11
+ *
12
+ * The record is the change's: the plan job runs its code. So it is read as
13
+ * data, as the report is (./pr-post.ts). The note job keeps the record's id,
14
+ * its times and the plan verb's exit code, and fills the op, environment,
15
+ * labels, commit, run origin and status from what it knows itself. A record
16
+ * that names another op, environment, target or commit is refused, and a
17
+ * plan job that failed records a failed run whatever the record says.
18
+ */
19
+
20
+ import { existsSync, readFileSync } from "node:fs";
21
+ import { join } from "node:path";
22
+ import type { OpRunRecordInput } from "./op/runtime";
23
+ import type { RunOrigin } from "./lifecycle/release-ledger";
24
+
25
+ /** The record's file under the hand-off directory: `PLAN_RUN_RECORD_FILE` in ./components/product-plan.ts. */
26
+ export const PLAN_RUN_RECORD_FILE = "run-record.json";
27
+
28
+ /** The op a product plan job's run is recorded under: `pr-plan`'s. */
29
+ export const PLAN_RUN_OP = "pr-plan";
30
+
31
+ /** What the note job knows of the plan job it records. */
32
+ export interface PlanRunExpect {
33
+ /** The pipeline's environment, `--env`. */
34
+ env: string;
35
+ /** The commit the plan job checked out, `--head`. */
36
+ head: string;
37
+ /** The target, `--member`. */
38
+ target?: string;
39
+ /** The plan job's result as the forge says it (`needs.<job>.result`, GitLab's job status). */
40
+ result?: string;
41
+ /** The plan job's run, as the note job names it. */
42
+ origin?: RunOrigin;
43
+ }
44
+
45
+ const ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
46
+ const SHA = /^[0-9a-f]{40}$/;
47
+
48
+ function instant(v: unknown): string | undefined {
49
+ return typeof v === "string" && v.length <= 40 && Number.isFinite(Date.parse(v)) ? new Date(Date.parse(v)).toISOString() : undefined;
50
+ }
51
+
52
+ /**
53
+ * The run record to keep for the plan job, read from `dir`, or why it is
54
+ * refused; undefined when the plan job wrote none.
55
+ */
56
+ export function readPlanRunRecord(dir: string, expect: PlanRunExpect): { record: OpRunRecordInput } | { refused: string } | undefined {
57
+ const file = join(dir, PLAN_RUN_RECORD_FILE);
58
+ if (!existsSync(file)) return undefined;
59
+ let doc: unknown;
60
+ try {
61
+ doc = JSON.parse(readFileSync(file, "utf-8"));
62
+ } catch (err) {
63
+ return { refused: `the run record does not read: ${err instanceof Error ? err.message : String(err)}` };
64
+ }
65
+ if (!doc || typeof doc !== "object" || Array.isArray(doc)) return { refused: "the run record is not an object" };
66
+ const r = doc as Record<string, unknown>;
67
+ if (typeof r.id !== "string" || !ID.test(r.id)) return { refused: "the run record's id is not a UUID" };
68
+ if (r.op !== PLAN_RUN_OP) return { refused: `the run record is for op ${JSON.stringify(r.op)}, not ${PLAN_RUN_OP}` };
69
+ if (r.env !== expect.env) return { refused: `the run record is for environment ${JSON.stringify(r.env)}, not ${expect.env}` };
70
+ const labels = r.labels && typeof r.labels === "object" && !Array.isArray(r.labels) ? (r.labels as Record<string, unknown>) : {};
71
+ if ((labels.Target ?? undefined) !== expect.target) return { refused: `the run record is for target ${JSON.stringify(labels.Target ?? null)}, not ${JSON.stringify(expect.target ?? null)}` };
72
+ if (r.gitSha !== undefined && r.gitSha !== expect.head) return { refused: `the run record is for commit ${JSON.stringify(r.gitSha)}, not ${expect.head}` };
73
+ if (!SHA.test(expect.head)) return { refused: `the head ${JSON.stringify(expect.head)} is not a full commit` };
74
+ const started = instant(r.started);
75
+ const ended = instant(r.ended);
76
+ if (!started || !ended || Date.parse(ended) < Date.parse(started)) return { refused: "the run record's start and end are not times in order" };
77
+ const failure = r.failure && typeof r.failure === "object" ? (r.failure as Record<string, unknown>) : undefined;
78
+ const exitCode = typeof failure?.exitCode === "number" && Number.isInteger(failure.exitCode) && failure.exitCode > 0 && failure.exitCode < 256 ? failure.exitCode : undefined;
79
+ const failedJob = expect.result === "failure" || expect.result === "cancelled";
80
+ const failed = failedJob || r.status !== "ok" || exitCode !== undefined;
81
+ const status = failed ? "fail" : "ok";
82
+ const durationMs = Date.parse(ended) - Date.parse(started);
83
+ return {
84
+ record: {
85
+ id: r.id,
86
+ op: PLAN_RUN_OP,
87
+ env: expect.env,
88
+ started,
89
+ ended,
90
+ status,
91
+ labels: { Env: expect.env, Pipeline: "pr", Job: "plan", ...(expect.target ? { Target: expect.target } : {}) },
92
+ outcomes: {},
93
+ phases: [{ name: "plan", status, steps: [{ fn: "shellCmd", status, durationMs, ...(failed ? { error: exitCode !== undefined ? `command exited ${exitCode}` : "the plan job failed" } : {}) }] }],
94
+ gitSha: expect.head,
95
+ ...(expect.origin ? { runOrigin: expect.origin } : {}),
96
+ ...(failed
97
+ ? { failure: { code: "command-failed", reason: exitCode !== undefined ? `the plan verb exited ${exitCode}` : "the plan job failed", phase: "plan", ...(exitCode !== undefined ? { exitCode } : {}) } }
98
+ : {}),
99
+ },
100
+ };
101
+ }
@@ -144,3 +144,63 @@ describe("pr-post posts a product's plan note hand-off (#4799)", () => {
144
144
  expect(notes[0]!.marker).toBe(prNoteMarker("default", "prod"));
145
145
  });
146
146
  });
147
+
148
+ describe("pr-post keeps the product's marker and adds the note job's notices (#4931)", () => {
149
+ const markerWords = { ...TERRAGUCCI_NOTE, productMarker: "terragucci:plan" };
150
+
151
+ test("the hand-off's marker body goes under chant's marker as the product's own hidden line", async () => {
152
+ const { forge, notes } = fakeForge();
153
+ await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir: handoffDir(planNoteHandoff(NOTE, { ...at, marker: "roots=live/a,live/b" })), pr: 7, head: HEAD, env: "default", noteWords: markerWords }));
154
+ const lines = notes[0]!.body.split("\n");
155
+ expect(lines[0]).toBe(prNoteMarker("default"));
156
+ expect(lines[1]).toBe("<!-- terragucci:plan roots=live/a,live/b -->");
157
+ expect(notes[0]!.body.split("<!--")).toHaveLength(4);
158
+ });
159
+
160
+ test("without a productMarker in the words, the hand-off's marker is left out", async () => {
161
+ const { forge, notes } = fakeForge();
162
+ await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir: handoffDir(planNoteHandoff(NOTE, { ...at, marker: "roots=a" })), pr: 7, head: HEAD, env: "default", noteWords: TERRAGUCCI_NOTE }));
163
+ expect(notes[0]!.body).not.toContain("terragucci:plan");
164
+ });
165
+
166
+ test.each([["a comment end", "roots=a --> <!-- x"], ["a newline", "roots=a\nb"], ["a quote", 'roots="a"']])("a marker with %s is refused, and no note is posted", async (_what, marker) => {
167
+ const { forge, notes, statuses } = fakeForge();
168
+ const r = await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir: handoffDir(planNoteHandoff(NOTE, { ...at, marker })), pr: 7, head: HEAD, env: "default", noteWords: markerWords }));
169
+ expect(r.refused).toMatch(/marker is not words/);
170
+ expect(notes).toEqual([]);
171
+ expect(statuses[0]!.status.state).toBe("failure");
172
+ });
173
+
174
+ test("the note job's notices and the overdue Ops go under the counts, each once", async () => {
175
+ const { forge, notes } = fakeForge();
176
+ const overdue = async () => [{ op: "tf-drift", cron: "0 * * * *", since: "2026-11-01T00:00:00Z", message: "Op `tf-drift` is overdue: it last ran 2026-11-01." }];
177
+ await withProductWords(TERRAGUCCI, () =>
178
+ postPlanReport({ forge, dir: handoffDir(planNoteHandoff(NOTE, at)), pr: 7, head: HEAD, env: "default", noteWords: TERRAGUCCI_NOTE, overdue, notices: ["A review by bob doesn't count toward the gate.", "A review by bob doesn't count toward the gate."] }),
179
+ );
180
+ const body = notes[0]!.body;
181
+ expect(body).toContain("> Op `tf-drift` is overdue: it last ran 2026-11-01.");
182
+ expect(body.split("> A review by bob doesn't count toward the gate.")).toHaveLength(2);
183
+ });
184
+
185
+ test("an Op the product's own notices call overdue is not said twice", async () => {
186
+ const { forge, notes } = fakeForge();
187
+ const own = { ...NOTE, notices: ["Op `tf-drift` is overdue: the plan job saw it."] };
188
+ const overdue = async () => [{ op: "tf-drift", cron: "0 * * * *", since: "2026-11-01T00:00:00Z", message: "Op `tf-drift` is overdue: it last ran 2026-11-01." }];
189
+ await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir: handoffDir(planNoteHandoff(own, at)), pr: 7, head: HEAD, env: "default", noteWords: TERRAGUCCI_NOTE, overdue }));
190
+ expect(notes[0]!.body).not.toContain("it last ran 2026-11-01");
191
+ });
192
+
193
+ test("the notices come from the file CHANT_PLAN_NOTE_NOTICES names", async () => {
194
+ const { forge, notes } = fakeForge();
195
+ const file = join(mkdtempSync(join(tmpdir(), "chant-notices-")), "notices");
196
+ dirs.push(file.slice(0, file.lastIndexOf("/")));
197
+ writeFileSync(file, "first notice\n\nsecond notice\n");
198
+ process.env.CHANT_PLAN_NOTE_NOTICES = file;
199
+ try {
200
+ await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir: handoffDir(planNoteHandoff(NOTE, at)), pr: 7, head: HEAD, env: "default", noteWords: TERRAGUCCI_NOTE }));
201
+ } finally {
202
+ delete process.env.CHANT_PLAN_NOTE_NOTICES;
203
+ }
204
+ expect(notes[0]!.body).toContain("> first notice\n\n> second notice");
205
+ });
206
+ });