@intentius/chant 0.124.55 → 0.124.56

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 (370) 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 +12 -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 -3
  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/pr.d.ts +5 -0
  58. package/dist/cli/handlers/pr.d.ts.map +1 -1
  59. package/dist/cli/handlers/pr.js +259 -4
  60. package/dist/cli/handlers/run-wave.js +89 -1
  61. package/dist/cli/main.d.ts.map +1 -1
  62. package/dist/cli/main.js +56 -2
  63. package/dist/cli/parse-args.d.ts.map +1 -1
  64. package/dist/cli/parse-args.js +107 -0
  65. package/dist/cli/registry.d.ts +38 -0
  66. package/dist/cli/registry.d.ts.map +1 -1
  67. package/dist/components/adoption.d.ts.map +1 -1
  68. package/dist/components/adoption.js +1 -2
  69. package/dist/components/capability.d.ts +37 -0
  70. package/dist/components/capability.d.ts.map +1 -1
  71. package/dist/components/capability.js +25 -0
  72. package/dist/components/check-hooks.d.ts +4 -1
  73. package/dist/components/check-hooks.d.ts.map +1 -1
  74. package/dist/components/check-steps.d.ts +74 -0
  75. package/dist/components/check-steps.d.ts.map +1 -0
  76. package/dist/components/check-steps.js +102 -0
  77. package/dist/components/ci-services.d.ts.map +1 -1
  78. package/dist/components/ci-services.js +1 -2
  79. package/dist/components/driver.d.ts +12 -0
  80. package/dist/components/driver.d.ts.map +1 -1
  81. package/dist/components/driver.js +35 -1
  82. package/dist/components/groups.d.ts.map +1 -1
  83. package/dist/components/groups.js +4 -3
  84. package/dist/components/pr-env-ledger.d.ts.map +1 -1
  85. package/dist/components/pr-env-ledger.js +1 -2
  86. package/dist/components/pr-environment.d.ts +1 -1
  87. package/dist/components/pr-environment.d.ts.map +1 -1
  88. package/dist/components/pr-environment.js +1 -1
  89. package/dist/components/pr-pipeline.d.ts +129 -3
  90. package/dist/components/pr-pipeline.d.ts.map +1 -1
  91. package/dist/components/pr-pipeline.js +153 -17
  92. package/dist/components/pr-run.d.ts +8 -0
  93. package/dist/components/pr-run.d.ts.map +1 -1
  94. package/dist/components/pr-run.js +9 -4
  95. package/dist/components/product-pipeline.d.ts +35 -2
  96. package/dist/components/product-pipeline.d.ts.map +1 -1
  97. package/dist/components/product-pipeline.js +24 -5
  98. package/dist/components/wave-plan.d.ts +8 -0
  99. package/dist/components/wave-plan.d.ts.map +1 -1
  100. package/dist/components/wave-plan.js +18 -2
  101. package/dist/e2e-harness/bucket.d.ts +21 -0
  102. package/dist/e2e-harness/bucket.d.ts.map +1 -0
  103. package/dist/e2e-harness/bucket.js +61 -0
  104. package/dist/e2e-harness/claim.d.ts +70 -0
  105. package/dist/e2e-harness/claim.d.ts.map +1 -0
  106. package/dist/e2e-harness/claim.js +98 -0
  107. package/dist/e2e-harness/driver.d.ts +64 -0
  108. package/dist/e2e-harness/driver.d.ts.map +1 -0
  109. package/dist/e2e-harness/driver.js +243 -0
  110. package/dist/e2e-harness/forgejo.d.ts +77 -0
  111. package/dist/e2e-harness/forgejo.d.ts.map +1 -0
  112. package/dist/e2e-harness/forgejo.js +205 -0
  113. package/dist/e2e-harness/git.d.ts +32 -0
  114. package/dist/e2e-harness/git.d.ts.map +1 -0
  115. package/dist/e2e-harness/git.js +67 -0
  116. package/dist/e2e-harness/index.d.ts +22 -0
  117. package/dist/e2e-harness/index.d.ts.map +1 -0
  118. package/dist/e2e-harness/index.js +48 -0
  119. package/dist/e2e-harness/jobs.d.ts +8 -0
  120. package/dist/e2e-harness/jobs.d.ts.map +1 -0
  121. package/dist/e2e-harness/jobs.js +34 -0
  122. package/dist/e2e-harness/pins.d.ts +45 -0
  123. package/dist/e2e-harness/pins.d.ts.map +1 -0
  124. package/dist/e2e-harness/pins.js +44 -0
  125. package/dist/e2e-harness/ports.d.ts +113 -0
  126. package/dist/e2e-harness/ports.d.ts.map +1 -0
  127. package/dist/e2e-harness/ports.js +4 -0
  128. package/dist/e2e-harness/reports.d.ts +45 -0
  129. package/dist/e2e-harness/reports.d.ts.map +1 -0
  130. package/dist/e2e-harness/reports.js +57 -0
  131. package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
  132. package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
  133. package/dist/e2e-harness/safe-run-cli.js +43 -0
  134. package/dist/e2e-harness/safe-run.d.ts +61 -0
  135. package/dist/e2e-harness/safe-run.d.ts.map +1 -0
  136. package/dist/e2e-harness/safe-run.js +172 -0
  137. package/dist/e2e-harness/scenario.d.ts +11 -0
  138. package/dist/e2e-harness/scenario.d.ts.map +1 -0
  139. package/dist/e2e-harness/scenario.js +89 -0
  140. package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  141. package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
  142. package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  143. package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  144. package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  145. package/dist/e2e-harness/schemas/index.d.ts +191 -0
  146. package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
  147. package/dist/e2e-harness/schemas/index.js +62 -0
  148. package/dist/e2e-harness/stack.d.ts +124 -0
  149. package/dist/e2e-harness/stack.d.ts.map +1 -0
  150. package/dist/e2e-harness/stack.js +207 -0
  151. package/dist/e2e-harness/steps.d.ts +11 -0
  152. package/dist/e2e-harness/steps.d.ts.map +1 -0
  153. package/dist/e2e-harness/steps.js +22 -0
  154. package/dist/e2e-harness.d.ts +3 -0
  155. package/dist/e2e-harness.d.ts.map +1 -0
  156. package/dist/e2e-harness.js +2 -0
  157. package/dist/exit-codes.d.ts +7 -1
  158. package/dist/exit-codes.d.ts.map +1 -1
  159. package/dist/exit-codes.js +7 -1
  160. package/dist/lexicon.d.ts +46 -0
  161. package/dist/lexicon.d.ts.map +1 -1
  162. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  163. package/dist/lifecycle/gate-ledger.js +2 -3
  164. package/dist/lifecycle/gated-request.d.ts.map +1 -1
  165. package/dist/lifecycle/gated-request.js +1 -2
  166. package/dist/lifecycle/query.d.ts.map +1 -1
  167. package/dist/lifecycle/query.js +4 -5
  168. package/dist/lifecycle/release-catalog.d.ts.map +1 -1
  169. package/dist/lifecycle/release-catalog.js +1 -1
  170. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  171. package/dist/lifecycle/release-ledger.js +1 -2
  172. package/dist/lifecycle/release-status.d.ts +20 -0
  173. package/dist/lifecycle/release-status.d.ts.map +1 -1
  174. package/dist/lifecycle/release-status.js +1 -22
  175. package/dist/lifecycle/wave-plans.d.ts +23 -7
  176. package/dist/lifecycle/wave-plans.d.ts.map +1 -1
  177. package/dist/lifecycle/wave-plans.js +9 -2
  178. package/dist/op/approval-status.d.ts +103 -0
  179. package/dist/op/approval-status.d.ts.map +1 -0
  180. package/dist/op/approval-status.js +197 -0
  181. package/dist/op/index.d.ts +1 -1
  182. package/dist/op/index.d.ts.map +1 -1
  183. package/dist/op/index.js +1 -1
  184. package/dist/op/op-waves-capability-spec.d.ts +8 -0
  185. package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
  186. package/dist/op/op-waves-capability-spec.js +21 -0
  187. package/dist/op/op-waves-release.d.ts.map +1 -1
  188. package/dist/op/op-waves-release.js +1 -2
  189. package/dist/op/op-waves-run.d.ts +7 -2
  190. package/dist/op/op-waves-run.d.ts.map +1 -1
  191. package/dist/op/op-waves-run.js +96 -4
  192. package/dist/op/op-waves-stand-down.d.ts.map +1 -1
  193. package/dist/op/op-waves-stand-down.js +1 -2
  194. package/dist/op/op-waves.d.ts +35 -0
  195. package/dist/op/op-waves.d.ts.map +1 -1
  196. package/dist/op/op-waves.js +46 -6
  197. package/dist/op/runtime.d.ts +4 -0
  198. package/dist/op/runtime.d.ts.map +1 -1
  199. package/dist/op/runtime.js +2 -3
  200. package/dist/otlp.d.ts.map +1 -1
  201. package/dist/otlp.js +1 -2
  202. package/dist/parallelism.d.ts +17 -0
  203. package/dist/parallelism.d.ts.map +1 -0
  204. package/dist/parallelism.js +33 -0
  205. package/dist/policy-source.d.ts.map +1 -1
  206. package/dist/policy-source.js +1 -2
  207. package/dist/pr-forge.d.ts.map +1 -1
  208. package/dist/pr-forge.js +56 -39
  209. package/dist/pr-loop.d.ts +9 -0
  210. package/dist/pr-loop.d.ts.map +1 -1
  211. package/dist/pr-loop.js +22 -3
  212. package/dist/pr-merge.d.ts +64 -0
  213. package/dist/pr-merge.d.ts.map +1 -0
  214. package/dist/pr-merge.js +78 -0
  215. package/dist/pr-post.d.ts +70 -1
  216. package/dist/pr-post.d.ts.map +1 -1
  217. package/dist/pr-post.js +116 -5
  218. package/dist/pr-report-url.d.ts.map +1 -1
  219. package/dist/pr-report-url.js +1 -2
  220. package/dist/release-floors.d.ts +1 -1
  221. package/dist/release-floors.js +1 -1
  222. package/dist/run-event.d.ts.map +1 -1
  223. package/dist/run-event.js +1 -2
  224. package/dist/scheduled-op-cloud.d.ts +32 -0
  225. package/dist/scheduled-op-cloud.d.ts.map +1 -0
  226. package/dist/scheduled-op-cloud.js +69 -0
  227. package/dist/wave-runtime.mjs +340 -327
  228. package/dist/workspace/ci-lock-grain.d.ts +5 -0
  229. package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
  230. package/dist/workspace/ci-lock-grain.js +1 -7
  231. package/dist/workspace/ci-run.d.ts.map +1 -1
  232. package/dist/workspace/ci-run.js +5 -1
  233. package/dist/workspace/pr-report.schema.json +5 -0
  234. package/package.json +1 -1
  235. package/src/ci-agent.ts +1 -2
  236. package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
  237. package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
  238. package/src/ci-audit/attribution.ts +260 -0
  239. package/src/ci-audit/audit-log.ts +220 -0
  240. package/src/ci-audit/ci-audit.test.ts +175 -0
  241. package/src/ci-audit/index.ts +15 -0
  242. package/src/ci-audit/unrecorded.ts +140 -0
  243. package/src/ci-audit.ts +2 -0
  244. package/src/ci-control.ts +3 -4
  245. package/src/ci-estate.ts +1 -2
  246. package/src/ci-identity-database.test.ts +2 -3
  247. package/src/ci-identity-targets.test.ts +1 -3
  248. package/src/ci-identity.ts +2 -3
  249. package/src/ci-job-guard.test.ts +154 -0
  250. package/src/ci-job-guard.ts +319 -0
  251. package/src/ci-jobs.ts +8 -0
  252. package/src/ci-product-comment-targets.test.ts +45 -0
  253. package/src/ci-product-words.ts +35 -6
  254. package/src/ci-product.ts +55 -3
  255. package/src/ci-respond-run.ts +291 -0
  256. package/src/ci-respond.test.ts +264 -0
  257. package/src/ci-respond.ts +412 -0
  258. package/src/cli/handlers/audit-log.ts +74 -0
  259. package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
  260. package/src/cli/handlers/build.ts +69 -0
  261. package/src/cli/handlers/ci-check-job.test.ts +114 -0
  262. package/src/cli/handlers/ci-check-job.ts +33 -0
  263. package/src/cli/handlers/ci-check.ts +38 -8
  264. package/src/cli/handlers/e2e-safe-run.ts +27 -0
  265. package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
  266. package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
  267. package/src/cli/handlers/pr.ts +228 -4
  268. package/src/cli/handlers/run-wave.ts +79 -1
  269. package/src/cli/main.test.ts +1 -1
  270. package/src/cli/main.ts +56 -2
  271. package/src/cli/parse-args.ts +77 -0
  272. package/src/cli/registry.ts +38 -0
  273. package/src/components/adoption.ts +1 -2
  274. package/src/components/capability.ts +50 -0
  275. package/src/components/check-hooks.ts +4 -1
  276. package/src/components/check-steps.test.ts +70 -0
  277. package/src/components/check-steps.ts +158 -0
  278. package/src/components/ci-services.ts +1 -2
  279. package/src/components/driver.ts +35 -1
  280. package/src/components/groups.ts +4 -2
  281. package/src/components/plan-flags.test.ts +46 -0
  282. package/src/components/pr-comment-preview-targets.test.ts +34 -0
  283. package/src/components/pr-env-ledger.ts +1 -2
  284. package/src/components/pr-env-run-bundle.test.ts +0 -20
  285. package/src/components/pr-environment.ts +1 -1
  286. package/src/components/pr-pipeline-runners.test.ts +80 -0
  287. package/src/components/pr-pipeline.ts +232 -17
  288. package/src/components/pr-run.ts +17 -6
  289. package/src/components/pr-stale-job.test.ts +34 -0
  290. package/src/components/product-pipeline.ts +50 -8
  291. package/src/components/wave-plan.ts +18 -2
  292. package/src/e2e-harness/__project__/chant.config.ts +4 -0
  293. package/src/e2e-harness/__project__/src/compose.ts +33 -0
  294. package/src/e2e-harness/bucket.ts +69 -0
  295. package/src/e2e-harness/claim.test.ts +150 -0
  296. package/src/e2e-harness/claim.ts +140 -0
  297. package/src/e2e-harness/driver.test.ts +304 -0
  298. package/src/e2e-harness/driver.ts +294 -0
  299. package/src/e2e-harness/forgejo.ts +267 -0
  300. package/src/e2e-harness/git.ts +96 -0
  301. package/src/e2e-harness/index.ts +50 -0
  302. package/src/e2e-harness/jobs.ts +35 -0
  303. package/src/e2e-harness/pins.ts +52 -0
  304. package/src/e2e-harness/ports.ts +130 -0
  305. package/src/e2e-harness/reports.ts +79 -0
  306. package/src/e2e-harness/safe-run-cli.test.ts +102 -0
  307. package/src/e2e-harness/safe-run-cli.ts +54 -0
  308. package/src/e2e-harness/safe-run.ts +198 -0
  309. package/src/e2e-harness/scenario.ts +89 -0
  310. package/src/e2e-harness/schemas/README.md +62 -0
  311. package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  312. package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
  313. package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  314. package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  315. package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  316. package/src/e2e-harness/schemas/index.ts +220 -0
  317. package/src/e2e-harness/schemas.test.ts +145 -0
  318. package/src/e2e-harness/stack.test.ts +124 -0
  319. package/src/e2e-harness/stack.ts +306 -0
  320. package/src/e2e-harness/steps.ts +30 -0
  321. package/src/e2e-harness.ts +2 -0
  322. package/src/exit-codes.test.ts +3 -2
  323. package/src/exit-codes.ts +7 -1
  324. package/src/gate-decision-bundle.test.ts +0 -2
  325. package/src/lexicon.ts +48 -0
  326. package/src/lifecycle/control-entries-ledger.test.ts +2 -3
  327. package/src/lifecycle/gate-ledger.ts +2 -3
  328. package/src/lifecycle/gated-request.ts +1 -2
  329. package/src/lifecycle/query.ts +4 -5
  330. package/src/lifecycle/release-catalog.test.ts +3 -4
  331. package/src/lifecycle/release-catalog.ts +1 -1
  332. package/src/lifecycle/release-ledger.ts +1 -2
  333. package/src/lifecycle/release-status.test.ts +3 -4
  334. package/src/lifecycle/release-status.ts +1 -2
  335. package/src/lifecycle/wave-plans.ts +33 -5
  336. package/src/op/approval-status.test.ts +134 -0
  337. package/src/op/approval-status.ts +235 -0
  338. package/src/op/gate-review.test.ts +2 -1
  339. package/src/op/index.ts +2 -0
  340. package/src/op/op-waves-after-plan.test.ts +12 -0
  341. package/src/op/op-waves-capability-spec.ts +20 -0
  342. package/src/op/op-waves-parallelism.test.ts +89 -0
  343. package/src/op/op-waves-pull-request.test.ts +78 -1
  344. package/src/op/op-waves-release.ts +1 -2
  345. package/src/op/op-waves-run.ts +94 -4
  346. package/src/op/op-waves-stand-down.ts +1 -2
  347. package/src/op/op-waves.ts +63 -6
  348. package/src/op/runtime.ts +6 -3
  349. package/src/otlp.ts +1 -2
  350. package/src/parallelism.test.ts +38 -0
  351. package/src/parallelism.ts +33 -0
  352. package/src/policy-source.ts +1 -2
  353. package/src/pr-forge-bundle.test.ts +1 -1
  354. package/src/pr-forge.ts +54 -35
  355. package/src/pr-loop-bundle.test.ts +1 -1
  356. package/src/pr-loop-narrowed.test.ts +63 -0
  357. package/src/pr-loop.ts +30 -3
  358. package/src/pr-merge.test.ts +100 -0
  359. package/src/pr-merge.ts +105 -0
  360. package/src/pr-post-stale.test.ts +163 -0
  361. package/src/pr-post.ts +159 -5
  362. package/src/pr-report-url.ts +1 -2
  363. package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
  364. package/src/release-floors.ts +1 -1
  365. package/src/run-event.ts +1 -2
  366. package/src/scheduled-op-cloud.ts +68 -0
  367. package/src/stage-hooks-bundle.test.ts +0 -2
  368. package/src/workspace/ci-lock-grain.ts +1 -2
  369. package/src/workspace/ci-run.ts +5 -1
  370. package/src/workspace/pr-report.schema.json +5 -0
