@intentius/chant 0.124.87 → 0.124.88

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 (342) 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 +12 -0
  5. package/dist/actor.d.ts.map +1 -0
  6. package/dist/actor.js +18 -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 +204 -2
  13. package/dist/ci-commit.d.ts +1 -1
  14. package/dist/ci-commit.d.ts.map +1 -1
  15. package/dist/ci-commit.js +1 -2
  16. package/dist/ci-control.d.ts +1 -1
  17. package/dist/ci-control.d.ts.map +1 -1
  18. package/dist/ci-control.js +1 -1
  19. package/dist/ci-evidence-claims.d.ts +59 -0
  20. package/dist/ci-evidence-claims.d.ts.map +1 -0
  21. package/dist/ci-evidence-claims.js +87 -0
  22. package/dist/ci-evidence-from-job.d.ts +103 -0
  23. package/dist/ci-evidence-from-job.d.ts.map +1 -0
  24. package/dist/ci-evidence-from-job.js +162 -0
  25. package/dist/ci-evidence-jobs.d.ts +39 -4
  26. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  27. package/dist/ci-evidence-jobs.js +38 -4
  28. package/dist/ci-handover.d.ts +12 -0
  29. package/dist/ci-handover.d.ts.map +1 -1
  30. package/dist/ci-handover.js +15 -3
  31. package/dist/ci-identity.d.ts +32 -6
  32. package/dist/ci-identity.d.ts.map +1 -1
  33. package/dist/ci-identity.js +40 -8
  34. package/dist/ci-image.d.ts +47 -9
  35. package/dist/ci-image.d.ts.map +1 -1
  36. package/dist/ci-image.js +45 -18
  37. package/dist/ci-jobs.d.ts +1 -1
  38. package/dist/ci-jobs.d.ts.map +1 -1
  39. package/dist/ci-jobs.js +7 -2
  40. package/dist/ci-login.d.ts +75 -13
  41. package/dist/ci-login.d.ts.map +1 -1
  42. package/dist/ci-login.js +89 -37
  43. package/dist/ci-product-words.d.ts +20 -1
  44. package/dist/ci-product-words.d.ts.map +1 -1
  45. package/dist/ci-product-words.js +27 -1
  46. package/dist/ci-product.d.ts +21 -2
  47. package/dist/ci-product.d.ts.map +1 -1
  48. package/dist/ci-product.js +21 -2
  49. package/dist/cli/handlers/approve-confirm.d.ts +14 -0
  50. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
  51. package/dist/cli/handlers/approve-confirm.js +46 -0
  52. package/dist/cli/handlers/build.d.ts +1 -1
  53. package/dist/cli/handlers/build.d.ts.map +1 -1
  54. package/dist/cli/handlers/build.js +22 -1
  55. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  56. package/dist/cli/handlers/ci-check.js +21 -1
  57. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  58. package/dist/cli/handlers/ci-evidence.js +227 -18
  59. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
  60. package/dist/cli/handlers/ci-forge-check.js +34 -17
  61. package/dist/cli/handlers/generated-check.d.ts +3 -0
  62. package/dist/cli/handlers/generated-check.d.ts.map +1 -0
  63. package/dist/cli/handlers/generated-check.js +41 -0
  64. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  65. package/dist/cli/handlers/lifecycle.js +3 -0
  66. package/dist/cli/handlers/local-chant.d.ts +13 -0
  67. package/dist/cli/handlers/local-chant.d.ts.map +1 -1
  68. package/dist/cli/handlers/local-chant.js +42 -1
  69. package/dist/cli/handlers/pr.d.ts.map +1 -1
  70. package/dist/cli/handlers/pr.js +42 -5
  71. package/dist/cli/handlers/run-wave.js +8 -0
  72. package/dist/cli/main.d.ts.map +1 -1
  73. package/dist/cli/main.js +38 -4
  74. package/dist/cli/parse-args.d.ts.map +1 -1
  75. package/dist/cli/parse-args.js +66 -0
  76. package/dist/cli/registry.d.ts +24 -0
  77. package/dist/cli/registry.d.ts.map +1 -1
  78. package/dist/components/check-hooks.d.ts +10 -0
  79. package/dist/components/check-hooks.d.ts.map +1 -1
  80. package/dist/components/check-hooks.js +18 -0
  81. package/dist/components/pr-checks.d.ts +105 -0
  82. package/dist/components/pr-checks.d.ts.map +1 -0
  83. package/dist/components/pr-checks.js +119 -0
  84. package/dist/components/pr-pipeline.d.ts +34 -0
  85. package/dist/components/pr-pipeline.d.ts.map +1 -1
  86. package/dist/components/pr-pipeline.js +14 -1
  87. package/dist/components/product-pipeline.d.ts +16 -1
  88. package/dist/components/product-pipeline.d.ts.map +1 -1
  89. package/dist/components/product-pipeline.js +17 -2
  90. package/dist/components/product-plan.d.ts +257 -4
  91. package/dist/components/product-plan.d.ts.map +1 -1
  92. package/dist/components/product-plan.js +241 -11
  93. package/dist/config.d.ts +10 -6
  94. package/dist/config.d.ts.map +1 -1
  95. package/dist/config.js +11 -6
  96. package/dist/control/consumers.d.ts +6 -0
  97. package/dist/control/consumers.d.ts.map +1 -1
  98. package/dist/control/consumers.js +6 -0
  99. package/dist/dead-guards.d.ts.map +1 -1
  100. package/dist/dead-guards.js +9 -6
  101. package/dist/discovery/files.d.ts +1 -1
  102. package/dist/discovery/files.js +1 -1
  103. package/dist/drift-issue.d.ts +20 -3
  104. package/dist/drift-issue.d.ts.map +1 -1
  105. package/dist/drift-issue.js +16 -0
  106. package/dist/drift-record.d.ts +45 -5
  107. package/dist/drift-record.d.ts.map +1 -1
  108. package/dist/drift-record.js +27 -6
  109. package/dist/floor-table.d.ts +6 -6
  110. package/dist/floor-table.d.ts.map +1 -1
  111. package/dist/floor-table.data.d.ts.map +1 -1
  112. package/dist/floor-table.data.js +58 -21
  113. package/dist/floor-table.js +10 -7
  114. package/dist/forge-check/contract.d.ts +8 -0
  115. package/dist/forge-check/contract.d.ts.map +1 -1
  116. package/dist/forge-check/contract.js +4 -1
  117. package/dist/forge-check/index.d.ts +2 -0
  118. package/dist/forge-check/index.d.ts.map +1 -1
  119. package/dist/forge-check/index.js +2 -0
  120. package/dist/forge-flags.d.ts +10 -0
  121. package/dist/forge-flags.d.ts.map +1 -1
  122. package/dist/forge-flags.js +31 -0
  123. package/dist/forge-remote.d.ts +47 -0
  124. package/dist/forge-remote.d.ts.map +1 -0
  125. package/dist/forge-remote.js +69 -0
  126. package/dist/generated-check.d.ts +74 -0
  127. package/dist/generated-check.d.ts.map +1 -0
  128. package/dist/generated-check.js +216 -0
  129. package/dist/lexicon.d.ts +16 -0
  130. package/dist/lexicon.d.ts.map +1 -1
  131. package/dist/lifecycle/publish-npm.d.ts +15 -0
  132. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  133. package/dist/lifecycle/publish-npm.js +49 -3
  134. package/dist/lifecycle/release-images.d.ts +22 -1
  135. package/dist/lifecycle/release-images.d.ts.map +1 -1
  136. package/dist/lifecycle/release-images.js +27 -3
  137. package/dist/lifecycle/release-ledger.d.ts +4 -3
  138. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  139. package/dist/lifecycle/release-ledger.js +3 -2
  140. package/dist/local-chant.d.ts +57 -3
  141. package/dist/local-chant.d.ts.map +1 -1
  142. package/dist/local-chant.js +122 -13
  143. package/dist/op/op-waves-evidence-jobs.d.ts +92 -0
  144. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
  145. package/dist/op/op-waves-evidence-jobs.js +112 -0
  146. package/dist/op/op-waves-evidence.d.ts +12 -1
  147. package/dist/op/op-waves-evidence.d.ts.map +1 -1
  148. package/dist/op/op-waves-evidence.js +23 -2
  149. package/dist/op/op-waves-run.d.ts +12 -1
  150. package/dist/op/op-waves-run.d.ts.map +1 -1
  151. package/dist/op/op-waves-run.js +54 -3
  152. package/dist/op/op-waves.d.ts +8 -0
  153. package/dist/op/op-waves.d.ts.map +1 -1
  154. package/dist/op/op-waves.js +10 -0
  155. package/dist/op/schedule-overdue.d.ts +39 -2
  156. package/dist/op/schedule-overdue.d.ts.map +1 -1
  157. package/dist/op/schedule-overdue.js +89 -7
  158. package/dist/pr-forge-reads.d.ts +21 -1
  159. package/dist/pr-forge-reads.d.ts.map +1 -1
  160. package/dist/pr-forge-reads.js +19 -1
  161. package/dist/pr-forge.d.ts +7 -1
  162. package/dist/pr-forge.d.ts.map +1 -1
  163. package/dist/pr-forge.js +7 -2
  164. package/dist/pr-plan-note.d.ts +24 -0
  165. package/dist/pr-plan-note.d.ts.map +1 -1
  166. package/dist/pr-plan-note.js +11 -1
  167. package/dist/pr-plan-record.d.ts +47 -0
  168. package/dist/pr-plan-record.d.ts.map +1 -0
  169. package/dist/pr-plan-record.js +89 -0
  170. package/dist/pr-post.d.ts +40 -0
  171. package/dist/pr-post.d.ts.map +1 -1
  172. package/dist/pr-post.js +79 -6
  173. package/dist/pr-requires.d.ts +8 -0
  174. package/dist/pr-requires.d.ts.map +1 -1
  175. package/dist/pr-requires.js +3 -1
  176. package/dist/ref-gate-init.d.ts +76 -0
  177. package/dist/ref-gate-init.d.ts.map +1 -0
  178. package/dist/ref-gate-init.js +144 -0
  179. package/dist/ref-gate-rules.d.ts +19 -0
  180. package/dist/ref-gate-rules.d.ts.map +1 -0
  181. package/dist/ref-gate-rules.js +17 -0
  182. package/dist/release-floors.d.ts +64 -16
  183. package/dist/release-floors.d.ts.map +1 -1
  184. package/dist/release-floors.js +65 -17
  185. package/dist/state-migration.d.ts +24 -1
  186. package/dist/state-migration.d.ts.map +1 -1
  187. package/dist/state-migration.js +39 -3
  188. package/dist/state-unlock.d.ts +32 -1
  189. package/dist/state-unlock.d.ts.map +1 -1
  190. package/dist/state-unlock.js +31 -0
  191. package/dist/wave-runtime.mjs +292 -285
  192. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  193. package/dist/workspace/ci-green-cli.js +13 -7
  194. package/dist/workspace/drift-cli.d.ts +1 -1
  195. package/dist/workspace/drift-cli.d.ts.map +1 -1
  196. package/dist/workspace/drift-cli.js +5 -12
  197. package/dist/workspace/forge-work.d.ts +3 -2
  198. package/dist/workspace/forge-work.d.ts.map +1 -1
  199. package/dist/workspace/forge-work.js +7 -17
  200. package/dist/workspace/lexicon-outputs.js +2 -2
  201. package/dist/workspace/release-workflow.d.ts +26 -3
  202. package/dist/workspace/release-workflow.d.ts.map +1 -1
  203. package/dist/workspace/release-workflow.js +48 -6
  204. package/dist/workspace/trust/check-evidence-report.d.ts +18 -0
  205. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  206. package/dist/workspace/trust/check-evidence-report.js +13 -0
  207. package/dist/workspace/trust/check-evidence.d.ts +13 -1
  208. package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
  209. package/dist/workspace/trust/check-evidence.js +8 -3
  210. package/dist/workspace/trust/evidence.d.ts +5 -0
  211. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  212. package/dist/workspace/trust/evidence.js +5 -0
  213. package/dist/workspace/trust/open-evidence.d.ts +67 -0
  214. package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
  215. package/dist/workspace/trust/open-evidence.js +92 -0
  216. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  217. package/dist/workspace/trust/ref-gate-cli.js +65 -3
  218. package/dist/workspace/trust/ref-gate.d.ts +61 -2
  219. package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
  220. package/dist/workspace/trust/ref-gate.js +72 -7
  221. package/package.json +1 -1
  222. package/src/action-pins.ts +2 -0
  223. package/src/actor.test.ts +12 -0
  224. package/src/actor.ts +19 -0
  225. package/src/bundle-check.test.ts +22 -0
  226. package/src/bundle-check.ts +33 -5
  227. package/src/chant-install.test.ts +109 -1
  228. package/src/chant-install.ts +243 -2
  229. package/src/ci-commit.test.ts +51 -5
  230. package/src/ci-commit.ts +1 -2
  231. package/src/ci-control.ts +1 -0
  232. package/src/ci-evidence-claims.ts +102 -0
  233. package/src/ci-evidence-from-job.test.ts +147 -0
  234. package/src/ci-evidence-from-job.ts +195 -0
  235. package/src/ci-evidence-jobs.ts +41 -4
  236. package/src/ci-handover.ts +16 -3
  237. package/src/ci-identity.test.ts +3 -3
  238. package/src/ci-identity.ts +51 -11
  239. package/src/ci-image.test.ts +60 -10
  240. package/src/ci-image.ts +78 -19
  241. package/src/ci-jobs.ts +7 -2
  242. package/src/ci-login.test.ts +131 -3
  243. package/src/ci-login.token-drop.test.ts +204 -0
  244. package/src/ci-login.ts +137 -39
  245. package/src/ci-product-words.ts +30 -0
  246. package/src/ci-product.ts +26 -1
  247. package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
  248. package/src/cli/handlers/approve-confirm.test.ts +35 -0
  249. package/src/cli/handlers/approve-confirm.ts +44 -0
  250. package/src/cli/handlers/build-source-dir.test.ts +4 -0
  251. package/src/cli/handlers/build.ts +20 -2
  252. package/src/cli/handlers/ci-check.ts +19 -1
  253. package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
  254. package/src/cli/handlers/ci-evidence.ts +210 -16
  255. package/src/cli/handlers/ci-forge-check.ts +22 -9
  256. package/src/cli/handlers/generated-check.ts +39 -0
  257. package/src/cli/handlers/lifecycle.test.ts +20 -0
  258. package/src/cli/handlers/lifecycle.ts +4 -0
  259. package/src/cli/handlers/local-chant.ts +39 -1
  260. package/src/cli/handlers/pr.ts +43 -5
  261. package/src/cli/handlers/run-wave.ts +7 -0
  262. package/src/cli/main.ts +38 -4
  263. package/src/cli/parse-args.ts +46 -0
  264. package/src/cli/registry.ts +24 -0
  265. package/src/components/check-hooks.ts +22 -0
  266. package/src/components/check-report-summary.test.ts +78 -0
  267. package/src/components/pr-checks.ts +159 -0
  268. package/src/components/pr-pipeline.ts +41 -1
  269. package/src/components/product-pipeline.ts +25 -3
  270. package/src/components/product-plan.test.ts +102 -1
  271. package/src/components/product-plan.ts +416 -15
  272. package/src/config.ts +13 -8
  273. package/src/control/consumers.ts +7 -0
  274. package/src/dead-guards.test.ts +27 -5
  275. package/src/dead-guards.ts +9 -6
  276. package/src/discovery/files.ts +1 -1
  277. package/src/drift-issue.test.ts +29 -1
  278. package/src/drift-issue.ts +28 -3
  279. package/src/drift-record.test.ts +25 -0
  280. package/src/drift-record.ts +55 -6
  281. package/src/floor-table.data.ts +58 -21
  282. package/src/floor-table.ts +12 -9
  283. package/src/forge-check/contract.ts +11 -1
  284. package/src/forge-check/forge-check.test.ts +8 -0
  285. package/src/forge-check/index.ts +2 -0
  286. package/src/forge-flags.test.ts +25 -1
  287. package/src/forge-flags.ts +34 -0
  288. package/src/forge-remote.test.ts +37 -0
  289. package/src/forge-remote.ts +79 -0
  290. package/src/generated-check.e2e.test.ts +98 -0
  291. package/src/generated-check.test.ts +104 -0
  292. package/src/generated-check.ts +269 -0
  293. package/src/lexicon.ts +17 -0
  294. package/src/lifecycle/publish-npm.ts +56 -3
  295. package/src/lifecycle/release-catalog.test.ts +2 -2
  296. package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
  297. package/src/lifecycle/release-images.test.ts +44 -0
  298. package/src/lifecycle/release-images.ts +39 -3
  299. package/src/lifecycle/release-ledger.ts +4 -3
  300. package/src/local-chant.e2e.test.ts +81 -6
  301. package/src/local-chant.test.ts +22 -3
  302. package/src/local-chant.ts +130 -13
  303. package/src/op/op-waves-evidence-jobs.ts +134 -0
  304. package/src/op/op-waves-evidence.test.ts +36 -3
  305. package/src/op/op-waves-evidence.ts +23 -3
  306. package/src/op/op-waves-run.ts +57 -2
  307. package/src/op/op-waves.ts +11 -0
  308. package/src/op/schedule-overdue.test.ts +83 -1
  309. package/src/op/schedule-overdue.ts +107 -9
  310. package/src/pr-forge-reads-compare.test.ts +2 -1
  311. package/src/pr-forge-reads.ts +37 -1
  312. package/src/pr-forge.ts +14 -3
  313. package/src/pr-plan-note.ts +32 -3
  314. package/src/pr-plan-record.test.ts +75 -0
  315. package/src/pr-plan-record.ts +101 -0
  316. package/src/pr-post-plan-note.test.ts +60 -0
  317. package/src/pr-post.test.ts +30 -0
  318. package/src/pr-post.ts +110 -6
  319. package/src/pr-requires.test.ts +20 -0
  320. package/src/pr-requires.ts +10 -1
  321. package/src/ref-gate-init.ts +189 -0
  322. package/src/ref-gate-rules.ts +26 -0
  323. package/src/release-floors.ts +86 -17
  324. package/src/state-migration-record.test.ts +90 -0
  325. package/src/state-migration.test.ts +1 -1
  326. package/src/state-migration.ts +52 -3
  327. package/src/state-unlock.test.ts +33 -1
  328. package/src/state-unlock.ts +49 -1
  329. package/src/workspace/ci-green-cli.ts +12 -6
  330. package/src/workspace/drift-cli.ts +6 -18
  331. package/src/workspace/forge-work.ts +7 -14
  332. package/src/workspace/lexicon-outputs.ts +2 -2
  333. package/src/workspace/release-workflow.test.ts +70 -0
  334. package/src/workspace/release-workflow.ts +56 -8
  335. package/src/workspace/trust/check-evidence-report.ts +24 -0
  336. package/src/workspace/trust/check-evidence.ts +17 -5
  337. package/src/workspace/trust/evidence.ts +5 -0
  338. package/src/workspace/trust/open-evidence.ts +129 -0
  339. package/src/workspace/trust/ref-gate-cli.ts +59 -3
  340. package/src/workspace/trust/ref-gate-pieces.test.ts +175 -0
  341. package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
  342. package/src/workspace/trust/ref-gate.ts +87 -6
