@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
@@ -91,6 +91,7 @@ import { ciRunIdFromEnv } from "./gate-run-locator";
91
91
  import { appendRunRecord, DEFAULT_RUN_ENV } from "../lifecycle/run-ledger";
92
92
  import { LifecyclePushLostError, pushLifecycleRebasing } from "../lifecycle/git";
93
93
  import { opWaveEvidenceRefusal, signOpWaveChecks } from "./op-waves-evidence";
94
+ import { writeCheckClaimFile } from "../ci-evidence-claims";
94
95
  import { opWavesEvidenceProblems, type OpWavesEvidence } from "./op-waves-evidence-spec";
95
96
  import { resolveCiJob } from "../lifecycle/release-ledger";
96
97
  import type { OpRunPolicyRow, OpRunRecordInput, OpRunStepRecord, OpRunWave, OpRunWavePlan, OpRunWaveTarget } from "./runtime";
@@ -143,6 +144,7 @@ import {
143
144
  opWaveGateName,
144
145
  opWaveHooksAt,
145
146
  opWaveHookRuns,
147
+ opWaveChecksDir,
146
148
  opWaveOutcomeDir,
147
149
  opWavePointAt,
148
150
  opWavePointProblems,
@@ -576,7 +578,8 @@ export interface OpWaveApplyHooksRun {
576
578
  /** Reads one file at one commit, or null when the commit has no such file. Injected for tests. */
577
579
  export type OpWaveShowAtBase = (base: string, path: string, cwd: string) => { sha: string; text: string | null };
578
580
 
579
- const gitShowAtBase: OpWaveShowAtBase = (base, path, cwd) => {
581
+ /** {@link OpWaveShowAtBase} through git: `git show <base>:<path>`. A run-time spec (#4982, `./op-waves-render-spec.ts`) reads every other file through it. */
582
+ export const gitShowAtBase: OpWaveShowAtBase = (base, path, cwd) => {
580
583
  let sha: string;
581
584
  try {
582
585
  sha = execFileSync("git", ["rev-parse", "--verify", `${base}^{commit}`], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
@@ -785,6 +788,15 @@ export interface RunOpWaveOptions {
785
788
  wave: number;
786
789
  /** Plan and decide only (a wide wave's deciding job). */
787
790
  decide?: boolean;
791
+ /**
792
+ * Plan the wave and run its policy hold, and nothing after it (#4926): the
793
+ * wave job's policy step, whose result the forge reports and the wave's
794
+ * evidence job signs `policy:<wave>` from. Exits 0 only when `ci.policy`
795
+ * ran over the wave's plans and denied nothing, 7 when it denied a run, 1
796
+ * when it did not run. Writes the check's claim file under
797
+ * {@link opWaveChecksDir} and no outcome file or run record.
798
+ */
799
+ policyOnly?: boolean;
788
800
  /** Apply this 1-based share of a decided wave, or with `group`, of that job group. */
789
801
  share?: number;
790
802
  /**
@@ -969,6 +981,8 @@ export interface RunOpWaveResult {
969
981
  targets?: Record<string, OpRunWaveTarget>;
970
982
  /** Each planned run with policy rows or an after-plan hook's files (#4614), as the run record's `wave.plans`. */
971
983
  plans?: Record<string, OpRunWavePlan>;
984
+ /** With `policyOnly` (#4926): the `ci.policy` rows the wave's policy hold gave, in run order. Empty when no policy ran. */
985
+ policyRows?: OpRunPolicyRow[];
972
986
  }
973
987
 
974
988
  /** What one wave job works with. */
@@ -2045,6 +2059,8 @@ export async function runOpWave(options: RunOpWaveOptions): Promise<RunOpWaveRes
2045
2059
  if (afterPlanWrong.length > 0) throw new Error(`Op waves "${options.spec.name}": ${afterPlanWrong.join("; ")}`);
2046
2060
  const runHooksWrong = opWaveRunHooksProblems(options.runHooks);
2047
2061
  if (runHooksWrong.length > 0) throw new Error(`Op waves "${options.spec.name}": ${runHooksWrong.join("; ")}`);
2062
+ // #4926: the policy step applies nothing, so it keeps no run record and no outcome file.
2063
+ if (options.policyOnly) return runOpWavePolicyOnly(options);
2048
2064
  // #4551: one run record per job, on every way the job ends.
2049
2065
  const started = new Date().toISOString();
2050
2066
  // #4555: the job's run events and its trace, when a reader or an exporter wants them.
@@ -2324,6 +2340,41 @@ async function runOpWaveJob(options: RunOpWaveOptions): Promise<RunOpWaveResult>
2324
2340
  return result;
2325
2341
  }
2326
2342
 
2343
+ /**
2344
+ * The wave job's policy step (#4926): plan the wave, run its policy hold,
2345
+ * and write `policy:<wave>`'s claim file, passed only when `ci.policy` ran
2346
+ * over the plans and denied nothing. The exit says the same, so the forge's
2347
+ * record of the step (GitLab: of the `<wave>-policy` job) carries it where
2348
+ * the change's code in the later steps cannot rewrite it. A share or job
2349
+ * group's job has no policy of its own; its deciding job's stands.
2350
+ */
2351
+ async function runOpWavePolicyOnly(options: RunOpWaveOptions): Promise<RunOpWaveResult> {
2352
+ const { spec } = options;
2353
+ if (options.share !== undefined || options.group !== undefined) throw new Error("--policy-only runs a wave's policy in its own or its deciding job; a share or job group's job has none of its own");
2354
+ const log = options.log ?? ((line: string) => console.error(line));
2355
+ const cwd = options.cwd ?? process.cwd();
2356
+ const outcomeDir = options.outcomeDir ?? opWaveOutcomeDir(spec);
2357
+ const dir = isAbsolute(outcomeDir) ? outcomeDir : join(cwd, outcomeDir);
2358
+ const wave = spec.waves[options.wave - 1] ?? spec.waves[spec.waves.length - 1]!;
2359
+ const check = `policy:${wave.name}`;
2360
+ const end = (exitCode: number, rows: OpRunPolicyRow[], line?: string): RunOpWaveResult => {
2361
+ if (line) log(line);
2362
+ const passed = exitCode === 0;
2363
+ writeCheckClaimFile(join(cwd, opWaveChecksDir(spec)), { check, passed, ...(passed ? { claim: JSON.stringify(rows) } : {}) });
2364
+ return { exitCode, applied: [], failed: [], moved: [], hooks: [], policyRows: rows };
2365
+ };
2366
+ const before = opWaveBefore(options, dir);
2367
+ if (before.stop) return end(CHANT_EXIT.failed, [], `${before.stop.line}; wave ${options.wave}'s policy did not run`);
2368
+ const step = await planOpWave(options, { k: options.wave, pass: 0 }, before.blocked);
2369
+ const got = "end" in step ? step.end : undefined;
2370
+ const rows = got?.policyRows ?? [];
2371
+ if (!got || got.exitCode !== 0 || got.policyRows === undefined) return end(got && got.exitCode !== 0 ? got.exitCode : CHANT_EXIT.failed, rows, `wave ${options.wave} (${wave.name}): its policy did not run to the end, so ${check} did not pass`);
2372
+ if (rows.length === 0) return end(CHANT_EXIT.failed, rows, `wave ${options.wave} (${wave.name}): no ci.policy ran over its plans (holds.policy is off, or the hold at base could not be read), so ${check} did not pass`);
2373
+ const denied = rows.filter((r) => r.result === "denied");
2374
+ if (denied.length > 0) return end(CHANT_EXIT.denied, rows, `wave ${options.wave} (${wave.name}): ci.policy denied ${denied.length} of its ${rows.length} plans, so ${check} did not pass`);
2375
+ return end(CHANT_EXIT.done, rows, `wave ${options.wave} (${wave.name}): ci.policy ran over its ${rows.length} plans and denied none`);
2376
+ }
2377
+
2327
2378
  /** The wave engine's loop over this module's steps, from `options.wave` on, with the runs in `skip` left out of that wave. */
2328
2379
  async function runOpWaveLoop(options: RunOpWaveOptions, log: (line: string) => void, applied: string[], skip: ReadonlyMap<string, string>): Promise<RunOpWaveResult> {
2329
2380
  const { spec } = options;
@@ -2658,6 +2709,8 @@ async function planOpWave(options: RunOpWaveOptions, { k, pass }: WaveAttempt<Ru
2658
2709
  }
2659
2710
  const before = await runBeforePlanHooks(ctx, rules.hooks, wave.runs);
2660
2711
  if (before.failed) return { end: failed(ctx, `a hook before the plan failed, so nothing in wave ${k} was planned or applied`) };
2712
+ // #4926: the policy step records no decision; the wave's own step does.
2713
+ if (before.waitingOn && options.policyOnly) return { end: failed(ctx, `wave ${k} (${wave.name}): a hook before the plan waits on ${before.waitingOn}, so its policy did not run`) };
2661
2714
  if (before.waitingOn) return { end: await decided(ctx, decision, recordPath, before.waitingOn) };
2662
2715
  if (spec.step) ctx.steps = new Map();
2663
2716
  const { members, pending: planPending, overriders: planOverriders, overridersSource: planOverridersSource, extras: planExtras, waves: found, changeSet, parts } = await planWaveRuns(ctx, wave.runs, wave.discover === true);
@@ -2676,8 +2729,11 @@ async function planOpWave(options: RunOpWaveOptions, { k, pass }: WaveAttempt<Ru
2676
2729
  // #4613: the decision names the shared policy commit its runs were judged by.
2677
2730
  if (held.policySource) decision.ciPolicySource = held.policySource;
2678
2731
  }
2679
- // #4870: with a runner key, the wave's plan and policy checks are signed over its commit.
2680
- await signOpWaveChecks({ cwd, head: options.head ?? "HEAD", base, wave: wave.name, planDigest: opWaveSetDigest(spec, members), policyRows, log });
2732
+ // #4926: the policy step ends here, with the rows its result stands for.
2733
+ if (options.policyOnly) return { end: { ...result, policyRows: [...policyRows.values()] } };
2734
+ // #4870: with a runner key, the wave's plan and policy checks are signed over its commit;
2735
+ // #4926: with an evidence job after it, the plan's claim file is left for that job.
2736
+ await signOpWaveChecks({ cwd, head: options.head ?? "HEAD", base, wave: wave.name, planDigest: opWaveSetDigest(spec, members), policyRows, log, checksDir: join(cwd, opWaveChecksDir(spec)) });
2681
2737
  // #4614: the after-plan hooks in the job's process, before the set digest and the gate.
2682
2738
  const inProcess = await runAfterPlan(ctx, members, parts, policyRows);
2683
2739
  if (inProcess.failed) return { end: failed(ctx, `${inProcess.failed}, so nothing in wave ${k} was approved or applied`) };
@@ -921,6 +921,17 @@ export function opWaveOutcomeDir(spec: Pick<OpWavesSpec, "name">): string {
921
921
  return `.chant/op-waves/${spec.name}/outcomes`;
922
922
  }
923
923
 
924
+ /**
925
+ * Where a wave job's steps leave the claim files of the checks they ran
926
+ * (#4926), for the wave's evidence job: `plan-<wave>.json` from the wave's
927
+ * command, `policy-<wave>.json` from its policy step. Beside the outcome
928
+ * directory; a later job that downloads every artifact into that directory
929
+ * skips them, since they are not named as outcome files.
930
+ */
931
+ export function opWaveChecksDir(spec: Pick<OpWavesSpec, "name">): string {
932
+ return `.chant/op-waves/${spec.name}/checks`;
933
+ }
934
+
924
935
  /** The outcome file of wave `wave`'s job, or of one group or share of it (#4322). */
925
936
  export function opWaveOutcomePath(spec: Pick<OpWavesSpec, "name">, wave: number, part: { group?: string; share?: number } = {}): string {
926
937
  return `${opWaveOutcomeDir(spec)}/${waveOutcomeFileName(wave, part)}`;
@@ -1451,14 +1462,17 @@ export function opWaveShare<T extends { target: string }>(runs: readonly T[], sh
1451
1462
  * The jobs of an Op waves pipeline, in order. `specFile` is the spec's path
1452
1463
  * from the job's working directory, which every command names. `bin` is the
1453
1464
  * product's command in place of `chant` (#4607, {@link opWaveBinArgv}).
1465
+ * With `renderSpec` (#4982) every command passes `--render-spec`: the job
1466
+ * renders the spec at base through the product's command
1467
+ * (`./op-waves-render-spec.ts`), and `spec` is the pipeline's shape.
1454
1468
  */
1455
- export function opWaveJobs(spec: OpWavesSpec, specFile: string, options: { bin?: string } = {}): OpWaveJob[] {
1469
+ export function opWaveJobs(spec: OpWavesSpec, specFile: string, options: { bin?: string; renderSpec?: boolean } = {}): OpWaveJob[] {
1456
1470
  assertOpWavesSpec(spec);
1457
1471
  const jobs: OpWaveJob[] = [];
1458
1472
  let previous: string[] = [];
1459
1473
  spec.waves.forEach((wave, index) => {
1460
1474
  const k = index + 1;
1461
- const command = [...opWaveBinArgv(options.bin), "run", "wave", "--spec", specFile, "--wave", String(k), ...(spec.base ? ["--base", spec.base] : [])];
1475
+ const command = [...opWaveBinArgv(options.bin), "run", "wave", "--spec", specFile, "--wave", String(k), ...(spec.base ? ["--base", spec.base] : []), ...(options.renderSpec ? ["--render-spec"] : [])];
1462
1476
  const prefix = `wave-${k}-${wave.name}`;
1463
1477
  const shares = wave.shares ?? 1;
1464
1478
  if (shares === 1 && wave.jobs === undefined) {
@@ -9,7 +9,7 @@ import { tmpdir } from "node:os";
9
9
  import { join } from "node:path";
10
10
  import { afterEach, describe, expect, test } from "vitest";
11
11
  import { cronFiresUtc } from "./cron";
12
- import { checkOverdueOps, opPipelineFile, overdueVerdict, scheduledWatches } from "./schedule-overdue";
12
+ import { checkOverdueOps, opPipelineFile, overdueOpsAt, overdueVerdict, PLAN_WATCHES_ENV, plannedWatchesFromEnv, scheduledWatches, scheduledWatchProblem } from "./schedule-overdue";
13
13
  import { forgejoForge, githubForge, gitlabForge, type ForgeFetch, type PrForge } from "../pr-forge";
14
14
  import { renderPrNote, type PrReport } from "../pr-loop";
15
15
  import type { OpConfig } from "./types";
@@ -309,6 +309,49 @@ describe("checkOverdueOps", () => {
309
309
  expect(asked).toEqual([schedule]);
310
310
  expect(found[0]?.message).toContain("No active pipeline schedule is picked by the Op's rule, one whose TERRAGUCCI_SCHEDULE is none of comments, resume.");
311
311
  });
312
+
313
+ /**
314
+ * #4952: a shallow checkout's oldest commit lists every file as added, so
315
+ * the job that never ran counts from that commit and the check
316
+ * under-reports. The check deepens the history and reads the real commit.
317
+ */
318
+ describe("a shallow checkout", () => {
319
+ function shallowClone(): string {
320
+ const origin = repo({ ".github/workflows/drift.yml": "on: schedule" }, "2026-09-01T00:00:00Z");
321
+ const later = "2026-10-20T00:00:00Z";
322
+ writeFileSync(join(origin, "README.md"), "later\n");
323
+ execFileSync("git", ["-C", origin, "add", "."], { stdio: "pipe" });
324
+ execFileSync("git", ["-C", origin, "-c", "user.name=t", "-c", "user.email=t@example.com", "commit", "-q", "-m", "later"], { env: { ...process.env, GIT_COMMITTER_DATE: later, GIT_AUTHOR_DATE: later }, stdio: "pipe" });
325
+ const clone = join(origin, ".clone");
326
+ execFileSync("git", ["clone", "-q", "--depth", "1", `file://${origin}`, clone], { stdio: "pipe" });
327
+ return clone;
328
+ }
329
+ const run = (root: string, lines: string[]) =>
330
+ checkOverdueOps({
331
+ watches: [{ op: "drift", cron: "0 6 * * *" }],
332
+ forge: forgeWith("github", async () => ({})),
333
+ repoRoot: root,
334
+ now: new Date("2026-10-22T00:00:00Z"),
335
+ log: (l) => lines.push(l),
336
+ });
337
+
338
+ test("deepens the history and counts from the commit that added the file", async () => {
339
+ const clone = shallowClone();
340
+ const lines: string[] = [];
341
+ const found = await run(clone, lines);
342
+ expect(found.map((o) => o.since.slice(0, 10))).toEqual(["2026-09-01"]);
343
+ expect(execFileSync("git", ["-C", clone, "rev-parse", "--is-shallow-repository"], { encoding: "utf-8" }).trim()).toBe("false");
344
+ });
345
+
346
+ test("a fetch that fails counts from the oldest commit there is, and says so", async () => {
347
+ const clone = shallowClone();
348
+ execFileSync("git", ["-C", clone, "remote", "remove", "origin"], { stdio: "pipe" });
349
+ const lines: string[] = [];
350
+ const found = await run(clone, lines);
351
+ expect(found.map((o) => o.since.slice(0, 10))).toEqual(["2026-10-20"]);
352
+ expect(lines.some((l) => l.includes("the checkout is shallow and its history could not be fetched"))).toBe(true);
353
+ });
354
+ });
312
355
  });
313
356
 
314
357
  describe("the plan note", () => {
@@ -329,3 +372,85 @@ describe("the plan note", () => {
329
372
  expect(renderPrNote(report)).toContain("Warning: Op `drift` is overdue: test.");
330
373
  });
331
374
  });
375
+
376
+ // #4888: a product's prefix and label, and its own watches beside the discovered Ops.
377
+ describe("a product's words and watches", () => {
378
+ /** A temporary repository, left for the OS to clear. */
379
+ function repo(files: Record<string, string>): string {
380
+ const dir = mkdtempSync(join(tmpdir(), "chant-overdue-words-"));
381
+ const date = "2026-10-01T00:00:00Z";
382
+ const git = (...args: string[]) => execFileSync("git", ["-C", dir, ...args], { env: { ...process.env, GIT_COMMITTER_DATE: date, GIT_AUTHOR_DATE: date }, stdio: "pipe" });
383
+ git("init", "-q");
384
+ for (const [path, body] of Object.entries(files)) {
385
+ mkdirSync(join(dir, path, ".."), { recursive: true });
386
+ writeFileSync(join(dir, path), body);
387
+ }
388
+ git("add", ".");
389
+ git("-c", "user.name=t", "-c", "user.email=t@example.com", "commit", "-q", "-m", "add");
390
+ return dir;
391
+ }
392
+
393
+ const forge = (scheduledRuns: PrForge["scheduledRuns"]): PrForge => ({ kind: "github", host: "example", scheduledRuns }) as PrForge;
394
+ const now = new Date("2026-10-22T00:00:00Z");
395
+
396
+ test("logPrefix goes before every log line and label before each verdict's message", async () => {
397
+ const root = repo({ ".github/workflows/drift.yml": "on: schedule", ".github/workflows/other.yml": "on: schedule" });
398
+ const lines: string[] = [];
399
+ const found = await checkOverdueOps({
400
+ watches: [
401
+ { op: "drift", cron: "0 6 * * *" },
402
+ { op: "other", cron: "0 6 * * *" },
403
+ ],
404
+ forge: forge(async (q) => {
405
+ if (q.op === "other") throw new Error("403\nmore");
406
+ return {};
407
+ }),
408
+ repoRoot: root,
409
+ now,
410
+ log: (l) => lines.push(l),
411
+ logPrefix: "yodel plan: ",
412
+ label: "Warning: ",
413
+ });
414
+ expect(found).toHaveLength(1);
415
+ expect(found[0]!.message).toMatch(/^Warning: Op `drift` is overdue: /);
416
+ expect(lines).toHaveLength(2);
417
+ expect(lines[0]).toMatch(/^yodel plan: Op `drift` is overdue: /);
418
+ expect(lines[1]).toBe("yodel plan: schedule check: github did not say when Op other last ran, so it is not checked: 403");
419
+ });
420
+
421
+ test("without words the lines and messages are chant's as before", async () => {
422
+ const root = repo({ ".github/workflows/drift.yml": "on: schedule" });
423
+ const lines: string[] = [];
424
+ const found = await checkOverdueOps({ watches: [{ op: "drift", cron: "0 6 * * *" }], forge: forge(async () => ({})), repoRoot: root, now, log: (l) => lines.push(l) });
425
+ expect(found[0]!.message).toMatch(/^Op `drift` is overdue: /);
426
+ expect(lines).toEqual([found[0]!.message]);
427
+ });
428
+
429
+ test("overdueOpsAt checks a product's watches where no Op is discovered", async () => {
430
+ const root = repo({ ".github/workflows/terragucci-drift.yml": "on: schedule" });
431
+ const asked: string[] = [];
432
+ const found = await overdueOpsAt({
433
+ forge: forge(async (q) => {
434
+ asked.push(`${q.op} ${q.workflow}`);
435
+ return {};
436
+ }),
437
+ cwd: root,
438
+ now,
439
+ log: () => {},
440
+ watches: [{ op: "tf-drift", cron: "0 6 * * *", files: [".github/workflows/terragucci-drift.yml", ".github/workflows/terragucci.yml"] }],
441
+ });
442
+ expect(asked).toEqual(["tf-drift terragucci-drift.yml"]);
443
+ expect(found.map((o) => o.op)).toEqual(["tf-drift"]);
444
+ });
445
+
446
+ test("the watches the pipeline names, each checked; one that is not a watch is said and left out", () => {
447
+ const lines: string[] = [];
448
+ const good = { op: "tf-drift", cron: "0 6 * * *", files: [".gitlab/terragucci-drift.yml"], schedule: { variable: "TERRAGUCCI_SCHEDULE", not: ["comments", "resume"] } };
449
+ const env = { [PLAN_WATCHES_ENV]: JSON.stringify([good, { op: "x", cron: "nope" }, { op: "y", cron: "0 6 * * *", files: ["../etc/passwd"] }]) };
450
+ expect(plannedWatchesFromEnv(env, (l) => lines.push(l))).toEqual([good]);
451
+ expect(lines).toEqual([`${PLAN_WATCHES_ENV}: watch x's cron "nope" is not five fields, so it is not checked`, `${PLAN_WATCHES_ENV}: watch y's files are not paths from the repository root, so it is not checked`]);
452
+ expect(plannedWatchesFromEnv({})).toEqual([]);
453
+ expect(plannedWatchesFromEnv({ [PLAN_WATCHES_ENV]: "{" }, (l) => lines.push(l))).toEqual([]);
454
+ expect(scheduledWatchProblem({ op: "a", cron: "0 6 * * *", schedule: { variable: "V", value: 'x" || true' } })).toContain("schedule value");
455
+ });
456
+ });
@@ -213,9 +213,61 @@ function yamlDocs(repoRoot: string, path: string): Record<string, unknown>[] {
213
213
 
214
214
  /** When `path` was first committed (ISO 8601), if the checkout's history has it. */
215
215
  export function fileAdded(repoRoot: string, path: string): string | undefined {
216
- const r = spawnSync("git", ["-C", repoRoot, "log", "--format=%cI", "--diff-filter=A", "--", path], { encoding: "utf-8" });
216
+ return addedCommit(repoRoot, path)?.at;
217
+ }
218
+
219
+ /** The oldest commit the checkout's history says added `path`, with its commit time. */
220
+ function addedCommit(repoRoot: string, path: string): { sha: string; at: string } | undefined {
221
+ const r = spawnSync("git", ["-C", repoRoot, "log", "--format=%H %cI", "--diff-filter=A", "--", path], { encoding: "utf-8" });
217
222
  if (r.status !== 0) return undefined;
218
- return r.stdout.trim().split("\n").filter(Boolean).pop();
223
+ const last = r.stdout.trim().split("\n").filter(Boolean).pop();
224
+ if (!last) return undefined;
225
+ const [sha, at] = last.split(" ");
226
+ return sha && at ? { sha, at } : undefined;
227
+ }
228
+
229
+ /**
230
+ * The commits a shallow checkout's history stops at (#4952), from git's
231
+ * `shallow` file. Empty for a full clone.
232
+ */
233
+ function shallowBoundary(repoRoot: string): Set<string> {
234
+ const r = spawnSync("git", ["-C", repoRoot, "rev-parse", "--path-format=absolute", "--git-path", "shallow"], { encoding: "utf-8" });
235
+ if (r.status !== 0) return new Set();
236
+ try {
237
+ return new Set(readFileSync(r.stdout.trim(), "utf-8").split("\n").map((l) => l.trim()).filter(Boolean));
238
+ } catch {
239
+ return new Set();
240
+ }
241
+ }
242
+
243
+ /** How long the check waits for the fetch that deepens a shallow checkout. */
244
+ const DEEPEN_TIMEOUT_MS = 120_000;
245
+
246
+ /**
247
+ * When `path` was added, read so a shallow checkout does not under-report
248
+ * (#4952). A CI checkout is often shallow, and its oldest commit lists
249
+ * every file as added, so a job that never ran would count from that
250
+ * commit. When the commit found is at the shallow boundary, the check
251
+ * fetches the rest of the history once per run (`git fetch --unshallow`,
252
+ * with the job's own credentials) and reads the file again. When that fetch
253
+ * fails, the boundary's time is still a lower bound, so the check counts
254
+ * from it and says so in the log.
255
+ */
256
+ function addedDate(repoRoot: string, path: string, op: string, state: { deepened?: boolean; failed?: string }, log: (line: string) => void): string | undefined {
257
+ let found = addedCommit(repoRoot, path);
258
+ if (!found || !shallowBoundary(repoRoot).has(found.sha)) return found?.at;
259
+ if (!state.deepened) {
260
+ state.deepened = true;
261
+ const r = spawnSync("git", ["-C", repoRoot, "fetch", "--quiet", "--unshallow"], { encoding: "utf-8", timeout: DEEPEN_TIMEOUT_MS });
262
+ if (r.status !== 0) state.failed = (r.stderr || r.error?.message || `git fetch exited ${r.status}`).trim().split("\n")[0];
263
+ // A checkout with no remote answers 0 and stays shallow.
264
+ else if (shallowBoundary(repoRoot).size > 0) state.failed = "git fetch --unshallow left it shallow";
265
+ found = addedCommit(repoRoot, path) ?? found;
266
+ }
267
+ if (state.failed !== undefined && shallowBoundary(repoRoot).has(found.sha)) {
268
+ log(`schedule check: the checkout is shallow and its history could not be fetched, so Op ${op} counts from its oldest commit, ${found.at.slice(0, 10)}: ${state.failed}`);
269
+ }
270
+ return found.at;
219
271
  }
220
272
 
221
273
  const HINT: Record<ForgeKind, string> = {
@@ -273,10 +325,13 @@ export async function checkOverdueOps(input: {
273
325
  member?: string;
274
326
  now: Date;
275
327
  log: (line: string) => void;
276
- }): Promise<OverdueOp[]> {
328
+ } & OverdueWords): Promise<OverdueOp[]> {
277
329
  const { forge } = input;
278
330
  if (!forge.scheduledRuns) return [];
331
+ const log = (line: string): void => input.log(`${input.logPrefix ?? ""}${line}`);
279
332
  const out: OverdueOp[] = [];
333
+ // One fetch at most per check, however many Ops count from a shallow boundary (#4952).
334
+ const history: { deepened?: boolean; failed?: string } = {};
280
335
  for (const watch of input.watches) {
281
336
  const file = opPipelineFile(input.repoRoot, forge.kind, watch, input.member);
282
337
  if (!file) continue;
@@ -284,18 +339,91 @@ export async function checkOverdueOps(input: {
284
339
  try {
285
340
  runs = await forge.scheduledRuns({ op: watch.op, workflow: file.split("/").pop()!, ...(watch.schedule ? { schedule: watch.schedule } : {}) });
286
341
  } catch (err) {
287
- input.log(`schedule check: ${forge.kind} did not say when Op ${watch.op} last ran, so it is not checked: ${(err instanceof Error ? err.message : String(err)).split("\n")[0]}`);
342
+ log(`schedule check: ${forge.kind} did not say when Op ${watch.op} last ran, so it is not checked: ${(err instanceof Error ? err.message : String(err)).split("\n")[0]}`);
288
343
  continue;
289
344
  }
290
- const found = overdueVerdict(watch, forge.kind, runs, runs.last ? undefined : fileAdded(input.repoRoot, file), input.now);
345
+ const found = overdueVerdict(watch, forge.kind, runs, runs.last ? undefined : addedDate(input.repoRoot, file, watch.op, history, log), input.now);
291
346
  if (found) {
292
- input.log(found.message);
293
- out.push(found);
347
+ log(found.message);
348
+ out.push(input.label ? { ...found, message: `${input.label}${found.message}` } : found);
294
349
  }
295
350
  }
296
351
  return out;
297
352
  }
298
353
 
354
+ /**
355
+ * A product's words for the overdue check (#4888), so it passes them in
356
+ * place of wrapping `log` and each verdict's message itself.
357
+ */
358
+ export interface OverdueWords {
359
+ /** Put before every line the check writes to `log`, such as `yodel plan: `. */
360
+ logPrefix?: string;
361
+ /** Put before each verdict's `message`, the line the note shows, such as `Warning: `. The log line keeps chant's words. */
362
+ label?: string;
363
+ }
364
+
365
+ /**
366
+ * The variable the generated plan-note job names a product's own scheduled
367
+ * watches in (#4888): a JSON array of {@link ScheduledWatch}, from the
368
+ * pipeline (`productPlan.watches`), never from the plan job's report.
369
+ * `pr-post` checks them with the job's token beside the Ops it discovers.
370
+ */
371
+ export const PLAN_WATCHES_ENV = "CHANT_PLAN_WATCHES";
372
+
373
+ const OP_NAME = /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/;
374
+ const REL_PATH = /^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9_.\/-]+$/;
375
+ const VAR_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
376
+
377
+ /**
378
+ * Why `watch` is not a scheduled watch a pipeline may name (#4888), or
379
+ * undefined when it is: an Op name, a cron of five fields, `files` as
380
+ * relative paths with no `..`, and a GitLab selector of a variable name and
381
+ * plain values. None of them holds a `$`, so GitLab, which expands
382
+ * variables in a job's variables, passes the JSON as written.
383
+ */
384
+ export function scheduledWatchProblem(watch: unknown): string | undefined {
385
+ if (!isRecord(watch)) return "a watch is an object with op and cron";
386
+ if (typeof watch.op !== "string" || !OP_NAME.test(watch.op)) return `the watch's op ${JSON.stringify(watch.op)} is not an Op name`;
387
+ if (typeof watch.cron !== "string" || !/^[0-9A-Za-z*\/,? -]+$/.test(watch.cron) || watch.cron.trim().split(/\s+/).length !== 5) return `watch ${watch.op}'s cron ${JSON.stringify(watch.cron)} is not five fields`;
388
+ if (watch.files !== undefined && (!Array.isArray(watch.files) || watch.files.some((f) => typeof f !== "string" || !REL_PATH.test(f)))) return `watch ${watch.op}'s files are not paths from the repository root`;
389
+ if (watch.schedule !== undefined) {
390
+ const s = watch.schedule;
391
+ const plain = (v: unknown): boolean => typeof v === "string" && /^[A-Za-z0-9_.:\/-]+$/.test(v);
392
+ if (!isRecord(s) || typeof s.variable !== "string" || !VAR_NAME.test(s.variable)) return `watch ${watch.op}'s schedule names no variable`;
393
+ if (s.value !== undefined && !plain(s.value)) return `watch ${watch.op}'s schedule value is not a plain word`;
394
+ if (s.not !== undefined && (!Array.isArray(s.not) || !s.not.every(plain))) return `watch ${watch.op}'s schedule not is not a list of plain words`;
395
+ }
396
+ return undefined;
397
+ }
398
+
399
+ /**
400
+ * The watches {@link PLAN_WATCHES_ENV} names (#4888), each checked with
401
+ * {@link scheduledWatchProblem}; one that is not a watch is a line in `log`
402
+ * and left out. None when the variable is unset or not a JSON array.
403
+ */
404
+ export function plannedWatchesFromEnv(env: Record<string, string | undefined> = process.env, log: (line: string) => void = () => undefined): ScheduledWatch[] {
405
+ const raw = env[PLAN_WATCHES_ENV];
406
+ if (!raw?.trim()) return [];
407
+ let doc: unknown;
408
+ try {
409
+ doc = JSON.parse(raw);
410
+ } catch {
411
+ log(`${PLAN_WATCHES_ENV} is not JSON, so no product watch is checked`);
412
+ return [];
413
+ }
414
+ if (!Array.isArray(doc)) {
415
+ log(`${PLAN_WATCHES_ENV} is not a JSON array, so no product watch is checked`);
416
+ return [];
417
+ }
418
+ const out: ScheduledWatch[] = [];
419
+ for (const w of doc) {
420
+ const problem = scheduledWatchProblem(w);
421
+ if (problem) log(`${PLAN_WATCHES_ENV}: ${problem}, so it is not checked`);
422
+ else out.push(w as ScheduledWatch);
423
+ }
424
+ return out;
425
+ }
426
+
299
427
  /**
300
428
  * The overdue check over the Ops declared at `cwd` (#4289), as the plan note
301
429
  * reports it: the Ops `discoverOps` finds there, and the repository root
@@ -305,14 +433,36 @@ export async function checkOverdueOps(input: {
305
433
  * when a job ran, nothing is checked. A failure is a line in `log` and no
306
434
  * verdict, and the plan goes on.
307
435
  */
308
- export async function overdueOpsAt(input: { forge: PrForge | undefined; cwd: string; member?: string; now?: Date; log: (line: string) => void }): Promise<OverdueOp[]> {
436
+ export async function overdueOpsAt(
437
+ input: {
438
+ forge: PrForge | undefined;
439
+ cwd: string;
440
+ member?: string;
441
+ now?: Date;
442
+ log: (line: string) => void;
443
+ /**
444
+ * A product's own scheduled watches (#4888), checked beside the
445
+ * discovered Ops; one of the same name takes the discovered Op's place.
446
+ * They are checked even when discovery fails.
447
+ */
448
+ watches?: readonly ScheduledWatch[];
449
+ } & OverdueWords,
450
+ ): Promise<OverdueOp[]> {
309
451
  const { forge } = input;
310
452
  if (!forge?.scheduledRuns) return [];
453
+ const own = input.watches ?? [];
454
+ let discovered: ScheduledWatch[] = [];
311
455
  try {
312
456
  const { discoverOps } = await import("./discover");
313
- const discovered = await discoverOps({ cwd: input.cwd });
314
- const watches = scheduledWatches([...discovered.ops.values()].map((d) => d.config));
315
- if (watches.length === 0) return [];
457
+ const found = await discoverOps({ cwd: input.cwd });
458
+ discovered = scheduledWatches([...found.ops.values()].map((d) => d.config));
459
+ } catch (err) {
460
+ input.log(`${input.logPrefix ?? ""}could not check the scheduled Ops, so none is reported overdue: ${err instanceof Error ? err.message : String(err)}`);
461
+ if (own.length === 0) return [];
462
+ }
463
+ const watches = [...discovered.filter((d) => !own.some((w) => w.op === d.op)), ...own];
464
+ if (watches.length === 0) return [];
465
+ try {
316
466
  const top = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd: input.cwd, encoding: "utf-8" });
317
467
  if (top.status !== 0) return [];
318
468
  return await checkOverdueOps({
@@ -322,9 +472,11 @@ export async function overdueOpsAt(input: { forge: PrForge | undefined; cwd: str
322
472
  ...(input.member ? { member: input.member } : {}),
323
473
  now: input.now ?? new Date(),
324
474
  log: input.log,
475
+ ...(input.logPrefix ? { logPrefix: input.logPrefix } : {}),
476
+ ...(input.label ? { label: input.label } : {}),
325
477
  });
326
478
  } catch (err) {
327
- input.log(`could not check the scheduled Ops, so none is reported overdue: ${err instanceof Error ? err.message : String(err)}`);
479
+ input.log(`${input.logPrefix ?? ""}could not check the scheduled Ops, so none is reported overdue: ${err instanceof Error ? err.message : String(err)}`);
328
480
  return [];
329
481
  }
330
482
  }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * #4979: the wave stop a comment writes before a re-run, `_waves/<op>.stops.json`
3
+ * on `chant/lifecycle`, and what a wave job says when it waits behind it.
4
+ */
5
+ import { describe, expect, test } from "vitest";
6
+ import { execFileSync } from "node:child_process";
7
+ import { mkdtempSync, realpathSync, writeFileSync } from "node:fs";
8
+ import { tmpdir } from "node:os";
9
+ import { join } from "node:path";
10
+ import { parseWaveStops, renderWaveStops, setWaveStop, waveStopAt, waveStopLine, waveStopped, WAVE_STOPS_KEPT } from "./wave-stop";
11
+
12
+ const SHA = "a".repeat(40);
13
+
14
+ function git(cwd: string, ...args: string[]): string {
15
+ return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
16
+ }
17
+
18
+ function initRepo(): string {
19
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "chant-wave-stop-")));
20
+ git(dir, "init", "-q", "-b", "main");
21
+ git(dir, "config", "user.email", "test@chant.dev");
22
+ git(dir, "config", "user.name", "Test");
23
+ git(dir, "config", "commit.gpgsign", "false");
24
+ writeFileSync(join(dir, "README.md"), "# t\n");
25
+ git(dir, "add", "README.md");
26
+ git(dir, "commit", "-q", "-m", "init");
27
+ return dir;
28
+ }
29
+
30
+ describe("the stops file (#4979)", () => {
31
+ test("reads back what it wrote, drops what is not a stop, and keeps the newest", () => {
32
+ const file = { version: 1 as const, stops: { [SHA]: { through: 2, at: "2026-11-10T00:00:00.000Z", by: "alice", pr: 12 } } };
33
+ expect(parseWaveStops(renderWaveStops(file))).toEqual(file);
34
+ expect(parseWaveStops('{"version":1,"stops":{"nope":{"through":1,"at":"x"},"' + SHA + '":{"through":0,"at":"x"}}}')).toEqual({ version: 1, stops: {} });
35
+ expect(parseWaveStops("not json")).toEqual({ version: 1, stops: {} });
36
+ const many = { version: 1 as const, stops: Object.fromEntries(Array.from({ length: WAVE_STOPS_KEPT + 5 }, (_, i) => [i.toString(16).padStart(40, "0"), { through: 1, at: `2026-11-10T00:00:${String(i).padStart(2, "0")}.000Z` }])) };
37
+ const kept = parseWaveStops(renderWaveStops(many)).stops;
38
+ expect(Object.keys(kept)).toHaveLength(WAVE_STOPS_KEPT);
39
+ expect(kept["0".repeat(40)]).toBeUndefined();
40
+ });
41
+
42
+ test("a wave after the stop waits, and the stop's own wave runs", () => {
43
+ const stop = { through: 2, at: "x" };
44
+ expect(waveStopped(stop, 2)).toBe(false);
45
+ expect(waveStopped(stop, 3)).toBe(true);
46
+ expect(waveStopped(undefined, 9)).toBe(false);
47
+ });
48
+ });
49
+
50
+ describe("a stop on chant/lifecycle (#4979)", () => {
51
+ test("is written for a commit, read by the wave job at that commit, and cleared", async () => {
52
+ const dir = initRepo();
53
+ const head = git(dir, "rev-parse", "HEAD");
54
+ expect(await waveStopLine("tf-apply", 3, { cwd: dir })).toBeUndefined();
55
+ expect(await setWaveStop("tf-apply", head, { through: 2, at: "2026-11-10T00:00:00.000Z", by: "alice", pr: 12 }, { cwd: dir })).toEqual({ changed: true, pushed: false });
56
+ expect(await waveStopAt("tf-apply", head, { cwd: dir })).toEqual({ through: 2, at: "2026-11-10T00:00:00.000Z", by: "alice", pr: 12 });
57
+ expect(git(dir, "show", "chant/lifecycle:_waves/tf-apply.stops.json")).toContain('"through": 2');
58
+ expect(await waveStopLine("tf-apply", 2, { cwd: dir })).toBeUndefined();
59
+ expect(await waveStopLine("tf-apply", 3, { cwd: dir })).toBe(`wave 3 waits: alice's comment on pull request 12 ran tf-apply again at ${head.slice(0, 12)} through wave 2; comment the apply again without a wave to run the waves after it`);
60
+ // Another op's waves, and another commit, are not stopped.
61
+ expect(await waveStopLine("other", 3, { cwd: dir })).toBeUndefined();
62
+ expect(await waveStopAt("tf-apply", SHA, { cwd: dir })).toBeUndefined();
63
+ expect(await setWaveStop("tf-apply", head, null, { cwd: dir })).toEqual({ changed: true, pushed: false });
64
+ expect(await waveStopLine("tf-apply", 3, { cwd: dir })).toBeUndefined();
65
+ expect(await setWaveStop("tf-apply", head, null, { cwd: dir })).toEqual({ changed: false, pushed: false });
66
+ });
67
+
68
+ test("refuses an op or a commit that is not one", async () => {
69
+ await expect(setWaveStop("a b", SHA, null)).rejects.toThrow(/not a stops file name/);
70
+ await expect(setWaveStop("tf-apply", "main", null)).rejects.toThrow(/not a commit sha/);
71
+ });
72
+ });