@intentius/chant 0.124.88 → 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 (303) hide show
  1. package/dist/actor.d.ts +36 -1
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +39 -1
  4. package/dist/chant-install.d.ts.map +1 -1
  5. package/dist/chant-install.js +1 -2
  6. package/dist/ci-base.d.ts +30 -0
  7. package/dist/ci-base.d.ts.map +1 -0
  8. package/dist/ci-base.js +33 -0
  9. package/dist/ci-comment-commands.d.ts +177 -0
  10. package/dist/ci-comment-commands.d.ts.map +1 -0
  11. package/dist/ci-comment-commands.js +325 -0
  12. package/dist/ci-comment-replies.d.ts +40 -0
  13. package/dist/ci-comment-replies.d.ts.map +1 -0
  14. package/dist/ci-comment-replies.js +59 -0
  15. package/dist/ci-evidence-from-job.d.ts +25 -0
  16. package/dist/ci-evidence-from-job.d.ts.map +1 -1
  17. package/dist/ci-evidence-from-job.js +43 -2
  18. package/dist/ci-evidence-jobs.d.ts +30 -1
  19. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  20. package/dist/ci-evidence-jobs.js +46 -3
  21. package/dist/ci-image.d.ts +21 -4
  22. package/dist/ci-image.d.ts.map +1 -1
  23. package/dist/ci-image.js +62 -10
  24. package/dist/ci-note-commands.d.ts +63 -3
  25. package/dist/ci-note-commands.d.ts.map +1 -1
  26. package/dist/ci-note-commands.js +69 -35
  27. package/dist/ci-product-words.d.ts +42 -0
  28. package/dist/ci-product-words.d.ts.map +1 -1
  29. package/dist/ci-product-words.js +25 -0
  30. package/dist/ci-product.d.ts +31 -0
  31. package/dist/ci-product.d.ts.map +1 -1
  32. package/dist/ci-product.js +34 -4
  33. package/dist/cli/commands/build.d.ts.map +1 -1
  34. package/dist/cli/commands/build.js +29 -2
  35. package/dist/cli/handlers/approve.d.ts.map +1 -1
  36. package/dist/cli/handlers/approve.js +2 -1
  37. package/dist/cli/handlers/ci-check.d.ts +1 -1
  38. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  39. package/dist/cli/handlers/ci-check.js +17 -7
  40. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  41. package/dist/cli/handlers/ci-evidence.js +33 -7
  42. package/dist/cli/handlers/components.d.ts.map +1 -1
  43. package/dist/cli/handlers/components.js +3 -1
  44. package/dist/cli/handlers/generated-check.d.ts +8 -0
  45. package/dist/cli/handlers/generated-check.d.ts.map +1 -1
  46. package/dist/cli/handlers/generated-check.js +31 -1
  47. package/dist/cli/handlers/lock.d.ts.map +1 -1
  48. package/dist/cli/handlers/lock.js +121 -4
  49. package/dist/cli/handlers/pr-comment.d.ts +21 -0
  50. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  51. package/dist/cli/handlers/pr-comment.js +112 -0
  52. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  53. package/dist/cli/handlers/pr-env.js +6 -3
  54. package/dist/cli/handlers/pr.d.ts +23 -1
  55. package/dist/cli/handlers/pr.d.ts.map +1 -1
  56. package/dist/cli/handlers/pr.js +55 -9
  57. package/dist/cli/handlers/promote.d.ts.map +1 -1
  58. package/dist/cli/handlers/promote.js +2 -1
  59. package/dist/cli/handlers/release.d.ts.map +1 -1
  60. package/dist/cli/handlers/release.js +11 -2
  61. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  62. package/dist/cli/handlers/run-wave.js +28 -2
  63. package/dist/cli/handlers/run.d.ts.map +1 -1
  64. package/dist/cli/handlers/run.js +2 -1
  65. package/dist/cli/main.d.ts.map +1 -1
  66. package/dist/cli/main.js +24 -2
  67. package/dist/cli/parse-args.d.ts.map +1 -1
  68. package/dist/cli/parse-args.js +16 -0
  69. package/dist/cli/registry.d.ts +11 -0
  70. package/dist/cli/registry.d.ts.map +1 -1
  71. package/dist/components/auto-release.d.ts.map +1 -1
  72. package/dist/components/auto-release.js +2 -1
  73. package/dist/components/pr-checks.d.ts +70 -6
  74. package/dist/components/pr-checks.d.ts.map +1 -1
  75. package/dist/components/pr-checks.js +74 -13
  76. package/dist/components/pr-pipeline.d.ts +16 -12
  77. package/dist/components/pr-pipeline.d.ts.map +1 -1
  78. package/dist/components/pr-pipeline.js +3 -11
  79. package/dist/components/product-pipeline.d.ts +42 -1
  80. package/dist/components/product-pipeline.d.ts.map +1 -1
  81. package/dist/components/product-pipeline.js +64 -12
  82. package/dist/components/product-plan.d.ts +190 -5
  83. package/dist/components/product-plan.d.ts.map +1 -1
  84. package/dist/components/product-plan.js +220 -39
  85. package/dist/drift-record.d.ts +7 -0
  86. package/dist/drift-record.d.ts.map +1 -1
  87. package/dist/drift-record.js +19 -0
  88. package/dist/floor-table.data.d.ts.map +1 -1
  89. package/dist/floor-table.data.js +54 -31
  90. package/dist/forge-check/contract.d.ts +11 -1
  91. package/dist/forge-check/contract.d.ts.map +1 -1
  92. package/dist/forge-check/contract.js +4 -1
  93. package/dist/forge-check/index.d.ts +2 -0
  94. package/dist/forge-check/index.d.ts.map +1 -1
  95. package/dist/forge-check/index.js +2 -0
  96. package/dist/gate-resume-run.d.ts +9 -1
  97. package/dist/gate-resume-run.d.ts.map +1 -1
  98. package/dist/gate-resume-run.js +26 -3
  99. package/dist/generated-check.d.ts +18 -4
  100. package/dist/generated-check.d.ts.map +1 -1
  101. package/dist/generated-check.js +37 -5
  102. package/dist/image-pins.d.ts +26 -0
  103. package/dist/image-pins.d.ts.map +1 -0
  104. package/dist/image-pins.js +19 -0
  105. package/dist/lexicon.d.ts +11 -0
  106. package/dist/lexicon.d.ts.map +1 -1
  107. package/dist/lifecycle/git.d.ts +11 -0
  108. package/dist/lifecycle/git.d.ts.map +1 -1
  109. package/dist/lifecycle/git.js +30 -3
  110. package/dist/lifecycle/publish-npm.d.ts +11 -0
  111. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  112. package/dist/lifecycle/publish-npm.js +27 -1
  113. package/dist/lifecycle/reach-locks.d.ts +131 -0
  114. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  115. package/dist/lifecycle/reach-locks.js +118 -0
  116. package/dist/lifecycle/release-cut.d.ts +3 -1
  117. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  118. package/dist/lifecycle/release-cut.js +15 -0
  119. package/dist/lifecycle/release-images.d.ts.map +1 -1
  120. package/dist/lifecycle/release-images.js +1 -2
  121. package/dist/notify-product.d.ts +12 -3
  122. package/dist/notify-product.d.ts.map +1 -1
  123. package/dist/notify-product.js +10 -6
  124. package/dist/op/activities/source-release.d.ts.map +1 -1
  125. package/dist/op/activities/source-release.js +2 -1
  126. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  127. package/dist/op/activities/source-rollback.js +2 -1
  128. package/dist/op/index.d.ts +2 -0
  129. package/dist/op/index.d.ts.map +1 -1
  130. package/dist/op/index.js +1 -0
  131. package/dist/op/op-waves-evidence-jobs.d.ts +6 -1
  132. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  133. package/dist/op/op-waves-evidence-jobs.js +9 -3
  134. package/dist/op/op-waves-render-spec.d.ts +100 -0
  135. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  136. package/dist/op/op-waves-render-spec.js +162 -0
  137. package/dist/op/op-waves-run.d.ts +2 -0
  138. package/dist/op/op-waves-run.d.ts.map +1 -1
  139. package/dist/op/op-waves-run.js +2 -1
  140. package/dist/op/op-waves.d.ts +4 -0
  141. package/dist/op/op-waves.d.ts.map +1 -1
  142. package/dist/op/op-waves.js +4 -1
  143. package/dist/op/schedule-overdue.d.ts.map +1 -1
  144. package/dist/op/schedule-overdue.js +59 -3
  145. package/dist/op/wave-stop.d.ts +64 -0
  146. package/dist/op/wave-stop.d.ts.map +1 -0
  147. package/dist/op/wave-stop.js +127 -0
  148. package/dist/planned-files.d.ts +76 -0
  149. package/dist/planned-files.d.ts.map +1 -0
  150. package/dist/planned-files.js +108 -0
  151. package/dist/pr-forge-job.d.ts +22 -0
  152. package/dist/pr-forge-job.d.ts.map +1 -0
  153. package/dist/pr-forge-job.js +46 -0
  154. package/dist/pr-loop.d.ts +3 -6
  155. package/dist/pr-loop.d.ts.map +1 -1
  156. package/dist/pr-loop.js +4 -81
  157. package/dist/pr-plan-note.d.ts +97 -0
  158. package/dist/pr-plan-note.d.ts.map +1 -1
  159. package/dist/pr-plan-note.js +94 -1
  160. package/dist/pr-post.d.ts +28 -3
  161. package/dist/pr-post.d.ts.map +1 -1
  162. package/dist/pr-post.js +145 -13
  163. package/dist/pr-status.d.ts +16 -0
  164. package/dist/pr-status.d.ts.map +1 -0
  165. package/dist/pr-status.js +90 -0
  166. package/dist/ref-gate-init.d.ts +16 -2
  167. package/dist/ref-gate-init.d.ts.map +1 -1
  168. package/dist/ref-gate-init.js +24 -13
  169. package/dist/release-floors.d.ts +37 -1
  170. package/dist/release-floors.d.ts.map +1 -1
  171. package/dist/release-floors.js +61 -25
  172. package/dist/render-module.d.ts +15 -0
  173. package/dist/render-module.d.ts.map +1 -0
  174. package/dist/render-module.js +73 -0
  175. package/dist/state-migration.d.ts.map +1 -1
  176. package/dist/state-migration.js +1 -2
  177. package/dist/wave-runtime.mjs +304 -301
  178. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  179. package/dist/workspace/ci-green-cli.js +3 -2
  180. package/dist/workspace/release-train.d.ts.map +1 -1
  181. package/dist/workspace/release-train.js +2 -1
  182. package/dist/workspace/release-workflow.d.ts +4 -3
  183. package/dist/workspace/release-workflow.d.ts.map +1 -1
  184. package/dist/workspace/release-workflow.js +10 -7
  185. package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
  186. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  187. package/dist/workspace/trust/check-evidence-report.js +15 -8
  188. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  189. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  190. package/dist/workspace/trust/ref-gate-cli.js +30 -10
  191. package/dist/workspace/workspace-run.d.ts.map +1 -1
  192. package/dist/workspace/workspace-run.js +2 -1
  193. package/package.json +1 -1
  194. package/src/actor.test.ts +68 -2
  195. package/src/actor.ts +61 -1
  196. package/src/chant-install.test.ts +2 -3
  197. package/src/chant-install.ts +1 -2
  198. package/src/ci-base.test.ts +41 -0
  199. package/src/ci-base.ts +43 -0
  200. package/src/ci-comment-commands.test.ts +376 -0
  201. package/src/ci-comment-commands.ts +389 -0
  202. package/src/ci-comment-replies.ts +78 -0
  203. package/src/ci-commit.test.ts +2 -3
  204. package/src/ci-evidence-from-job.test.ts +18 -0
  205. package/src/ci-evidence-from-job.ts +58 -2
  206. package/src/ci-evidence-jobs.ts +50 -5
  207. package/src/ci-image.test.ts +130 -9
  208. package/src/ci-image.ts +85 -12
  209. package/src/ci-note-commands.ts +104 -41
  210. package/src/ci-product-words.ts +59 -0
  211. package/src/ci-product.ts +40 -4
  212. package/src/cli/commands/build.test.ts +41 -0
  213. package/src/cli/commands/build.ts +27 -2
  214. package/src/cli/handlers/approve.ts +2 -1
  215. package/src/cli/handlers/ci-check.ts +19 -7
  216. package/src/cli/handlers/ci-evidence.ts +29 -8
  217. package/src/cli/handlers/components.ts +3 -1
  218. package/src/cli/handlers/generated-check.ts +31 -1
  219. package/src/cli/handlers/lock-reach.test.ts +103 -0
  220. package/src/cli/handlers/lock.ts +100 -4
  221. package/src/cli/handlers/pr-comment.ts +104 -0
  222. package/src/cli/handlers/pr-env.ts +6 -3
  223. package/src/cli/handlers/pr-record.test.ts +1 -1
  224. package/src/cli/handlers/pr.ts +50 -10
  225. package/src/cli/handlers/promote.ts +2 -1
  226. package/src/cli/handlers/release.e2e.test.ts +35 -0
  227. package/src/cli/handlers/release.ts +14 -2
  228. package/src/cli/handlers/run-wave.ts +28 -2
  229. package/src/cli/handlers/run.ts +2 -1
  230. package/src/cli/main.ts +24 -2
  231. package/src/cli/parse-args.ts +12 -0
  232. package/src/cli/registry.ts +11 -0
  233. package/src/components/auto-release.ts +2 -1
  234. package/src/components/pr-checks.ts +112 -17
  235. package/src/components/pr-pipeline.ts +17 -15
  236. package/src/components/product-pipeline.ts +93 -11
  237. package/src/components/product-plan.test.ts +40 -2
  238. package/src/components/product-plan.ts +331 -45
  239. package/src/drift-record.test.ts +20 -0
  240. package/src/drift-record.ts +16 -0
  241. package/src/floor-table.data.ts +54 -31
  242. package/src/forge-check/contract.ts +12 -1
  243. package/src/forge-check/forge-check.test.ts +17 -0
  244. package/src/forge-check/index.ts +2 -0
  245. package/src/gate-resume-run.ts +27 -3
  246. package/src/generated-check.e2e.test.ts +21 -1
  247. package/src/generated-check.test.ts +66 -0
  248. package/src/generated-check.ts +51 -10
  249. package/src/image-pins.ts +31 -0
  250. package/src/lexicon.ts +11 -0
  251. package/src/lifecycle/git.test.ts +48 -0
  252. package/src/lifecycle/git.ts +27 -4
  253. package/src/lifecycle/publish-npm.ts +31 -1
  254. package/src/lifecycle/reach-locks.test.ts +87 -0
  255. package/src/lifecycle/reach-locks.ts +169 -0
  256. package/src/lifecycle/release-cut.ts +17 -1
  257. package/src/lifecycle/release-images.test.ts +56 -0
  258. package/src/lifecycle/release-images.ts +1 -2
  259. package/src/notify-product.ts +19 -8
  260. package/src/op/activities/source-release.ts +2 -1
  261. package/src/op/activities/source-rollback.ts +2 -1
  262. package/src/op/gate-resume.test.ts +27 -0
  263. package/src/op/index.ts +10 -0
  264. package/src/op/op-waves-evidence-jobs.ts +10 -4
  265. package/src/op/op-waves-notify-words.test.ts +18 -0
  266. package/src/op/op-waves-render-spec.test.ts +160 -0
  267. package/src/op/op-waves-render-spec.ts +171 -0
  268. package/src/op/op-waves-run.ts +2 -1
  269. package/src/op/op-waves.ts +5 -2
  270. package/src/op/schedule-overdue.test.ts +43 -0
  271. package/src/op/schedule-overdue.ts +57 -3
  272. package/src/op/wave-stop.test.ts +72 -0
  273. package/src/op/wave-stop.ts +137 -0
  274. package/src/planned-files.test.ts +80 -0
  275. package/src/planned-files.ts +134 -0
  276. package/src/pr-forge-job.test.ts +53 -0
  277. package/src/pr-forge-job.ts +46 -0
  278. package/src/pr-loop-narrowed.test.ts +2 -1
  279. package/src/pr-loop-words.test.ts +2 -1
  280. package/src/pr-loop.test.ts +1 -2
  281. package/src/pr-loop.ts +4 -80
  282. package/src/pr-plan-note.ts +155 -3
  283. package/src/pr-post-replan.test.ts +144 -0
  284. package/src/pr-post-subject.test.ts +230 -0
  285. package/src/pr-post.test.ts +2 -1
  286. package/src/pr-post.ts +150 -15
  287. package/src/pr-status.ts +91 -0
  288. package/src/ref-gate-init.ts +30 -11
  289. package/src/release-floors.ts +78 -25
  290. package/src/render-module.ts +73 -0
  291. package/src/state-migration-record.test.ts +2 -3
  292. package/src/state-migration.ts +1 -2
  293. package/src/workspace/ci-green-cli.ts +3 -2
  294. package/src/workspace/ci-green-workflow.test.ts +32 -1
  295. package/src/workspace/release-train.ts +2 -1
  296. package/src/workspace/release-workflow.test.ts +36 -5
  297. package/src/workspace/release-workflow.ts +10 -7
  298. package/src/workspace/trust/check-evidence-report.ts +15 -8
  299. package/src/workspace/trust/check-evidence.test.ts +5 -0
  300. package/src/workspace/trust/ref-gate-cli.ts +30 -8
  301. package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
  302. package/src/workspace/trust/ref-gate.test.ts +10 -0
  303. package/src/workspace/workspace-run.ts +2 -1