package/src/cli/main.ts CHANGED
@@ -267,18 +267,27 @@ E2E harness:
267
267
  CLEAN, or the rejecting lines and exits 3.
268
268
 
269
269
  CI:
270
- ci check --base <rev> [<target>...] [--output <dir>] [--json]
270
+ ci check --base <rev> [<target>...] [--output <dir>] [--summary <file>] [--json]
271
271
  Run the ci.hooks.check hooks the workspace declaration
272
272
  at --base names, once each, or once per target with
273
273
  perRun, with no forge token or cloud credentials in
274
274
  their environment. Writes check-hooks.json under
275
- --output (default .chant/check); exits 1 when one failed.
275
+ --output (default .chant/check), and with --summary
276
+ appends the report's markdown section to the file;
277
+ exits 1 when one failed.
276
278
  ci evidence sign --check-id <id>[,<id>...] [--at <rev>] [--base <rev>] [--no-push]
277
279
  Sign that each named check passed at --at, with the
278
280
  runner key in CHANT_RUNNER_KEY or --key, and keep it on
279
281
  chant/lifecycle by the commit's tree. With --from-report
280
282
  <dir> --result <result>, sign plan and policy from the
281
283
  plan job's report, as a generated plan note job does.
284
+ With --open --job <job> --from-report <dir> -o <out>,
285
+ in a GitLab pipeline of the target branch, sign each
286
+ open merge request's settled <job> from its artifact.
287
+ With --from-job <job> [--claims <dir>], sign each
288
+ named check whose step in that job of this run and
289
+ commit the forge reports as passed, as a wave's
290
+ evidence job does (#4926).
282
291
  ci evidence verify --check-id <id>[,<id>...] [--at <rev>] [--base <rev>] [--json]
283
292
  Verify the kept evidence for --at's tree against the
284
293
  runner keys at --base; exits 1 when one is not current.
@@ -287,12 +296,13 @@ CI:
287
296
  expectation in CHANT_JOB_GUARD, which a generated
288
297
  op-wave job carries. Exits 1, one line per value
289
298
  that differs, before any credential is taken.
290
- ci forge-check [--env <env>] [--member <name>] [--forge <forge>] [--repo <owner/name>] [--branch <default>] [--require-clouds] [--json]
299
+ ci forge-check [--env <env>] [--member <name>] [--forge <forge>] [--repo <owner/name>] [--branch <default>] [--require-clouds] [--ref-gate-status] [--json]
291
300
  Read the forge, each cloud's trust policy and Pulumi
292
301
  Cloud's OIDC policies against the pipelines
293
302
  ci.identity.cloud gives --env (default production):
294
303
  apply environments, branch protection, required
295
304
  statuses, and each identity trusted to its own jobs.
305
+ --ref-gate-status requires the ref gate's status too.
296
306
  Read-only; exits 1 on a mismatch, and with
297
307
  --require-clouds on a cloud it had no credentials for.
298
308
  ci last-green [--json] [--lane <name>] [--from <rev>] The newest first-parent commit of
@@ -598,6 +608,10 @@ Ops:
598
608
  pipeline runs. --decide plans and decides only;
599
609
  --share <i> applies one share of a decided wave;
600
610
  --group <name> applies one job group's runs.
611
+ --policy-only plans the wave and runs its policy
612
+ hold, applying nothing, and exits 0 only when the
613
+ policy ran and denied nothing: the wave job's
614
+ policy step, whose result its evidence job reads (#4926).
601
615
  --record-plans (no --wave), in a pull request's
602
616
  pipeline: plan every wave at its head and record the
603
617
  digests a pr-review approval mode compares.
@@ -1057,7 +1071,8 @@ Workspace (level 1, #2524):
1057
1071
  workspace ref-gate check|status --ref <ref> [--at <rev>] [--base <rev>] [--json]
1058
1072
  Decide a ref update against the checks .chant/trust.json
1059
1073
  at base requires for the ref; status sets the commit
1060
- status a forge requires
1074
+ status a forge requires; status --open sets it on
1075
+ every open pull request into the branch (#4935)
1061
1076
  workspace ref-gate install --hook pre-receive|pre-push [--git-dir <dir>]
1062
1077
  Write the git hook that refuses an update whose commit
1063
1078
  lacks current evidence for a blocking check
@@ -1476,6 +1491,14 @@ Lexicon development:
1476
1491
  Check a bundle against its package.json chantBundleCheck: imports
1477
1492
  only Node, its dependencies and chant served as compiled JS, the
1478
1493
  dependencies on the root's chant pin, size ceilings, denied inputs
1494
+ dev local-image [--with <package>]... [-- <docker build args>]
1495
+ Print the chant an image installs (the pin, or local-<commit>
1496
+ after dev local), or run docker build with CHANT_VERSION and,
1497
+ for a local build, the chant-local build context
1498
+ dev generated-check [<render>...]
1499
+ Render the files package.json's chantGenerated declares into a
1500
+ directory under the OS temp dir, compare each with the committed
1501
+ file, and fail naming the ones that drifted
1479
1502
  dev dead-guards [<product-dir>]
1480
1503
  Fail naming each feature-detect on a chant floor (a floor read off
1481
1504
  a lazily loaded module, a subpath loaded behind a catch, the
@@ -1581,6 +1604,15 @@ Options:
1581
1604
  apply on merge tells it. With --control-setting
1582
1605
  <key>=<value> (repeatable) for op, member,
1583
1606
  readTokenSecret and the other control settings
1607
+ --evidence-runner-key-secret <NAME>, --evidence-identity oidc [--evidence-audience <aud>]
1608
+ (build --pr-loop) The runner identity the note job
1609
+ signs plan and policy with (#4935)
1610
+ --check-job (build --pr-loop) A check job that runs ci check on
1611
+ the pull request's commit, and with evidence a job
1612
+ that signs each passed hook (#4935)
1613
+ --ref-gate-status (build --pr-loop) A job that sets the ref gate's
1614
+ status on the pull request's commit (#4935); (ci
1615
+ forge-check) the default branch requires it (#4913)
1584
1616
  --no-release-record Skip auto-emitting a release-ledger record after a
1585
1617
  successful \`run --components\` deploy (default: on;
1586
1618
  also settable via chant.config.ts's
@@ -1984,6 +2016,8 @@ export const commandRegistry: CommandDef[] = [
1984
2016
  // #4787: build a product against a chant checkout, and check its bundle. Imported on first use.
1985
2017
  { name: "dev local", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/local-chant")).runDevLocal(ctx) },
1986
2018
  { name: "dev bundle-check", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/local-chant")).runDevBundleCheck(ctx) },
2019
+ { name: "dev local-image", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/local-chant")).runDevLocalImage(ctx) },
2020
+ { name: "dev generated-check", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/generated-check")).runDevGeneratedCheck(ctx) },
1987
2021
  // #4792: the feature-detects on a chant floor the product's pin already meets.
1988
2022
  { name: "dev dead-guards", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/dead-guards")).runDevDeadGuards(ctx) },
1989
2023
 
@@ -21,6 +21,8 @@ const BOOLEAN_FLAGS = new Set([
21
21
  "--help",
22
22
  "--open",
23
23
  "--note-commands",
24
+ "--check-job",
25
+ "--ref-gate-status",
24
26
  "--locks",
25
27
  "--version",
26
28
  "--agents",
@@ -80,6 +82,7 @@ const BOOLEAN_FLAGS = new Set([
80
82
  "--require-runner-start",
81
83
  "--require-clouds",
82
84
  "--no-push",
85
+ "--no-forks",
83
86
  "--list",
84
87
  "--no-require-review",
85
88
  "--expire",
@@ -102,6 +105,7 @@ const BOOLEAN_FLAGS = new Set([
102
105
  "--root-only",
103
106
  "--generated",
104
107
  "--decide",
108
+ "--policy-only",
105
109
  "--record-plans",
106
110
  "--approval-status",
107
111
  "--waves-outcome",
@@ -483,6 +487,9 @@ export function parseArgs(args: string[]): ParsedArgs {
483
487
  result.wave = wave;
484
488
  } else if (arg === "--decide") {
485
489
  result.decide = true;
490
+ } else if (arg === "--policy-only") {
491
+ // `chant run wave --policy-only` (#4926): plan the wave and run its policy hold, as a step of its own.
492
+ result.policyOnly = true;
486
493
  } else if (arg === "--record-plans") {
487
494
  result.recordPlans = true;
488
495
  } else if (arg === "--approval-status") {
@@ -570,6 +577,12 @@ export function parseArgs(args: string[]): ParsedArgs {
570
577
  // `chant lock --from-report <pr-plan.json>` (#4293): lock the components a pull-request report lists.
571
578
  result.fromReport = args[++i];
572
579
  if (!result.fromReport || result.fromReport.startsWith("-")) throw new Error("--from-report needs a report file: --from-report <pr-plan.json>");
580
+ } else if (arg === "--from-job" || arg === "--claims") {
581
+ // `chant ci evidence sign --from-job <job> [--claims <dir>]` (#4926): sign from another job's step results.
582
+ const value = args[++i];
583
+ if (value === undefined || value.startsWith("-")) throw new Error(arg === "--from-job" ? "--from-job needs the job's name: --from-job <job>" : "--claims needs a directory: --claims <dir>");
584
+ if (arg === "--from-job") result.fromJob = value;
585
+ else result.claims = value;
573
586
  } else if (arg === "--report-url") {
574
587
  // `chant components pr-plan|pr-apply --report-url <url>` (#4007).
575
588
  const url = args[++i];
@@ -579,6 +592,9 @@ export function parseArgs(args: string[]): ParsedArgs {
579
592
  // `chant components pr-post --result <result>` (#4295): the plan job's own result, which fails the status when it failed.
580
593
  result.planResult = args[++i];
581
594
  if (!result.planResult || result.planResult.startsWith("-")) throw new Error("--result needs the plan job's result: --result success|failure|cancelled");
595
+ } else if (arg === "--no-forks") {
596
+ // `chant ci evidence sign --open --no-forks` (#4914): sign for no merge request from a fork.
597
+ result.noForks = true;
582
598
  } else if (arg === "--no-status") {
583
599
  // `chant ci run|serve --no-status` (#4097): post no commit status for the job.
584
600
  result.noStatus = true;
@@ -926,6 +942,36 @@ export function parseArgs(args: string[]): ParsedArgs {
926
942
  } else if (arg === "--note-commands") {
927
943
  // `chant build --pr-loop --note-commands` (#4785).
928
944
  result.noteCommands = true;
945
+ } else if (arg === "--check-job") {
946
+ // `chant build --pr-loop --check-job` (#4935): the check job, chant ci check on the pull request's commit.
947
+ result.checkJob = true;
948
+ } else if (arg === "--ref-gate-status") {
949
+ // `chant build --pr-loop --ref-gate-status` (#4935): the job that sets the ref gate's status; on `ci forge-check` (#4913), require it.
950
+ result.refGateStatus = true;
951
+ } else if (arg === "--evidence-runner-key-secret") {
952
+ // `chant build --pr-loop --evidence-runner-key-secret <NAME>` (#4935): the secret holding the runner key the note job signs with.
953
+ result.evidenceRunnerKeySecret = args[++i];
954
+ if (!result.evidenceRunnerKeySecret || result.evidenceRunnerKeySecret.startsWith("-")) throw new Error("--evidence-runner-key-secret needs the secret holding the runner key: --evidence-runner-key-secret <NAME>");
955
+ } else if (arg === "--evidence-identity") {
956
+ // `chant build --pr-loop --evidence-identity oidc` (#4935, #4869): sign keyless from the job's OIDC identity.
957
+ result.evidenceIdentity = args[++i];
958
+ if (result.evidenceIdentity !== "oidc") throw new Error(`--evidence-identity takes oidc, the one identity chant signs keyless with: got "${result.evidenceIdentity ?? ""}"`);
959
+ } else if (arg === "--evidence-audience") {
960
+ // `chant build --pr-loop --evidence-identity oidc --evidence-audience <aud>` (#4935, #4869).
961
+ result.evidenceAudience = args[++i];
962
+ if (!result.evidenceAudience || result.evidenceAudience.startsWith("-")) throw new Error("--evidence-audience needs the OIDC token's audience: --evidence-audience <aud>");
963
+ } else if (arg === "--record-run") {
964
+ // `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle.
965
+ result.recordRun = args[++i];
966
+ if (!result.recordRun || !/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(result.recordRun)) throw new Error(`--record-run needs the plan job's name: got "${result.recordRun ?? ""}"`);
967
+ } else if (arg === "--evidence-dir") {
968
+ // `chant components pr-post --open --evidence-dir <dir>` (#4914): each merge request's evidence.json, from the GitLab signing job.
969
+ result.evidenceDir = args[++i];
970
+ if (!result.evidenceDir || result.evidenceDir.startsWith("-")) throw new Error("--evidence-dir needs the directory the signing job kept: --evidence-dir .chant/evidence/plan");
971
+ } else if (arg === "--summary") {
972
+ // `chant ci check --summary <file>` (#4914): the check report's markdown section, appended to the file.
973
+ result.checkSummary = args[++i];
974
+ if (!result.checkSummary || result.checkSummary.startsWith("-")) throw new Error("--summary needs a file to append the check report's section to: --summary <file>");
929
975
  } else if (arg === "--locks") {
930
976
  // `chant components pr-notes --locks` (#4785).
931
977
  result.locks = true;
@@ -334,6 +334,8 @@ export interface ParsedArgs {
334
334
  wave?: number;
335
335
  /** `chant run wave --decide` (#3679) — plan a wide wave and decide its gate, applying nothing. */
336
336
  decide?: boolean;
337
+ /** `chant run wave --policy-only` (#4926) — plan the wave and run its policy hold, applying nothing: the wave job's policy step. */
338
+ policyOnly?: boolean;
337
339
  /** `chant run wave --record-plans` (#3684) — plan every wave at a pull request's head and record the digests for a `pr-review` gate. */
338
340
  recordPlans?: boolean;
339
341
  /** `chant run wave --approval-status` (#4630) — post `<product>/approval` on an open pull request's head under `pr-review` or `pull-request`. */
@@ -375,6 +377,10 @@ export interface ParsedArgs {
375
377
  lockStage?: string;
376
378
  /** `chant lock --from-report <file>` (#4293): lock the components a `pr-plan.json` lists. */
377
379
  fromReport?: string;
380
+ /** `chant ci evidence sign --from-job <job>` (#4926): sign the checks whose steps in that job of this run passed. */
381
+ fromJob?: string;
382
+ /** `chant ci evidence sign --from-job <job> --claims <dir>` (#4926): the directory of the checks' claim files. */
383
+ claims?: string;
378
384
  /** `chant lock --alive <run>` (#4552): print `alive` or `dead` for a run that holds rows or the repo lock tag. */
379
385
  aliveRun?: string;
380
386
  /** `chant lock --beat <run>` (#4660): the heartbeat side process of the rows a run holds. Not for people. */
@@ -589,6 +595,24 @@ export interface ParsedArgs {
589
595
  staleNotes?: boolean;
590
596
  /** `chant build --pr-loop --note-commands` (#4785): on GitLab, the scheduled job that answers the product's comment commands by polling merge request notes. */
591
597
  noteCommands?: boolean;
598
+ /** `chant build --pr-loop --check-job` (#4935): the check job, `chant ci check` on the pull request's commit. */
599
+ checkJob?: boolean;
600
+ /** `chant build --pr-loop --ref-gate-status` (#4935): the job that runs `chant workspace ref-gate status` for the pull request's commit. `chant ci forge-check --ref-gate-status` (#4913): the default branch requires its status. */
601
+ refGateStatus?: boolean;
602
+ /** `chant build --pr-loop --evidence-runner-key-secret <NAME>` (#4935): the secret holding the runner key the note job signs `plan` and `policy` with. */
603
+ evidenceRunnerKeySecret?: string;
604
+ /** `chant build --pr-loop --evidence-identity oidc` (#4935, #4869): sign keyless from the job's OIDC identity. */
605
+ evidenceIdentity?: string;
606
+ /** `chant build --pr-loop --evidence-audience <aud>` (#4935, #4869): the keyless signing token's audience. */
607
+ evidenceAudience?: string;
608
+ /** `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle. */
609
+ recordRun?: string;
610
+ /** `chant components pr-post --open --evidence-dir <dir>` (#4914): where the GitLab signing job kept each merge request's `evidence.json`, for the note's checks line. */
611
+ evidenceDir?: string;
612
+ /** `chant ci evidence sign --open --no-forks` (#4914): sign for no merge request from a fork. */
613
+ noForks?: boolean;
614
+ /** `chant ci check --summary <file>` (#4914): append the check report's markdown section to the file. */
615
+ checkSummary?: string;
592
616
  /** `chant components pr-notes --locks` (#4785): the pipeline has the lock and unlock jobs, so a lock or unlock note starts them. */
593
617
  locks?: boolean;
594
618
  /** `chant components pr-post --stale` (#4628): mark the open pull requests' notes stale after the target branch moved. */
@@ -35,6 +35,7 @@ import { CHECK_EVIDENCE_KEY_ENV, LOCAL_EVIDENCE_KEY_ENV, SIGNING_ID_TOKEN_VAR }
35
35
  import { acceptedLocalEvidence, acceptsLocalEvidence, fetchLocalEvidence } from "../workspace/trust/local-evidence";
36
36
 
37
37
  export { CI_CHECK_HOOK_FLOOR } from "../op/op-waves";
38
+ export { CHECK_SUMMARY_FLOOR } from "../release-floors";
38
39
 
39
40
  /** The check hooks a job runs, and where they were read. */
40
41
  export interface CheckHooksRead {
@@ -161,6 +162,27 @@ export function passedCheckHooks(outcomes: readonly CheckHookOutcome[]): Array<{
161
162
  return [...byName].filter(([, runs]) => runs.every((r) => r.outcome === "passed")).map(([check, runs]) => ({ check, runs }));
162
163
  }
163
164
 
165
+ /**
166
+ * The check report's markdown section (#4914): a heading naming the base
167
+ * the hooks were read at, a line per hook run and per lexicon check step,
168
+ * the failure, and the checks whose evidence was signed. A product's check
169
+ * step keeps it in its own report or job summary (`chant ci check
170
+ * --summary <file>`) instead of rendering `check-hooks.json` itself. Empty
171
+ * when no hook is declared and no step ran.
172
+ */
173
+ export function checkReportSummary(report: Pick<CheckHooksReport, "status" | "base" | "hooks" | "steps" | "failed" | "evidence">): string[] {
174
+ if (report.status === "none") return [];
175
+ const at = report.base === "HEAD" ? "" : ` (read at ${/^[0-9a-f]{40}$/.test(report.base) ? report.base.slice(0, 12) : report.base})`;
176
+ const hooks = report.hooks.map(
177
+ (h) => `- ${h.outcome}: \`${h.name}\`${h.target ? ` for \`${h.target}\`` : ""}${h.outcome === "failed" ? `, exit ${h.exit}` : ""}${h.reason ? ` (${h.reason})` : ""}`,
178
+ );
179
+ const steps = (report.steps ?? []).map(
180
+ (s) => `- ${s.outcome}: \`${s.lexicon} ${s.step}\` for \`${s.member}\`${s.stack ? ` (stack \`${s.stack}\`)` : ""}${s.outcome === "failed" ? `, exit ${s.exit}` : ""}${s.reason && s.outcome !== "failed" ? ` (${s.reason})` : ""}`,
181
+ );
182
+ const signed = report.evidence ? [`- signed: ${report.evidence.signed.map((c) => `\`${c}\``).join(", ")} as ${report.evidence.runner}`] : [];
183
+ return [`### Check hooks${at}`, "", ...hooks, ...steps, ...(report.failed ? [`- ${report.failed}`] : []), ...signed, ""];
184
+ }
185
+
164
186
  /** Where {@link runCheckHooks} writes its runs file and report unless told: `.chant/check`. */
165
187
  export const CHECK_HOOKS_DIR = ".chant/check";
166
188
 
@@ -0,0 +1,78 @@
1
+ /**
2
+ * #4914: the check report's markdown section, which `chant ci check
3
+ * --summary <file>` appends to a product's own report, so a product's check
4
+ * step runs chant's check stage (hooks, lexicon steps, signing) and renders
5
+ * nothing of its own.
6
+ */
7
+
8
+ import { execFileSync } from "node:child_process";
9
+ import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { join } from "node:path";
12
+ import { afterEach, describe, expect, test, vi } from "vitest";
13
+ import { checkReportSummary } from "./check-hooks";
14
+ import { parseArgs } from "../cli/parse-args";
15
+ import type { CommandContext } from "../cli/registry";
16
+
17
+ const BASE = "0123456789abcdef0123456789abcdef01234567";
18
+
19
+ describe("checkReportSummary (#4914)", () => {
20
+ test("names the base, each hook run and step, the failure and the evidence signed", () => {
21
+ const lines = checkReportSummary({
22
+ status: "failed",
23
+ base: BASE,
24
+ hooks: [
25
+ { name: "fmt", exit: 0, outcome: "passed" },
26
+ { name: "tflint", target: "roots/a", exit: 2, outcome: "failed" },
27
+ { name: "checkov", exit: 0, outcome: "skipped", reason: "current local evidence from person alice" },
28
+ ],
29
+ steps: [{ lexicon: "pulumi", step: "pulumi-about", member: "app", stack: "dev", exit: 0, outcome: "passed" }],
30
+ failed: "a check hook failed: tflint",
31
+ evidence: { signed: ["fmt"], runner: "ci", commit: BASE },
32
+ });
33
+ expect(lines).toEqual([
34
+ "### Check hooks (read at 0123456789ab)",
35
+ "",
36
+ "- passed: `fmt`",
37
+ "- failed: `tflint` for `roots/a`, exit 2",
38
+ "- skipped: `checkov` (current local evidence from person alice)",
39
+ "- passed: `pulumi pulumi-about` for `app` (stack `dev`)",
40
+ "- a check hook failed: tflint",
41
+ "- signed: `fmt` as ci",
42
+ "",
43
+ ]);
44
+ });
45
+
46
+ test("nothing when no hook is declared and no step ran", () => {
47
+ expect(checkReportSummary({ status: "none", base: "HEAD", hooks: [] })).toEqual([]);
48
+ });
49
+ });
50
+
51
+ describe("chant ci check --summary (#4914)", () => {
52
+ afterEach(() => vi.restoreAllMocks());
53
+
54
+ test("the flag parses", () => {
55
+ expect(parseArgs(["ci", "check", "--base", "HEAD", "--summary", ".terragucci/check/report.md"])).toMatchObject({ checkSummary: ".terragucci/check/report.md" });
56
+ expect(() => parseArgs(["ci", "check", "--summary"])).toThrow(/--summary needs a file/);
57
+ });
58
+
59
+ test("appends the section to the file after the check hooks ran", async () => {
60
+ const cwd = mkdtempSync(join(tmpdir(), "chant-4914-summary-"));
61
+ const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=t", "-c", "user.email=t@example.invalid", "-c", "init.defaultBranch=main", ...args], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
62
+ git("init", "--quiet");
63
+ writeFileSync(join(cwd, "chant.workspace.json"), JSON.stringify({ name: "acme", schema: 1, members: [], ci: { hooks: { check: [{ name: "ok", command: ["true"] }] } } }, null, 2) + "\n");
64
+ git("add", ".");
65
+ git("commit", "--quiet", "-m", "base");
66
+ const file = join(cwd, "out", "report.md");
67
+ vi.spyOn(process, "cwd").mockReturnValue(cwd);
68
+ const said: string[] = [];
69
+ vi.spyOn(console, "error").mockImplementation((l: string) => void said.push(String(l)));
70
+ vi.stubEnv("GITHUB_STEP_SUMMARY", "");
71
+ const { runCiCheck } = await import("../cli/handlers/ci-check");
72
+ const code = await runCiCheck({ args: parseArgs(["ci", "check", "--base", "HEAD", "--output", join(cwd, ".chant/check"), "--summary", file]), plugins: [{} as never] } as unknown as CommandContext);
73
+ vi.unstubAllEnvs();
74
+ expect(code, said.join("\n")).toBe(0);
75
+ expect(said.join("\n")).toContain("1 passed");
76
+ expect(readFileSync(file, "utf-8")).toContain("- passed: `ok`");
77
+ });
78
+ });
@@ -0,0 +1,159 @@
1
+ /**
2
+ * The pull request's check job and the ref gate's status job (#4935), for
3
+ * the forge lexicons to render beside the plan jobs: the pull request loop
4
+ * (`chant build --pr-loop --check-job --ref-gate-status`) and the product
5
+ * pipeline (`productPipelineJobs({ checkJob, refGateStatus })`).
6
+ *
7
+ * - The check job runs `chant ci check --base <base>` on the pull request's
8
+ * commit: the `ci.hooks.check` hooks the declaration at base names and the
9
+ * lexicons' check steps. A hook whose current local evidence the policy at
10
+ * base accepts is skipped (#4868). The job runs the change's code, so it
11
+ * follows the plan job's handover (#4295): the checkout script alone sees
12
+ * the forge token, every later step starts without it, and the check is
13
+ * the job's last step, handing `.chant/check` on as the job's outputs.
14
+ * It holds no runner key and no OIDC token for signing either (#4328).
15
+ * - With `evidence` (#4870, #4869) the `check-evidence` job signs each hook
16
+ * that passed, by name, from the check job's report, in a job that checks
17
+ * out the target branch's commit and runs none of the change's code, as
18
+ * the plan note job signs `plan` and `policy` from the plan job's report.
19
+ * It pushes `refs/notes/chant/evidence`. On GitLab it runs in the target
20
+ * branch's plan notes pipeline (#4914), as the plan's `<plan job>-evidence`
21
+ * job does: `ci evidence sign --open` signs every open merge request's
22
+ * settled check job from its artifact, so no job of the merge request's
23
+ * own pipeline holds the key.
24
+ * - The `ref-gate` job runs `chant workspace ref-gate status` (#4867) for
25
+ * the pull request's commit once the plan note and the check evidence are
26
+ * in: it reads the evidence notes, decides the update a merge into the
27
+ * target branch would make under the policy at base, and sets the
28
+ * `chant/ref-gate` status (or the policy's own status name), which a
29
+ * project can then make a required status. GitLab sets a status only with
30
+ * the protected token a target-branch pipeline holds (#4328), so there the
31
+ * job runs in the plan notes pipeline and posts for every open merge
32
+ * request into the branch (`ref-gate status --open`).
33
+ *
34
+ * The commit is the one the plan job checked out and every other status of
35
+ * the loop names: `github.sha` on GitHub and Forgejo, `CI_COMMIT_SHA` in a
36
+ * GitLab merge request pipeline.
37
+ */
38
+
39
+ import type { ForgeKind } from "../pr-forge";
40
+ import { GITHUB_JOB_TOKEN } from "../ci-jobs";
41
+ import { assertPipelineEvidence, evidenceIdTokens, evidenceKeyEnv, evidenceKeyless, gitlabOpenEvidenceDir, openEvidenceLines, planEvidenceLines, type PipelineEvidence } from "../ci-evidence-jobs";
42
+ import { withProductBin } from "./pr-pipeline";
43
+
44
+ /** The check job's name (#4935). */
45
+ export const PR_CHECK_JOB = "check";
46
+
47
+ /** The job that signs the check job's hooks (#4935). */
48
+ export const PR_CHECK_EVIDENCE_JOB = "check-evidence";
49
+
50
+ /** The job that sets the ref gate's status (#4935). */
51
+ export const PR_REF_GATE_JOB = "ref-gate";
52
+
53
+ /** Where `chant ci check` writes its report: `CHECK_HOOKS_DIR` in ./check-hooks.ts, kept here so a generator does not load the check runner. */
54
+ export const PR_CHECK_REPORT_DIR = ".chant/check";
55
+
56
+ /** The artifact the check report is kept as. */
57
+ export const PR_CHECK_ARTIFACT = "chant-pr-check";
58
+
59
+ /** The check job (#4935): its command and the values it reads. */
60
+ export interface PrCheckJob {
61
+ jobName: string;
62
+ /** `chant ci check --base "$BASE_SHA"`, through the words' bin. */
63
+ command: string;
64
+ /** `BASE_SHA`, as the forge spells it. */
65
+ env: Record<string, string>;
66
+ /** The report directory it writes and hands on. */
67
+ dir: string;
68
+ /**
69
+ * With `evidence`: the signing job's lines and variables. GitHub and
70
+ * Forgejo run them in `check-evidence` after taking the report back;
71
+ * GitLab in `check-evidence` in the target branch's plan notes pipeline
72
+ * (#4914), for every open merge request's check job, keeping `dir`.
73
+ * Signing keyless, the job asks for an OIDC token: `idToken` (GitHub's
74
+ * `id-token: write`, Forgejo's `enable-openid-connect`) or GitLab's
75
+ * `idTokens`.
76
+ */
77
+ evidence?: { jobName: string; lines: string[]; env: Record<string, string>; dir?: string; idToken?: true; idTokens?: Record<string, { aud: string }> };
78
+ }
79
+
80
+ /** The check job for `forge` (#4935), with the check evidence job when `evidence` names a runner identity. */
81
+ export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: PipelineEvidence; noForks?: boolean } = {}): PrCheckJob {
82
+ assertPipelineEvidence(opts.evidence);
83
+ const gitlab = forge === "gitlab";
84
+ const base = gitlab ? "$CI_MERGE_REQUEST_DIFF_BASE_SHA" : "${{ github.event.pull_request.base.sha }}";
85
+ const job: PrCheckJob = {
86
+ jobName: PR_CHECK_JOB,
87
+ command: withProductBin('chant ci check --base "$BASE_SHA"', opts.bin),
88
+ env: { BASE_SHA: base },
89
+ dir: PR_CHECK_REPORT_DIR,
90
+ };
91
+ const evidence = opts.evidence;
92
+ if (!evidence) return job;
93
+ const key = evidenceKeyEnv(forge, evidence);
94
+ const bin = opts.bin ? { bin: opts.bin } : {};
95
+ if (gitlab) {
96
+ // #4914: the job runs in the target branch's plan notes pipeline and signs every open merge request's
97
+ // settled check job from its artifact; no job of a merge request pipeline holds the key.
98
+ const dir = gitlabOpenEvidenceDir(PR_CHECK_JOB);
99
+ return {
100
+ ...job,
101
+ evidence: {
102
+ jobName: PR_CHECK_EVIDENCE_JOB,
103
+ // A fork's check job runs too, as it holds nothing; with noForks (a product plan's forks: "skip") its hooks are not signed for.
104
+ lines: openEvidenceLines({ job: PR_CHECK_JOB, dir: PR_CHECK_REPORT_DIR, out: dir, ...bin, ...(opts.noForks ? { noForks: true } : {}) }),
105
+ env: key,
106
+ dir,
107
+ ...(evidenceKeyless(evidence) ? { idTokens: evidenceIdTokens(evidence) } : {}),
108
+ },
109
+ };
110
+ }
111
+ return {
112
+ ...job,
113
+ evidence: {
114
+ jobName: PR_CHECK_EVIDENCE_JOB,
115
+ lines: planEvidenceLines({ dir: PR_CHECK_REPORT_DIR, at: '"$HEAD_SHA"', base: '"$BASE_SHA"', result: '"$CHECK_RESULT"', ...bin }),
116
+ env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: base, CHECK_RESULT: `\${{ needs.${PR_CHECK_JOB}.result }}`, ...key },
117
+ ...(evidenceKeyless(evidence) ? { idToken: true as const } : {}),
118
+ },
119
+ };
120
+ }
121
+
122
+ /** The ref gate's status job (#4935): its lines and the values they read. */
123
+ export interface PrRefGateJob {
124
+ jobName: string;
125
+ /** The fetches of the pull request's commit and the evidence notes, before the command. */
126
+ setup: string[];
127
+ /** `chant workspace ref-gate status`, through the words' bin. */
128
+ command: string;
129
+ /** The values the lines read, as the forge spells them, the token included on GitHub and Forgejo. */
130
+ env: Record<string, string>;
131
+ }
132
+
133
+ /**
134
+ * The ref gate's status job for `forge` (#4935). `branch` is the target
135
+ * branch on GitHub and Forgejo (default `main`); GitLab's job runs in a
136
+ * pipeline of the target branch and names it from `CI_COMMIT_BRANCH`.
137
+ */
138
+ export function prRefGateJob(forge: ForgeKind, opts: { bin?: string; branch?: string } = {}): PrRefGateJob {
139
+ const notes = "'+refs/notes/chant/evidence:refs/notes/chant/evidence'";
140
+ if (forge === "gitlab") {
141
+ return {
142
+ jobName: PR_REF_GATE_JOB,
143
+ // The heads are fetched by the command, one merge request at a time.
144
+ setup: [`git fetch --quiet --no-tags origin ${notes} || true`],
145
+ command: withProductBin('chant workspace ref-gate status --open --ref "refs/heads/$CI_COMMIT_BRANCH" --base "$CI_COMMIT_SHA"', opts.bin),
146
+ env: {},
147
+ };
148
+ }
149
+ const branch = opts.branch ?? "main";
150
+ if (!/^[A-Za-z0-9._\/-]+$/.test(branch)) throw new Error(`the ref gate's branch ${JSON.stringify(branch)} is not a branch name`);
151
+ return {
152
+ jobName: PR_REF_GATE_JOB,
153
+ setup: [`git fetch --quiet --no-tags origin "$HEAD_SHA" ${notes} || git fetch --quiet --no-tags origin "$HEAD_SHA" || true`],
154
+ command: withProductBin(`chant workspace ref-gate status --ref refs/heads/${branch} --at "$HEAD_SHA" --base "$BASE_SHA"`, opts.bin),
155
+ env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: "${{ github.event.pull_request.base.sha }}", GITHUB_TOKEN: GITHUB_JOB_TOKEN },
156
+ };
157
+ }
158
+
159
+ export { CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR } from "../release-floors";
@@ -101,6 +101,7 @@ import { commandWord, commentLine, PRODUCT_ACTION_ENV, PRODUCT_ACTION_EVENT_FLAG
101
101
  import { CHANT_EXIT } from "../exit-codes";
102
102
  import type { ControlTarget } from "../control/dispatch";
103
103
  import { CI_RESPOND_ENV, respondList, type CiResponses } from "../ci-respond";
104
+ import type { PipelineEvidence } from "../ci-evidence-jobs";
104
105
 
105
106
  /** The variable `chant ci run` reads its runner key from (`RUNNER_KEY_ENV` in ../workspace/ci-green.ts). */
106
107
  const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
@@ -391,6 +392,44 @@ export interface PrLoopPipelineOptions {
391
392
  * to `pr-post`. Needed with `respond.description: "check"`.
392
393
  */
393
394
  decide?: { backend: string; model: string };
395
+ /**
396
+ * The pipeline's runner identity (#4935, as #4870's `PipelineEvidence`):
397
+ * the plan-note job signs the plan job's `plan` and `policy` checks from
398
+ * its report before it posts, with the runner key from the named secret or
399
+ * (#4869) keyless from the job's OIDC identity. On GitLab a
400
+ * `<plan job>-evidence` job after the plan job signs from its artifact.
401
+ * With `checkJob`, the `check-evidence` job signs each passed hook. Set
402
+ * from `--evidence-runner-key-secret`, or `--evidence-identity oidc` with
403
+ * an optional `--evidence-audience`. Absent: nothing is signed, and every
404
+ * job is as before. Refused on a workspace member's pipeline: the checks
405
+ * are the commit's, so one pipeline signs them.
406
+ */
407
+ evidence?: PipelineEvidence;
408
+ /**
409
+ * The check job (#4935, ./pr-checks.ts): `chant ci check --base <base>` on
410
+ * the pull request's commit, with no forge token, runner key or OIDC token
411
+ * while the hooks run. Set from `--check-job`. Refused on a member's
412
+ * pipeline: the hooks are the workspace's.
413
+ */
414
+ checkJob?: boolean;
415
+ /**
416
+ * The ref gate's status job (#4935, ./pr-checks.ts): `chant workspace
417
+ * ref-gate status` for the pull request's commit, after the note and the
418
+ * check evidence, so `chant/ref-gate` can be a required status. Set from
419
+ * `--ref-gate-status`. Refused on a member's pipeline.
420
+ */
421
+ refGateStatus?: boolean;
422
+ }
423
+
424
+ /**
425
+ * Refuse the loop's `evidence`, `checkJob` and `refGateStatus` (#4935) on a
426
+ * workspace member's pipeline: a check and its evidence are the commit's,
427
+ * so the root pipeline runs and signs them once.
428
+ */
429
+ export function assertRootChecks(options: Pick<PrLoopPipelineOptions, "evidence" | "checkJob" | "refGateStatus">, member: string | undefined): void {
430
+ if (!member) return;
431
+ const given = [...(options.evidence ? ["evidence"] : []), ...(options.checkJob ? ["checkJob"] : []), ...(options.refGateStatus ? ["refGateStatus"] : [])];
432
+ if (given.length > 0) throw new Error(`${given.join(", ")} sign and judge the pull request's commit once, for the whole workspace, so give ${given.length === 1 ? "it" : "them"} on the root pipeline, not member ${member}'s`);
394
433
  }
395
434
 
396
435
  /** The `CHANT_RESPOND` value of `respond` (#4629), or undefined when every event is at its default. Throws on a description check with no decide service. */
@@ -427,7 +466,8 @@ export function prLoopRunner(options: Pick<PrLoopPipelineOptions, "runners">, st
427
466
  */
428
467
  export function prLoopJobStage(name: string, member?: string): PrLoopRunnerStage {
429
468
  const bare = member && name.startsWith(`${member}-`) ? name.slice(member.length + 1) : name;
430
- if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB) return "plan";
469
+ // #4935: the check job runs the change's code, as the plan does.
470
+ if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB || bare === "check") return "plan";
431
471
  if (bare === "apply" || bare === "record" || bare === PR_ACTION_JOB || /^apply-wave-\d+$/.test(bare) || bare === "env-up" || bare === "env-down" || bare === "env-sweep") return "apply";
432
472
  return "default";
433
473
  }