@@ -29,7 +29,7 @@
29
29
 
30
30
  import { resolvePlannedLock, type PlannedLock } from "../lifecycle/lock-rows";
31
31
  import type { PlanShape } from "./covered-round";
32
- import { assertTargetsAccepted, resolveStepInput, unresolvedWiringSources, type DriverComponent, type DriverPhase, type DriverStep } from "./driver";
32
+ import { assertPlanFlagsAccepted, assertTargetsAccepted, resolveStepInput, unresolvedWiringSources, type DriverComponent, type DriverPhase, type DriverStep } from "./driver";
33
33
  import { componentPlanDigest } from "./gate-plan";
34
34
  import { componentDeployInputs, type ComponentDeployInputs } from "./deploy-inputs";
35
35
  import { computePlanDigest } from "../lifecycle/plan-digest";
@@ -156,12 +156,13 @@ export async function planWaveComponent(
156
156
  const locks: Record<string, PlannedLock> = {};
157
157
  const locations: Record<string, string> = {};
158
158
  assertTargetsAccepted(component, registry, ctx);
159
+ assertPlanFlagsAccepted(component, registry, ctx);
159
160
  for (const step of capabilitySteps(component.deploy)) {
160
161
  const capability = registry.resolve(step.kind);
161
162
  if (!capability.plan) continue;
162
163
  const { kind: _kind, ...rest } = step;
163
164
  const input = resolveStepInput(rest, {}, componentOutputs);
164
- const planned = bindTargets(step.kind, ctx, await capability.plan(planContext(ctx, rest, componentOutputs), input as never));
165
+ const planned = bindPlanFlags(ctx, bindTargets(step.kind, ctx, await capability.plan(planContext(ctx, rest, componentOutputs), input as never)));
165
166
  const member = { member: planned.member, planDigest: planned.planDigest };
166
167
  members.push(member);
167
168
  parts.push(planned.changeSet ?? emptyPart(member));
@@ -257,6 +258,21 @@ export function bindTargets(kind: string, ctx: DeployContext, planned: Capabilit
257
258
  return { ...planned, planDigest, targets: want, ...(changeSet ? { changeSet } : {}) };
258
259
  }
259
260
 
261
+ /**
262
+ * A step's plan made with `ctx.refresh` or `ctx.targetDependents` (#4627),
263
+ * its digest bound to them: the digest over the plan's own digest and the
264
+ * flags, so an approval of a refreshed or widened plan covers no plain one,
265
+ * as {@link bindTargets} binds targets. Without either flag, the plan as it
266
+ * came.
267
+ */
268
+ export function bindPlanFlags(ctx: Pick<DeployContext, "refresh" | "targetDependents">, planned: CapabilityPlan): CapabilityPlan {
269
+ const flags = { ...(ctx.refresh ? { refresh: true } : {}), ...(ctx.targetDependents ? { targetDependents: true } : {}) };
270
+ if (Object.keys(flags).length === 0) return planned;
271
+ const planDigest = computePlanDigest("capability-plan-flags", { plan: planned.planDigest, ...flags });
272
+ const changeSet = planned.changeSet ? { ...planned.changeSet, member: { ...planned.changeSet.member, planDigest } } : undefined;
273
+ return { ...planned, planDigest, ...(changeSet ? { changeSet } : {}) };
274
+ }
275
+
260
276
  /** `next` over `prior`, as a later step's outputs win over an earlier one's in a run. */
261
277
  function mergePlannedOutputs(prior: PlannedOutputs | undefined, next: PlannedOutputs): PlannedOutputs {
262
278
  const known = { ...(prior?.known ?? {}), ...next.known };
@@ -0,0 +1,4 @@
1
+ import type { ChantConfig } from "@intentius/chant";
2
+
3
+ /** The e2e harness's compose project (chant#4587): floci, Forgejo, forgejo-runner, and the sql emulator behind a profile. */
4
+ export default { lexicons: ["docker"] } satisfies ChantConfig;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The e2e harness's compose project (chant#4587), the whole stack:
3
+ * floci, Forgejo and forgejo-runner with the docker executor on one network,
4
+ * and the sql emulator's ClickHouse and Postgres behind the `sql` profile.
5
+ * The services are ../../stack.ts's, and every image is ../../pins.ts's.
6
+ *
7
+ * The project name comes from CHANT_E2E_PROJECT at build time (default
8
+ * chant-e2e) and names the network, the containers and the volumes; pass the
9
+ * same name to `docker compose -p`. Host ports bind to 127.0.0.1 and move
10
+ * with CHANT_E2E_FLOCI_PORT, CHANT_E2E_FORGEJO_PORT, CHANT_E2E_CLICKHOUSE_PORT
11
+ * and CHANT_E2E_POSTGRES_PORT.
12
+ *
13
+ * chant build <this dir>/src --lexicon docker -o compose.yaml
14
+ * docker compose -p chant-e2e -f compose.yaml up -d
15
+ * docker compose -p chant-e2e -f compose.yaml --profile sql up -d
16
+ *
17
+ * A product with its own words or ports writes the same few lines with its
18
+ * own options to harnessStack.
19
+ */
20
+ import { Network, Service, Volume } from "@intentius/chant-lexicon-docker";
21
+ import { harnessStack } from "../../stack";
22
+
23
+ const h = harnessStack({ project: process.env.CHANT_E2E_PROJECT ?? "chant-e2e" });
24
+
25
+ export const harness = new Network(h.network);
26
+ export const forgejoData = new Volume(h.volumes.forgejoData);
27
+ export const runnerData = new Volume(h.volumes.runnerData);
28
+
29
+ export const floci = new Service(h.services.floci);
30
+ export const forgejo = new Service(h.services.forgejo);
31
+ export const forgejoRunner = new Service(h.services.forgejoRunner);
32
+ export const clickhouse = new Service(h.services.clickhouse);
33
+ export const postgres = new Service(h.services.postgres);
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A bucket, for real: one bucket in the harness's floci, path-style S3 over
3
+ * http (chant#4587, from the fan-out demo's lib/bucket.ts). floci takes
4
+ * unsigned requests, so the driver needs no AWS CLI on the host. chant's
5
+ * reports under `--report-url` are read from here.
6
+ */
7
+ import type { Bucket } from "./ports";
8
+
9
+ const TIMEOUT_MS = 30_000;
10
+
11
+ export class FlociBucket implements Bucket {
12
+ /** `endpoint` is floci as the driver reaches it, http://localhost:<port>. */
13
+ constructor(
14
+ private readonly endpoint: string,
15
+ private readonly bucket: string,
16
+ ) {}
17
+
18
+ private url(key = ""): string {
19
+ return `${this.endpoint.replace(/\/$/, "")}/${this.bucket}${key ? `/${key.split("/").map(encodeURIComponent).join("/")}` : ""}`;
20
+ }
21
+
22
+ /** The bucket itself. An existing one is kept. */
23
+ async create(): Promise<void> {
24
+ const res = await fetch(this.url(), { method: "PUT", signal: AbortSignal.timeout(TIMEOUT_MS) });
25
+ if (!res.ok && res.status !== 409) throw new Error(`floci PUT ${this.bucket} answered ${res.status}`);
26
+ }
27
+
28
+ async get(key: string): Promise<string | null> {
29
+ const res = await fetch(this.url(key), { signal: AbortSignal.timeout(TIMEOUT_MS) });
30
+ if (res.status === 404 || res.status === 403) return null;
31
+ if (!res.ok) throw new Error(`floci GET ${key} answered ${res.status}`);
32
+ return res.text();
33
+ }
34
+
35
+ async put(key: string, body: string, contentType: string): Promise<void> {
36
+ const res = await fetch(this.url(key), {
37
+ method: "PUT",
38
+ headers: { "content-type": contentType },
39
+ body,
40
+ signal: AbortSignal.timeout(TIMEOUT_MS),
41
+ });
42
+ if (!res.ok) throw new Error(`floci PUT ${key} answered ${res.status}`);
43
+ }
44
+
45
+ async list(prefix: string): Promise<string[]> {
46
+ const keys: string[] = [];
47
+ let token: string | undefined;
48
+ for (;;) {
49
+ const q = new URLSearchParams({ "list-type": "2", prefix, ...(token ? { "continuation-token": token } : {}) });
50
+ const res = await fetch(`${this.url()}?${q.toString()}`, { signal: AbortSignal.timeout(TIMEOUT_MS) });
51
+ if (!res.ok) throw new Error(`floci list ${prefix} answered ${res.status}`);
52
+ const xml = await res.text();
53
+ for (const m of xml.matchAll(/<Key>([^<]*)<\/Key>/g)) keys.push(decodeXml(m[1]!));
54
+ const next = /<NextContinuationToken>([^<]*)<\/NextContinuationToken>/.exec(xml)?.[1];
55
+ if (!next || !/<IsTruncated>true<\/IsTruncated>/.test(xml)) break;
56
+ token = decodeXml(next);
57
+ }
58
+ return keys;
59
+ }
60
+
61
+ async delete(key: string): Promise<void> {
62
+ const res = await fetch(this.url(key), { method: "DELETE", signal: AbortSignal.timeout(TIMEOUT_MS) });
63
+ if (!res.ok && res.status !== 404) throw new Error(`floci DELETE ${key} answered ${res.status}`);
64
+ }
65
+ }
66
+
67
+ function decodeXml(s: string): string {
68
+ return s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
69
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The claim row protocol and the no-real-cloud wrapper (chant#4587): a row
3
+ * from a run's verdicts, the run as an e2e-claim ledger record (#4551), the
4
+ * per-product render, the engine-version rule, and recording refused
5
+ * without a CLEAN scan. The wrapper's own runs are `node -e` one-liners.
6
+ */
7
+ import { mkdtempSync, readFileSync, rmSync } from "node:fs";
8
+ import { tmpdir } from "node:os";
9
+ import { join } from "node:path";
10
+ import { afterAll, describe, expect, test } from "vitest";
11
+ import type { OpRunRecord, OpRunRecordInput } from "../op/runtime";
12
+ import { CLAIM_OP, claimRow, claimRowsOf, claimRunRecordInput, renderClaims, rowCountsFor } from "./claim";
13
+ import type { ArmRun, ClaimRun } from "./driver";
14
+ import { FLOCI_DIGEST } from "./pins";
15
+ import { SafeRun, backendIsLocal, realCloudHits, recordClaimRow, safeRunEnv } from "./safe-run";
16
+ import type { ClaimRow } from "./schemas/index";
17
+
18
+ const tmp = mkdtempSync(join(tmpdir(), "chant-e2e-claim-test-"));
19
+ afterAll(() => rmSync(tmp, { recursive: true, force: true }));
20
+
21
+ const COMMIT = "e962b2c0000000000000000000000000000000aa";
22
+ const scenario = { id: "tg-estate-overlap", product: "terragucci", claim: "choudoufu/rows-overlap" };
23
+
24
+ const arm = (a: "plain" | "break", outcome: ArmRun["outcome"]): ArmRun => ({
25
+ scenario: scenario.id,
26
+ arm: a,
27
+ outcome,
28
+ started: a === "plain" ? "2026-10-28T10:00:00.000Z" : "2026-10-28T10:05:00.000Z",
29
+ ended: a === "plain" ? "2026-10-28T10:04:00.000Z" : "2026-10-28T10:09:00.000Z",
30
+ steps: [
31
+ { id: "one", do: "open", pull: 1 },
32
+ ...(outcome === "held" ? [] : [{ id: "one-apply", do: "apply" as const, stopped: { outcome: outcome as "broke", reason: "a is failed, not applied" } }]),
33
+ ],
34
+ });
35
+
36
+ const run: ClaimRun = { plain: arm("plain", "held"), break: arm("break", "broke"), verdicts: { plain: "pass", break: "caught" } };
37
+
38
+ const rowAt = (date: string, over: Partial<Parameters<typeof claimRow>[0]> = {}): ClaimRow =>
39
+ claimRow({ scenario, productCommit: COMMIT, engine: { binary: "choudoufu", version: "0.31.0" }, verdicts: run.verdicts, at: new Date(`${date}T10:09:00Z`), ...over });
40
+
41
+ const record = (input: OpRunRecordInput, id: string): OpRunRecord => ({ version: 1, id, ...input });
42
+
43
+ describe("the claim row", () => {
44
+ test("names the scenario's product and claim, the run's date and the harness's floci pin", () => {
45
+ const r = rowAt("2026-10-28");
46
+ expect(r).toMatchObject({ product: "terragucci", scenario: "tg-estate-overlap", claim: "choudoufu/rows-overlap", date: "2026-10-28", floci: FLOCI_DIGEST, plain: "pass", break: "caught", safeRun: "CLEAN" });
47
+ expect(() => rowAt("2026-10-28", { productCommit: "e962b2c" })).toThrow(/not e2e-claim-row\/v1/);
48
+ });
49
+
50
+ test("is the claim outcome of an e2e-claim run record, one phase per arm", () => {
51
+ const input = claimRunRecordInput({ row: rowAt("2026-10-28"), run, env: "local", gitSha: COMMIT });
52
+ expect(input.op).toBe(CLAIM_OP);
53
+ expect(input.status).toBe("ok");
54
+ expect(input.labels).toEqual({ Product: "terragucci", Scenario: "tg-estate-overlap", Claim: "choudoufu/rows-overlap" });
55
+ expect(input.started).toBe(run.plain.started);
56
+ expect(input.ended).toBe(run.break.ended);
57
+ expect(input.phases.map((p) => [p.name, p.status])).toEqual([
58
+ ["plain", "ok"],
59
+ ["break", "fail"],
60
+ ]);
61
+ expect(input.phases[1]!.steps.at(-1)).toMatchObject({ fn: "apply:one-apply", status: "fail", error: "broke: a is failed, not applied" });
62
+ expect(input.outcomes.claim).toEqual(rowAt("2026-10-28"));
63
+
64
+ const missed = claimRunRecordInput({ row: { ...rowAt("2026-10-28"), break: "missed" }, run });
65
+ expect(missed.status).toBe("fail");
66
+ });
67
+
68
+ test("renders a product's newest row per scenario and claim, from the ledger's records", () => {
69
+ const old = rowAt("2026-10-20", { verdicts: { plain: "fail", break: "caught" } });
70
+ const now = rowAt("2026-10-28");
71
+ const other = claimRow({ scenario: { ...scenario, id: "tg-migrate", claim: "choudoufu/7" }, productCommit: COMMIT, engine: { binary: "choudoufu", version: "0.31.0" }, verdicts: run.verdicts, at: new Date("2026-10-27T00:00:00Z") });
72
+ const foreign = claimRow({ scenario: { ...scenario, product: "plywood", id: "pw-disjoint" }, productCommit: COMMIT, engine: { binary: "plunge", version: "0.9.0" }, verdicts: run.verdicts, at: new Date("2026-10-27T00:00:00Z") });
73
+ const records = [
74
+ record({ ...claimRunRecordInput({ row: now, run }), ended: "2026-10-28T10:09:00.000Z" }, "c"),
75
+ record({ ...claimRunRecordInput({ row: old, run }), ended: "2026-10-20T10:09:00.000Z" }, "a"),
76
+ record({ ...claimRunRecordInput({ row: other, run }), ended: "2026-10-27T00:00:00.000Z" }, "b"),
77
+ record({ ...claimRunRecordInput({ row: foreign, run }), ended: "2026-10-27T00:00:00.000Z" }, "d"),
78
+ record({ op: "pr-apply", env: "local", started: "", ended: "2026-10-29T00:00:00.000Z", status: "ok", labels: {}, outcomes: { claim: now }, phases: [] }, "e"),
79
+ record({ op: CLAIM_OP, env: "local", started: "", ended: "2026-10-29T00:00:00.000Z", status: "ok", labels: {}, outcomes: { claim: { not: "a row" } }, phases: [] }, "f"),
80
+ ];
81
+ const rows = claimRowsOf(records);
82
+ expect(rows).toHaveLength(4);
83
+ const doc = renderClaims("terragucci", rows);
84
+ expect(doc.product).toBe("terragucci");
85
+ expect(doc.rows.map((r) => [r.scenario, r.date, r.plain])).toEqual([
86
+ ["tg-estate-overlap", "2026-10-28", "pass"],
87
+ ["tg-migrate", "2026-10-27", "pass"],
88
+ ]);
89
+ });
90
+
91
+ test("counts for an engine claim only at the version the row ran, and only when it holds", () => {
92
+ const r = rowAt("2026-10-28");
93
+ expect(rowCountsFor(r, { binary: "choudoufu", version: "v0.31.0" })).toBe(true);
94
+ expect(rowCountsFor(r, { binary: "choudoufu", version: "0.28.0" })).toBe(false);
95
+ expect(rowCountsFor(r, { binary: "plunge", version: "0.31.0" })).toBe(false);
96
+ expect(rowCountsFor({ ...r, break: "missed" }, { binary: "choudoufu", version: "0.31.0" })).toBe(false);
97
+ });
98
+ });
99
+
100
+ describe("the no-real-cloud wrapper", () => {
101
+ test("scrubs every cloud variable and sets floci's test keys, empty config and a file backend", () => {
102
+ const env = safeRunEnv(
103
+ { scratch: join(tmp, "env"), extra: { BREAK: "1" } },
104
+ { PATH: "/usr/bin", AWS_PROFILE: "prod", AWS_SESSION_TOKEN: "x", GOOGLE_APPLICATION_CREDENTIALS: "/k.json", ARM_CLIENT_SECRET: "s", CLOUDSDK_CORE_PROJECT: "p", PULUMI_ACCESS_TOKEN: "pul-x" },
105
+ );
106
+ expect(env.PATH).toBe("/usr/bin");
107
+ expect(env.BREAK).toBe("1");
108
+ for (const k of ["AWS_PROFILE", "AWS_SESSION_TOKEN", "GOOGLE_APPLICATION_CREDENTIALS", "ARM_CLIENT_SECRET", "CLOUDSDK_CORE_PROJECT", "PULUMI_ACCESS_TOKEN"]) expect(env[k], k).toBeUndefined();
109
+ expect(env).toMatchObject({ AWS_ACCESS_KEY_ID: "test", AWS_SECRET_ACCESS_KEY: "test", AWS_REGION: "us-east-1", GCE_METADATA_HOST: "127.0.0.1:9", PULUMI_SKIP_UPDATE_CHECK: "true" });
110
+ expect(env.PULUMI_BACKEND_URL).toMatch(/^file:\/\//);
111
+ expect(readFileSync(env.AWS_SHARED_CREDENTIALS_FILE!, "utf8")).toBe("");
112
+ expect(env.CLOUDSDK_CONFIG!.startsWith(join(tmp, "env"))).toBe(true);
113
+ });
114
+
115
+ test("refuses a credentials file and a backend that is not local", () => {
116
+ expect(() => safeRunEnv({ scratch: join(tmp, "x"), extra: { GOOGLE_APPLICATION_CREDENTIALS: "/k.json" } }, {})).toThrow(/refused/);
117
+ expect(() => safeRunEnv({ scratch: join(tmp, "x") }, { PULUMI_BACKEND_URL: "https://api.pulumi.com" })).toThrow(/not a local backend/);
118
+ expect(safeRunEnv({ scratch: join(tmp, "x") }, { PULUMI_BACKEND_URL: "file:///tmp/s" }).PULUMI_BACKEND_URL).toBe("file:///tmp/s");
119
+ expect(backendIsLocal("plunge+s3://b?endpoint=http://127.0.0.1:4566")).toBe(true);
120
+ expect(backendIsLocal("plunge+s3://b?region=us-east-1")).toBe(false);
121
+ });
122
+
123
+ test("finds what a real cloud says to a fake credential, and nothing an emulator says", () => {
124
+ expect(realCloudHits("ok\nAn error occurred (InvalidClientTokenId) when calling GetCallerIdentity\n")).toEqual(["log:2:An error occurred (InvalidClientTokenId) when calling GetCallerIdentity"]);
125
+ expect(realCloudHits("401 Unauthorized from https://sts.amazonaws.com/")).toHaveLength(1);
126
+ expect(realCloudHits("401 from http://floci:4566/\nstack applied in 4012ms")).toEqual([]);
127
+ });
128
+
129
+ test("a run whose log shows a real cloud is not recorded; a CLEAN one is, as an e2e-claim record", async () => {
130
+ const dirty = new SafeRun({ scratch: join(tmp, "dirty") });
131
+ expect(await dirty.run([process.execPath, "-e", "console.log('UnrecognizedClientException: The security token included in the request is invalid')"])).toBe(0);
132
+ const v = dirty.scan();
133
+ expect(v.verdict).toBe("REAL-CLOUD");
134
+ const appended: OpRunRecordInput[] = [];
135
+ await expect(recordClaimRow({ row: rowAt("2026-10-28"), run, verdict: v, append: async (i) => void appended.push(i) })).rejects.toThrow(/refusing to record tg-estate-overlap/);
136
+ expect(appended).toEqual([]);
137
+
138
+ const clean = new SafeRun({ scratch: join(tmp, "clean"), scan: [join(tmp, "clean")] });
139
+ expect(await clean.run([process.execPath, "-e", "process.exit(3)"])).toBe(3);
140
+ expect(await clean.outOfBand().run([process.execPath, "-e", "console.log(process.env.AWS_ACCESS_KEY_ID)"])).toBe(0);
141
+ expect(readFileSync(clean.logFile, "utf8")).toContain("\ntest\n");
142
+ const ok = clean.scan();
143
+ expect(ok).toEqual({ verdict: "CLEAN" });
144
+ await recordClaimRow({ row: rowAt("2026-10-28"), run, verdict: ok, append: async (i) => void appended.push(i) });
145
+ expect(appended.map((a) => a.op)).toEqual([CLAIM_OP]);
146
+
147
+ const missing = new SafeRun({ scratch: join(tmp, "missing"), scan: [join(tmp, "no-such-dir")] });
148
+ expect(missing.scan().verdict).toBe("REAL-CLOUD");
149
+ });
150
+ });
@@ -0,0 +1,140 @@
1
+ /**
2
+ * The claim row protocol (chant#4587), terragucci's: one claim, a plain run
3
+ * that must pass, a BREAK=1 run that must be caught, one row. A row records
4
+ * the product and its commit, the engine binary and version, the floci
5
+ * digest, the date and both verdicts.
6
+ *
7
+ * Following the ledger ruling (chant#4551), the run is a ledger record: op
8
+ * `e2e-claim`, the row as its `claim` outcome, one phase per arm. A
9
+ * product's page reads e2e-claims/v1, rendered from those records with the
10
+ * newest row per scenario and claim. Recording goes through ./safe-run.ts's
11
+ * `recordClaimRow`, which refuses a run whose scan was not CLEAN.
12
+ */
13
+ import type { OpRunRecord, OpRunRecordInput } from "../op/runtime";
14
+ import type { RunOrigin } from "../lifecycle/release-ledger";
15
+ import type { ArmRun, ClaimRun } from "./driver";
16
+ import { FLOCI_DIGEST } from "./pins";
17
+ import {
18
+ E2E_CLAIMS_SCHEMA,
19
+ E2E_CLAIM_ROW_SCHEMA,
20
+ validateClaimRow,
21
+ validateClaims,
22
+ type BreakVerdict,
23
+ type ClaimRow,
24
+ type ClaimsDoc,
25
+ type PlainVerdict,
26
+ type Scenario,
27
+ } from "./schemas/index";
28
+
29
+ /** The op every claim run is recorded under. */
30
+ export const CLAIM_OP = "e2e-claim";
31
+
32
+ export interface ClaimRowInput {
33
+ scenario: Pick<Scenario, "id" | "product" | "claim">;
34
+ productCommit: string;
35
+ engine: { binary: string; version: string };
36
+ verdicts: { plain: PlainVerdict; break: BreakVerdict };
37
+ /** When the run ended. */
38
+ at: Date;
39
+ /** The floci digest the stack ran. Default the harness's pin. */
40
+ floci?: string;
41
+ chant?: string;
42
+ runUrl?: string;
43
+ }
44
+
45
+ /** A claim row, validated. A run's scan verdict is added when it is recorded. */
46
+ export function claimRow(i: ClaimRowInput): ClaimRow {
47
+ const row: ClaimRow = {
48
+ $schema: E2E_CLAIM_ROW_SCHEMA,
49
+ contract: 1,
50
+ product: i.scenario.product,
51
+ productCommit: i.productCommit,
52
+ scenario: i.scenario.id,
53
+ claim: i.scenario.claim,
54
+ engine: { binary: i.engine.binary, version: i.engine.version },
55
+ floci: i.floci ?? FLOCI_DIGEST,
56
+ ...(i.chant ? { chant: i.chant } : {}),
57
+ date: i.at.toISOString().slice(0, 10),
58
+ plain: i.verdicts.plain,
59
+ break: i.verdicts.break,
60
+ safeRun: "CLEAN",
61
+ ...(i.runUrl ? { runUrl: i.runUrl } : {}),
62
+ };
63
+ const v = validateClaimRow(row);
64
+ if (!v.ok) throw new Error(`the claim row for ${row.scenario} is not e2e-claim-row/v1: ${v.errors.join("; ")}`);
65
+ return row;
66
+ }
67
+
68
+ /** Whether a row proves its claim: the plain run passed and the BREAK run was caught. */
69
+ export const rowHolds = (row: Pick<ClaimRow, "plain" | "break">): boolean => row.plain === "pass" && row.break === "caught";
70
+
71
+ const phaseOf = (run: ArmRun) => ({
72
+ name: run.arm,
73
+ // A phase fails when a step did, as the ledger reads phases; the arm's verdict is in the row.
74
+ status: run.outcome === "held" ? ("ok" as const) : ("fail" as const),
75
+ steps: run.steps.map((s) => ({
76
+ fn: `${s.do}:${s.id}`,
77
+ status: s.stopped ? ("fail" as const) : ("ok" as const),
78
+ durationMs: 0,
79
+ ...(s.stopped ? { error: `${s.stopped.outcome}: ${s.stopped.reason}` } : {}),
80
+ })),
81
+ });
82
+
83
+ /**
84
+ * The run record of one claim run (#4551): op `e2e-claim`, labels naming the
85
+ * product, scenario and claim, the row as the `claim` outcome, and one phase
86
+ * per arm with a step per scenario step. Status ok when the row holds.
87
+ */
88
+ export function claimRunRecordInput(o: { row: ClaimRow; run: ClaimRun; env?: string; gitSha?: string; runOrigin?: RunOrigin }): OpRunRecordInput {
89
+ return {
90
+ op: CLAIM_OP,
91
+ env: o.env ?? "local",
92
+ started: o.run.plain.started,
93
+ ended: o.run.break.ended,
94
+ status: rowHolds(o.row) ? "ok" : "fail",
95
+ labels: { Product: o.row.product, Scenario: o.row.scenario, Claim: o.row.claim },
96
+ outcomes: { claim: o.row },
97
+ phases: [phaseOf(o.run.plain), phaseOf(o.run.break)],
98
+ ...(o.gitSha ? { gitSha: o.gitSha } : {}),
99
+ ...(o.runOrigin ? { runOrigin: o.runOrigin } : {}),
100
+ };
101
+ }
102
+
103
+ /** The rows on a ledger's e2e-claim records, oldest first. A record whose outcome is not a row is skipped. */
104
+ export function claimRowsOf(records: readonly OpRunRecord[]): ClaimRow[] {
105
+ return records
106
+ .filter((r) => r.op === CLAIM_OP)
107
+ .slice()
108
+ .sort((a, b) => a.ended.localeCompare(b.ended))
109
+ .map((r) => r.outcomes.claim)
110
+ .filter((c): c is ClaimRow => validateClaimRow(c).ok);
111
+ }
112
+
113
+ /**
114
+ * e2e-claims/v1 for one product: its newest row per scenario and claim,
115
+ * sorted by scenario then claim. Rows are recorded in order, so the last
116
+ * one read for a pair is the newest.
117
+ */
118
+ export function renderClaims(product: string, rows: readonly ClaimRow[]): ClaimsDoc {
119
+ const newest = new Map<string, ClaimRow>();
120
+ for (const row of rows) if (row.product === product) newest.set(`${row.scenario}\u0000${row.claim}`, row);
121
+ const doc: ClaimsDoc = {
122
+ $schema: E2E_CLAIMS_SCHEMA,
123
+ contract: 1,
124
+ product,
125
+ rows: [...newest.values()].sort((a, b) => a.scenario.localeCompare(b.scenario) || a.claim.localeCompare(b.claim)),
126
+ };
127
+ const v = validateClaims(doc);
128
+ if (!v.ok) throw new Error(`the rendered claims of ${product} are not e2e-claims/v1: ${v.errors.join("; ")}`);
129
+ return doc;
130
+ }
131
+
132
+ /**
133
+ * Whether an engine claim about `version` may count a row: only when the row
134
+ * ran that version of that engine (chant#4586, the v0.28.0 against 0.31.0
135
+ * split), and only when it holds.
136
+ */
137
+ export function rowCountsFor(row: ClaimRow, engine: { binary: string; version: string }): boolean {
138
+ const norm = (v: string) => v.replace(/^v/, "");
139
+ return row.engine.binary === engine.binary && norm(row.engine.version) === norm(engine.version) && rowHolds(row);
140
+ }