@@ -105,9 +105,7 @@ import {
105
105
  prApproveCommands,
106
106
  prNoteMarker,
107
107
  prOp,
108
- prStatusDescription,
109
108
  prStatusContext,
110
- prStatusState,
111
109
  renderPrNote,
112
110
  type PrApproval,
113
111
  type PrBeforeMerge,
@@ -119,7 +117,10 @@ import {
119
117
  type PrRound,
120
118
  type PrOverdue,
121
119
  } from "../../pr-loop";
120
+ import { prStatusDescription, prStatusState } from "../../pr-status";
122
121
  import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf, type ForgeKind, type PrForge } from "../../pr-forge";
122
+ // #4964: a status for a pull_request run's merge preview goes on the pull request's head.
123
+ import { forgeFromJobEnv } from "../../pr-forge-job";
123
124
  import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary";
124
125
  import { upsertPlanNote } from "../../pr-post";
125
126
  import { activeProductWords, commandWord, parseProductComment, productContext } from "../../ci-product-words";
@@ -146,6 +147,7 @@ import type { OpWaveHookMoment } from "../../op/op-waves";
146
147
  import type { PrHookOutcome } from "../../pr-loop";
147
148
  import type { PrMigrationFile } from "../../pr-migrations";
148
149
  import { lexiconNames } from "../../lexicon-module";
150
+ import { actorFromEnv } from "../../actor";
149
151
 
150
152
 
151
153
  /** Where the reports land unless `--output` says. */
@@ -247,7 +249,7 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
247
249
  let forge: PrForge | undefined;
248
250
  if (args.forge && !(stage === "plan" && args.noStatus)) {
249
251
  try {
250
- forge = forgeFromEnv(args.forge as ForgeKind);
252
+ forge = forgeFromJobEnv(args.forge as ForgeKind);
251
253
  } catch (err) {
252
254
  return fail(err instanceof Error ? err.message : String(err));
253
255
  }
@@ -1404,7 +1406,7 @@ async function mergeAfterUpdate(ctx: CommandContext, p: Prepared, pr: number): P
1404
1406
  }
1405
1407
  let forge: PrForge;
1406
1408
  try {
1407
- forge = forgeFromEnv(kind, env);
1409
+ forge = forgeFromJobEnv(kind, env);
1408
1410
  } catch (err) {
1409
1411
  console.error(formatWarning({ message: `the pull request was not merged: ${err instanceof Error ? err.message : String(err)}` }));
1410
1412
  return CHANT_EXIT.waiting;
@@ -1481,7 +1483,7 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1481
1483
  let head: string;
1482
1484
  let base: string;
1483
1485
  try {
1484
- forge = forgeFromEnv(args.forge as ForgeKind);
1486
+ forge = forgeFromJobEnv(args.forge as ForgeKind);
1485
1487
  head = await resolveCommit(cwd, args.head ?? "HEAD");
1486
1488
  base = await resolveMergeBase(cwd, args.base, head);
1487
1489
  } catch (err) {
@@ -1507,8 +1509,12 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1507
1509
  // plywood#66: the forge also reports the pull-request pipeline's plan job, `chant-pr.<member>.<env> / plan (<event>)`, which a denial fails too.
1508
1510
  const planJob = [`chant-pr.${member ?? "*"}.${ctx.args.env ?? "*"} / plan*`];
1509
1511
  const ignore = [...new Set([productContext(activeProductWords(), gate), productContext(activeProductWords(), PR_APPLY_GATE), `chant/${gate}`, `chant/${PR_APPLY_GATE}`, prStatusContext("apply", member), prStatusContext("plan"), `${prStatusContext("plan")}/`, ...planJob])];
1512
+ // #4966: the `checks` require waits for the ref gate's status too, when the policy at base has a rule for the target branch.
1513
+ const refGate = await beforeMergeRefGate(cwd, args.base, args.branch);
1514
+ if ("problem" in refGate) return fail(refGate.problem);
1515
+ if (refGate.note) console.error(formatInfo(refGate.note));
1510
1516
  // ws-106 gives the declaration no way to leave a check out, so with no --requires all four are asked (#4336, #4607).
1511
- const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}) });
1517
+ const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}), ...(refGate.require.length > 0 ? { require: refGate.require } : {}) });
1512
1518
  for (const r of requires) console.error(formatInfo(`${r.name}: ${r.passed ? "passed" : r.pending ? "pending" : "unmet"}, ${r.reason}`));
