@intentius/chant 0.124.55 → 0.124.57

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 (419) hide show
  1. package/dist/ci-agent.d.ts.map +1 -1
  2. package/dist/ci-agent.js +1 -2
  3. package/dist/ci-audit/attribution.d.ts +111 -0
  4. package/dist/ci-audit/attribution.d.ts.map +1 -0
  5. package/dist/ci-audit/attribution.js +194 -0
  6. package/dist/ci-audit/audit-log.d.ts +144 -0
  7. package/dist/ci-audit/audit-log.d.ts.map +1 -0
  8. package/dist/ci-audit/audit-log.js +149 -0
  9. package/dist/ci-audit/index.d.ts +12 -0
  10. package/dist/ci-audit/index.d.ts.map +1 -0
  11. package/dist/ci-audit/index.js +11 -0
  12. package/dist/ci-audit/unrecorded.d.ts +74 -0
  13. package/dist/ci-audit/unrecorded.d.ts.map +1 -0
  14. package/dist/ci-audit/unrecorded.js +95 -0
  15. package/dist/ci-audit.d.ts +3 -0
  16. package/dist/ci-audit.d.ts.map +1 -0
  17. package/dist/ci-audit.js +2 -0
  18. package/dist/ci-control.d.ts.map +1 -1
  19. package/dist/ci-control.js +3 -4
  20. package/dist/ci-estate.d.ts +24 -0
  21. package/dist/ci-estate.d.ts.map +1 -1
  22. package/dist/ci-estate.js +1 -2
  23. package/dist/ci-identity.d.ts.map +1 -1
  24. package/dist/ci-identity.js +2 -3
  25. package/dist/ci-job-guard.d.ts +139 -0
  26. package/dist/ci-job-guard.d.ts.map +1 -0
  27. package/dist/ci-job-guard.js +287 -0
  28. package/dist/ci-jobs.d.ts +7 -0
  29. package/dist/ci-jobs.d.ts.map +1 -1
  30. package/dist/ci-jobs.js +7 -0
  31. package/dist/ci-product-words.d.ts +7 -1
  32. package/dist/ci-product-words.d.ts.map +1 -1
  33. package/dist/ci-product-words.js +38 -4
  34. package/dist/ci-product.d.ts +35 -0
  35. package/dist/ci-product.d.ts.map +1 -1
  36. package/dist/ci-product.js +38 -4
  37. package/dist/ci-respond-run.d.ts +73 -0
  38. package/dist/ci-respond-run.d.ts.map +1 -0
  39. package/dist/ci-respond-run.js +247 -0
  40. package/dist/ci-respond.d.ts +189 -0
  41. package/dist/ci-respond.d.ts.map +1 -0
  42. package/dist/ci-respond.js +285 -0
  43. package/dist/cli/handlers/audit-log.d.ts +12 -0
  44. package/dist/cli/handlers/audit-log.d.ts.map +1 -0
  45. package/dist/cli/handlers/audit-log.js +81 -0
  46. package/dist/cli/handlers/build.d.ts +7 -0
  47. package/dist/cli/handlers/build.d.ts.map +1 -1
  48. package/dist/cli/handlers/build.js +81 -0
  49. package/dist/cli/handlers/ci-check-job.d.ts +11 -0
  50. package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
  51. package/dist/cli/handlers/ci-check-job.js +27 -0
  52. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  53. package/dist/cli/handlers/ci-check.js +38 -9
  54. package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
  55. package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
  56. package/dist/cli/handlers/e2e-safe-run.js +23 -0
  57. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  58. package/dist/cli/handlers/lifecycle.js +14 -0
  59. package/dist/cli/handlers/pr.d.ts +5 -0
  60. package/dist/cli/handlers/pr.d.ts.map +1 -1
  61. package/dist/cli/handlers/pr.js +346 -36
  62. package/dist/cli/handlers/run-wave.js +89 -1
  63. package/dist/cli/main.d.ts.map +1 -1
  64. package/dist/cli/main.js +56 -2
  65. package/dist/cli/parse-args.d.ts.map +1 -1
  66. package/dist/cli/parse-args.js +107 -0
  67. package/dist/cli/registry.d.ts +38 -0
  68. package/dist/cli/registry.d.ts.map +1 -1
  69. package/dist/components/adoption.d.ts.map +1 -1
  70. package/dist/components/adoption.js +1 -2
  71. package/dist/components/auto-release.d.ts +5 -2
  72. package/dist/components/auto-release.d.ts.map +1 -1
  73. package/dist/components/auto-release.js +9 -4
  74. package/dist/components/capability.d.ts +47 -0
  75. package/dist/components/capability.d.ts.map +1 -1
  76. package/dist/components/capability.js +25 -0
  77. package/dist/components/check-hooks.d.ts +4 -1
  78. package/dist/components/check-hooks.d.ts.map +1 -1
  79. package/dist/components/check-steps.d.ts +74 -0
  80. package/dist/components/check-steps.d.ts.map +1 -0
  81. package/dist/components/check-steps.js +102 -0
  82. package/dist/components/ci-services.d.ts.map +1 -1
  83. package/dist/components/ci-services.js +1 -2
  84. package/dist/components/deploy-units.d.ts +12 -0
  85. package/dist/components/deploy-units.d.ts.map +1 -1
  86. package/dist/components/deploy-units.js +20 -1
  87. package/dist/components/driver.d.ts +12 -0
  88. package/dist/components/driver.d.ts.map +1 -1
  89. package/dist/components/driver.js +35 -1
  90. package/dist/components/groups.d.ts.map +1 -1
  91. package/dist/components/groups.js +4 -3
  92. package/dist/components/pr-env-ledger.d.ts.map +1 -1
  93. package/dist/components/pr-env-ledger.js +1 -2
  94. package/dist/components/pr-environment.d.ts +1 -1
  95. package/dist/components/pr-environment.d.ts.map +1 -1
  96. package/dist/components/pr-environment.js +1 -1
  97. package/dist/components/pr-pipeline.d.ts +137 -5
  98. package/dist/components/pr-pipeline.d.ts.map +1 -1
  99. package/dist/components/pr-pipeline.js +164 -20
  100. package/dist/components/pr-run.d.ts +8 -0
  101. package/dist/components/pr-run.d.ts.map +1 -1
  102. package/dist/components/pr-run.js +9 -4
  103. package/dist/components/product-pipeline.d.ts +35 -2
  104. package/dist/components/product-pipeline.d.ts.map +1 -1
  105. package/dist/components/product-pipeline.js +24 -5
  106. package/dist/components/row-lease.d.ts +22 -1
  107. package/dist/components/row-lease.d.ts.map +1 -1
  108. package/dist/components/row-lease.js +32 -6
  109. package/dist/components/wave-plan.d.ts +8 -0
  110. package/dist/components/wave-plan.d.ts.map +1 -1
  111. package/dist/components/wave-plan.js +18 -2
  112. package/dist/e2e-harness/bucket.d.ts +21 -0
  113. package/dist/e2e-harness/bucket.d.ts.map +1 -0
  114. package/dist/e2e-harness/bucket.js +61 -0
  115. package/dist/e2e-harness/claim.d.ts +70 -0
  116. package/dist/e2e-harness/claim.d.ts.map +1 -0
  117. package/dist/e2e-harness/claim.js +98 -0
  118. package/dist/e2e-harness/driver.d.ts +64 -0
  119. package/dist/e2e-harness/driver.d.ts.map +1 -0
  120. package/dist/e2e-harness/driver.js +243 -0
  121. package/dist/e2e-harness/forgejo.d.ts +77 -0
  122. package/dist/e2e-harness/forgejo.d.ts.map +1 -0
  123. package/dist/e2e-harness/forgejo.js +205 -0
  124. package/dist/e2e-harness/git.d.ts +32 -0
  125. package/dist/e2e-harness/git.d.ts.map +1 -0
  126. package/dist/e2e-harness/git.js +67 -0
  127. package/dist/e2e-harness/index.d.ts +22 -0
  128. package/dist/e2e-harness/index.d.ts.map +1 -0
  129. package/dist/e2e-harness/index.js +47 -0
  130. package/dist/e2e-harness/jobs.d.ts +8 -0
  131. package/dist/e2e-harness/jobs.d.ts.map +1 -0
  132. package/dist/e2e-harness/jobs.js +34 -0
  133. package/dist/e2e-harness/pins.d.ts +45 -0
  134. package/dist/e2e-harness/pins.d.ts.map +1 -0
  135. package/dist/e2e-harness/pins.js +44 -0
  136. package/dist/e2e-harness/ports.d.ts +113 -0
  137. package/dist/e2e-harness/ports.d.ts.map +1 -0
  138. package/dist/e2e-harness/ports.js +4 -0
  139. package/dist/e2e-harness/reports.d.ts +45 -0
  140. package/dist/e2e-harness/reports.d.ts.map +1 -0
  141. package/dist/e2e-harness/reports.js +57 -0
  142. package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
  143. package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
  144. package/dist/e2e-harness/safe-run-cli.js +43 -0
  145. package/dist/e2e-harness/safe-run.d.ts +61 -0
  146. package/dist/e2e-harness/safe-run.d.ts.map +1 -0
  147. package/dist/e2e-harness/safe-run.js +172 -0
  148. package/dist/e2e-harness/scenario.d.ts +11 -0
  149. package/dist/e2e-harness/scenario.d.ts.map +1 -0
  150. package/dist/e2e-harness/scenario.js +89 -0
  151. package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  152. package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
  153. package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  154. package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  155. package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  156. package/dist/e2e-harness/schemas/index.d.ts +191 -0
  157. package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
  158. package/dist/e2e-harness/schemas/index.js +62 -0
  159. package/dist/e2e-harness/stack.d.ts +124 -0
  160. package/dist/e2e-harness/stack.d.ts.map +1 -0
  161. package/dist/e2e-harness/stack.js +207 -0
  162. package/dist/e2e-harness/steps.d.ts +11 -0
  163. package/dist/e2e-harness/steps.d.ts.map +1 -0
  164. package/dist/e2e-harness/steps.js +22 -0
  165. package/dist/e2e-harness.d.ts +3 -0
  166. package/dist/e2e-harness.d.ts.map +1 -0
  167. package/dist/e2e-harness.js +2 -0
  168. package/dist/exit-codes.d.ts +7 -1
  169. package/dist/exit-codes.d.ts.map +1 -1
  170. package/dist/exit-codes.js +7 -1
  171. package/dist/lexicon.d.ts +55 -0
  172. package/dist/lexicon.d.ts.map +1 -1
  173. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  174. package/dist/lifecycle/gate-ledger.js +2 -3
  175. package/dist/lifecycle/gated-request.d.ts.map +1 -1
  176. package/dist/lifecycle/gated-request.js +1 -2
  177. package/dist/lifecycle/git.d.ts +39 -3
  178. package/dist/lifecycle/git.d.ts.map +1 -1
  179. package/dist/lifecycle/git.js +223 -15
  180. package/dist/lifecycle/lock-rows.d.ts +23 -0
  181. package/dist/lifecycle/lock-rows.d.ts.map +1 -1
  182. package/dist/lifecycle/lock-rows.js +47 -8
  183. package/dist/lifecycle/query.d.ts.map +1 -1
  184. package/dist/lifecycle/query.js +4 -5
  185. package/dist/lifecycle/release-catalog.d.ts.map +1 -1
  186. package/dist/lifecycle/release-catalog.js +1 -1
  187. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  188. package/dist/lifecycle/release-ledger.js +1 -2
  189. package/dist/lifecycle/release-status.d.ts +20 -0
  190. package/dist/lifecycle/release-status.d.ts.map +1 -1
  191. package/dist/lifecycle/release-status.js +1 -22
  192. package/dist/lifecycle/resource-lock.d.ts +70 -0
  193. package/dist/lifecycle/resource-lock.d.ts.map +1 -1
  194. package/dist/lifecycle/resource-lock.js +241 -5
  195. package/dist/lifecycle/wave-plans.d.ts +23 -7
  196. package/dist/lifecycle/wave-plans.d.ts.map +1 -1
  197. package/dist/lifecycle/wave-plans.js +9 -2
  198. package/dist/op/approval-status.d.ts +103 -0
  199. package/dist/op/approval-status.d.ts.map +1 -0
  200. package/dist/op/approval-status.js +197 -0
  201. package/dist/op/gate.js +21 -4
  202. package/dist/op/index.d.ts +1 -1
  203. package/dist/op/index.d.ts.map +1 -1
  204. package/dist/op/index.js +1 -1
  205. package/dist/op/op-waves-capability-spec.d.ts +8 -0
  206. package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
  207. package/dist/op/op-waves-capability-spec.js +21 -0
  208. package/dist/op/op-waves-release-port.js +1 -1
  209. package/dist/op/op-waves-release.d.ts +2 -1
  210. package/dist/op/op-waves-release.d.ts.map +1 -1
  211. package/dist/op/op-waves-release.js +1 -2
  212. package/dist/op/op-waves-run.d.ts +15 -2
  213. package/dist/op/op-waves-run.d.ts.map +1 -1
  214. package/dist/op/op-waves-run.js +195 -31
  215. package/dist/op/op-waves-stand-down.d.ts.map +1 -1
  216. package/dist/op/op-waves-stand-down.js +1 -2
  217. package/dist/op/op-waves.d.ts +53 -0
  218. package/dist/op/op-waves.d.ts.map +1 -1
  219. package/dist/op/op-waves.js +62 -6
  220. package/dist/op/runtime.d.ts +4 -0
  221. package/dist/op/runtime.d.ts.map +1 -1
  222. package/dist/op/runtime.js +2 -3
  223. package/dist/otlp.d.ts.map +1 -1
  224. package/dist/otlp.js +1 -2
  225. package/dist/parallelism.d.ts +17 -0
  226. package/dist/parallelism.d.ts.map +1 -0
  227. package/dist/parallelism.js +33 -0
  228. package/dist/policy-source.d.ts.map +1 -1
  229. package/dist/policy-source.js +1 -2
  230. package/dist/pr-forge.d.ts.map +1 -1
  231. package/dist/pr-forge.js +56 -39
  232. package/dist/pr-loop.d.ts +9 -0
  233. package/dist/pr-loop.d.ts.map +1 -1
  234. package/dist/pr-loop.js +22 -4
  235. package/dist/pr-merge.d.ts +64 -0
  236. package/dist/pr-merge.d.ts.map +1 -0
  237. package/dist/pr-merge.js +78 -0
  238. package/dist/pr-post.d.ts +70 -1
  239. package/dist/pr-post.d.ts.map +1 -1
  240. package/dist/pr-post.js +116 -5
  241. package/dist/pr-report-url.d.ts.map +1 -1
  242. package/dist/pr-report-url.js +1 -2
  243. package/dist/release-floors.d.ts +1 -1
  244. package/dist/release-floors.js +1 -1
  245. package/dist/run-event.d.ts.map +1 -1
  246. package/dist/run-event.js +1 -2
  247. package/dist/scheduled-op-cloud.d.ts +32 -0
  248. package/dist/scheduled-op-cloud.d.ts.map +1 -0
  249. package/dist/scheduled-op-cloud.js +69 -0
  250. package/dist/wave-runtime.mjs +351 -328
  251. package/dist/workspace/ci-lock-grain.d.ts +5 -0
  252. package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
  253. package/dist/workspace/ci-lock-grain.js +1 -7
  254. package/dist/workspace/ci-run.d.ts.map +1 -1
  255. package/dist/workspace/ci-run.js +5 -1
  256. package/dist/workspace/pr-report.schema.json +5 -0
  257. package/package.json +1 -1
  258. package/src/ci-agent.ts +1 -2
  259. package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
  260. package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
  261. package/src/ci-audit/attribution.ts +260 -0
  262. package/src/ci-audit/audit-log.ts +220 -0
  263. package/src/ci-audit/ci-audit.test.ts +175 -0
  264. package/src/ci-audit/index.ts +14 -0
  265. package/src/ci-audit/unrecorded.ts +140 -0
  266. package/src/ci-audit.ts +2 -0
  267. package/src/ci-control.ts +3 -4
  268. package/src/ci-estate.ts +1 -2
  269. package/src/ci-identity-database.test.ts +2 -3
  270. package/src/ci-identity-targets.test.ts +1 -3
  271. package/src/ci-identity.ts +2 -3
  272. package/src/ci-job-guard.test.ts +154 -0
  273. package/src/ci-job-guard.ts +319 -0
  274. package/src/ci-jobs.ts +8 -0
  275. package/src/ci-product-comment-targets.test.ts +45 -0
  276. package/src/ci-product-words.ts +35 -6
  277. package/src/ci-product.ts +55 -4
  278. package/src/ci-respond-run.ts +291 -0
  279. package/src/ci-respond.test.ts +264 -0
  280. package/src/ci-respond.ts +412 -0
  281. package/src/cli/handlers/audit-log.ts +74 -0
  282. package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
  283. package/src/cli/handlers/build.ts +69 -0
  284. package/src/cli/handlers/ci-check-job.test.ts +114 -0
  285. package/src/cli/handlers/ci-check-job.ts +33 -0
  286. package/src/cli/handlers/ci-check.ts +38 -8
  287. package/src/cli/handlers/e2e-safe-run.ts +27 -0
  288. package/src/cli/handlers/lifecycle.ts +13 -0
  289. package/src/cli/handlers/pr-before-merge.test.ts +1 -1
  290. package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
  291. package/src/cli/handlers/pr-endpoint.test.ts +1 -1
  292. package/src/cli/handlers/pr-green.test.ts +1 -1
  293. package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
  294. package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
  295. package/src/cli/handlers/pr-plan-targets.test.ts +1 -1
  296. package/src/cli/handlers/pr-record.test.ts +34 -2
  297. package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
  298. package/src/cli/handlers/pr-waves.test.ts +1 -1
  299. package/src/cli/handlers/pr.test.ts +1 -1
  300. package/src/cli/handlers/pr.ts +311 -32
  301. package/src/cli/handlers/run-wave.ts +79 -1
  302. package/src/cli/main.test.ts +1 -1
  303. package/src/cli/main.ts +56 -2
  304. package/src/cli/parse-args.ts +77 -0
  305. package/src/cli/registry.ts +38 -0
  306. package/src/components/adoption.ts +1 -2
  307. package/src/components/auto-release.test.ts +4 -2
  308. package/src/components/auto-release.ts +9 -5
  309. package/src/components/capability.ts +60 -0
  310. package/src/components/check-hooks.ts +4 -1
  311. package/src/components/check-steps.test.ts +70 -0
  312. package/src/components/check-steps.ts +158 -0
  313. package/src/components/ci-services.ts +1 -2
  314. package/src/components/deploy-units.test.ts +18 -1
  315. package/src/components/deploy-units.ts +26 -1
  316. package/src/components/driver.ts +35 -1
  317. package/src/components/groups.ts +4 -2
  318. package/src/components/plan-flags.test.ts +46 -0
  319. package/src/components/pr-comment-preview-targets.test.ts +34 -0
  320. package/src/components/pr-env-ledger.ts +1 -2
  321. package/src/components/pr-env-run-bundle.test.ts +0 -20
  322. package/src/components/pr-environment.ts +1 -1
  323. package/src/components/pr-pipeline-runners.test.ts +80 -0
  324. package/src/components/pr-pipeline.ts +244 -20
  325. package/src/components/pr-run.ts +17 -6
  326. package/src/components/pr-stale-job.test.ts +34 -0
  327. package/src/components/product-pipeline.ts +50 -8
  328. package/src/components/row-lease.test.ts +61 -1
  329. package/src/components/row-lease.ts +48 -7
  330. package/src/components/wave-plan.ts +18 -2
  331. package/src/e2e-harness/__project__/chant.config.ts +4 -0
  332. package/src/e2e-harness/__project__/src/compose.ts +33 -0
  333. package/src/e2e-harness/bucket.ts +69 -0
  334. package/src/e2e-harness/claim.test.ts +150 -0
  335. package/src/e2e-harness/claim.ts +140 -0
  336. package/src/e2e-harness/driver.test.ts +304 -0
  337. package/src/e2e-harness/driver.ts +294 -0
  338. package/src/e2e-harness/forgejo.ts +267 -0
  339. package/src/e2e-harness/git.ts +96 -0
  340. package/src/e2e-harness/index.ts +49 -0
  341. package/src/e2e-harness/jobs.ts +35 -0
  342. package/src/e2e-harness/pins.ts +52 -0
  343. package/src/e2e-harness/ports.ts +130 -0
  344. package/src/e2e-harness/reports.ts +79 -0
  345. package/src/e2e-harness/safe-run-cli.test.ts +102 -0
  346. package/src/e2e-harness/safe-run-cli.ts +54 -0
  347. package/src/e2e-harness/safe-run.ts +198 -0
  348. package/src/e2e-harness/scenario.ts +89 -0
  349. package/src/e2e-harness/schemas/README.md +62 -0
  350. package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  351. package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
  352. package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  353. package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  354. package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  355. package/src/e2e-harness/schemas/index.ts +220 -0
  356. package/src/e2e-harness/schemas.test.ts +145 -0
  357. package/src/e2e-harness/stack.test.ts +124 -0
  358. package/src/e2e-harness/stack.ts +306 -0
  359. package/src/e2e-harness/steps.ts +30 -0
  360. package/src/e2e-harness.ts +2 -0
  361. package/src/exit-codes.test.ts +3 -2
  362. package/src/exit-codes.ts +7 -1
  363. package/src/gate-decision-bundle.test.ts +0 -2
  364. package/src/lexicon.ts +57 -0
  365. package/src/lifecycle/control-entries-ledger.test.ts +2 -3
  366. package/src/lifecycle/gate-ledger.ts +2 -3
  367. package/src/lifecycle/gated-request.ts +1 -2
  368. package/src/lifecycle/git.test.ts +155 -0
  369. package/src/lifecycle/git.ts +213 -17
  370. package/src/lifecycle/lock-rows.test.ts +6 -1
  371. package/src/lifecycle/lock-rows.ts +58 -7
  372. package/src/lifecycle/query.ts +4 -5
  373. package/src/lifecycle/release-catalog.test.ts +3 -4
  374. package/src/lifecycle/release-catalog.ts +1 -1
  375. package/src/lifecycle/release-ledger.ts +1 -2
  376. package/src/lifecycle/release-status.test.ts +3 -4
  377. package/src/lifecycle/release-status.ts +1 -2
  378. package/src/lifecycle/resource-lock-wait.test.ts +292 -0
  379. package/src/lifecycle/resource-lock.ts +261 -7
  380. package/src/lifecycle/wave-plans.ts +33 -5
  381. package/src/op/approval-status.test.ts +134 -0
  382. package/src/op/approval-status.ts +235 -0
  383. package/src/op/gate-review.test.ts +2 -1
  384. package/src/op/gate.test.ts +7 -5
  385. package/src/op/gate.ts +20 -4
  386. package/src/op/index.ts +2 -0
  387. package/src/op/op-waves-after-plan.test.ts +11 -0
  388. package/src/op/op-waves-capability-spec.ts +20 -0
  389. package/src/op/op-waves-ledger-lock.test.ts +208 -0
  390. package/src/op/op-waves-parallelism.test.ts +89 -0
  391. package/src/op/op-waves-pull-request.test.ts +78 -1
  392. package/src/op/op-waves-release-port.ts +1 -1
  393. package/src/op/op-waves-release.ts +2 -3
  394. package/src/op/op-waves-run.ts +196 -31
  395. package/src/op/op-waves-stand-down.ts +1 -2
  396. package/src/op/op-waves.ts +81 -6
  397. package/src/op/runtime.ts +6 -3
  398. package/src/otlp.ts +1 -2
  399. package/src/parallelism.test.ts +38 -0
  400. package/src/parallelism.ts +33 -0
  401. package/src/policy-source.ts +1 -2
  402. package/src/pr-forge-bundle.test.ts +1 -1
  403. package/src/pr-forge.ts +54 -35
  404. package/src/pr-loop-bundle.test.ts +0 -2
  405. package/src/pr-loop-narrowed.test.ts +63 -0
  406. package/src/pr-loop.ts +30 -4
  407. package/src/pr-merge.test.ts +100 -0
  408. package/src/pr-merge.ts +105 -0
  409. package/src/pr-post-stale.test.ts +163 -0
  410. package/src/pr-post.ts +159 -5
  411. package/src/pr-report-url.ts +1 -2
  412. package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
  413. package/src/release-floors.ts +1 -1
  414. package/src/run-event.ts +1 -2
  415. package/src/scheduled-op-cloud.ts +68 -0
  416. package/src/stage-hooks-bundle.test.ts +0 -2
  417. package/src/workspace/ci-lock-grain.ts +1 -2
  418. package/src/workspace/ci-run.ts +5 -1
  419. package/src/workspace/pr-report.schema.json +5 -0
