@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
@@ -0,0 +1,245 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json",
4
+ "title": "fan-out demo step",
5
+ "description": "The step record of the fan-out demo, written to step.json at every step of a cycle. It narrates; the facts a viewer draws come from chant's own reports named under reports. Version 1 of the demo contract. Required fields are kept to a minimum: a new field is optional within contract 1, readers ignore fields they do not know, and a rename or removal is contract 2.",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "contract",
10
+ "demo",
11
+ "cycle",
12
+ "step"
13
+ ],
14
+ "properties": {
15
+ "$schema": {
16
+ "const": "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json"
17
+ },
18
+ "contract": {
19
+ "const": 1
20
+ },
21
+ "demo": {
22
+ "type": "string",
23
+ "description": "The demo's name, fan-out-estate."
24
+ },
25
+ "repo": {
26
+ "type": "string",
27
+ "description": "The forge repository the demo runs on, <org>/<repo>."
28
+ },
29
+ "cycle": {
30
+ "type": "integer",
31
+ "minimum": 0,
32
+ "description": "The cycle the step belongs to."
33
+ },
34
+ "scenario": {
35
+ "type": "string",
36
+ "description": "The scenario the cycle plays, fan-out."
37
+ },
38
+ "name": {
39
+ "type": "string",
40
+ "description": "The scenario's display name, for example fifteen stacks."
41
+ },
42
+ "title": {
43
+ "type": "string",
44
+ "description": "The story's title, shown on every step."
45
+ },
46
+ "step": {
47
+ "enum": [
48
+ "pull-request",
49
+ "planned",
50
+ "waiting",
51
+ "approved",
52
+ "merged",
53
+ "applying",
54
+ "failed",
55
+ "resumed",
56
+ "applied",
57
+ "reset",
58
+ "stalled"
59
+ ],
60
+ "description": "Where the cycle stands. The enum lists the steps a writer may write in this version; a step can be added within contract 1, so a reader must not reject a step it does not know and treats it as one it cannot classify."
61
+ },
62
+ "label": {
63
+ "type": "string",
64
+ "description": "One line narrating the step."
65
+ },
66
+ "highlight": {
67
+ "description": "A call-out for the step: the thing that just happened worth stopping on, which a viewer may show as a modal. null or absent when the step has none. Optional within contract 1.",
68
+ "oneOf": [
69
+ {
70
+ "type": "null"
71
+ },
72
+ {
73
+ "type": "object",
74
+ "required": [
75
+ "title",
76
+ "body"
77
+ ],
78
+ "properties": {
79
+ "title": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ },
83
+ "body": {
84
+ "type": "string",
85
+ "minLength": 1
86
+ }
87
+ }
88
+ }
89
+ ]
90
+ },
91
+ "chapter": {
92
+ "oneOf": [
93
+ {
94
+ "type": "null"
95
+ },
96
+ {
97
+ "$ref": "#/$defs/chapter"
98
+ }
99
+ ],
100
+ "description": "The chapter the step belongs to. null only on the base and on a stall before the first step; a stall otherwise keeps the chapter before it."
101
+ },
102
+ "started_at": {
103
+ "type": "string",
104
+ "description": "When the cycle started, ISO-8601."
105
+ },
106
+ "at": {
107
+ "type": "string",
108
+ "description": "When this step was written, ISO-8601."
109
+ },
110
+ "next": {
111
+ "type": "object",
112
+ "description": "What the driver does after the hold.",
113
+ "properties": {
114
+ "action": {
115
+ "type": "string"
116
+ },
117
+ "from": {
118
+ "type": "string",
119
+ "description": "When the hold began, ISO-8601."
120
+ },
121
+ "at": {
122
+ "type": "string",
123
+ "description": "When the next step is due, ISO-8601."
124
+ }
125
+ }
126
+ },
127
+ "pull": {
128
+ "type": [
129
+ "integer",
130
+ "null"
131
+ ],
132
+ "minimum": 1,
133
+ "description": "The pull request number the step concerns, null before one exists."
134
+ },
135
+ "commit": {
136
+ "type": "string",
137
+ "pattern": "^[0-9a-f]{40,64}$",
138
+ "description": "The commit the step concerns: the head for a plan, the merge commit for an apply."
139
+ },
140
+ "reports": {
141
+ "$ref": "#/$defs/reports"
142
+ },
143
+ "cycle_reports": {
144
+ "type": "array",
145
+ "items": {
146
+ "$ref": "#/$defs/cycleReport"
147
+ },
148
+ "description": "The keys of every stage of this cycle so far, the same shape as demo-cycle's reports, so a reader that starts mid-cycle can find an earlier apply. In the order the stages ran: a writer appends each stage's key when its report is written, so the first apply of a cycle comes before the fix's."
149
+ },
150
+ "about": {
151
+ "type": "object",
152
+ "description": "The about cards.",
153
+ "properties": {
154
+ "changes": {
155
+ "type": "string"
156
+ },
157
+ "watch": {
158
+ "type": "string"
159
+ },
160
+ "shows": {
161
+ "type": "string"
162
+ }
163
+ }
164
+ }
165
+ },
166
+ "$defs": {
167
+ "chapter": {
168
+ "type": "object",
169
+ "required": [
170
+ "n",
171
+ "of",
172
+ "headline",
173
+ "short"
174
+ ],
175
+ "properties": {
176
+ "n": {
177
+ "type": "integer",
178
+ "minimum": 1
179
+ },
180
+ "of": {
181
+ "type": "integer",
182
+ "minimum": 1
183
+ },
184
+ "headline": {
185
+ "type": "string"
186
+ },
187
+ "short": {
188
+ "type": "string"
189
+ }
190
+ }
191
+ },
192
+ "reports": {
193
+ "type": "object",
194
+ "required": [
195
+ "url"
196
+ ],
197
+ "description": "Where chant's own reports for the cycle live. plan and apply are keys in reportKey(pr, commit) form, <pr>/<commit>, below url. The report files are pr-plan.json, pr-apply.json and the matching .events.jsonl.",
198
+ "properties": {
199
+ "url": {
200
+ "type": "string",
201
+ "description": "The --report-url the pipeline uploads to, always s3:// or https://.",
202
+ "pattern": "^(s3|https)://"
203
+ },
204
+ "plan": {
205
+ "type": "string",
206
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$"
207
+ },
208
+ "apply": {
209
+ "type": "string",
210
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$"
211
+ }
212
+ }
213
+ },
214
+ "cycleReport": {
215
+ "type": "object",
216
+ "required": [
217
+ "stage",
218
+ "pr",
219
+ "commit",
220
+ "key"
221
+ ],
222
+ "properties": {
223
+ "stage": {
224
+ "enum": [
225
+ "plan",
226
+ "apply"
227
+ ]
228
+ },
229
+ "pr": {
230
+ "type": "integer",
231
+ "minimum": 1
232
+ },
233
+ "commit": {
234
+ "type": "string",
235
+ "pattern": "^[0-9a-f]{40,64}$"
236
+ },
237
+ "key": {
238
+ "type": "string",
239
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$",
240
+ "description": "reportKey(pr, commit)."
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/e2e-harness/e2e-claim-row/v1/e2e-claim-row.schema.json",
4
+ "title": "e2e harness claim row",
5
+ "description": "One recorded claim of the e2e harness (chant#4587), terragucci's protocol: one claim, a plain run that must pass, a BREAK=1 run that must be caught, one row. The row is the claim outcome of a run record on the ledger (op e2e-claim, chant#4551), and a product's page reads the rows rendered as e2e-claims/v1. A row is only written for a run whose no-real-cloud scan said CLEAN. An engine counts a row only when engine.version is the version its claim is about. Version 1: a field is only ever added within contract 1, and a new field is optional.",
6
+ "type": "object",
7
+ "required": ["$schema", "contract", "product", "productCommit", "scenario", "claim", "engine", "floci", "date", "plain", "break", "safeRun"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "https://intentius.io/chant/schemas/e2e-harness/e2e-claim-row/v1/e2e-claim-row.schema.json" },
11
+ "contract": { "const": 1 },
12
+ "product": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$", "description": "The product that drove the scenario." },
13
+ "productCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$", "description": "The product's commit, in full." },
14
+ "scenario": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$", "description": "The scenario id." },
15
+ "claim": { "type": "string", "minLength": 1, "description": "The claim id." },
16
+ "engine": {
17
+ "type": "object",
18
+ "required": ["binary", "version"],
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "binary": { "type": "string", "minLength": 1, "description": "The engine binary the pipeline ran: choudoufu, plunge, tofu, pulumi, yodel, chant." },
22
+ "version": { "type": "string", "minLength": 1, "description": "Its version as it reported it." }
23
+ }
24
+ },
25
+ "floci": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$", "description": "The floci image digest the run's stack ran." },
26
+ "chant": { "type": "string", "description": "The chant version the harness ran." },
27
+ "date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", "description": "The run's date, UTC." },
28
+ "plain": { "enum": ["pass", "fail"], "description": "The plain run: pass when every outcome held." },
29
+ "break": { "enum": ["caught", "missed", "stalled"], "description": "The BREAK run: caught when an outcome did not hold, missed when all held, stalled when a step did not finish." },
30
+ "safeRun": { "const": "CLEAN", "description": "The no-real-cloud scan's verdict. Only CLEAN is ever recorded." },
31
+ "runUrl": { "type": "string", "description": "Where the run's logs are, when it ran in CI." }
32
+ }
33
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/e2e-harness/e2e-claims/v1/e2e-claims.schema.json",
4
+ "title": "e2e harness claims of one product",
5
+ "description": "A product's recorded claims (chant#4587), rendered from the e2e-claim run records on its ledger: the newest row per scenario and claim, for the product's page to read, as terragucci's docs-site/src/data/smoke.json is read today. Version 1: a field is only ever added within contract 1, and a new field is optional.",
6
+ "type": "object",
7
+ "required": ["$schema", "contract", "product", "rows"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "https://intentius.io/chant/schemas/e2e-harness/e2e-claims/v1/e2e-claims.schema.json" },
11
+ "contract": { "const": 1 },
12
+ "product": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
13
+ "rows": {
14
+ "type": "array",
15
+ "items": { "$ref": "https://intentius.io/chant/schemas/e2e-harness/e2e-claim-row/v1/e2e-claim-row.schema.json" }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json",
4
+ "title": "e2e harness scenario",
5
+ "description": "One scenario of the e2e harness (chant#4587): a repo tree, the pull request steps the driver takes in order, and the outcomes each step must show, read from chant's own reports and run ledger. A scenario proves one claim, with a plain run that must pass and a BREAK arm that must be caught. Version 1: a field is only ever added within contract 1, and a new field is optional.",
6
+ "type": "object",
7
+ "required": ["$schema", "contract", "id", "product", "claim", "tree", "reportUrl", "steps", "break"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json" },
11
+ "contract": { "const": 1 },
12
+ "id": { "$ref": "#/$defs/name", "description": "The scenario's id, such as tg-estate-overlap. Rows cite it." },
13
+ "product": { "$ref": "#/$defs/name", "description": "The product that drives it: terragucci, plywood, sql-yodeler, or chant for its own demo." },
14
+ "claim": { "type": "string", "minLength": 1, "description": "The claim id the scenario records a row for." },
15
+ "title": { "type": "string" },
16
+ "tree": {
17
+ "type": "object",
18
+ "description": "The repo the forge serves: a base tree, and the overlays the steps copy over it. Paths are relative to the scenario file.",
19
+ "required": ["base"],
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "base": { "type": "string", "minLength": 1 },
23
+ "overlays": { "type": "string", "minLength": 1 }
24
+ }
25
+ },
26
+ "env": { "type": "string", "description": "The chant environment the pipeline runs (--env), which the ledger records runs under. Default local." },
27
+ "reportUrl": { "type": "string", "pattern": "^s3://[^/]+/.+", "description": "The pipeline's --report-url, where pr-plan.json and pr-apply.json land." },
28
+ "limits": {
29
+ "type": "object",
30
+ "description": "Seconds each kind of step may take, over the harness's defaults.",
31
+ "propertyNames": { "$ref": "#/$defs/do" },
32
+ "additionalProperties": { "type": "integer", "minimum": 1 }
33
+ },
34
+ "steps": {
35
+ "type": "array",
36
+ "minItems": 1,
37
+ "items": { "$ref": "#/$defs/step" }
38
+ },
39
+ "break": {
40
+ "type": "object",
41
+ "description": "The BREAK arm: the same steps with the claim's subject broken. The run must be caught, meaning one of the outcomes does not hold. env carries BREAK=1 to the pipeline; an overlay may stand in for or add to it.",
42
+ "required": ["env"],
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "env": {
46
+ "type": "object",
47
+ "required": ["BREAK"],
48
+ "properties": { "BREAK": { "const": "1" } },
49
+ "additionalProperties": { "type": "string" }
50
+ },
51
+ "overlay": { "type": "string", "minLength": 1, "description": "An overlay copied over every pull request of the break run, after the step's own." },
52
+ "note": { "type": "string", "description": "What the break changes, in a sentence." }
53
+ }
54
+ }
55
+ },
56
+ "$defs": {
57
+ "name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
58
+ "do": { "enum": ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"] },
59
+ "step": {
60
+ "type": "object",
61
+ "required": ["id", "do"],
62
+ "properties": {
63
+ "id": { "$ref": "#/$defs/name" },
64
+ "do": { "$ref": "#/$defs/do" },
65
+ "label": { "type": "string" },
66
+ "expect": { "type": "array", "items": { "$ref": "#/$defs/outcome" } }
67
+ },
68
+ "oneOf": [
69
+ {
70
+ "type": "object",
71
+ "properties": {
72
+ "do": { "enum": ["open", "open-concurrent"] },
73
+ "branch": { "type": "string", "minLength": 1 },
74
+ "overlay": { "type": "string", "minLength": 1 },
75
+ "title": { "type": "string", "minLength": 1 },
76
+ "body": { "type": "string" }
77
+ },
78
+ "required": ["branch", "overlay", "title"]
79
+ },
80
+ {
81
+ "type": "object",
82
+ "properties": {
83
+ "do": { "enum": ["plan", "approve", "merge"] },
84
+ "pull": { "$ref": "#/$defs/name", "description": "The id of the open step whose pull request this is." }
85
+ },
86
+ "required": ["pull"]
87
+ },
88
+ {
89
+ "type": "object",
90
+ "properties": {
91
+ "do": { "const": "apply" },
92
+ "merge": { "$ref": "#/$defs/name", "description": "The id of the merge step whose commit the apply runs on." }
93
+ },
94
+ "required": ["merge"]
95
+ },
96
+ {
97
+ "type": "object",
98
+ "properties": {
99
+ "do": { "const": "out-of-band" },
100
+ "command": { "type": "array", "minItems": 1, "items": { "type": "string" } }
101
+ },
102
+ "required": ["command"]
103
+ },
104
+ {
105
+ "type": "object",
106
+ "properties": {
107
+ "do": { "const": "kill-job" },
108
+ "match": { "type": "string", "minLength": 1, "description": "Part of the job container's name; the newest running job when absent." }
109
+ }
110
+ }
111
+ ]
112
+ },
113
+ "outcome": {
114
+ "type": "object",
115
+ "description": "One thing a step must show. report reads the step's pr-plan.json or pr-apply.json; ledger reads the run records the scenario added; comment and issue read the forge; exit is an out-of-band command's exit code.",
116
+ "minProperties": 1,
117
+ "maxProperties": 1,
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "report": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "properties": {
124
+ "status": { "type": "string" },
125
+ "components": { "type": "object", "additionalProperties": { "type": "string" } },
126
+ "only": { "type": "boolean", "description": "components names every component the report has." }
127
+ }
128
+ },
129
+ "ledger": {
130
+ "type": "object",
131
+ "required": ["op"],
132
+ "additionalProperties": false,
133
+ "properties": {
134
+ "op": { "type": "string" },
135
+ "status": { "enum": ["ok", "fail", "gated", "waiting"] },
136
+ "count": { "type": "integer", "minimum": 0 }
137
+ }
138
+ },
139
+ "comment": { "type": "string", "minLength": 1, "description": "Text one of the step's pull request comments holds." },
140
+ "issue": {
141
+ "type": "object",
142
+ "required": ["title"],
143
+ "additionalProperties": false,
144
+ "properties": { "title": { "type": "string", "minLength": 1 }, "open": { "type": "boolean" } }
145
+ },
146
+ "exit": { "type": "integer" }
147
+ }
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,220 @@
1
+ /**
2
+ * The e2e harness's contracts (chant#4587) and their validators: the fan-out
3
+ * demo's demo-step/v1 and demo-cycle/v1 (#4085 section 3, #4092, moved here
4
+ * from examples/fan-out-estate/demo/schemas), and the harness's own
5
+ * e2e-scenario/v1, e2e-claim-row/v1 and e2e-claims/v1. The schemas are the
6
+ * source of truth; the types follow them.
7
+ */
8
+ import { createRequire } from "node:module";
9
+ import { loadAjv2020 } from "../../workspace/ajv2020";
10
+
11
+ const require = createRequire(import.meta.url);
12
+ const stepSchema = require("./demo-step.schema.json") as object;
13
+ const cycleSchema = require("./demo-cycle.schema.json") as object;
14
+ const scenarioSchema = require("./e2e-scenario.schema.json") as object;
15
+ const claimRowSchema = require("./e2e-claim-row.schema.json") as object;
16
+ const claimsSchema = require("./e2e-claims.schema.json") as object;
17
+
18
+ export const DEMO_STEP_SCHEMA = "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json";
19
+ export const DEMO_CYCLE_SCHEMA = "https://intentius.io/chant/schemas/demo/demo-cycle/v1/demo-cycle.schema.json";
20
+ export const E2E_SCENARIO_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-scenario/v1/e2e-scenario.schema.json";
21
+ export const E2E_CLAIM_ROW_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-claim-row/v1/e2e-claim-row.schema.json";
22
+ export const E2E_CLAIMS_SCHEMA = "https://intentius.io/chant/schemas/e2e-harness/e2e-claims/v1/e2e-claims.schema.json";
23
+
24
+ // ── demo-step/v1 and demo-cycle/v1 ────────────────────────────────────
25
+
26
+ export const DEMO_STEPS = [
27
+ "pull-request",
28
+ "planned",
29
+ "waiting",
30
+ "approved",
31
+ "merged",
32
+ "applying",
33
+ "failed",
34
+ "resumed",
35
+ "applied",
36
+ "reset",
37
+ "stalled",
38
+ ] as const;
39
+
40
+ export type DemoStepName = (typeof DEMO_STEPS)[number];
41
+
42
+ export interface DemoChapter {
43
+ n: number;
44
+ of: number;
45
+ headline: string;
46
+ short: string;
47
+ }
48
+
49
+ /** Keys are reportKey(pr, commit) from pr-report-url.ts, below `url`. */
50
+ export interface DemoReports {
51
+ url: string;
52
+ plan?: string;
53
+ apply?: string;
54
+ }
55
+
56
+ /** A call-out a viewer may show as a modal at the step. */
57
+ export interface DemoHighlight {
58
+ title: string;
59
+ body: string;
60
+ }
61
+
62
+ export interface DemoStep {
63
+ $schema: string;
64
+ contract: 1;
65
+ demo: string;
66
+ cycle: number;
67
+ step: DemoStepName;
68
+ repo?: string;
69
+ scenario?: string;
70
+ name?: string;
71
+ title?: string;
72
+ label?: string;
73
+ highlight?: DemoHighlight | null;
74
+ chapter?: DemoChapter | null;
75
+ started_at?: string;
76
+ at?: string;
77
+ next?: { action?: string; from?: string; at?: string };
78
+ pull?: number | null;
79
+ commit?: string;
80
+ reports?: DemoReports;
81
+ cycle_reports?: DemoCycleReport[];
82
+ about?: { changes?: string; watch?: string; shows?: string };
83
+ }
84
+
85
+ export interface DemoCycleStep extends Omit<DemoStep, "$schema" | "contract" | "demo" | "cycle" | "at"> {
86
+ $schema?: string;
87
+ contract?: 1;
88
+ demo?: string;
89
+ cycle?: number;
90
+ at: string;
91
+ }
92
+
93
+ export interface DemoCycleReport {
94
+ stage: "plan" | "apply";
95
+ pr: number;
96
+ commit: string;
97
+ key: string;
98
+ }
99
+
100
+ export interface DemoCycle {
101
+ $schema: string;
102
+ contract: 1;
103
+ demo: string;
104
+ cycle: number;
105
+ repo?: string;
106
+ started?: string;
107
+ ended?: string;
108
+ steps: DemoCycleStep[];
109
+ reports?: DemoCycleReport[];
110
+ }
111
+
112
+ // ── e2e-scenario/v1 ───────────────────────────────────────────────────
113
+
114
+ export const SCENARIO_STEP_KINDS = ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"] as const;
115
+ export type ScenarioStepKind = (typeof SCENARIO_STEP_KINDS)[number];
116
+
117
+ /** One thing a step must show. Exactly one key is set. */
118
+ export type ScenarioOutcome =
119
+ | { report: { status?: string; components?: Record<string, string>; only?: boolean } }
120
+ | { ledger: { op: string; status?: "ok" | "fail" | "gated" | "waiting"; count?: number } }
121
+ | { comment: string }
122
+ | { issue: { title: string; open?: boolean } }
123
+ | { exit: number };
124
+
125
+ interface StepBase {
126
+ id: string;
127
+ label?: string;
128
+ expect?: ScenarioOutcome[];
129
+ }
130
+
131
+ export type ScenarioStep =
132
+ | (StepBase & { do: "open" | "open-concurrent"; branch: string; overlay: string; title: string; body?: string })
133
+ | (StepBase & { do: "plan" | "approve" | "merge"; pull: string })
134
+ | (StepBase & { do: "apply"; merge: string })
135
+ | (StepBase & { do: "out-of-band"; command: string[] })
136
+ | (StepBase & { do: "kill-job"; match?: string });
137
+
138
+ export interface Scenario {
139
+ $schema: string;
140
+ contract: 1;
141
+ id: string;
142
+ product: string;
143
+ claim: string;
144
+ title?: string;
145
+ tree: { base: string; overlays?: string };
146
+ env?: string;
147
+ reportUrl: string;
148
+ limits?: Partial<Record<ScenarioStepKind, number>>;
149
+ steps: ScenarioStep[];
150
+ break: { env: { BREAK: "1" } & Record<string, string>; overlay?: string; note?: string };
151
+ }
152
+
153
+ // ── e2e-claim-row/v1 and e2e-claims/v1 ────────────────────────────────
154
+
155
+ export type PlainVerdict = "pass" | "fail";
156
+ export type BreakVerdict = "caught" | "missed" | "stalled";
157
+
158
+ export interface ClaimRow {
159
+ $schema: string;
160
+ contract: 1;
161
+ product: string;
162
+ productCommit: string;
163
+ scenario: string;
164
+ claim: string;
165
+ engine: { binary: string; version: string };
166
+ floci: string;
167
+ chant?: string;
168
+ date: string;
169
+ plain: PlainVerdict;
170
+ break: BreakVerdict;
171
+ safeRun: "CLEAN";
172
+ runUrl?: string;
173
+ }
174
+
175
+ export interface ClaimsDoc {
176
+ $schema: string;
177
+ contract: 1;
178
+ product: string;
179
+ rows: ClaimRow[];
180
+ }
181
+
182
+ // ── validators ────────────────────────────────────────────────────────
183
+
184
+ export type Validation<T> = { ok: true; value: T } | { ok: false; errors: string[] };
185
+
186
+ type ValidateFn = ((data: unknown) => boolean) & {
187
+ errors?: { instancePath: string; message?: string }[] | null;
188
+ };
189
+
190
+ interface AjvInstance {
191
+ addSchema(schema: object): unknown;
192
+ getSchema(id: string): unknown;
193
+ }
194
+
195
+ let ajv: AjvInstance | undefined;
196
+
197
+ function validatorFor(id: string): ValidateFn {
198
+ if (!ajv) {
199
+ const Ajv = loadAjv2020();
200
+ const made = new Ajv({ allErrors: true, strict: true }) as unknown as AjvInstance;
201
+ for (const s of [stepSchema, cycleSchema, scenarioSchema, claimRowSchema, claimsSchema]) made.addSchema(s);
202
+ ajv = made;
203
+ }
204
+ const fn = ajv.getSchema(id) as ValidateFn | undefined;
205
+ if (!fn) throw new Error(`no schema ${id}`);
206
+ return fn;
207
+ }
208
+
209
+ function check<T>(id: string, data: unknown): Validation<T> {
210
+ const fn = validatorFor(id);
211
+ if (fn(data)) return { ok: true, value: data as T };
212
+ const errors = (fn.errors ?? []).map((e) => `${e.instancePath || "/"} ${e.message ?? "is invalid"}`);
213
+ return { ok: false, errors };
214
+ }
215
+
216
+ export const validateDemoStep = (data: unknown): Validation<DemoStep> => check(DEMO_STEP_SCHEMA, data);
217
+ export const validateDemoCycle = (data: unknown): Validation<DemoCycle> => check(DEMO_CYCLE_SCHEMA, data);
218
+ export const validateScenario = (data: unknown): Validation<Scenario> => check(E2E_SCENARIO_SCHEMA, data);
219
+ export const validateClaimRow = (data: unknown): Validation<ClaimRow> => check(E2E_CLAIM_ROW_SCHEMA, data);
220
+ export const validateClaims = (data: unknown): Validation<ClaimsDoc> => check(E2E_CLAIMS_SCHEMA, data);