1513
1519
  const unmet = unmetRequires(requires);
1514
1520
  if (unmet) {
@@ -1517,6 +1523,38 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1517
1523
  return { requires };
1518
1524
  }
1519
1525
 
1526
+ /**
1527
+ * The branch an apply before merge lands on (#4966): `--branch`, else the
1528
+ * pull request's target as its job names it, else the branch the job runs
1529
+ * on, which for the generated apply job is the target branch (an
1530
+ * `issue_comment` run on GitHub and Forgejo, a target-branch pipeline on
1531
+ * GitLab).
1532
+ */
1533
+ export function beforeMergeBranch(explicit: string | undefined, env: Record<string, string | undefined> = process.env): string | undefined {
1534
+ for (const v of [explicit, env.GITHUB_BASE_REF, env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME, env.CI_COMMIT_BRANCH, env.GITHUB_REF_NAME]) {
1535
+ if (v && v.trim()) return v.trim();
1536
+ }
1537
+ return undefined;
1538
+ }
1539
+
1540
+ /**
1541
+ * The statuses an apply before merge waits for beside the forge's own
1542
+ * (#4966): the ref gate's status for the target branch, as the policy at
1543
+ * `base` sets it (`refGateRulesAt`), passed as `require` to the `checks`
1544
+ * require, so `checks` does not pass before the `ref-gate` job posted it.
1545
+ * No rule for the branch requires nothing; a policy that can't be read is
1546
+ * a problem, and the apply stops.
1547
+ */
1548
+ export async function beforeMergeRefGate(cwd: string, base: string, branch: string | undefined, env: Record<string, string | undefined> = process.env): Promise<{ require: string[]; note?: string } | { problem: string }> {
1549
+ const target = beforeMergeBranch(branch, env);
1550
+ if (!target) return { require: [], note: "the job names no target branch (--branch), so the ref gate's status is not waited for" };
1551
+ const { refGateRulesAt } = await import("../../ref-gate-rules");
1552
+ const rules = refGateRulesAt(cwd, { ref: `refs/heads/${target}`, base });
1553
+ if (rules.problems.length > 0) return { problem: `the trust policy at base can't be read, so the apply before merge can't tell which ref gate status to wait for: ${rules.problems.join("; ")}. Nothing was applied.` };
1554
+ if (!rules.matched || !rules.status) return { require: [] };
1555
+ return { require: [rules.status], note: `the checks require waits for ${rules.status}, the ref gate's status for refs/heads/${target}` };
1556
+ }
1557
+
1520
1558
  /** The refusal report of an apply before merge stopped before it planned (#4301): nothing selected, nothing planned. */