@@ -95,10 +95,11 @@ import type { CloudTradeSpec } from "../ci-identity";
95
95
  import { gatePointProblems, type GatePoint } from "./gate-point";
96
96
  import { quorumProblems, type GateQuorumRule } from "./gate-quorum";
97
97
  import { notifyConfigProblem, type NotifyConfig } from "../notify";
98
+ // Types only: the small bundles that carry this module stay without ../ci-respond.ts (#4629).
99
+ import type { CiResponses } from "../ci-respond";
98
100
  import { WAVE_GATE_NAME_PATTERN, waveGateNameFrom, waveShare } from "../wave-layout";
99
101
  import { waveOutcomeFileName } from "../wave-blocked";
100
- import { NEXT_RELEASE } from "../release-floors";
101
- import { opWaveHoldsProblems, opWaveStepProblems, type OpWaveHolds, type OpWaveStep } from "./op-waves-capability-spec";
102
+ import { opWaveHoldsProblems, opWaveParallelismProblems, opWaveStepProblems, type OpWaveHolds, type OpWaveStep } from "./op-waves-capability-spec";
102
103
  import { opWaveReleaseProblems, type OpWaveReleaseNames } from "./op-waves-release";
103
104
  import { CONTROL_DISPATCH_JOB, CONTROL_NAME, controlSettingsProblems, resolveControlTarget, type ControlSettingsInput, type ControlTarget } from "../control/dispatch";
