@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
@@ -0,0 +1,172 @@
1
+ /**
2
+ * The harness's one no-real-cloud wrapper (chant#4587), with plunge's rule
3
+ * (scripts/plunge-safe-run.sh, scripts/plunge-races/record.sh:8-11): every
4
+ * process a scenario starts runs with no real cloud credential in reach, its
5
+ * output is logged, and a run whose log shows a real cloud answering is
6
+ * never recorded. A row is written only after a CLEAN scan.
7
+ *
8
+ * What a command runs with: every AWS_*, AZURE_*, ARM_*, GOOGLE_*, CLOUDSDK_*
9
+ * and GCE_* variable unset (GOOGLE_APPLICATION_CREDENTIALS among them), then
10
+ * floci's test credentials, empty AWS config files, an empty CLOUDSDK_CONFIG
11
+ * and AZURE_CONFIG_DIR, a closed loopback GCE metadata host, no
12
+ * PULUMI_ACCESS_TOKEN, and a file:// Pulumi backend in the scratch
13
+ * directory (a backend already set is kept only when it is local).
14
+ *
15
+ * The scan looks for what a real cloud answers to a fake or missing
16
+ * credential, which no emulator says: UnrecognizedClientException,
17
+ * InvalidClientTokenId, invalid_grant, AADSTS, CREDENTIALS_MISSING, and a 401
18
+ * on a line naming googleapis.com, amazonaws.com, azure.com or windows.net.
19
+ */
20
+ import { spawn } from "node:child_process";
21
+ import { appendFileSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
22
+ import { join } from "node:path";
23
+ import { claimRunRecordInput } from "./claim.js";
24
+ /** The prefixes of every variable a cloud SDK reads credentials or config from. */
25
+ export const CLOUD_ENV_PREFIXES = ["AWS_", "AZURE_", "ARM_", "GOOGLE_", "CLOUDSDK_", "GCE_"];
26
+ const MARKERS = /UnrecognizedClientException|InvalidClientTokenId|invalid_grant|AADSTS[0-9]*|CREDENTIALS_MISSING/;
27
+ const CLOUD_HOSTS = /googleapis\.com|amazonaws\.com|azure\.com|windows\.net/;
28
+ const FOUR_OH_ONE = /(^|[^0-9])401([^0-9]|$)/;
29
+ /** A backend URL a run may keep: local files, or a bucket store on a loopback emulator. */
30
+ export function backendIsLocal(url, env = {}) {
31
+ if (url.startsWith("file://") || url.startsWith("plunge+file://"))
32
+ return true;
33
+ if (url.startsWith("plunge+s3://") || url.startsWith("plunge+azblob://")) {
34
+ return /[?&](endpoint=https?(:\/\/|%3A%2F%2F)(localhost|127\.0\.0\.1)([:/%]|$|&)|metadata_host=(localhost|127\.0\.0\.1)(:|%3A))/.test(url);
35
+ }
36
+ if (url.startsWith("plunge+gs://"))
37
+ return /^(localhost|127\.0\.0\.1):[0-9]+$/.test(env.STORAGE_EMULATOR_HOST ?? "");
38
+ return false;
39
+ }
40
+ /** The environment a scenario's processes run with, from `base` (default process.env). */
41
+ export function safeRunEnv(o, base = process.env) {
42
+ for (const k of Object.keys(o.extra ?? {})) {
43
+ if (k === "GOOGLE_APPLICATION_CREDENTIALS")
44
+ throw new Error("GOOGLE_APPLICATION_CREDENTIALS is refused: no credentials file may be in reach of a run");
45
+ }
46
+ const backend = base.PULUMI_BACKEND_URL;
47
+ if (backend && !backendIsLocal(backend, base)) {
48
+ throw new Error(`PULUMI_BACKEND_URL=${backend} is not a local backend (file://, plunge+file://, or a plunge store on a loopback emulator)`);
49
+ }
50
+ mkdirSync(o.scratch, { recursive: true });
51
+ const dir = mkdtempSync(join(o.scratch, "env-"));
52
+ for (const d of ["gcloud", "azure", "state"])
53
+ mkdirSync(join(dir, d), { recursive: true });
54
+ writeFileSync(join(dir, "aws-config"), "");
55
+ writeFileSync(join(dir, "aws-credentials"), "");
56
+ const env = {};
57
+ for (const [k, v] of Object.entries(base)) {
58
+ if (v === undefined || k === "PULUMI_ACCESS_TOKEN")
59
+ continue;
60
+ if (CLOUD_ENV_PREFIXES.some((p) => k.startsWith(p)))
61
+ continue;
62
+ env[k] = v;
63
+ }
64
+ Object.assign(env, {
65
+ AWS_ACCESS_KEY_ID: "test",
66
+ AWS_SECRET_ACCESS_KEY: "test",
67
+ AWS_REGION: "us-east-1",
68
+ AWS_EC2_METADATA_DISABLED: "true",
69
+ AWS_CONFIG_FILE: join(dir, "aws-config"),
70
+ AWS_SHARED_CREDENTIALS_FILE: join(dir, "aws-credentials"),
71
+ CLOUDSDK_CONFIG: join(dir, "gcloud"),
72
+ AZURE_CONFIG_DIR: join(dir, "azure"),
73
+ GCE_METADATA_HOST: "127.0.0.1:9",
74
+ PULUMI_SKIP_UPDATE_CHECK: "true",
75
+ PULUMI_SKIP_CONFIRMATIONS: "true",
76
+ PULUMI_BACKEND_URL: backend ?? `file://${join(dir, "state")}`,
77
+ });
78
+ Object.assign(env, o.extra ?? {});
79
+ return env;
80
+ }
81
+ /** The lines of `text` a real cloud wrote, as `<where>:<line>:<text>`. */
82
+ export function realCloudHits(text, where = "log") {
83
+ const out = [];
84
+ text.split("\n").forEach((line, i) => {
85
+ if (MARKERS.test(line) || (FOUR_OH_ONE.test(line) && CLOUD_HOSTS.test(line)))
86
+ out.push(`${where}:${i + 1}:${line}`);
87
+ });
88
+ return out;
89
+ }
90
+ function filesUnder(dir) {
91
+ const out = [];
92
+ for (const name of readdirSync(dir)) {
93
+ const p = join(dir, name);
94
+ if (statSync(p).isDirectory())
95
+ out.push(...filesUnder(p));
96
+ else
97
+ out.push(p);
98
+ }
99
+ return out;
100
+ }
101
+ /**
102
+ * One scenario's wrapper: the scrubbed environment, the log every process's
103
+ * output goes to, and the scan at the end. A directory named in `scan` that
104
+ * does not exist when the scan runs is a hit, since it could not be checked.
105
+ */
106
+ export class SafeRun {
107
+ constructor(o, base = process.env) {
108
+ this.o = o;
109
+ this.env = safeRunEnv(o, base);
110
+ this.logFile = o.logFile ?? join(o.scratch, "safe-run.log");
111
+ appendFileSync(this.logFile, `e2e-safe-run: ${new Date().toISOString()} PULUMI_BACKEND_URL=${this.env.PULUMI_BACKEND_URL} CLOUDSDK_CONFIG=${this.env.CLOUDSDK_CONFIG}\n`);
112
+ }
113
+ log(line) {
114
+ appendFileSync(this.logFile, line.endsWith("\n") ? line : `${line}\n`);
115
+ }
116
+ /** Run a command with the scrubbed environment, its output teed to the log. Resolves with its exit code. */
117
+ run(command, extra = {}) {
118
+ const [file, ...args] = command;
119
+ if (!file)
120
+ return Promise.reject(new Error("no command to run"));
121
+ this.log(`e2e-safe-run: command: ${command.map((a) => JSON.stringify(a)).join(" ")}`);
122
+ return new Promise((resolve, reject) => {
123
+ const child = spawn(file, args, { env: { ...this.env, ...extra }, stdio: ["ignore", "pipe", "pipe"] });
124
+ child.stdout.on("data", (b) => {
125
+ appendFileSync(this.logFile, b);
126
+ if (this.o.echo)
127
+ process.stdout.write(b);
128
+ });
129
+ child.stderr.on("data", (b) => {
130
+ appendFileSync(this.logFile, b);
131
+ if (this.o.echo)
132
+ process.stderr.write(b);
133
+ });
134
+ child.on("error", reject);
135
+ child.on("close", (code) => resolve(code ?? 1));
136
+ });
137
+ }
138
+ /** Out-of-band steps, run through this wrapper. */
139
+ outOfBand() {
140
+ return { run: (command) => this.run(command) };
141
+ }
142
+ /** The scan of the log and every `scan` directory. Writes the verdict line to the log. */
143
+ scan(extraDirs = []) {
144
+ const hits = realCloudHits(readFileSync(this.logFile, "utf8"), this.logFile);
145
+ for (const d of [...(this.o.scan ?? []), ...extraDirs]) {
146
+ if (!existsSync(d)) {
147
+ hits.push(`${d}: the scan directory does not exist after the run, so it could not be checked`);
148
+ continue;
149
+ }
150
+ for (const f of filesUnder(d))
151
+ if (f !== this.logFile)
152
+ hits.push(...realCloudHits(readFileSync(f, "utf8"), f));
153
+ }
154
+ if (hits.length > 0) {
155
+ this.log(`e2e-safe-run: REAL-CLOUD CALL: the output shows a public cloud rejecting a credential, so a call left this machine. This run is not recorded.\n${hits.map((h) => ` ${h}`).join("\n")}`);
156
+ return { verdict: "REAL-CLOUD", hits };
157
+ }
158
+ this.log("e2e-safe-run: CLEAN");
159
+ return { verdict: "CLEAN" };
160
+ }
161
+ }
162
+ /** Record a claim run on the ledger, only after a CLEAN scan. */
163
+ export async function recordClaimRow(i) {
164
+ if (i.verdict.verdict !== "CLEAN") {
165
+ throw new Error(`refusing to record ${i.row.scenario}/${i.row.claim}: the no-real-cloud scan found ${i.verdict.hits.length} real-cloud line(s)`);
166
+ }
167
+ if (i.row.safeRun !== "CLEAN")
168
+ throw new Error(`refusing to record ${i.row.scenario}/${i.row.claim}: its row does not say CLEAN`);
169
+ const input = claimRunRecordInput({ row: i.row, run: i.run, env: i.env, gitSha: i.gitSha, runOrigin: i.runOrigin });
170
+ await i.append(input);
171
+ return input;
172
+ }
@@ -0,0 +1,11 @@
1
+ import { type Scenario } from "./schemas/index.js";
2
+ export interface ScenarioFinding {
3
+ /** Where, as a JSON pointer into the file. */
4
+ at: string;
5
+ message: string;
6
+ }
7
+ /** Every reason `data` is not a scenario the driver can run and record. Empty when it is one. */
8
+ export declare function lintScenario(data: unknown): ScenarioFinding[];
9
+ /** Read and lint a scenario file. Throws with every finding when it is not one. */
10
+ export declare function loadScenario(path: string): Scenario;
11
+ //# sourceMappingURL=scenario.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/scenario.ts"],"names":[],"mappings":"AAQA,OAAO,EAAoB,KAAK,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CA+D7D;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKnD"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * A scenario file (e2e-scenario/v1, chant#4587) and its lint. A scenario is
3
+ * a repo tree, an ordered list of pull request steps, and the outcomes each
4
+ * step must show. The lint refuses one that cannot record a row: no claim
5
+ * id, no BREAK arm, nothing to check, or a step that names a pull request or
6
+ * a merge no earlier step made.
7
+ */
8
+ import { readFileSync } from "node:fs";
9
+ import { validateScenario } from "./schemas/index.js";
10
+ /** Every reason `data` is not a scenario the driver can run and record. Empty when it is one. */
11
+ export function lintScenario(data) {
12
+ const out = [];
13
+ const doc = (data ?? {});
14
+ // The two refusals the protocol rests on, said plainly before the schema's wording.
15
+ if (typeof doc.claim !== "string" || doc.claim.trim() === "")
16
+ out.push({ at: "/claim", message: "the scenario has no claim id, so its run would record a row for nothing" });
17
+ if (doc.break === undefined || doc.break === null)
18
+ out.push({ at: "/break", message: "the scenario has no BREAK arm, so nothing shows its outcomes can fail" });
19
+ else if (doc.break.env?.BREAK !== "1")
20
+ out.push({ at: "/break/env/BREAK", message: 'the BREAK arm must set BREAK to "1"' });
21
+ const v = validateScenario(data);
22
+ if (!v.ok) {
23
+ for (const e of v.errors) {
24
+ const [at, ...rest] = e.split(" ");
25
+ if ((at === "/" && /claim|break/.test(e)) || at.startsWith("/break"))
26
+ continue;
27
+ out.push({ at: at, message: rest.join(" ") });
28
+ }
29
+ return out;
30
+ }
31
+ const s = v.value;
32
+ const seen = new Map();
33
+ let expectations = 0;
34
+ s.steps.forEach((step, i) => {
35
+ const at = `/steps/${i}`;
36
+ if (seen.has(step.id))
37
+ out.push({ at: `${at}/id`, message: `step id ${step.id} is used twice` });
38
+ const opened = (id) => {
39
+ const o = seen.get(id);
40
+ return o !== undefined && (o.do === "open" || o.do === "open-concurrent");
41
+ };
42
+ switch (step.do) {
43
+ case "open-concurrent": {
44
+ const prev = s.steps[i - 1];
45
+ if (!prev || (prev.do !== "open" && prev.do !== "open-concurrent")) {
46
+ out.push({ at: `${at}/do`, message: "open-concurrent opens beside the step before it, which must be an open" });
47
+ }
48
+ break;
49
+ }
50
+ case "plan":
51
+ case "approve":
52
+ case "merge":
53
+ if (!opened(step.pull))
54
+ out.push({ at: `${at}/pull`, message: `${step.do} names ${step.pull}, which is not an earlier open step` });
55
+ break;
56
+ case "apply": {
57
+ const m = seen.get(step.merge);
58
+ if (!m || m.do !== "merge")
59
+ out.push({ at: `${at}/merge`, message: `apply names ${step.merge}, which is not an earlier merge step` });
60
+ break;
61
+ }
62
+ default:
63
+ break;
64
+ }
65
+ for (const [j, e] of (step.expect ?? []).entries()) {
66
+ expectations++;
67
+ if ("report" in e && step.do !== "plan" && step.do !== "apply") {
68
+ out.push({ at: `${at}/expect/${j}`, message: `a report outcome belongs on a plan or apply step, not ${step.do}` });
69
+ }
70
+ if ("comment" in e && !("pull" in step) && step.do !== "open" && step.do !== "open-concurrent") {
71
+ out.push({ at: `${at}/expect/${j}`, message: "a comment outcome belongs on a step with a pull request" });
72
+ }
73
+ if ("exit" in e && step.do !== "out-of-band")
74
+ out.push({ at: `${at}/expect/${j}`, message: "an exit outcome belongs on an out-of-band step" });
75
+ }
76
+ seen.set(step.id, step);
77
+ });
78
+ if (expectations === 0)
79
+ out.push({ at: "/steps", message: "no step expects anything, so the plain run would pass and the BREAK run could never be caught" });
80
+ return out;
81
+ }
82
+ /** Read and lint a scenario file. Throws with every finding when it is not one. */
83
+ export function loadScenario(path) {
84
+ const data = JSON.parse(readFileSync(path, "utf8"));
85
+ const findings = lintScenario(data);
86
+ if (findings.length > 0)
87
+ throw new Error(`${path} is not a scenario the harness runs:\n${findings.map((f) => ` ${f.at}: ${f.message}`).join("\n")}`);
88
+ return data;
89
+ }
@@ -0,0 +1,282 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/demo/demo-cycle/v1/demo-cycle.schema.json",
4
+ "title": "fan-out demo cycle",
5
+ "description": "One finished cycle of the fan-out demo, published at reset to cycles/latest.json and cycles/<cycle>.json, newest five kept. A cycle with a stalled step is never published, so latest is always a full cycle. 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
+ "steps"
13
+ ],
14
+ "properties": {
15
+ "$schema": {
16
+ "const": "https://intentius.io/chant/schemas/demo/demo-cycle/v1/demo-cycle.schema.json"
17
+ },
18
+ "contract": {
19
+ "const": 1
20
+ },
21
+ "demo": {
22
+ "type": "string"
23
+ },
24
+ "repo": {
25
+ "type": "string"
26
+ },
27
+ "cycle": {
28
+ "type": "integer",
29
+ "minimum": 0
30
+ },
31
+ "started": {
32
+ "type": "string",
33
+ "description": "ISO-8601."
34
+ },
35
+ "ended": {
36
+ "type": "string",
37
+ "description": "ISO-8601."
38
+ },
39
+ "steps": {
40
+ "type": "array",
41
+ "description": "Each demo-step record as written, with at.",
42
+ "items": {
43
+ "$ref": "#/$defs/cycleStep"
44
+ }
45
+ },
46
+ "reports": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "object",
50
+ "required": [
51
+ "stage",
52
+ "pr",
53
+ "commit",
54
+ "key"
55
+ ],
56
+ "properties": {
57
+ "stage": {
58
+ "enum": [
59
+ "plan",
60
+ "apply"
61
+ ]
62
+ },
63
+ "pr": {
64
+ "type": "integer",
65
+ "minimum": 1
66
+ },
67
+ "commit": {
68
+ "type": "string",
69
+ "pattern": "^[0-9a-f]{40,64}$"
70
+ },
71
+ "key": {
72
+ "type": "string",
73
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$",
74
+ "description": "reportKey(pr, commit)."
75
+ }
76
+ }
77
+ },
78
+ "description": "Every stage of the cycle, as {stage, pr, commit, key}. 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."
79
+ }
80
+ },
81
+ "$defs": {
82
+ "cycleStep": {
83
+ "type": "object",
84
+ "description": "A demo-step record as written (demo-step/v1), with at. step and at are required here; the rest follows demo-step/v1.",
85
+ "required": [
86
+ "step",
87
+ "at"
88
+ ],
89
+ "properties": {
90
+ "demo": {
91
+ "type": "string",
92
+ "description": "The demo's name, fan-out-estate."
93
+ },
94
+ "repo": {
95
+ "type": "string",
96
+ "description": "The forge repository the demo runs on, <org>/<repo>."
97
+ },
98
+ "cycle": {
99
+ "type": "integer",
100
+ "minimum": 0,
101
+ "description": "The cycle the step belongs to."
102
+ },
103
+ "scenario": {
104
+ "type": "string",
105
+ "description": "The scenario the cycle plays, fan-out."
106
+ },
107
+ "name": {
108
+ "type": "string",
109
+ "description": "The scenario's display name, for example fifteen stacks."
110
+ },
111
+ "title": {
112
+ "type": "string",
113
+ "description": "The story's title, shown on every step."
114
+ },
115
+ "step": {
116
+ "enum": [
117
+ "pull-request",
118
+ "planned",
119
+ "waiting",
120
+ "approved",
121
+ "merged",
122
+ "applying",
123
+ "failed",
124
+ "resumed",
125
+ "applied",
126
+ "reset",
127
+ "stalled"
128
+ ],
129
+ "description": "Where the cycle stands. A step set gains a value only as an addition within a version."
130
+ },
131
+ "label": {
132
+ "type": "string",
133
+ "description": "One line narrating the step."
134
+ },
135
+ "highlight": {
136
+ "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.",
137
+ "oneOf": [
138
+ {
139
+ "type": "null"
140
+ },
141
+ {
142
+ "type": "object",
143
+ "required": [
144
+ "title",
145
+ "body"
146
+ ],
147
+ "properties": {
148
+ "title": {
149
+ "type": "string",
150
+ "minLength": 1
151
+ },
152
+ "body": {
153
+ "type": "string",
154
+ "minLength": 1
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ "chapter": {
161
+ "oneOf": [
162
+ {
163
+ "type": "null"
164
+ },
165
+ {
166
+ "$ref": "#/$defs/chapter"
167
+ }
168
+ ],
169
+ "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."
170
+ },
171
+ "started_at": {
172
+ "type": "string",
173
+ "description": "When the cycle started, ISO-8601."
174
+ },
175
+ "at": {
176
+ "type": "string"
177
+ },
178
+ "next": {
179
+ "type": "object",
180
+ "description": "What the driver does after the hold.",
181
+ "properties": {
182
+ "action": {
183
+ "type": "string"
184
+ },
185
+ "from": {
186
+ "type": "string",
187
+ "description": "When the hold began, ISO-8601."
188
+ },
189
+ "at": {
190
+ "type": "string",
191
+ "description": "When the next step is due, ISO-8601."
192
+ }
193
+ }
194
+ },
195
+ "pull": {
196
+ "type": [
197
+ "integer",
198
+ "null"
199
+ ],
200
+ "minimum": 1,
201
+ "description": "The pull request number the step concerns, null before one exists."
202
+ },
203
+ "commit": {
204
+ "type": "string",
205
+ "pattern": "^[0-9a-f]{40,64}$",
206
+ "description": "The commit the step concerns: the head for a plan, the merge commit for an apply."
207
+ },
208
+ "reports": {
209
+ "$ref": "#/$defs/reports"
210
+ },
211
+ "about": {
212
+ "type": "object",
213
+ "description": "The about cards.",
214
+ "properties": {
215
+ "changes": {
216
+ "type": "string"
217
+ },
218
+ "watch": {
219
+ "type": "string"
220
+ },
221
+ "shows": {
222
+ "type": "string"
223
+ }
224
+ }
225
+ },
226
+ "$schema": {
227
+ "const": "https://intentius.io/chant/schemas/demo/demo-step/v1/demo-step.schema.json"
228
+ },
229
+ "contract": {
230
+ "const": 1
231
+ }
232
+ }
233
+ },
234
+ "chapter": {
235
+ "type": "object",
236
+ "required": [
237
+ "n",
238
+ "of",
239
+ "headline",
240
+ "short"
241
+ ],
242
+ "properties": {
243
+ "n": {
244
+ "type": "integer",
245
+ "minimum": 1
246
+ },
247
+ "of": {
248
+ "type": "integer",
249
+ "minimum": 1
250
+ },
251
+ "headline": {
252
+ "type": "string"
253
+ },
254
+ "short": {
255
+ "type": "string"
256
+ }
257
+ }
258
+ },
259
+ "reports": {
260
+ "type": "object",
261
+ "required": [
262
+ "url"
263
+ ],
264
+ "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.",
265
+ "properties": {
266
+ "url": {
267
+ "type": "string",
268
+ "description": "The --report-url the pipeline uploads to, always s3:// or https://.",
269
+ "pattern": "^(s3|https)://"
270
+ },
271
+ "plan": {
272
+ "type": "string",
273
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$"
274
+ },
275
+ "apply": {
276
+ "type": "string",
277
+ "pattern": "^[0-9]+/[0-9a-f]{40,64}$"
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }