@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
@@ -145,7 +145,11 @@ export function commitAndTree(repo, rev) {
145
145
  const commit = git(repo, ["rev-parse", "--verify", "--quiet", `${rev}^{commit}`]);
146
146
  return { commit, tree: git(repo, ["rev-parse", `${commit}^{tree}`]) };
147
147
  }
148
- /** The check's statement over `commit`, with the digest of what it said when given. */
148
+ /**
149
+ * The check's statement over `commit`, with the digest of what it said when
150
+ * given, and (#4926) the run, job and step a signer outside the check's job
151
+ * read its pass from, so a verifier can look them up.
152
+ */
149
153
  export function checkStatement(input) {
150
154
  if (!input.check.trim())
151
155
  throw new Error("a check's evidence needs the check's name");
@@ -159,6 +163,7 @@ export function checkStatement(input) {
159
163
  tree: input.tree,
160
164
  check: input.check,
161
165
  ...(input.claim !== undefined ? { claim: { sha256: createHash("sha256").update(input.claim).digest("hex") } } : {}),
166
+ ...(input.source ? { source: { run: input.source.run, job: input.source.job, ...(input.source.step ? { step: input.source.step } : {}) } } : {}),
162
167
  },
163
168
  };
164
169
  }
@@ -166,8 +171,8 @@ export function checkStatement(input) {
166
171
  export async function signChecks(repo, at, checks, signer) {
167
172
  const { commit, tree } = commitAndTree(repo, at);
168
173
  const out = [];
169
- for (const { check, claim } of checks) {
170
- const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}) });
174
+ for (const { check, claim, source } of checks) {
175
+ const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}), ...(source ? { source } : {}) });
171
176
  out.push({ check, commit, tree, runner: signer.principal, envelope: await signer.sign(IN_TOTO_PAYLOAD_TYPE, Buffer.from(canonicalJson(statement), "utf8")) });
172
177
  }
173
178
  return out;
@@ -47,6 +47,11 @@ export declare const evidenceStatementSchema: z.ZodObject<{
47
47
  environment: z.ZodOptional<z.ZodObject<{
48
48
  sha256: z.ZodString;
49
49
  }, z.core.$strict>>;
50
+ source: z.ZodOptional<z.ZodObject<{
51
+ run: z.ZodNumber;
52
+ job: z.ZodNumber;
53
+ step: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strict>>;
50
55
  }, z.core.$strict>;
51
56
  }, z.core.$strict>;
52
57
  export type EvidenceStatement = z.infer<typeof evidenceStatementSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,cAAc,oCAAoC,CAAC;AAChE,eAAO,MAAM,yBAAyB,kDAAkD,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,+ZAmBS,CAAC;AAC3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAKtE,kGAAkG;AAClG,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;kBA2BzB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAkBD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC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ACvB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,qGAAqG;IACrG,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe,CAmCvH"}
@@ -70,6 +70,11 @@ export const evidenceStatementSchema = z
70
70
  check: z.string().min(1),
71
71
  claim: z.object({ sha256: sha256Hex }).strict().optional(),
72
72
  environment: z.object({ sha256: sha256Hex }).strict().optional(),
73
+ // #4926: the forge's record the signer relied on: the run, the job, and the step whose conclusion it read.
74
+ source: z
75
+ .object({ run: z.number().int().nonnegative(), job: z.number().int().nonnegative(), step: z.string().min(1).optional() })
76
+ .strict()
77
+ .optional(),
73
78
  })
74
79
  .strict(),
75
80
  })
@@ -0,0 +1,67 @@
1
+ /**
2
+ * `chant ci evidence sign --open` (#4914): the GitLab signing job, in a
3
+ * pipeline of the target branch, signs the checks of every open merge
4
+ * request into the branch from its newest pipeline's job.
5
+ *
6
+ * A merge request pipeline is built from the merge request's own files, so
7
+ * a job there that holds the runner key (or asks for a signing token) runs
8
+ * whatever the change wrote. The plan notes pipeline (#4328) is the target
9
+ * branch's: its jobs come from the branch's files, and its protected
10
+ * variables reach it. So the signing moves there, as the note posting did:
11
+ * for each open merge request GitLab names the newest pipeline's `job`
12
+ * (`plan`, `<target>-plan`, `check`), the report is read from that job's
13
+ * artifacts as data, the head is fetched, and the checks are signed for
14
+ * the head as `sign --from-report` signs them. What was signed and why the
15
+ * rest were not is kept as `<out>/<iid>/evidence.json`, with the merge
16
+ * request and the head, which the note job reads (`pr-post --open
17
+ * --evidence-dir`, ../../pr-post.ts) for the note's "Checks:" line.
18
+ *
19
+ * A job that has not settled is left for the next pipeline. A merge request
20
+ * whose report does not read, whose head does not fetch, or that the forge
21
+ * refuses is a warning, and the others go on.
22
+ */
23
+ import type { PrForge } from "../../pr-forge.js";
24
+ import { type CheckEvidenceNote } from "./check-evidence-report.js";
25
+ /** The report files a job's artifact is read for, in order: a plan report, a product's plan note hand-off, then a check job's report. */
26
+ export declare const OPEN_PLAN_FILES: readonly ["pr-plan.json", "pr-plan-note.json"];
27
+ export declare const OPEN_CHECK_FILE = "check-hooks.json";
28
+ /** What {@link signOpenReports} signs for. */
29
+ export interface OpenEvidenceInput {
30
+ /**
31
+ * A GitLab client with {@link PrForge.mergeRequestJobs} and
32
+ * {@link PrForge.jobArtifact}, and with `noForks` {@link PrForge.openPullRequests},
33
+ * which says which merge requests come from a fork. The fork test is read
34
+ * here, not in `mergeRequestJobs`, to keep it out of the pull request loop's
35
+ * bundle (its ceiling, pr-loop-bundle.test.ts).
36
+ */
37
+ forge: Pick<PrForge, "kind" | "mergeRequestJobs" | "jobArtifact" | "openPullRequests">;
38
+ /** The branch the merge requests merge into: the pipeline's own. */
39
+ branch: string;
40
+ /** The job whose report is signed: `plan`, `<target>-plan` or `check`. */
41
+ job: string;
42
+ /** The report directory from the repository root, as the job kept it as its artifact. */
43
+ artifactDir: string;
44
+ /** Where each merge request's report and `evidence.json` go: `<out>/<iid>/`. */
45
+ out: string;
46
+ /** Sign for no merge request from a fork, as a product plan with `forks: "skip"` plans none. */
47
+ noForks?: boolean;
48
+ /** Fetch merge request `pr`'s head into this checkout; true once the commit is here. */
49
+ fetchHead: (pr: number, head: string) => boolean;
50
+ /** Sign the checks of the report in `dir` for `head`, given the job's result, as `sign --from-report` does. */
51
+ sign: (dir: string, head: string, result: "success" | "failure" | "cancelled") => Promise<CheckEvidenceNote>;
52
+ }
53
+ /** What {@link signOpenReports} did for one merge request. */
54
+ export interface OpenEvidence {
55
+ pr: number;
56
+ head: string;
57
+ /** What was signed and what was not, as kept in `evidence.json`. */
58
+ note?: CheckEvidenceNote;
59
+ /** Why nothing was signed: the job has not settled, left no report, or its head did not fetch. */
60
+ skipped?: string;
61
+ }
62
+ /** Sign every open merge request's settled `job` into `branch` (#4914). */
63
+ export declare function signOpenReports(input: OpenEvidenceInput): Promise<{
64
+ done: OpenEvidence[];
65
+ warnings: string[];
66
+ }>;
67
+ //# sourceMappingURL=open-evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-evidence.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/open-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAuB,KAAK,iBAAiB,EAAyB,MAAM,yBAAyB,CAAC;AAE7G,yIAAyI;AACzI,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,mBAAmB,CAAU,CAAC;AAC9E,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAC;IACvF,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,gGAAgG;IAChG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wFAAwF;IACxF,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,+GAA+G;IAC/G,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC9G;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,wBAAsB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2DrH"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * `chant ci evidence sign --open` (#4914): the GitLab signing job, in a
3
+ * pipeline of the target branch, signs the checks of every open merge
4
+ * request into the branch from its newest pipeline's job.
5
+ *
6
+ * A merge request pipeline is built from the merge request's own files, so
7
+ * a job there that holds the runner key (or asks for a signing token) runs
8
+ * whatever the change wrote. The plan notes pipeline (#4328) is the target
9
+ * branch's: its jobs come from the branch's files, and its protected
10
+ * variables reach it. So the signing moves there, as the note posting did:
11
+ * for each open merge request GitLab names the newest pipeline's `job`
12
+ * (`plan`, `<target>-plan`, `check`), the report is read from that job's
13
+ * artifacts as data, the head is fetched, and the checks are signed for
14
+ * the head as `sign --from-report` signs them. What was signed and why the
15
+ * rest were not is kept as `<out>/<iid>/evidence.json`, with the merge
16
+ * request and the head, which the note job reads (`pr-post --open
17
+ * --evidence-dir`, ../../pr-post.ts) for the note's "Checks:" line.
18
+ *
19
+ * A job that has not settled is left for the next pipeline. A merge request
20
+ * whose report does not read, whose head does not fetch, or that the forge
21
+ * refuses is a warning, and the others go on.
22
+ */
23
+ import { mkdirSync, writeFileSync } from "node:fs";
24
+ import { join } from "node:path";
25
+ import { CHECK_EVIDENCE_FILE } from "./check-evidence-report.js";
26
+ /** The report files a job's artifact is read for, in order: a plan report, a product's plan note hand-off, then a check job's report. */
27
+ export const OPEN_PLAN_FILES = ["pr-plan.json", "pr-plan-note.json"];
28
+ export const OPEN_CHECK_FILE = "check-hooks.json";
29
+ /** Sign every open merge request's settled `job` into `branch` (#4914). */
30
+ export async function signOpenReports(input) {
31
+ const { forge } = input;
32
+ if (!forge.mergeRequestJobs || !forge.jobArtifact) {
33
+ throw new Error(`ci evidence sign --open reads the jobs of open merge requests, which ${forge.kind} cannot say; it is for GitLab`);
34
+ }
35
+ const done = [];
36
+ const warnings = [];
37
+ const at = input.artifactDir.replace(/\/+$/, "");
38
+ let forks = new Set();
39
+ if (input.noForks) {
40
+ if (!forge.openPullRequests)
41
+ throw new Error(`ci evidence sign --open --no-forks reads which merge requests come from a fork, which ${forge.kind} cannot say`);
42
+ forks = new Set((await forge.openPullRequests(input.branch)).filter((p) => p.fork).map((p) => p.number));
43
+ }
44
+ for (const job of await forge.mergeRequestJobs(input.branch, input.job)) {
45
+ if (forks.has(job.pr)) {
46
+ done.push({ pr: job.pr, head: job.head, skipped: "the merge request is from a fork" });
47
+ continue;
48
+ }
49
+ const result = job.status === "success" ? "success" : job.status === "failed" ? "failure" : job.status === "canceled" ? "cancelled" : undefined;
50
+ if (!result) {
51
+ done.push({ pr: job.pr, head: job.head, skipped: `the ${input.job} job is ${job.status}` });
52
+ continue;
53
+ }
54
+ try {
55
+ const dir = join(input.out, String(job.pr));
56
+ mkdirSync(dir, { recursive: true });
57
+ // A plan report wins over a check report, as `sign --from-report` reads a directory.
58
+ let found = false;
59
+ for (const file of OPEN_PLAN_FILES) {
60
+ const text = await forge.jobArtifact(job.id, `${at}/${file}`);
61
+ if (text === undefined)
62
+ continue;
63
+ writeFileSync(join(dir, file), text);
64
+ found = true;
65
+ break;
66
+ }
67
+ if (!found) {
68
+ const text = await forge.jobArtifact(job.id, `${at}/${OPEN_CHECK_FILE}`);
69
+ if (text !== undefined) {
70
+ writeFileSync(join(dir, OPEN_CHECK_FILE), text);
71
+ found = true;
72
+ }
73
+ }
74
+ if (!found) {
75
+ done.push({ pr: job.pr, head: job.head, skipped: `the ${input.job} job left no report under ${at}` });
76
+ continue;
77
+ }
78
+ if (!input.fetchHead(job.pr, job.head)) {
79
+ done.push({ pr: job.pr, head: job.head, skipped: `the head ${job.head.slice(0, 12)} did not fetch` });
80
+ continue;
81
+ }
82
+ const note = await input.sign(dir, job.head, result);
83
+ const kept = { pr: job.pr, head: job.head, ...note };
84
+ writeFileSync(join(dir, CHECK_EVIDENCE_FILE), JSON.stringify(kept, null, 2) + "\n");
85
+ done.push({ pr: job.pr, head: job.head, note });
86
+ }
87
+ catch (err) {
88
+ warnings.push(`!${job.pr}: ${err instanceof Error ? err.message : String(err)}`);
89
+ }
90
+ }
91
+ return { done, warnings };
92
+ }
@@ -20,7 +20,16 @@ export declare const REF_GATE_OUTPUT_SCHEMA_ID = "https://intentius.io/chant/sch
20
20
  /** The line a hook chant writes carries, so `install` knows it may replace it. */
21
21
  export declare const REF_GATE_HOOK_MARK = "# chant ref gate (#4867)";
22
22
  export declare function runWorkspaceRefGate(ctx: CommandContext): Promise<number>;
23
- /** The commit status a forge requires for `d`'s ref: `success` when it is admitted, `failure` naming the missing checks when not. */
23
+ /** The status `d` sets: its rule's, or `chant/ref-gate` when the gate could not decide (#4964); null when no rule matched. */
24
+ export declare function refGateStatusContext(d: Pick<RefDecision, "status" | "error">): string | null;
25
+ /**
26
+ * The commit status a forge requires for `d`'s ref: `success` when it is
27
+ * admitted, `failure` naming the missing checks when not. A gate that could
28
+ * not decide (#4964: the policy at base does not read, or the commit is not
29
+ * there) fails `chant/ref-gate` closed: the policy that would name another
30
+ * status is the one that did not read, and a forge that requires the status
31
+ * then refuses the merge rather than waiting for a status that never comes.
32
+ */
24
33
  export declare function postRefGateStatus(forge: {
25
34
  setStatus(sha: string, status: {
26
35
  context: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ref-gate-cli.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/ref-gate-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAYL,KAAK,WAAW,EAGjB,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,yBAAyB,kFAAkF,CAAC;AACzH,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAyF7D,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuE9E;AAED,qIAAqI;AACrI,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAAE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAUvM;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,EAAE,OAAO,SAAU,GAAG,MAAM,CAEvF"}
1
+ {"version":3,"file":"ref-gate-cli.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/ref-gate-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAaL,KAAK,WAAW,EAGjB,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,yBAAyB,kFAAkF,CAAC;AACzH,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AA0F7D,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA8E9E;AAsDD,8HAA8H;AAC9H,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAE5F;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAAE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAevM;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,EAAE,OAAO,SAAU,GAAG,MAAM,CAEvF"}
@@ -17,7 +17,7 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "n
17
17
  import { join } from "node:path";
18
18
  import { formatError, formatSuccess } from "../../cli/format.js";
19
19
  import { readerVersion } from "../declaration.js";
20
- import { appendRefGateLedger, attachEvidence, commitOf, decideRefUpdate, describeDecision, readRefGateLedger, refGateLedgerPath, RefUpdateInputError, runPrePush, runPreReceive, spentOverrides, } from "./ref-gate.js";
20
+ import { appendRefGateLedger, attachEvidence, commitOf, decideRefUpdate, describeDecision, readRefGateLedger, refGateLedgerPath, REF_GATE_STATUS, RefUpdateInputError, runPrePush, runPreReceive, spentOverrides, } from "./ref-gate.js";
21
21
  import { resolveBase } from "./provenance.js";
22
22
  import { spawnSync } from "node:child_process";
23
23
  export const REF_GATE_CONTRACT_VERSION = 1;
@@ -28,6 +28,7 @@ export const REF_GATE_HOOK_MARK = "# chant ref gate (#4867)";
28
28
  const OVERRIDE_REQUEST_HOURS = 72;
29
29
  const USAGE = "chant workspace ref-gate check --ref <ref> [--at <rev>] [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
30
30
  " chant workspace ref-gate status --ref <ref> [--at <rev>] [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
31
+ " chant workspace ref-gate status --open --ref refs/heads/<branch> [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
31
32
  " chant workspace ref-gate pre-receive|pre-push [--ledger <file>] [--dry-run] [--json] (git hook input on stdin)\n" +
32
33
  " chant workspace ref-gate attach --envelope <file> [--at <rev>]\n" +
33
34
  " chant workspace ref-gate install --hook pre-receive|pre-push [--git-dir <dir>] [--chant <command>]";
@@ -59,7 +60,7 @@ function repoHere() {
59
60
  }
60
61
  return { repo: top, bare: false };
61
62
  }
62
- function print(json, decisions, ledger, stream) {
63
+ function print(json, decisions, ledger, stream, site) {
63
64
  const ok = decisions.every((d) => d.decision === "admit");
64
65
  if (json) {
65
66
  console.log(JSON.stringify({ ...head(), ok, ...(ledger ? { ledger } : {}), decisions }, null, 2));
@@ -68,7 +69,7 @@ function print(json, decisions, ledger, stream) {
68
69
  for (const d of decisions) {
69
70
  if (d.status === null && d.checks.length === 0 && !d.error)
70
71
  continue;
71
- const text = describeDecision(d).join("\n");
72
+ const text = describeDecision(d, site ? { site } : {}).join("\n");
72
73
  if (stream === "err" || d.decision === "refuse")
73
74
  console.error(text);
74
75
  else
@@ -142,7 +143,7 @@ export async function runWorkspaceRefGate(ctx) {
142
143
  try {
143
144
  if (sub === "pre-receive") {
144
145
  const r = runPreReceive(here.repo, stdin, { ...(args.ledger ? { ledger: args.ledger } : {}), now });
145
- print(args.json, r.decisions, r.ledger, "err");
146
+ print(args.json, r.decisions, r.ledger, "err", "pre-receive");
146
147
  return r.ok ? 0 : 1;
147
148
  }
148
149
  const r = runPrePush(here.repo, stdin, { ...(args.ledger ? { ledger: args.ledger } : {}), now, base: (repo) => resolveBase(repo).commit });
@@ -160,6 +161,11 @@ export async function runWorkspaceRefGate(ctx) {
160
161
  // check and status: one update, from a checkout or a CI job.
161
162
  if (!args.ref || !args.ref.startsWith("refs/"))
162
163
  return usage("--ref <ref> is required, as a full ref name such as refs/heads/main");
164
+ if (args.open) {
165
+ if (sub !== "status")
166
+ return usage("--open sets the status of every open pull request, so it goes with status");
167
+ return statusOpen(here.repo, args.ref, args.base, args.ledger, args.dryRun === true, args.json, now);
168
+ }
163
169
  const at = commitOf(here.repo, args.at ?? "HEAD");
164
170
  if (!at)
165
171
  return fail(args.json, "revision-unknown", `--at ${args.at ?? "HEAD"} names no commit`);
@@ -175,26 +181,102 @@ export async function runWorkspaceRefGate(ctx) {
175
181
  print(args.json, [d], args.dryRun ? undefined : ledger, "out");
176
182
  if (site === "check" && d.decision === "refuse" && !args.dryRun && !here.bare)
177
183
  await recordRequests(here.repo, [d], now);
178
- if (site === "status" && d.status !== null) {
184
+ const context = refGateStatusContext(d);
185
+ if (site === "status" && context !== null) {
179
186
  if (args.dryRun) {
180
- console.error(`chant ref gate: would set ${d.status} to ${d.decision === "admit" ? "success" : "failure"} on ${at.slice(0, 8)}`);
187
+ console.error(`chant ref gate: would set ${context} to ${d.decision === "admit" ? "success" : "failure"} on ${at.slice(0, 8)}`);
181
188
  }
182
189
  else {
183
- const { detectForge, forgeFromEnv } = await import("../../pr-forge.js");
190
+ const { detectForge } = await import("../../pr-forge.js");
184
191
  const kind = detectForge();
185
192
  if (!kind) {
186
- console.error(formatError({ message: `no forge detected, so ${d.status} was not set`, hint: "run it in a GitHub, GitLab or Forgejo job, or pass --dry-run" }));
193
+ console.error(formatError({ message: `no forge detected, so ${context} was not set`, hint: "run it in a GitHub, GitLab or Forgejo job, or pass --dry-run" }));
187
194
  return 1;
188
195
  }
189
- await postRefGateStatus(forgeFromEnv(kind), d);
196
+ // #4964: `--at` is a pull_request run's merge preview; the status goes on the pull request's head.
197
+ const { forgeFromJobEnv } = await import("../../pr-forge-job.js");
198
+ await postRefGateStatus(forgeFromJobEnv(kind), d);
190
199
  }
191
200
  }
192
201
  return d.decision === "admit" ? 0 : 1;
193
202
  }
194
- /** The commit status a forge requires for `d`'s ref: `success` when it is admitted, `failure` naming the missing checks when not. */
203
+ /**
204
+ * `status --open --ref refs/heads/<branch>` (#4935): the status of every open
205
+ * pull request into the branch, from a pipeline of the branch. GitLab sets a
206
+ * commit status only with the protected token a target-branch pipeline holds
207
+ * (#4328), so its generated `ref-gate` job runs here, beside the plan notes.
208
+ * Each head is fetched and decided as `status --at <head>` decides it, against
209
+ * the policy at `base` (default this checkout's `HEAD`, the branch's commit).
210
+ * A head that does not fetch, or a forge that refuses one status, is said
211
+ * and the others go on. Exits 0 once each is set, whatever it decided: each
212
+ * pull request's status says it.
213
+ */
214
+ async function statusOpen(repo, ref, baseRev, ledgerFlag, dryRun, json, now) {
215
+ if (!ref.startsWith("refs/heads/"))
216
+ return usage("--open names the branch the pull requests merge into: --ref refs/heads/<branch>");
217
+ const base = commitOf(repo, baseRev ?? "HEAD");
218
+ if (!base)
219
+ return fail(json, "revision-unknown", `--base ${baseRev ?? "HEAD"} names no commit`);
220
+ const { detectForge, forgeFromEnv } = await import("../../pr-forge.js");
221
+ const kind = detectForge();
222
+ if (!kind && !dryRun) {
223
+ console.error(formatError({ message: "no forge detected, so no status was set", hint: "run it in a GitHub, GitLab or Forgejo job, or pass --dry-run" }));
224
+ return 1;
225
+ }
226
+ const forge = kind ? forgeFromEnv(kind) : undefined;
227
+ if (!forge?.openPullRequests)
228
+ return fail(json, "ref-update-invalid", `--open lists the open pull requests, which ${kind ?? "no"} forge client here can`);
229
+ const branch = ref.slice("refs/heads/".length);
230
+ const ledger = ledgerFlag ?? refGateLedgerPath(repo);
231
+ const decisions = [];
232
+ for (const pr of await forge.openPullRequests(branch)) {
233
+ const fetched = spawnSync("git", ["fetch", "--quiet", "--no-tags", "origin", pr.headSha], { cwd: repo, encoding: "utf-8" });
234
+ if (!commitOf(repo, pr.headSha)) {
235
+ console.error(`chant ref gate: #${pr.number}'s head ${pr.headSha.slice(0, 8)} did not fetch${fetched.stderr ? ` (${fetched.stderr.trim().split("\n")[0]})` : ""}, so its status is left as it is`);
236
+ continue;
237
+ }
238
+ const spent = spentOverrides(readRefGateLedger(ledger));
239
+ const d = decideRefUpdate({ repo, update: { ref, old: base, new: pr.headSha }, base, spent, now });
240
+ decisions.push(d);
241
+ if (dryRun) {
242
+ const context = refGateStatusContext(d);
243
+ if (context !== null)
244
+ console.error(`chant ref gate: would set ${context} to ${d.decision === "admit" ? "success" : "failure"} on #${pr.number} at ${pr.headSha.slice(0, 8)}`);
245
+ continue;
246
+ }
247
+ appendRefGateLedger(ledger, [{ ...d, version: 1, kind: "ref-update", site: "status", timestamp: now }]);
248
+ try {
249
+ await postRefGateStatus(forge, d);
250
+ }
251
+ catch (err) {
252
+ console.error(`chant ref gate: could not set the status on #${pr.number}: ${err instanceof Error ? err.message : String(err)}`);
253
+ }
254
+ }
255
+ print(json, decisions, dryRun ? undefined : ledger, "err");
256
+ if (decisions.length === 0)
257
+ console.error(`chant ref gate: no open pull request into ${branch} to set a status on`);
258
+ return 0;
259
+ }
260
+ /** The status `d` sets: its rule's, or `chant/ref-gate` when the gate could not decide (#4964); null when no rule matched. */
261
+ export function refGateStatusContext(d) {
262
+ return d.status ?? (d.error ? REF_GATE_STATUS : null);
263
+ }
264
+ /**
265
+ * The commit status a forge requires for `d`'s ref: `success` when it is
266
+ * admitted, `failure` naming the missing checks when not. A gate that could
267
+ * not decide (#4964: the policy at base does not read, or the commit is not
268
+ * there) fails `chant/ref-gate` closed: the policy that would name another
269
+ * status is the one that did not read, and a forge that requires the status
270
+ * then refuses the merge rather than waiting for a status that never comes.
271
+ */
195
272
  export async function postRefGateStatus(forge, d) {
196
- if (d.status === null || d.new === null)
273
+ const context = refGateStatusContext(d);
274
+ if (context === null || d.new === null)
197
275
  return;
276
+ if (d.status === null) {
277
+ await forge.setStatus(d.new, { context, state: "failure", description: `refused: ${d.error.code}` });
278
+ return;
279
+ }
198
280
  const missing = d.checks.filter((c) => c.action === "block" && (c.status === "missing" || c.status === "stale"));
199
281
  const overridden = d.checks.filter((c) => c.status === "overridden").map((c) => c.check);
200
282
  const description = d.error
@@ -106,6 +106,50 @@ export declare function rulesFor(policy: Pick<TrustPolicy, "refs">, ref: string)
106
106
  status: string;
107
107
  overrides?: "ledger" | "sealed";
108
108
  };
109
+ /** The ref gate's rules for one ref, read at base, as a product reads them (#4913). */
110
+ export interface RefGateRules {
111
+ ref: string;
112
+ /** The commit the policy was read at, or null when there is none. */
113
+ base: string | null;
114
+ /** A rule of the policy at base matches the ref. */
115
+ matched: boolean;
116
+ /** The commit status the ref gate's status job sets for the ref, which the forge should require; null when no rule matches. */
117
+ status: string | null;
118
+ /** The checks an update of the ref needs current evidence for, each once, as {@link rulesFor} merges them. */
119
+ checks: RefRule["checks"];
120
+ overrides?: "ledger" | "sealed";
121
+ /**
122
+ * Why the policy at base cannot be read. The gate then refuses every
123
+ * update of the ref and sets no status, so a product should refuse too.
124
+ */
125
+ problems: string[];
126
+ }
127
+ /**
128
+ * The ref gate's rules for `ref` from the policy at `base` (#4913), the same
129
+ * read {@link decideRefUpdate} makes, for a product that acts on them
130
+ * without deciding an update: an apply that waits for the status the gate
131
+ * sets (`@intentius/chant/ref-gate-rules`), or a forge check that requires
132
+ * it. `base` defaults as `check` and `status` default it: `origin/HEAD`,
133
+ * then `main`, then `master`. A base that names no commit is a problem; no
134
+ * base at all is no policy, so nothing is required.
135
+ */
136
+ export declare function refGateRulesAt(repo: string, opts: {
137
+ ref: string;
138
+ base?: string;
139
+ }): RefGateRules;
140
+ /**
141
+ * The status a forge's default branch should require for the ref gate
142
+ * (#4913), for a forge check whose pipeline renders the `ref-gate` job: the
143
+ * policy's status for `refs/heads/<defaultBranch>`, read at
144
+ * `origin/<defaultBranch>` when the checkout has it, else at `HEAD`. With
145
+ * no rule for the branch the job sets no status, so none is required and
146
+ * `note` says so; a policy that can't be read is a `problem`.
147
+ */
148
+ export declare function refGateStatusFor(repo: string, defaultBranch: string): {
149
+ status?: string;
150
+ note?: string;
151
+ problem?: string;
152
+ };
109
153
  /** The envelopes in a note's text: one per line, or the whole note as one envelope or an array of them. */
110
154
  export declare function parseEvidenceNote(text: string): unknown[];
111
155
  /** The envelopes attached to `commit`, read from the notes commit `notes` (default: {@link EVIDENCE_NOTES_REF}'s tip). */
@@ -182,6 +226,21 @@ export declare function runPrePush(repo: string, stdin: string, opts?: {
182
226
  now?: string;
183
227
  base?: (repo: string) => string | null;
184
228
  }): SiteResult;
185
- /** What the gate says about one decision: each missing check and its command, and how to override a blocked one. */
186
- export declare function describeDecision(d: RefDecision): string[];
229
+ /**
230
+ * The command that records the request for an override of `d`'s blocked
231
+ * checks from a checkout (#4913): `check` for the same ref, commit and base
232
+ * the remote decided, so it reaches the same decision and records the
233
+ * request on `chant/lifecycle`, which a pre-receive hook can't move.
234
+ */
235
+ export declare function requestCommand(d: Pick<RefDecision, "ref" | "new" | "base">): string;
236
+ /**
237
+ * What the gate says about one decision: each missing check and its command,
238
+ * and how to override a blocked one. At `pre-receive` (#4913) the request
239
+ * can't be recorded where the decision is made, so the refusal prints the
240
+ * exact command that records it from the checkout, then the override and
241
+ * the push that spends it.
242
+ */
243
+ export declare function describeDecision(d: RefDecision, opts?: {
244
+ site?: RefGateSite;
245
+ }): string[];
187
246
  //# sourceMappingURL=ref-gate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-gate.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/ref-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAQH,OAAO,EAAa,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACr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E,CAUtD;AAED,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAIjD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAsBnH;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,UAAU,CAUxJ;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,WAAW,CAAA;CAAO,GAAG,MAAM,EAAE,CAiC5F"}
@@ -35,7 +35,7 @@ import { execFileSync, spawnSync } from "node:child_process";
35
35
  import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
36
36
  import { dirname, isAbsolute, join } from "node:path";
37
37
  import { verifyEvidence } from "./evidence.js";
38
- import { policyAtBase } from "./provenance.js";
38
+ import { policyAtBase, resolveBase } from "./provenance.js";
39
39
  import { runnersAt } from "./policy.js";
40
40
  import { OVERRIDE_APPLIED, OVERRIDE_LEDGER, OVERRIDERS_PATH, decideOverride, overrideCommand, overridersAt, parseAppliedOverrides, } from "../../override-gate.js";
41
41
  import { parseGateLedger } from "../../lifecycle/gate-ledger.js";
@@ -104,6 +104,46 @@ export function rulesFor(policy, ref) {
104
104
  ...(overrides ? { overrides } : {}),
105
105
  };
106
106
  }
107
+ /**
108
+ * The ref gate's rules for `ref` from the policy at `base` (#4913), the same
109
+ * read {@link decideRefUpdate} makes, for a product that acts on them
110
+ * without deciding an update: an apply that waits for the status the gate
111
+ * sets (`@intentius/chant/ref-gate-rules`), or a forge check that requires
112
+ * it. `base` defaults as `check` and `status` default it: `origin/HEAD`,
113
+ * then `main`, then `master`. A base that names no commit is a problem; no
114
+ * base at all is no policy, so nothing is required.
115
+ */
116
+ export function refGateRulesAt(repo, opts) {
117
+ const resolved = resolveBase(repo, opts.base);
118
+ const none = { ref: opts.ref, base: resolved.commit, matched: false, status: null, checks: [] };
119
+ if (!resolved.commit)
120
+ return { ...none, problems: opts.base !== undefined && resolved.problem ? [resolved.problem] : [] };
121
+ const policy = policyAtBase(repo, resolved);
122
+ if (policy.problems.length > 0)
123
+ return { ...none, problems: [...policy.problems] };
124
+ const rules = rulesFor(policy, opts.ref);
125
+ if (!rules.matched)
126
+ return { ...none, problems: [] };
127
+ return { ref: opts.ref, base: resolved.commit, matched: true, status: rules.status, checks: rules.checks, ...(rules.overrides ? { overrides: rules.overrides } : {}), problems: [] };
128
+ }
129
+ /**
130
+ * The status a forge's default branch should require for the ref gate
131
+ * (#4913), for a forge check whose pipeline renders the `ref-gate` job: the
132
+ * policy's status for `refs/heads/<defaultBranch>`, read at
133
+ * `origin/<defaultBranch>` when the checkout has it, else at `HEAD`. With
134
+ * no rule for the branch the job sets no status, so none is required and
135
+ * `note` says so; a policy that can't be read is a `problem`.
136
+ */
137
+ export function refGateStatusFor(repo, defaultBranch) {
138
+ const remote = `refs/remotes/origin/${defaultBranch}`;
139
+ const rules = refGateRulesAt(repo, { ref: `refs/heads/${defaultBranch}`, base: commitOf(repo, remote) ? remote : "HEAD" });
140
+ if (rules.problems.length > 0)
141
+ return { problem: `the trust policy can't be read, so the ref gate sets no status to require: ${rules.problems.join("; ")}` };
142
+ if (!rules.matched || !rules.status) {
143
+ return { note: `no refs rule in .chant/trust.json${rules.base ? ` at ${rules.base.slice(0, 8)}` : ""} matches refs/heads/${defaultBranch}, so the ref-gate job sets no status there and none is required` };
144
+ }
145
+ return { status: rules.status };
146
+ }
107
147
  // ── evidence notes ───────────────────────────────────────────────────────
108
148
  /** The envelopes in a note's text: one per line, or the whole note as one envelope or an array of them. */
109
149
  export function parseEvidenceNote(text) {
@@ -401,8 +441,23 @@ export function runPrePush(repo, stdin, opts = {}) {
401
441
  }
402
442
  // ── words ────────────────────────────────────────────────────────────────
403
443
  const short = (s) => (s ? s.slice(0, 8) : "(none)");
404
- /** What the gate says about one decision: each missing check and its command, and how to override a blocked one. */
405
- export function describeDecision(d) {
444
+ /**
445
+ * The command that records the request for an override of `d`'s blocked
446
+ * checks from a checkout (#4913): `check` for the same ref, commit and base
447
+ * the remote decided, so it reaches the same decision and records the
448
+ * request on `chant/lifecycle`, which a pre-receive hook can't move.
449
+ */
450
+ export function requestCommand(d) {
451
+ return `chant workspace ref-gate check --ref ${d.ref} --at ${d.new ?? "HEAD"}${d.base ? ` --base ${d.base}` : ""}`;
452
+ }
453
+ /**
454
+ * What the gate says about one decision: each missing check and its command,
455
+ * and how to override a blocked one. At `pre-receive` (#4913) the request
456
+ * can't be recorded where the decision is made, so the refusal prints the
457
+ * exact command that records it from the checkout, then the override and
458
+ * the push that spends it.
459
+ */
460
+ export function describeDecision(d, opts = {}) {
406
461
  const out = [];
407
462
  const verb = d.decision === "admit" ? "admitted" : "refused";
408
463
  out.push(`chant ref gate: ${verb} ${d.ref} ${short(d.old)}..${short(d.new)}`);
@@ -423,10 +478,20 @@ export function describeDecision(d) {
423
478
  const blocked = d.checks.filter((c) => c.action === "block" && (c.status === "missing" || c.status === "stale"));
424
479
  if (blocked.length > 0) {
425
480
  out.push(` Attach each check's evidence to ${short(d.new)} (chant workspace ref-gate attach --envelope <file> --at ${short(d.new)}) and push ${EVIDENCE_NOTES_REF} with the ref.`);
426
- out.push(` To let ${short(d.new)} through without a check, a person listed in ${OVERRIDERS_PATH} at base can override it once the request is recorded`);
427
- out.push(` (the pre-push hook records it, or chant workspace ref-gate check --ref ${d.ref} --at ${short(d.new)}):`);
428
- for (const c of blocked)
429
- out.push(` ${overrideCommand(c.subject, [c.check])}`);
481
+ if (opts.site === "pre-receive") {
482
+ out.push(` To let ${short(d.new)} through without a check, record the request for an override in your checkout (this remote can't):`);
483
+ out.push(` ${requestCommand(d)}`);
484
+ out.push(` then a person listed in ${OVERRIDERS_PATH} at base overrides each check:`);
485
+ for (const c of blocked)
486
+ out.push(` ${overrideCommand(c.subject, [c.check])}`);
487
+ out.push(` and the push goes again with chant/lifecycle: git push origin chant/lifecycle ${d.new ?? "HEAD"}:${d.ref}`);
488
+ }
489
+ else {
490
+ out.push(` To let ${short(d.new)} through without a check, a person listed in ${OVERRIDERS_PATH} at base can override it once the request is recorded`);
491
+ out.push(` (the pre-push hook records it, or ${requestCommand(d)}):`);
492
+ for (const c of blocked)
493
+ out.push(` ${overrideCommand(c.subject, [c.check])}`);
494
+ }
430
495
  }
431
496
  return out;
432
497
  }