104
105
 
@@ -234,7 +235,7 @@ export const CHECK_HOOK_MOMENT = "check";
234
235
  export type CiHookMoment = OpWaveHookMoment | typeof CHECK_HOOK_MOMENT;
235
236
 
236
237
  /** The first chant that reads and runs `ci.hooks.check` (#4556). A declaration that uses it sets `minReader` to it. */
237
- export const CI_CHECK_HOOK_FLOOR = NEXT_RELEASE;
238
+ export const CI_CHECK_HOOK_FLOOR = "0.124.55";
238
239
 
239
240
  /**
240
241
  * Who runs the `before.apply` and `after.apply` hooks (#3804). `chant`: the
@@ -389,6 +390,8 @@ export interface OpWave {
389
390
  hooks?: OpWaveHooks;
390
391
  /** Where this wave's jobs run (#3914). Default: the spec's `runner`. */
391
392
  runner?: OpWaveRunner;
393
+ /** How many of the wave's runs apply at once (#4625), over the spec's `parallelism`. */
394
+ parallelism?: number;
392
395
  /**
393
396
  * The OIDC tokens this wave's jobs get (#3914), as `{ <variable>: <audience> }`;
394
397
  * see {@link OpWaveJobGroup.idTokens}. With `jobs`, these are the deciding
@@ -487,6 +490,13 @@ export interface OpWavesSpec {
487
490
  * moved exits 4. See `./op-waves-capability.ts`.
488
491
  */
489
492
  step?: OpWaveStep;
493
+ /**
494
+ * How many runs of a wave apply at once (#4625), a wave's own
495
+ * `parallelism` winning. Default 1, one at a time. Over 1 it needs `step`:
496
+ * a run whose wave lists one of its `dependsOn` before it waits for that
497
+ * one, and is blocked when it failed, as one at a time.
498
+ */
499
+ parallelism?: number;
490
500
  /**
491
501
  * Holds the wave runs over its plans (#4545), read at the base commit
492
502
  * with the policy: `policy` runs the workspace's `ci.policy` over each
@@ -554,6 +564,14 @@ export interface OpWavesSpec {
554
564
  * `../notify.ts`.
555
565
  */
556
566
  notify?: NotifyConfig;
567
+ /**
568
+ * The responses a wave job posts (#4629, `../ci-respond.ts`): a refused
569
+ * wave's diff (`wave-refused: diff`, on by default) and a failed apply's
570
+ * triage (`apply-failed: triage`, on by default), on the pull request the
571
+ * wave applies or a tracking issue. `off` turns one off. A job's
572
+ * `CHANT_RESPOND` sits under these.
573
+ */
574
+ respond?: CiResponses;
557
575
  /**
558
576
  * The control repo (#4617, `@intentius/chant/ci-control`): once the last
559
577
  * wave ran, a `control-dispatch` job tells the control repo how the waves
@@ -582,7 +600,7 @@ export interface OpWavesControl extends ControlSettingsInput {
582
600
  }
583
601
 
584
602
  /** The first chant whose Op waves specs take `control` (#4617). A product feature-detects this name. */
585
- export const OP_WAVES_CONTROL_FLOOR = NEXT_RELEASE;
603
+ export const OP_WAVES_CONTROL_FLOOR = "0.124.55";
586
604
 
587
605
  /** The control dispatch job's name in an Op waves pipeline (#4617). */
588
606
  export const OP_WAVES_CONTROL_JOB = CONTROL_DISPATCH_JOB;
@@ -633,6 +651,24 @@ export interface OpWavesDigest {
633
651
  over?: "all" | "changing";
634
652
  }
635
653
 
654
+ /**
655
+ * A wave job's default timeout in minutes (ruling for ci-products
656
+ * 2026-10-28, "Ledger lock"): three hours, a Forgejo runner's default, under
657
+ * GitHub's six. The generators write it on every wave job.
658
+ */
659
+ export const OP_WAVE_JOB_TIMEOUT_MINUTES = 180;
660
+
661
+ /**
662
+ * The job's timeout, and the `CHANT_LOCK_WAIT` a wave job carries: the
663
+ * seconds a run on the `target` or `repo` grain waits for its row on the
664
+ * ledger, five minutes under the job's timeout (at least one minute), so the
665
+ * wait gives up by name before the forge stops the job.
666
+ */
667
+ export function opWaveJobTimeout(minutes: number | undefined): { minutes: number; env: { CHANT_LOCK_WAIT: string } } {
668
+ const m = minutes !== undefined && Number.isFinite(minutes) && minutes > 0 ? Math.ceil(minutes) : OP_WAVE_JOB_TIMEOUT_MINUTES;
669
+ return { minutes: m, env: { CHANT_LOCK_WAIT: String(Math.max(60, (m - 5) * 60)) } };
670
+ }
671
+
636
672
  export const OP_WAVES_DIGEST_OVER = ["all", "changing"] as const;
637
673
 
638
674
  /** The default gate name pattern. */
@@ -757,6 +793,29 @@ export function opWavesRecordPlansCommand(specFile: string, bin?: string): strin
757
793
  return [...opWaveBinArgv(bin), "run", "wave", "--spec", specFile, "--record-plans"];
758
794
  }
759
795
 
796
+ /** The GitLab variable a pipeline schedule sets to `1` to post every open merge request's approval status (#4630). */
797
+ export const OP_WAVES_APPROVAL_STATUS_VAR = "CHANT_APPROVAL_STATUS";
798
+
799
+ /**
800
+ * Whether a spec's pipeline records each head's plans and posts
801
+ * `<product>/approval` before merge (#4630): some wave takes its approval
802
+ * from the pull request, by its review (`pr-review`) or by its own approval
803
+ * (`pull-request`, under the 2026-10-28 ruling).
804
+ */
805
+ export function opWavesPostsApprovalStatus(spec: Pick<OpWavesSpec, "waves">): boolean {
806
+ return spec.waves.some((w) => w.approval === "pr-review" || w.approval === "pull-request");
807
+ }
808
+
809
+ /**
810
+ * The command the approval status job runs (#4630), through the product's
811
+ * bin: `--pr`, `--head` and `--base` from the pull request event on GitHub
812
+ * and Forgejo, `--open` on GitLab.
813
+ */
814
+ export function opWavesApprovalStatusCommand(specFile: string, forge: "github" | "gitlab" | "forgejo", bin?: string): string[] {
815
+ const at = forge === "gitlab" ? ["--open"] : ["--pr", '"$PR_NUMBER"', "--head", '"$HEAD_SHA"', "--base", '"$BASE_SHA"'];
816
+ return [...opWaveBinArgv(bin), "run", "wave", "--spec", specFile, "--approval-status", ...at, "--forge", forge];
817
+ }
818
+
760
819
  /** The default apply command. */
761
820
  export const OP_WAVE_DEFAULT_APPLY = ["chant", "run", "{op}", "--env", "{target}"];
762
821
 
@@ -935,10 +994,26 @@ export function assertOpWavesSpec(spec: OpWavesSpec): void {
935
994
  }
936
995
  if (spec.neverOverMcp !== undefined && typeof spec.neverOverMcp !== "boolean") throw new Error(`${where}: neverOverMcp must be true or false.`);
937
996
  if (spec.runner !== undefined) assertOpWaveRunner(where, "runner", spec.runner);
997
+ {
998
+ const problems = opWaveParallelismProblems(spec);
999
+ if (problems.length > 0) throw new Error(`${where}: ${problems[0]}.`);
1000
+ }
938
1001
  if (spec.notify !== undefined) {
939
1002
  const problem = notifyConfigProblem(spec.notify, "notify");
940
1003
  if (problem) throw new Error(`${where}: ${problem}`);
941
1004
  }
1005
+ if (spec.respond !== undefined) {
1006
+ const respond = spec.respond as unknown;
1007
+ if (respond === null || typeof respond !== "object" || Array.isArray(respond)) throw new Error(`${where}: respond must be an object of event to mode, such as { "wave-refused": "off" }.`);
1008
+ // The wave events and their modes, as ../ci-respond.ts's CI_RESPONSES has them.
1009
+ const modes: Record<string, readonly string[]> = { "wave-refused": ["diff", "off"], "apply-failed": ["triage", "off"] };
1010
+ for (const [event, mode] of Object.entries(respond as Record<string, unknown>)) {
1011
+ if (event === "description") throw new Error(`${where}: respond: the description check runs in the plan-note job, so an op waves spec takes only wave-refused and apply-failed.`);
1012
+ const allowed = modes[event];
1013
+ if (!allowed) throw new Error(`${where}: respond names no event ${JSON.stringify(event)}; the events are wave-refused and apply-failed.`);
1014
+ if (typeof mode !== "string" || !allowed.includes(mode)) throw new Error(`${where}: respond: ${event} takes ${allowed.join(" or ")}, not ${JSON.stringify(mode)}.`);
1015
+ }
1016
+ }
942
1017
  const names = new Set<string>();