1521
1559
  function earlyStop(ctx: CommandContext, forge: PrForge, at: { pr: number; base: string; head: string; gate: string; member?: string }) {
1522
1560
  return async (beforeMerge: PrBeforeMerge, refusal: "requires-unmet" | "before-merge-off", message: string, code: number): Promise<number> => {
@@ -1538,7 +1576,7 @@ function earlyStop(ctx: CommandContext, forge: PrForge, at: { pr: number; base:
1538
1576
  async function takeApplyLocks(p: Prepared, pr: number, targets: readonly string[] = p.plan.order): Promise<string | null | number> {
1539
1577
  const { takeTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock");
1540
1578
  const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
1541
- const by = process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER ?? "unknown";
1579
+ const by = actorFromEnv();
1542
1580
  let result;
1543
1581
  try {
1544
1582
  result = await takeTargetLocks(p.gate, targets, { pr, by, at: new Date().toISOString(), stage: "apply", head: p.head }, { ...(isOpen ? { isOpen } : {}) });
@@ -2778,7 +2816,7 @@ function writeWaveChangeSet(ctx: CommandContext, wave: number, doc: PrPlanSet["d
2778
2816
  }
2779
2817
 
2780
2818
  /**
2781
- * chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] (#4295)
2819
+ * chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] [--not-affected <argument>] (#4295, #4963)
2782
2820
  * chant components pr-post --open --env <env> --forge gitlab [--branch <branch>] [--member <name>] [--output <dir>] (#4328)
2783
2821
  *
2784
2822
  * Post the plan note and the `chant/plan` status from the report a plan job
@@ -2799,7 +2837,7 @@ export async function runComponentsPrPost(ctx: CommandContext): Promise<number>
2799
2837
  if (args.members && args.members.length > 1) return fail(`pr-post takes one --member, not ${args.members.join(", ")}`);
2800
2838
  let forge: PrForge;
2801
2839
  try {
2802
- forge = forgeFromEnv(args.forge as ForgeKind);
2840
+ forge = forgeFromJobEnv(args.forge as ForgeKind);
2803
2841
  } catch (err) {
2804
2842
  return fail(err instanceof Error ? err.message : String(err));
2805
2843
  }
@@ -2823,6 +2861,8 @@ export async function runComponentsPrPost(ctx: CommandContext): Promise<number>
2823
2861
  ...(args.forge !== "gitlab" && process.env.GITHUB_STEP_SUMMARY ? { summaryFile: process.env.GITHUB_STEP_SUMMARY } : {}),
2824
2862
  // #4899: the product plan job's run record, kept on chant/lifecycle with the note.
2825
2863
  ...(args.recordRun ? { recordRun: await planRunRecorder(args.forge as ForgeKind, args.recordRun) } : {}),
2864
+ // #4963: a re-plan narrowed to an argument the change does not reach gets a reply in place of the note.
2865
+ ...(args.notAffected ? { notAffected: args.notAffected } : {}),
2826
2866
  });
2827
2867
  for (const message of posted.warnings) console.error(formatWarning({ message }));
2828
2868
  if (posted.refused) console.error(formatWarning({ message: `the plan report was not used: ${posted.refused}` }));
@@ -2908,7 +2948,7 @@ async function runComponentsPrPostStale(ctx: CommandContext): Promise<number> {
2908
2948
  if (!branch) return fail("pr-post --stale marks the notes of the pull requests into a branch: run it in a job of a push, or pass --branch <branch>");
2909
2949
  let forge: PrForge;
2910
2950
  try {
2911
- forge = forgeFromEnv(args.forge as ForgeKind);
2951
+ forge = forgeFromJobEnv(args.forge as ForgeKind);
2912
2952
  } catch (err) {
2913
2953
  return fail(err instanceof Error ? err.message : String(err));
2914
2954
  }
@@ -72,6 +72,7 @@ import { GATED_EXIT_CODE } from "./run";
72
72
  import type { CommandContext } from "../registry";
73
73
  import { withComponentEndpoint } from "../component-endpoint";
74
74
  import { redeployLine, releaseRollbackLine, rollbackTarget, unsettledComponents } from "../../lifecycle/mixed-environment";
75
+ import { actorFromEnv } from "../../actor";
75
76
 
76
77
  const PROMOTE_USAGE =
77
78
  "chant components promote --to <env> [--from <env>] [--allow-skip] [--release <label|digest>] [--component <name> [--digest <sha256:...>] | --digest <component>=<sha256:...> ...] [--wave-gate <gate>] [--resume <file>] [--dry-run] [--json]";
@@ -117,7 +118,7 @@ function planJson(plan: PromotionPlan, removed: Map<string, string[]>) {
117
118
  }
118
119
 
119
120
  function resolveActor(ctx: CommandContext): string | undefined {
120
- return ctx.args.actor ?? process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER;
121
+ return ctx.args.actor ?? (actorFromEnv(process.env, "") || undefined);
121
122
  }
122
123
 
123
124
  /**
@@ -187,4 +187,39 @@ describe("chant release cut, publish and list", () => {
187
187
  },
188
188
  240_000,
189
189
  );
190
+
191
+ // #4965: plywood's 0.3.9 cut warned that the chant/lifecycle push was refused, tagged, and the publish found no release.
192
+ test(
193
+ "a chant/lifecycle push the remote refuses once is pushed again; one it always refuses stops the cut, untagged and non-zero",
194
+ () => {
195
+ const root = mkdtempSync(join(tmpdir(), "chant-release-cut-refused-"));
196
+ try {
197
+ const { dir, sha, remote } = project(root);
198
+ git(dir, "tag", `ci/green/${sha}`);
199
+ const hook = join(remote, "hooks", "update");
200
+ const cut = (label: string) => chant(dir, ["release", "cut", label, "--build", BUILD, "--yes", "--json"]);
201
+
202
+ // Always refused: no tag, exit 1, and the record stays in this checkout only.
203
+ writeFileSync(hook, `#!/bin/sh\necho 'fatal error in commit_refs_rules' >&2\nexit 1\n`, { mode: 0o755 });
204
+ const refused = cut("v1");
205
+ expect(refused.code, refused.stderr).toBe(1);
206
+ expect(refused.stderr).toContain("[release-record-not-pushed]");
207
+ expect(refused.stderr).toContain("chant/lifecycle was not pushed to \"origin\" after 3 tries: the remote refused each try");
208
+ expect(refused.stdout).toBe("");
209
+ expect(hasRef(dir, "refs/tags/release/v1")).toBe(false);
210
+ expect(hasRef(remote, "refs/heads/chant/lifecycle")).toBe(false);
211
+
212
+ // Refused once: the second push lands, and the cut tags as it always has.
213
+ writeFileSync(hook, `#!/bin/sh\nif [ ! -f '${remote}/refused' ]; then touch '${remote}/refused'; echo 'fatal error in commit_refs_rules' >&2; exit 1; fi\nexit 0\n`, { mode: 0o755 });
214
+ const landed = cut("v1");
215
+ expect(landed.code, landed.stderr).toBe(0);
216
+ expect(JSON.parse(landed.stdout)).toMatchObject({ label: "v1", tag: { name: "release/v1" } });
217
+ expect(git(dir, "rev-parse", "release/v1^{commit}")).toBe(sha);
218
+ expect(git(remote, "rev-parse", "refs/heads/chant/lifecycle")).toBe(git(dir, "rev-parse", "refs/heads/chant/lifecycle"));
219
+ } finally {
220
+ rmSync(root, { recursive: true, force: true });
221
+ }
222
+ },
223
+ 240_000,
224
+ );
190
225
  });
@@ -286,7 +286,7 @@ export async function runReleaseCut(ctx: CommandContext): Promise<number> {
286
286
  const { spawnTargetCompiler, ReleaseCompileError } = await import("../../components/release-compile");
287
287
  const { cutRelease, planRelease, ReleaseCutError } = await import("../../lifecycle/release-cut");
288
288
  const { ReleaseLabelError } = await import("../../lifecycle/release-store");
289
- const { pushLifecycleReport, getHeadCommit } = await import("../../lifecycle/git");
289
+ const { pushLifecycleRebasing, getHeadCommit } = await import("../../lifecycle/git");
290
290
  const { resolveCiRun } = await import("../../lifecycle/release-ledger");
291
291
  const ws = await import("../../lifecycle/release-workstation");
292
292
  const { detectProvenance, releasePublishTargets } = await import("../../lifecycle/release-publish");
@@ -526,7 +526,19 @@ export async function runReleaseCut(ctx: CommandContext): Promise<number> {
526
526
  // release records are put where release.images names them here, so the job's next step (the hand-off to the
527
527
  // publish job) finds them.
528
528
  if (checkout && declaredImages.length > 0) copyImageArchives((await import("../../lifecycle/release-images")).resolveReleaseImages(declaredImages), cutCwd, cwd);
529
- const push = await pushLifecycleReport({ cwd }).catch(() => ({ pushed: false, pushWarning: undefined }));
529
+ // #4965: the record must be on the remote before the release is tagged. The release workflow pushes the tag
530
+ // right after the cut, and a tag whose record never landed spends the label: the publish job finds no release.
531
+ // A refused push is tried again; one that never lands stops the cut here, untagged and non-zero.
532
+ let push: { pushed: boolean; pushWarning?: string };
533
+ try {
534
+ push = await pushLifecycleRebasing({ cwd, requireLanded: true });
535
+ } catch (err) {
536
+ return fail(
537
+ "release-record-not-pushed",
538
+ `the release was cut and its record did not reach the remote, so the commit was not tagged: ${err instanceof Error ? err.message : String(err)}`,
539
+ "Nothing was tagged, so the label is not spent. Run the cut again (in CI, run the release workflow again) once the remote takes pushes to chant/lifecycle.",
540
+ );
541
+ }
530
542
  // The tag names the release's label, which a re-cut with no label reads from the earlier cut.
531
543
  let tagged: { name: string; created: boolean } | null = null;
532
544
  let tagWarning: string | undefined;
@@ -6,12 +6,15 @@
6
6
  import { readFileSync } from "node:fs";
7
7
  import { relative, resolve } from "node:path";
8
8
  import { notifyOpWave } from "../../op/op-waves-notify";
9
- import { parseOpWavesSpec, recordOpWaveHeadPlans, runOpWave } from "../../op/op-waves-run";
9
+ import { gitShowAtBase, parseOpWavesSpec, recordOpWaveHeadPlans, runOpWave } from "../../op/op-waves-run";
10
10
  import { activeProductWaveHook } from "../../op/op-waves-after-plan";
11
11
  import type { OpWavesSpec } from "../../op/op-waves";
12
+ import type { OpWaveShowAtBase } from "../../op/op-waves-run";
12
13
  import { formatError, formatWarning } from "../format";
13
14
  import { ledgerRecordingOff, NO_RECORD_ENV, noRecordEndNote, noRecordStartNote, resetNoRecordLedger } from "../../lifecycle/no-record";
14
15
  import type { CommandContext } from "../registry";
16
+ import { waveStopLine } from "../../op/wave-stop";
17
+ import { CHANT_EXIT } from "../../exit-codes";
15
18
 
16
19
  /**
17
20
  * `chant run wave`, with recording off under `--no-record` or
@@ -100,7 +103,29 @@ async function runOpWaveJobCommand(ctx: CommandContext): Promise<number> {
100
103
  }
101
104
  try {
102
105
  const path = resolve(specFile);
103
- spec = parseOpWavesSpec(readFileSync(path, "utf-8"), `--spec ${specFile}`);
106
+ // #4982: --render-spec has the product's command print the spec at base, and reads the rules from it there too.
107
+ let show: OpWaveShowAtBase | undefined;
108
+ if (args.renderSpec) {
109
+ const at = await import("../../op/op-waves-render-spec");
110
+ const file = relative(process.cwd(), path);
111
+ show = at.renderedSpecShow(file, at.commandSpecRender(at.opWavesSpecCommandFromEnv(), file, process.cwd()), gitShowAtBase);
112
+ spec = at.renderOpWavesSpecFile({ specFile: file, base: args.base ?? "HEAD^1", cwd: process.cwd(), show, parse: parseOpWavesSpec }).spec;
113
+ const missing = at.renderedJobMissing(spec, args.wave, job);
114
+ if (missing) {
115
+ console.error(`${missing}, so this job has nothing to apply`);
116
+ return 0;
117
+ }
118
+ } else {
119
+ spec = parseOpWavesSpec(readFileSync(path, "utf-8"), `--spec ${specFile}`);
120
+ }
121
+ // #4979: a comment that ran the apply again through wave n leaves the waves after it waiting, as a gate does.
122
+ if (!args.policyOnly) {
123
+ const stopped = await waveStopLine(spec.name, args.wave);
124
+ if (stopped) {
125
+ console.error(stopped);
126
+ return CHANT_EXIT.waiting;
127
+ }
128
+ }
104
129
  // #4555: --events-json streams the job's run events, a phase per wave and a step per run target.
105
130
  const stream = args.eventsJson
106
131
  ? await (await import("../run-events")).openCliRunEvents(args, { kind: "op", name: spec.name, cwd: process.cwd() })
@@ -121,6 +146,7 @@ async function runOpWaveJobCommand(ctx: CommandContext): Promise<number> {
121
146
  ...(args.share !== undefined ? { share: args.share } : {}),
122
147
  ...(args.group !== undefined ? { group: args.group } : {}),
123
148
  ...(args.base ? { base: args.base } : {}),
149
+ ...(show ? { show } : {}),
124
150
  });
125
151
  if (args.json) console.log(JSON.stringify(result, null, 2));
126
152
  // #4926: the policy step applied nothing; the wave's own step tells people how it went.
@@ -40,6 +40,7 @@ import { adoptionReview, loadDeployAdoption, type DeployAdoption } from "../../c
40
40
  import { isApplyRecord, resolveCiRun, type ReleaseRecord, type RunOrigin } from "../../lifecycle/release-ledger";
41
41
  import { gateAdmission, gateApprover } from "../../components/promote";
42
42
  import { runOpGenerate } from "./run-generate";
43
+ import { actorFromEnv } from "../../actor";
43
44
 
44
45
  /**
45
46
  * The exit code a run that stopped at an unapproved gate uses (#2119).
@@ -1132,7 +1133,7 @@ export async function recordSkips(
1132
1133
  ): Promise<ReleaseRecord[]> {
1133
1134
  const fresh = [...skipped.values()].filter((v) => !v.recorded);
1134
1135
  if (fresh.length === 0) return [];
1135
- const actor = process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER;
1136
+ const actor = actorFromEnv(process.env, "");
1136
1137
  if (!actor) {
1137
1138
  console.error(formatWarning({ message: `the skips of ${fresh.map((v) => v.since.component).join(", ")} were not recorded: no actor (GITHUB_ACTOR, GITLAB_USER_LOGIN or USER)` }));
1138
1139
  return [];
package/src/cli/main.ts CHANGED
@@ -267,14 +267,17 @@ 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>] [--summary <file>] [--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
275
  --output (default .chant/check), and with --summary
276
276
  appends the report's markdown section to the file;
277
- exits 1 when one failed.
277
+ exits 1 when one failed. With no --base, a pull
278
+ request's target branch, else origin/<default> for a
279
+ push to another branch (--branch names the default
280
+ branch where the job does not).
278
281
  ci evidence sign --check-id <id>[,<id>...] [--at <rev>] [--base <rev>] [--no-push]
279
282
  Sign that each named check passed at --at, with the
280
283
  runner key in CHANT_RUNNER_KEY or --key, and keep it on
@@ -612,6 +615,10 @@ Ops:
612
615
  hold, applying nothing, and exits 0 only when the
613
616
  policy ran and denied nothing: the wave job's
614
617
  policy step, whose result its evidence job reads (#4926).
618
+ --render-spec runs the command CHANT_WAVES_SPEC_COMMAND
619
+ names (a JSON argv) with CHANT_WAVES_SPEC_AT set to
620
+ the base, writes the spec it prints over --spec, and
621
+ reads the rules at base from it (#4982).
615
622
  --record-plans (no --wave), in a pull request's
616
623
  pipeline: plan every wave at its head and record the
617
624
  digests a pr-review approval mode compares.
@@ -776,6 +783,8 @@ Ops:
776
783
  (--pr <n>, --stage plan|apply|lock, --head <sha>,
777
784
  --by <who>, --gate <name>, --json). --from-report
778
785
  <pr-plan.json> locks the components a plan selected.
786
+ --reach locks what the line in CHANT_LOCK_REACH prints
787
+ for --base..--head (--open: every open merge request).
779
788
  --forge <kind> reads which holders are still open and
780
789
  posts chant/lock on --head. Exits 3 when another open
781
790
  pull request holds a target. --list prints the locks
@@ -1350,6 +1359,12 @@ Component release ledger + status:
1350
1359
  [--preview-comment] [--apply-before-merge]
1351
1360
  [--apply-on-merge] [--locks]); each answered
1352
1361
  note is recorded on chant/lifecycle
1362
+ components pr-comment GitHub and Forgejo (#4946): answer a comment
1363
+ command no other job of the pipeline takes:
1364
+ a refusal, a command the pipeline runs no job
1365
+ for, or a merged pull request's apply run
1366
+ again (--forge github|forgejo [--branch <b>];
1367
+ the jobs from CHANT_COMMENT_JOBS)
1353
1368
  components pr-record On merge (#4168): plan the same members again,
1354
1369
  store the change set and write the merge record
1355
1370
  _merges/<commit>.json; applies and refuses
@@ -1499,6 +1514,9 @@ Lexicon development:
1499
1514
  Render the files package.json's chantGenerated declares into a
1500
1515
  directory under the OS temp dir, compare each with the committed
1501
1516
  file, and fail naming the ones that drifted
1517
+ dev render <module> <export> [--output <root>]
1518
+ Import the module and write the { path: text } files its export
1519
+ returns below the root (the working directory by default)
1502
1520
  dev dead-guards [<product-dir>]
1503
1521
  Fail naming each feature-detect on a chant floor (a floor read off
1504
1522
  a lazily loaded module, a subpath loaded behind a catch, the
@@ -2018,6 +2036,8 @@ export const commandRegistry: CommandDef[] = [
2018
2036
  { name: "dev bundle-check", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/local-chant")).runDevBundleCheck(ctx) },
2019
2037
  { name: "dev local-image", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/local-chant")).runDevLocalImage(ctx) },
2020
2038
  { name: "dev generated-check", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/generated-check")).runDevGeneratedCheck(ctx) },
2039
+ // #4950: a module's { path: text } export, written in place.
2040
+ { name: "dev render", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/generated-check")).runDevRender(ctx) },
2021
2041
  // #4792: the feature-detects on a chant floor the product's pin already meets.
2022
2042
  { name: "dev dead-guards", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/dead-guards")).runDevDeadGuards(ctx) },
2023
2043
 
@@ -2156,6 +2176,8 @@ export const commandRegistry: CommandDef[] = [
2156
2176
  { name: "components pr-post", handler: async (ctx) => (await import("./handlers/pr")).runComponentsPrPost(ctx) },
2157
2177
  // #4785: GitLab's comment commands, polled from the notes in a job that runs none of the change's code, so it loads no plugins.
2158
2178
  { name: "components pr-notes", handler: async (ctx) => (await import("./handlers/pr-notes")).runComponentsPrNotes(ctx) },
2179
+ // #4946: GitHub's and Forgejo's comment job, at the target branch's commit, so it loads no plugins.
2180
+ { name: "components pr-comment", handler: async (ctx) => (await import("./handlers/pr-comment")).runComponentsPrComment(ctx) },
2159
2181
  { name: "components pr-record", requiresPlugins: true, handler: async (ctx) => (await import("./handlers/pr")).runComponentsPrRecord(ctx) },
2160
2182
  // #4616: the agent jobs' three steps. Imported on first use; none loads plugins.
2161
2183
  { name: "agent prepare", handler: async (ctx) => (await import("./handlers/agent")).runAgentCommandLine(ctx) },
@@ -24,6 +24,7 @@ const BOOLEAN_FLAGS = new Set([
24
24
  "--check-job",
25
25
  "--ref-gate-status",
26
26
  "--locks",
27
+ "--reach",
27
28
  "--version",
28
29
  "--agents",
29
30
  "--agent",
@@ -106,6 +107,7 @@ const BOOLEAN_FLAGS = new Set([
106
107
  "--generated",
107
108
  "--decide",
108
109
  "--policy-only",
110
+ "--render-spec",
109
111
  "--record-plans",
110
112
  "--approval-status",
111
113
  "--waves-outcome",
@@ -429,6 +431,9 @@ export function parseArgs(args: string[]): ParsedArgs {
429
431
  } else if (arg === "--keep") {
430
432
  // `chant lock --keep --pr <n>` (#4588): keep the locks the pull request's plan took, as `/<product> lock` asks.
431
433
  result.keepLocks = true;
434
+ } else if (arg === "--reach") {
435
+ // `chant lock --reach --pr <n> --head <sha> --base <sha>` (#4979): lock what the reach line in CHANT_LOCK_REACH prints.
436
+ result.lockReach = true;
432
437
  } else if (arg === "--runs" || arg === "--plans" || arg === "--wave-outputs") {
433
438
  // `chant components plan-wave|apply-wave` (#4588): the op-waves runs and plans files, and the outputs the waves hand on.
434
439
  const value = args[++i];
@@ -490,6 +495,9 @@ export function parseArgs(args: string[]): ParsedArgs {
490
495
  } else if (arg === "--policy-only") {
491
496
  // `chant run wave --policy-only` (#4926): plan the wave and run its policy hold, as a step of its own.
492
497
  result.policyOnly = true;
498
+ } else if (arg === "--render-spec") {
499
+ // `chant run wave --render-spec` (#4982): the product's command prints the spec at base.
500
+ result.renderSpec = true;
493
501
  } else if (arg === "--record-plans") {
494
502
  result.recordPlans = true;
495
503
  } else if (arg === "--approval-status") {
@@ -964,6 +972,10 @@ export function parseArgs(args: string[]): ParsedArgs {
964
972
  // `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle.
965
973
  result.recordRun = args[++i];
966
974
  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 ?? ""}"`);
975
+ } else if (arg === "--not-affected") {
976
+ // `chant components pr-post --not-affected <argument>` (#4963): the re-plan's argument, which may be empty; pr-post checks it.
977
+ if (i + 1 >= args.length) throw new Error('--not-affected needs the re-plan\'s argument, empty for none: --not-affected "$CHANT_PLAN_ARGUMENT"');
978
+ result.notAffected = args[++i];
967
979
  } else if (arg === "--evidence-dir") {
968
980
  // `chant components pr-post --open --evidence-dir <dir>` (#4914): each merge request's evidence.json, from the GitLab signing job.
969
981
  result.evidenceDir = args[++i];
@@ -336,6 +336,8 @@ export interface ParsedArgs {
336
336
  decide?: boolean;
337
337
  /** `chant run wave --policy-only` (#4926) — plan the wave and run its policy hold, applying nothing: the wave job's policy step. */
338
338
  policyOnly?: boolean;
339
+ /** `chant run wave --render-spec` (#4982) — run the command `CHANT_WAVES_SPEC_COMMAND` names to print the spec at base, and run the wave on it. */
340
+ renderSpec?: boolean;
339
341
  /** `chant run wave --record-plans` (#3684) — plan every wave at a pull request's head and record the digests for a `pr-review` gate. */
340
342
  recordPlans?: boolean;
341
343
  /** `chant run wave --approval-status` (#4630) — post `<product>/approval` on an open pull request's head under `pr-review` or `pull-request`. */
@@ -607,6 +609,8 @@ export interface ParsedArgs {
607
609
  evidenceAudience?: string;
608
610
  /** `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle. */
609
611
  recordRun?: string;
612
+ /** `chant components pr-post --not-affected <argument>` (#4963): the argument a re-plan was narrowed to, which gets a "not affected" reply when the change reaches nothing. */
613
+ notAffected?: string;
610
614
  /** `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
615
  evidenceDir?: string;
612
616
  /** `chant ci evidence sign --open --no-forks` (#4914): sign for no merge request from a fork. */
@@ -914,6 +918,13 @@ export interface ParsedArgs {
914
918
  * until it closes or `chant unlock`. What `/<product> lock` runs.
915
919
  */
916
920
  keepLocks?: boolean;
921
+ /**
922
+ * `chant lock --reach` (#4979): lock the targets the reach line in
923
+ * `CHANT_LOCK_REACH` prints for the change from `--base` to `--head`,
924
+ * after fetching the pull request's head; with `--open`, every open merge
925
+ * request's (GitLab's plan notes pipeline).
926
+ */
927
+ lockReach?: boolean;
917
928
  /** `chant components plan-wave|apply-wave --runs <file>` (#4588): the runs file `chant run wave` writes, `{runs}`. */
918
929
  runsFile?: string;
919
930
  /** `chant components plan-wave|apply-wave --plans <file>` (#4588): the wave's plans file, `{plans}`. */
@@ -30,6 +30,7 @@ import { appendReleaseRecord, InvalidReleaseRecordError, type ReleaseAdmission,
30
30
  import { changeSetDigest } from "../change-set";
31
31
  import type { DriverComponent, DriverStepRecord } from "./driver";
32
32
  import { componentInputDigests } from "./fan-out-inputs";
33
+ import { actorFromEnv } from "../actor";
33
34
 
34
35
  /**
35
36
  * A step output that represents a *promoted* artifact — a publish-family result
@@ -165,7 +166,7 @@ export interface AutoReleaseOptions {
165
166
  }
166
167
 
167
168
  function resolveActor(override?: string): string | undefined {
168
- return override ?? process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER;
169
+ return override ?? (actorFromEnv(process.env, "") || undefined);
169
170
  }
170
171
 
171
172
  /**