943
1018
  for (const wave of spec.waves) {
944
1019
  if (!NAME.test(wave.name)) {
@@ -1038,8 +1113,8 @@ const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
1038
1113
  /** The key each cloud of a `cloud` trade names its identity under (`IDENTITY_KEY` in ../ci-identity.ts, kept here so this module imports none of it). */
1039
1114
  const CLOUD_IDENTITY_KEY: Record<string, string> = { aws: "role", gcp: "serviceAccount", azure: "clientId", pulumi: "token" };
1040
1115
 
1041
- /** Refuse a `cloud` (#4332) the trade could not run: an unknown cloud, one that names no identity, or no audience. */
1042
- function assertOpWaveCloud(where: string, field: string, cloud: unknown): void {
1116
+ /** Refuse a `cloud` (#4332) the trade could not run: an unknown cloud, one that names no identity, or no audience. Scheduled Ops check theirs with it too (#4631). */
1117
+ export function assertOpWaveCloud(where: string, field: string, cloud: unknown): void {
1043
1118
  if (cloud === null || typeof cloud !== "object" || Array.isArray(cloud) || Object.keys(cloud).length === 0) throw new Error(`${where}: ${field} must name one or more of aws, gcp, azure and pulumi.`);
1044
1119
  for (const [name, c] of Object.entries(cloud as Record<string, unknown>)) {
1045
1120
  const key = CLOUD_IDENTITY_KEY[name];
package/src/op/runtime.ts CHANGED
@@ -21,7 +21,6 @@ import type { StepRecord, OpRunResult } from "./local-executor";
21
21
  import type { WaitingPoint } from "./steward-points";
22
22
  import type { GateResolutionRecord } from "../lifecycle/gate-ledger";
23
23
  import type { RunOrigin } from "../lifecycle/release-ledger";
24
- import { NEXT_RELEASE } from "../release-floors";
25
24
  import type { CapabilityTraceSpan } from "../otlp";
26
25
  import type { RunComponentsOptions, RunComponentsResult } from "../components/cli-support";
27
26
 
@@ -284,7 +283,7 @@ export interface OpRunWavePlan {
284
283
  }
285
284
 
286
285
  /** The first chant that runs an after-plan hook in the wave job's process and writes {@link OpRunWave.plans} (#4614). */
287
- export const OP_WAVE_AFTER_PLAN_FLOOR = NEXT_RELEASE;
286
+ export const OP_WAVE_AFTER_PLAN_FLOOR = "0.124.55";
288
287
 
289
288
  /** One run target's apply in an op wave job (#4555). */
290
289
  export interface OpRunWaveTarget {
@@ -295,10 +294,14 @@ export interface OpRunWaveTarget {
295
294
  attributes?: Record<string, string | number | boolean>;
296
295
  /** The pieces the engine timed. */
297
296
  spans?: CapabilityTraceSpan[];
297
+ /** The engine's error, when the apply failed (#4629): what the failed-apply triage posts. */
298
+ error?: string;
299
+ /** The resources the engine reported failed (#4629), by name or id. */
300
+ failedResources?: string[];
298
301
  }
299
302
 
300
303
  /** The first chant that writes {@link OpRunRecord.wave}, a run record per op wave job (#4551). */
301
- export const OP_WAVE_RUN_RECORD_FLOOR = NEXT_RELEASE;
304
+ export const OP_WAVE_RUN_RECORD_FLOOR = "0.124.55";
302
305
 
303
306
  /** `value` as an {@link OpRunWave}, or undefined when it is not one, so a reader drops a malformed field and keeps the record. */
304
307
  export function opRunWaveOf(value: unknown): OpRunWave | undefined {
package/src/otlp.ts CHANGED
@@ -36,11 +36,10 @@
36
36
  import { randomBytes } from "node:crypto";
37
37
  import { activeProductWords } from "./ci-product-words";
38
38
  import { CHANT_VERSION } from "./chant-version";
39
- import { NEXT_RELEASE } from "./release-floors";
40
39
  import type { RunEventBody, RunEventRun } from "./run-event";
41
40
 
42
41
  /** The first chant with the OTLP exporter, op-wave run events and the product tool hook (#4555). */
43
- export const OTLP_EXPORTER_FLOOR = NEXT_RELEASE;
42
+ export const OTLP_EXPORTER_FLOOR = "0.124.55";
44
43
 
45
44
  export type OtlpAttrValue = string | number | boolean;
46
45
  export type OtlpAttrs = Record<string, OtlpAttrValue | undefined>;
@@ -0,0 +1,38 @@
1
+ /** The parallelism limit (#4625). Written for the ci-products post-merge pass. */
2
+
3
+ import { describe, expect, test } from "vitest";
4
+ import { mapLimited, parallelismProblem } from "./parallelism";
5
+
6
+ describe("mapLimited", () => {
7
+ test("never runs more than the limit at once, and keeps the order", async () => {
8
+ let running = 0;
9
+ let most = 0;
10
+ const out = await mapLimited([5, 1, 4, 2, 3], 2, async (n) => {
11
+ running++;
12
+ most = Math.max(most, running);
13
+ await new Promise((r) => setTimeout(r, n));
14
+ running--;
15
+ return n * 10;
16
+ });
17
+ expect(out).toEqual([50, 10, 40, 20, 30]);
18
+ expect(most).toBe(2);
19
+ });
20
+
21
+ test("no limit runs them all at once", async () => {
22
+ let most = 0;
23
+ let running = 0;
24
+ await mapLimited([1, 2, 3], undefined, async () => {
25
+ running++;
26
+ most = Math.max(most, running);
27
+ await Promise.resolve();
28
+ running--;
29
+ });
30
+ expect(most).toBe(3);
31
+ });
32
+ });
33
+
34
+ test("parallelismProblem", () => {
35
+ expect(parallelismProblem("parallelism", 4)).toBeUndefined();
36
+ expect(parallelismProblem("parallelism", 0)).toMatch(/whole number of 1 or more/);
37
+ expect(parallelismProblem("parallelism", 1.5)).toMatch(/whole number/);
38
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A limit on how many things run at once (#4625): members a pull request
3
+ * plans at once (`pr-plan --parallelism`), and runs an op wave applies at
4
+ * once (`parallelism` on the spec or a wave). A product's `parallelism`
5
+ * maps onto both.
6
+ */
7
+
8
+ /** Why `value` is not a parallelism, or undefined when it is one: a whole number of 1 or more. */
9
+ export function parallelismProblem(field: string, value: unknown): string | undefined {
10
+ if (typeof value === "number" && Number.isInteger(value) && value >= 1) return undefined;
11
+ return `${field} is ${JSON.stringify(value)}; give a whole number of 1 or more, the most that run at once`;
12
+ }
13
+
14
+ /**
15
+ * Run `fn` over `items` with at most `limit` in flight, results in the
16
+ * items' order. Items start in order, and `fn` is called synchronously when
17
+ * an item starts, so an item that awaits an earlier one's promise never
18
+ * waits on one that has not started. No limit, or one at least the number
19
+ * of items: all at once.
20
+ */
21
+ export async function mapLimited<T, R>(items: readonly T[], limit: number | undefined, fn: (item: T, index: number) => Promise<R>): Promise<R[]> {
22
+ if (limit === undefined || limit >= items.length) return Promise.all(items.map((item, i) => fn(item, i)));
23
+ const out: R[] = new Array(items.length);
24
+ let next = 0;
25
+ const worker = async (): Promise<void> => {
26
+ while (next < items.length) {
27
+ const i = next++;
28
+ out[i] = await fn(items[i]!, i);
29
+ }
30
+ };
31
+ await Promise.all(Array.from({ length: Math.max(1, limit) }, worker));
32
+ return out;
33
+ }
@@ -21,7 +21,6 @@ import { spawnSync } from "node:child_process";
21
21
  import { mkdtempSync, rmSync } from "node:fs";
22
22
  import { tmpdir } from "node:os";
23
23
  import { join } from "node:path";
24
- import { NEXT_RELEASE } from "./release-floors";
25
24
  import { gitTree, type WorkspaceTree } from "./workspace/tree";
26
25
  import type { GatePolicySource, ResolvedGatePolicySource } from "./gate-policy";
27
26
 
@@ -30,7 +29,7 @@ import type { GatePolicySource, ResolvedGatePolicySource } from "./gate-policy";
30
29
  export { assertGatePolicySource, type GatePolicySource, type ResolvedGatePolicySource } from "./gate-policy";
31
30
 
32
31
  /** The first chant that reads `ci.policy.source` and `ci.policy.packs`; a declaration that sets either needs this `minReader`. */
33
- export const CI_POLICY_SOURCE_FLOOR = NEXT_RELEASE;
32
+ export const CI_POLICY_SOURCE_FLOOR = "0.124.55";
34
33
 
35
34
  /** A fetched source: its record, and its tree at the commit, rooted at the repository's top. */
36
35
  export interface FetchedGatePolicySource {
@@ -34,7 +34,7 @@ describe("the pr-forge bundle", () => {
34
34
  expect(inputs.filter((i) => pattern.test(i)), String(pattern)).toEqual([]);
35
35
  }
36
36
  expect(inputs.map((i) => i.replace(/^.*?packages\//, "packages/")).sort()).toEqual(["packages/core/src/pr-forge.ts"]);
37
- // About 52 KB today, after the pull request authors (#4000), pullRequestOpen for target locks (#4293), the four requires checks of an apply before merge (#4301) the approver filter (#4337) the approved fields (#4287) and the plan job's GitLab note (#4328).
37
+ // About 55.9 KB today, after the pull request authors (#4000), pullRequestOpen for target locks (#4293), the four requires checks of an apply before merge (#4301) the approver filter (#4337) the approved fields (#4287) the plan job's GitLab note (#4328) and GitLab's open merge requests for stale notes (#4628).
38
38
  expect(result.outputFiles.reduce((n, f) => n + f.contents.byteLength, 0)).toBeLessThan(56 * 1024);
39
39
  });
40
40
  });
package/src/pr-forge.ts CHANGED
@@ -675,6 +675,11 @@ export class ForgeApiError extends Error {
675
675
  }
676
676
  }
677
677
 
678
+ /** The forge answered 404. */
679
+ const notFound = (err: unknown): boolean => err instanceof ForgeApiError && err.status === 404;
680
+
681
+ const byNumber = (a: { number: number }, b: { number: number }): number => a.number - b.number;
682
+
678
683
  const DEFAULT_HOST: Record<ForgeKind, string | null> = { github: "github.com", gitlab: "gitlab.com", forgejo: null };
679
684
 
680
685
  /** `<forge>:<login>` on the forge's default host, `<forge>@<host>:<login>` elsewhere, lower-cased (#3163's form). */
@@ -900,6 +905,22 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
900
905
  const url = str(v.html_url);
901
906
  return { number, title: str(v.title) ?? "", body: str(v.body) ?? "", head: head ?? "", ...(base ? { base } : {}), ...(url ? { url } : {}) };
902
907
  };
908
+ /**
909
+ * The open pull requests; GitHub takes `filter` server-side, Forgejo's list
910
+ * takes none and is matched by the caller. Forgejo answers the list with
911
+ * 404 while it still counts the repository as empty (just after the first
912
+ * push). That is no pull request; a repository that is really missing 404s
913
+ * on its own read too.
914
+ */
915
+ const openPulls = async (filter: string): Promise<unknown[]> => {
916
+ try {
917
+ return await api.list(`${repo}/pulls?state=open${kind === "github" ? filter : ""}`, pageParams, pageSize);
918
+ } catch (err) {
919
+ if (kind !== "forgejo" || !notFound(err)) throw err;
920
+ await api.call("GET", repo);
921
+ return [];
922
+ }
923
+ };
903
924
  /** A pull request whose head branch lives in this repository, not a fork. */
904
925
  const fromHere = (v: unknown, head: string): boolean => {
905
926
  if (!isObject(v) || !isObject(v.head) || v.head.ref !== head) return false;
@@ -950,7 +971,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
950
971
  try {
951
972
  b = await api.call("GET", `${repo}/branches/${branch.split("/").map(encodeURIComponent).join("/")}`);
952
973
  } catch (err) {
953
- if (err instanceof ForgeApiError && err.status === 404) return undefined;
974
+ if (notFound(err)) return undefined;
954
975
  throw err;
955
976
  }
956
977
  // GitHub names the commit `sha`, Forgejo `id`.
@@ -1084,7 +1105,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1084
1105
  const got = await api.call("GET", `${repo}/pulls/${pr}`);
1085
1106
  return isObject(got) && got.state === "open" && got.merged !== true;
1086
1107
  } catch (err) {
1087
- if (err instanceof ForgeApiError && err.status === 404) return false;
1108
+ if (notFound(err)) return false;
1088
1109
  throw err;
1089
1110
  }
1090
1111
  },
@@ -1094,7 +1115,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1094
1115
  const pr = await api.call("GET", `${repo}/commits/${sha}/pull`);
1095
1116
  return isObject(pr) && typeof pr.number === "number" ? pr.number : null;
1096
1117
  } catch (err) {
1097
- if (err instanceof ForgeApiError && err.status === 404) return null;
1118
+ if (notFound(err)) return null;
1098
1119
  throw err;
1099
1120
  }
1100
1121
  }
@@ -1121,33 +1142,12 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1121
1142
  // GitHub filters by `owner:branch` server-side; Forgejo's list takes no
1122
1143
  // head filter, so every open page is read and matched here.
1123
1144
  const owner = opts.repo.split("/")[0];
1124
- const query = kind === "github" ? `?state=open&head=${encodeURIComponent(`${owner}:${head}`)}` : "?state=open";
1125
- let listed: unknown[];
1126
- try {
1127
- listed = await api.list(`${repo}/pulls${query}`, pageParams, pageSize);
1128
- } catch (err) {
1129
- // Forgejo answers the list with 404 while it still counts the repository
1130
- // as empty (just after the first push). That is no pull request; a
1131
- // repository that is really missing 404s on its own read too.
1132
- if (kind !== "forgejo" || !(err instanceof ForgeApiError) || err.status !== 404) throw err;
1133
- await api.call("GET", repo);
1134
- return undefined;
1135
- }
1136
- const open = listed.filter((p) => fromHere(p, head));
1137
- return open.map(pull).filter((p): p is PullRequest => p !== undefined).sort((a, b) => a.number - b.number)[0];
1145
+ const open = (await openPulls(`&head=${encodeURIComponent(`${owner}:${head}`)}`)).filter((p) => fromHere(p, head));
1146
+ return open.map(pull).filter((p): p is PullRequest => p !== undefined).sort(byNumber)[0];
1138
1147
  },
1139
1148
  async openPullRequests(base) {
1140
1149
  // GitHub filters by base server-side; Forgejo's list is matched here.
1141
- const query = kind === "github" ? `?state=open&base=${encodeURIComponent(base)}` : "?state=open";
1142
- let listed: unknown[];
1143
- try {
1144
- listed = await api.list(`${repo}/pulls${query}`, pageParams, pageSize);
1145
- } catch (err) {
1146
- // Forgejo answers 404 while it counts the repository as empty, as findPullRequest notes.
1147
- if (kind !== "forgejo" || !(err instanceof ForgeApiError) || err.status !== 404) throw err;
1148
- await api.call("GET", repo);
1149
- return [];
1150
- }
1150
+ const listed = await openPulls(`&base=${encodeURIComponent(base)}`);
1151
1151
  const out: OpenPullRequest[] = [];
1152
1152
  for (const v of listed) {
1153
1153
  if (!isObject(v) || !isObject(v.head) || !isObject(v.base)) continue;
@@ -1160,7 +1160,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1160
1160
  const author = isObject(v.user) ? str(v.user.login) : undefined;
1161
1161
  out.push({ number, head, headSha, base: into, ...(baseSha ? { baseSha } : {}), ...(author ? { author } : {}), fork: !fromHere(v, head) });
1162
1162
  }
1163
- return out.sort((a, b) => a.number - b.number);
1163
+ return out.sort(byNumber);
1164
1164
  },
1165
1165
  branchHead: branchTip,
1166
1166
  async pullRequestHead(pr) {
@@ -1168,7 +1168,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
1168
1168
  try {
1169
1169
  got = await api.call("GET", `${repo}/pulls/${pr}`);
1170
1170
  } catch (err) {
1171
- if (err instanceof ForgeApiError && err.status === 404) return undefined;
1171
+ if (notFound(err)) return undefined;
1172
1172
  throw err;
1173
1173
  }
1174
1174
  if (!isObject(got) || !isObject(got.head)) return undefined;
@@ -1336,6 +1336,8 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1336
1336
  return { id, body: str(v.description) ?? "", ...(created ? { created } : {}), ...(str(v.title) !== undefined ? { title: str(v.title) } : {}), ...(author ? { author } : {}), ...(url ? { url } : {}) };
1337
1337
  };
1338
1338
  const notes = `${project}/merge_requests`;
1339
+ /** The open merge requests from (`source`) or into (`target`) `branch`. */
1340
+ const openMrs = (end: "source" | "target", branch: string): Promise<unknown[]> => api.list(`${notes}?state=opened&${end}_branch=${encodeURIComponent(branch)}`, pageParams, 100);
1339
1341
  const mergeRequest = (v: unknown): PullRequest | undefined => {
1340
1342
  if (!isObject(v)) return undefined;
1341
1343
  const number = num(v.iid);
@@ -1457,7 +1459,7 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1457
1459
  try {
1458
1460
  member = await api.call("GET", `${project}/members/all/${id}`);
1459
1461
  } catch (err) {
1460
- if (err instanceof ForgeApiError && err.status === 404) return `${login} is not a member`;
1462
+ if (notFound(err)) return `${login} is not a member`;
1461
1463
  return `could not read ${login}'s access (${err instanceof Error ? err.message : String(err)})`;
1462
1464
  }
1463
1465
  const level = isObject(member) ? (num(member.access_level) ?? 0) : 0;
@@ -1510,7 +1512,7 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1510
1512
  const got = await api.call("GET", `${notes}/${mr}`);
1511
1513
  return isObject(got) && got.state === "opened";
1512
1514
  } catch (err) {
1513
- if (err instanceof ForgeApiError && err.status === 404) return false;
1515
+ if (notFound(err)) return false;
1514
1516
  throw err;
1515
1517
  }
1516
1518
  },
@@ -1528,13 +1530,13 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1528
1530
  return mergeRequest(made) ?? { number: 0, title, body: spec.body, head: spec.head, base };
1529
1531
  },
1530
1532
  async findPullRequest(head) {
1531
- const open = await api.list(`${notes}?state=opened&source_branch=${encodeURIComponent(head)}`, pageParams, 100);
1533
+ const open = await openMrs("source", head);
1532
1534
  return open
1533
1535
  // A fork's merge request into this project has another source project.
1534
1536
  .filter((m) => isObject(m) && m.source_branch === head && (m.source_project_id === undefined || m.source_project_id === m.project_id))
1535
1537
  .map(mergeRequest)
1536
1538
  .filter((m): m is PullRequest => m !== undefined)
1537
- .sort((a, b) => a.number - b.number)[0];
1539
+ .sort(byNumber)[0];
1538
1540
  },
1539
1541
  async scheduledRuns(q) {
1540
1542
  // The variable the gitlab lexicon's generated Op file selects a scheduled job by.
@@ -1549,9 +1551,26 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1549
1551
  const last = newestTime(pipelines.map((p) => (isObject(p) ? str(p.created_at) : undefined)));
1550
1552
  return { ...(last ? { last } : {}), ...(ours.length === 0 ? { noSchedule: true } : {}) };
1551
1553
  },
1554
+ // #4628: the open merge requests into `base`, for the stale marking a push to it runs.
1555
+ async openPullRequests(base) {
1556
+ const out: OpenPullRequest[] = [];
1557
+ for (const m of await openMrs("target", base)) {
1558
+ if (!isObject(m)) continue;
1559
+ const number = num(m.iid);
1560
+ const head = str(m.source_branch);
1561
+ const headSha = str(m.sha);
1562
+ if (number === undefined || !head || !headSha || str(m.target_branch) !== base) continue;
1563
+ const refs = isObject(m.diff_refs) ? m.diff_refs : undefined;
1564
+ const baseSha = refs ? str(refs.base_sha) : undefined;
1565
+ const author = isObject(m.author) ? str(m.author.username) : undefined;
1566
+ const fork = num(m.source_project_id) !== undefined && num(m.source_project_id) !== num(m.target_project_id);
1567
+ out.push({ number, head, headSha, base, ...(baseSha ? { baseSha } : {}), ...(author ? { author } : {}), fork });
1568
+ }
1569
+ return out.sort(byNumber);
1570
+ },
1552
1571
  async mergeRequestJobs(branch, job) {
1553
1572
  const out: MergeRequestJob[] = [];
1554
- const open = await api.list(`${notes}?state=opened&target_branch=${encodeURIComponent(branch)}`, pageParams, 100);
1573
+ const open = await openMrs("target", branch);
1555
1574
  for (const m of open) {
1556
1575
  if (!isObject(m)) continue;
1557
1576
  const iid = num(m.iid);
@@ -1579,7 +1598,7 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
1579
1598
  try {
1580
1599
  got = await api.call("GET", `${notes}/${mr}`);
1581
1600
  } catch (err) {
1582
- if (err instanceof ForgeApiError && err.status === 404) return undefined;
1601
+ if (notFound(err)) return undefined;
1583
1602
  throw err;
1584
1603
  }
1585
1604
  if (!isObject(got)) return undefined;
@@ -45,8 +45,6 @@ describe("the pull-request loop bundle", () => {
45
45
  "packages/core/src/pr-migrations.ts",
46
46
  // The Pulumi URN rule (#4548, the may-appear rows): no imports.
47
47
  "packages/core/src/pulumi-urn.ts",
48
- // The next-release floor constant (#4480): no imports.
49
- "packages/core/src/release-floors.ts",
50
48
  ]);
51
49
  // About 89 KB today, after the hooks line (#4288), the blocked set (#4291), the scheduled-run reads (#4289) the requires checks (#4301) and the migration notes (#4407), about 97 KB; with the group lines (#4446), about 100 KB.
52
50
  // 120 KB (122,880 bytes) is the ruled ceiling: raised from 110 KB by the maintainer ruling of 2026-10-27 on #4481. It is not a figure to lower by trimming note text.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A narrowed plan in the note and the status (#4626): each narrowed
3
+ * member's row lists its addresses, a line says the plan on merge is of
4
+ * each member whole, and the status counts the narrowed members, in the
5
+ * product's words. Written for the ci-products post-merge pass.
6
+ */
7
+ import { describe, expect, test } from "vitest";
8
+ import { composeChangeSet } from "./change-set";
9
+ import { memberCounts, PR_REPORT_SCHEMA_ID, prStatusDescription, renderPrNote, type PrReport } from "./pr-loop";
10
+ import { assertProductWords } from "./ci-product-words";
11
+ import { PLYWOOD } from "./__fixtures__/product-words";
12
+
13
+ const hex = (n: number) => n.toString(16).padStart(64, "0");
14
+ const URN = "urn:pulumi:dev::shop::aws:s3/bucket:Bucket::site";
15
+ const doc = composeChangeSet([
16
+ {
17
+ member: { member: "shop-dev", lexicon: "pulumi", planner: "pulumi", status: "planned", planDigest: `jcs1-sha256:${hex(1)}`, holes: [] },
18
+ entries: [{ member: "shop-dev", lexicon: "pulumi", planner: "pulumi", address: URN, type: "aws:s3/bucket:Bucket", action: "create", attributes: [] }],
19
+ },
20
+ ]);
21
+ const report: PrReport = {
22
+ $schema: PR_REPORT_SCHEMA_ID,
23
+ contract: 1,
24
+ stage: "plan",
25
+ pr: 12,
26
+ env: "dev",
27
+ base: "1".repeat(40),
28
+ head: "2".repeat(40),
29
+ op: "pulumi-up",
30
+ gate: "up",
31
+ digest: doc.digest,
32
+ status: "planned",
33
+ approval: { status: "pending" },
34
+ selection: { changed: ["shop"], dependents: [], unclaimed: [], indeterminate: [], waves: [["shop"]] },
35
+ members: [{ member: "shop-dev", component: "shop", planDigest: `jcs1-sha256:${hex(1)}`, status: "planned", counts: memberCounts(doc, "shop-dev") }],
36
+ changeSet: doc,
37
+ };
38
+ const plywood = assertProductWords(PLYWOOD);
39
+
40
+ describe("a narrowed plan (#4626)", () => {
41
+ const narrowed: PrReport = { ...report, narrowed: { shop: [URN] } };
42
+
43
+ test("the member's row lists the addresses", () => {
44
+ const note = renderPrNote(narrowed, { words: plywood });
45
+ const row = note.split("\n").find((l) => l.startsWith("| `shop-dev`"))!;
46
+ expect(row).toContain(`narrowed to \`${URN}\``);
47
+ });
48
+
49
+ test("a line says so in the product's words, and that the update on merge plans each stack whole", () => {
50
+ const note = renderPrNote(narrowed, { words: plywood });
51
+ expect(note).toContain(`This preview was narrowed with \`--target\`: \`shop\` to \`${URN}\`. The approval binds the narrowed plan. On merge each stack is previewed whole.`);
52
+ });
53
+
54
+ test("the status counts the narrowed members", () => {
55
+ expect(prStatusDescription(narrowed, plywood)).toMatch(/^1 stack \(1 narrowed with --target\): /);
56
+ expect(prStatusDescription(narrowed, plywood).length).toBeLessThanOrEqual(140);
57
+ });
58
+
59
+ test("a plan that was not narrowed says nothing of it", () => {
60
+ expect(renderPrNote(report, { words: plywood })).not.toContain("narrowed");
61
+ expect(prStatusDescription(report, plywood)).not.toContain("narrowed");
62
+ });
63
+ });