@empire-builder-kit/nx 1.0.0-rc.47 → 1.0.0-rc.48

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 (764) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +8 -18
  4. package/package.json +13 -71
  5. package/src/aws/identity.d.ts +1 -1
  6. package/src/aws-authority/boundary-transforms.d.ts +9 -0
  7. package/src/aws-authority/boundary-transforms.js +78 -0
  8. package/src/aws-authority/contracts.d.ts +116 -0
  9. package/src/aws-authority/contracts.js +40 -0
  10. package/src/aws-authority/deployment-guardrails.d.ts +4 -0
  11. package/src/aws-authority/deployment-guardrails.js +543 -0
  12. package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
  13. package/src/aws-authority/deployment-policy-groups.js +299 -0
  14. package/src/aws-authority/deployment-resources.d.ts +64 -0
  15. package/src/aws-authority/deployment-resources.js +265 -0
  16. package/src/aws-authority/deployment-services.d.ts +3 -0
  17. package/src/aws-authority/deployment-services.js +717 -0
  18. package/src/aws-authority/development-authority.d.ts +11 -0
  19. package/src/aws-authority/development-authority.js +160 -0
  20. package/src/aws-authority/guardrail-actions.d.ts +87 -0
  21. package/src/aws-authority/guardrail-actions.js +463 -0
  22. package/src/aws-authority/policy-document.d.ts +15 -0
  23. package/src/aws-authority/policy-document.js +264 -0
  24. package/src/aws-authority/runtime-boundary.d.ts +7 -0
  25. package/src/aws-authority/runtime-boundary.js +211 -0
  26. package/src/aws-authority/service-actions.d.ts +96 -0
  27. package/src/aws-authority/service-actions.js +512 -0
  28. package/src/aws-authority/stage-authority.d.ts +6 -272
  29. package/src/aws-authority/stage-authority.js +109 -3609
  30. package/src/aws-authority/stage-identity.d.ts +6 -0
  31. package/src/aws-authority/stage-identity.js +134 -0
  32. package/src/cli/bootstrap.d.ts +0 -20
  33. package/src/cli/bootstrap.js +2 -153
  34. package/src/cli/dev-command.d.ts +2 -4
  35. package/src/cli/dev-command.js +1 -19
  36. package/src/cli/main.d.ts +0 -4
  37. package/src/cli/main.js +22 -80
  38. package/src/cli/output.d.ts +2 -4
  39. package/src/cli/output.js +2 -8
  40. package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
  41. package/src/executors/deployment-plan/deployment-plan.js +3 -68
  42. package/src/executors/dev-doctor/dev-doctor.js +2 -2
  43. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  44. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  45. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  46. package/src/executors/local-deploy/deployment-authority.js +81 -0
  47. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  48. package/src/executors/local-deploy/deployment-child.js +77 -0
  49. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  50. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  51. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  52. package/src/executors/local-deploy/deployment-projects.js +16 -0
  53. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  54. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  55. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  56. package/src/executors/local-deploy/deployment-scope.js +239 -0
  57. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  58. package/src/executors/local-deploy/deployment-source.js +86 -0
  59. package/src/executors/local-deploy/local-deploy.d.ts +5 -121
  60. package/src/executors/local-deploy/local-deploy.js +55 -936
  61. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  62. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  63. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  64. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  65. package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
  66. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  67. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  68. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  69. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  70. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  71. package/src/foundation/discovery.d.ts +1 -5
  72. package/src/foundation/discovery.js +0 -2
  73. package/src/foundation/index.d.ts +0 -2
  74. package/src/foundation/index.js +0 -9
  75. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  76. package/src/foundation/local-private-smoke-access.js +8 -192
  77. package/src/foundation/observability.d.ts +16 -26
  78. package/src/foundation/observability.js +34 -135
  79. package/src/foundation/preflight.js +0 -14
  80. package/src/foundation/private-smoke-access.d.ts +7 -14
  81. package/src/foundation/private-smoke-access.js +4 -126
  82. package/src/foundation/root-site-workspace.d.ts +35 -0
  83. package/src/foundation/root-site-workspace.js +80 -0
  84. package/src/foundation/root-site.d.ts +8 -7
  85. package/src/foundation/root-site.js +17 -9
  86. package/src/generators/formatting.js +5 -4
  87. package/src/generators/function/function.d.ts +9 -5
  88. package/src/generators/function/function.js +106 -136
  89. package/src/generators/function/schema.json +2 -2
  90. package/src/generators/function-access/function-access.d.ts +0 -6
  91. package/src/generators/function-access/function-access.js +41 -109
  92. package/src/generators/observability-policy.js +1 -2
  93. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  94. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  95. package/src/generators/post-generation-install.d.ts +1 -8
  96. package/src/generators/post-generation-install.js +11 -139
  97. package/src/generators/preset/dependency-overrides.d.ts +13 -19
  98. package/src/generators/preset/dependency-overrides.js +12 -56
  99. package/src/generators/preset/generator.js +0 -3
  100. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  101. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  102. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  103. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  104. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  105. package/src/generators/preset/workspace-files-foundation.js +170 -0
  106. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  107. package/src/generators/preset/workspace-files-ownership.js +124 -0
  108. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  109. package/src/generators/preset/workspace-files-root-config.js +356 -0
  110. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  111. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  112. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  113. package/src/generators/preset/workspace-files-shared.js +7 -0
  114. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  115. package/src/generators/preset/workspace-files-workflows.js +306 -0
  116. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  117. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  118. package/src/generators/preset/workspace-files.d.ts +10 -24
  119. package/src/generators/preset/workspace-files.js +48 -10705
  120. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
  121. package/src/generators/site/built-in-site-documentation-files.js +15 -56
  122. package/src/generators/site/built-in-site-files.d.ts +4 -1
  123. package/src/generators/site/built-in-site-files.js +12 -11
  124. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
  125. package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
  126. package/src/generators/site/built-in-site-plan.d.ts +5 -1
  127. package/src/generators/site/built-in-site-plan.js +7 -5
  128. package/src/generators/site/built-in-site-project-files.d.ts +10 -2
  129. package/src/generators/site/built-in-site-project-files.js +131 -177
  130. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  131. package/src/generators/site/built-in-site-script-files.js +76 -280
  132. package/src/generators/site/built-in-site-shared.d.ts +64 -4
  133. package/src/generators/site/built-in-site-shared.js +307 -14
  134. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
  135. package/src/generators/site/built-in-site-sst-config-files.js +90 -22
  136. package/src/generators/site/built-in-site-web-files.d.ts +2 -1
  137. package/src/generators/site/built-in-site-web-files.js +19 -225
  138. package/src/generators/site/schema.d.ts +5 -0
  139. package/src/generators/site/schema.json +6 -0
  140. package/src/generators/site/site.d.ts +0 -8
  141. package/src/generators/site/site.js +17 -85
  142. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  143. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  144. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  145. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  146. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
  147. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  148. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  149. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  150. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  151. package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
  152. package/src/generators/slice/built-in-plan-shared.js +4 -57
  153. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  154. package/src/generators/slice/built-in-plan-web-files.js +14 -540
  155. package/src/generators/slice/built-in-plan.d.ts +2 -3
  156. package/src/generators/slice/built-in-plan.js +79 -277
  157. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  158. package/src/generators/slice/generation-tree.js +161 -0
  159. package/src/generators/slice/schema.json +12 -4
  160. package/src/generators/slice/slice-config.d.ts +7 -0
  161. package/src/generators/slice/slice-config.js +125 -0
  162. package/src/generators/slice/slice.js +29 -261
  163. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  164. package/src/generators/slice/sql-bootstrap.js +505 -0
  165. package/src/generators/slice/sql-client.d.ts +1 -0
  166. package/src/generators/slice/sql-client.js +107 -0
  167. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  168. package/src/generators/slice/sql-infrastructure.js +225 -0
  169. package/src/generators/slice/sql-logging.d.ts +1 -0
  170. package/src/generators/slice/sql-logging.js +266 -0
  171. package/src/generators/slice/sql-migration.d.ts +2 -0
  172. package/src/generators/slice/sql-migration.js +202 -0
  173. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  174. package/src/generators/slice/standard-slice-contract.js +64 -0
  175. package/src/generators/sql/schema.json +1 -1
  176. package/src/generators/sql/sql.d.ts +1 -1
  177. package/src/generators/sql/sql.js +13 -7
  178. package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
  179. package/src/generators/upgrade/framework-package-upgrade.js +16 -39
  180. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  181. package/src/generators/upgrade/framework-packages.js +138 -0
  182. package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
  183. package/src/generators/upgrade/function-authentication-notice.js +24 -44
  184. package/src/generators/upgrade/schema.d.ts +0 -3
  185. package/src/generators/upgrade/schema.json +6 -16
  186. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  187. package/src/generators/upgrade/slice-compositions.js +100 -0
  188. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  189. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  190. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  191. package/src/generators/upgrade/slice-upgrade.js +231 -0
  192. package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
  193. package/src/generators/upgrade/upgrade-plan.js +33 -197
  194. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  195. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  196. package/src/generators/upgrade/upgrade.d.ts +8 -53
  197. package/src/generators/upgrade/upgrade.js +23 -1571
  198. package/src/generators/workload/schema.json +2 -2
  199. package/src/generators/workload/workload.d.ts +11 -11
  200. package/src/generators/workload/workload.js +166 -1255
  201. package/src/index.d.ts +0 -5
  202. package/src/index.js +0 -5
  203. package/src/local-dev/browser-verification.d.ts +0 -7
  204. package/src/local-dev/browser-verification.js +0 -136
  205. package/src/local-dev/contracts.d.ts +6 -0
  206. package/src/local-dev/contracts.js +17 -9
  207. package/src/local-dev/environment-checks.d.ts +126 -0
  208. package/src/local-dev/environment-checks.js +81 -0
  209. package/src/local-dev/environment-inspector.d.ts +3 -124
  210. package/src/local-dev/environment-inspector.js +9 -148
  211. package/src/local-dev/private-state.d.ts +1 -0
  212. package/src/local-dev/private-state.js +19 -23
  213. package/src/local-dev/process-identity.js +4 -2
  214. package/src/local-dev/slice-runner-child.d.ts +37 -0
  215. package/src/local-dev/slice-runner-child.js +127 -0
  216. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  217. package/src/local-dev/slice-runner-recovery.js +216 -0
  218. package/src/local-dev/slice-runner-state.d.ts +82 -0
  219. package/src/local-dev/slice-runner-state.js +265 -0
  220. package/src/local-dev/slice-runner.d.ts +4 -117
  221. package/src/local-dev/slice-runner.js +59 -594
  222. package/src/local-dev/tls.js +8 -97
  223. package/src/ownership/index.d.ts +1 -0
  224. package/src/ownership/index.js +6 -0
  225. package/src/ownership/pnpm-workspace.d.ts +77 -0
  226. package/src/ownership/pnpm-workspace.js +225 -0
  227. package/src/ownership/site-record.d.ts +8 -0
  228. package/src/ownership/site-record.js +17 -2
  229. package/src/repository-policy/capacity-migration.d.ts +1 -1
  230. package/src/repository-policy/capacity-migration.js +1 -1
  231. package/src/repository-policy/foundation-router.d.ts +17 -0
  232. package/src/repository-policy/foundation-router.js +44 -0
  233. package/src/repository-policy/index.d.ts +2 -0
  234. package/src/repository-policy/index.js +2 -0
  235. package/src/repository-policy/policy-accounts.d.ts +22 -0
  236. package/src/repository-policy/policy-accounts.js +134 -0
  237. package/src/repository-policy/policy-files.d.ts +8 -0
  238. package/src/repository-policy/policy-files.js +201 -0
  239. package/src/repository-policy/policy-internal.d.ts +2 -0
  240. package/src/repository-policy/policy-internal.js +11 -0
  241. package/src/repository-policy/policy-model.d.ts +95 -0
  242. package/src/repository-policy/policy-model.js +42 -0
  243. package/src/repository-policy/policy-validation.d.ts +4 -0
  244. package/src/repository-policy/policy-validation.js +308 -0
  245. package/src/repository-policy/policy.d.ts +5 -120
  246. package/src/repository-policy/policy.js +34 -662
  247. package/src/repository-policy/public-dns.d.ts +4 -0
  248. package/src/repository-policy/public-dns.js +102 -5
  249. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  250. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  251. package/src/schemas/repository-policy-v1.json +40 -3
  252. package/src/secrets/index.d.ts +0 -5
  253. package/src/secrets/index.js +0 -5
  254. package/src/slice-infra/index.d.ts +57 -0
  255. package/src/slice-infra/index.js +117 -0
  256. package/src/slice-scripts/build.d.ts +27 -0
  257. package/src/slice-scripts/build.js +120 -0
  258. package/src/slice-scripts/database.d.ts +87 -0
  259. package/src/slice-scripts/database.js +328 -0
  260. package/src/slice-scripts/index.d.ts +11 -0
  261. package/src/slice-scripts/index.js +23 -0
  262. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  263. package/src/slice-scripts/root-site-routes.js +83 -0
  264. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  265. package/src/workload-roles/effective-policy.d.ts +0 -37
  266. package/src/workload-roles/effective-policy.js +1 -174
  267. package/src/workload-roles/standard-slice.d.ts +2 -19
  268. package/src/workload-roles/standard-slice.js +3 -129
  269. package/src/api-contract/baseline-update.d.ts +0 -82
  270. package/src/api-contract/baseline-update.js +0 -225
  271. package/src/api-contract/compatibility.d.ts +0 -30
  272. package/src/api-contract/compatibility.js +0 -643
  273. package/src/api-contract/contract-graph.d.ts +0 -35
  274. package/src/api-contract/contract-graph.js +0 -141
  275. package/src/api-contract/evidence.d.ts +0 -23
  276. package/src/api-contract/evidence.js +0 -87
  277. package/src/api-contract/index.d.ts +0 -6
  278. package/src/api-contract/index.js +0 -10
  279. package/src/api-contract/model.d.ts +0 -144
  280. package/src/api-contract/model.js +0 -993
  281. package/src/api-contract/rollout.d.ts +0 -32
  282. package/src/api-contract/rollout.js +0 -88
  283. package/src/authorization/compatibility.d.ts +0 -62
  284. package/src/authorization/compatibility.js +0 -175
  285. package/src/authorization/index.d.ts +0 -1
  286. package/src/authorization/index.js +0 -5
  287. package/src/blueprints/execution.d.ts +0 -55
  288. package/src/blueprints/execution.js +0 -329
  289. package/src/blueprints/external-sandbox.d.ts +0 -53
  290. package/src/blueprints/external-sandbox.js +0 -1194
  291. package/src/blueprints/index.d.ts +0 -5
  292. package/src/blueprints/index.js +0 -9
  293. package/src/blueprints/inputs.d.ts +0 -43
  294. package/src/blueprints/inputs.js +0 -103
  295. package/src/blueprints/manifest.d.ts +0 -281
  296. package/src/blueprints/manifest.js +0 -424
  297. package/src/blueprints/resolver.d.ts +0 -37
  298. package/src/blueprints/resolver.js +0 -387
  299. package/src/blueprints/transitions.d.ts +0 -20
  300. package/src/blueprints/transitions.js +0 -61
  301. package/src/cli/agent-command.d.ts +0 -30
  302. package/src/cli/agent-command.js +0 -204
  303. package/src/cli/agent-runtime.d.ts +0 -25
  304. package/src/cli/agent-runtime.js +0 -498
  305. package/src/cli/blueprint-authority.d.ts +0 -9
  306. package/src/cli/blueprint-authority.js +0 -43
  307. package/src/cli/blueprint-command.d.ts +0 -24
  308. package/src/cli/blueprint-command.js +0 -63
  309. package/src/data-lifecycle/index.d.ts +0 -3
  310. package/src/data-lifecycle/index.js +0 -7
  311. package/src/data-lifecycle/model.d.ts +0 -172
  312. package/src/data-lifecycle/model.js +0 -95
  313. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  314. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  315. package/src/data-lifecycle/validation.d.ts +0 -32
  316. package/src/data-lifecycle/validation.js +0 -837
  317. package/src/database-retirement/contract.d.ts +0 -68
  318. package/src/database-retirement/contract.js +0 -166
  319. package/src/database-retirement/index.d.ts +0 -1
  320. package/src/database-retirement/index.js +0 -5
  321. package/src/developer-agent/context.d.ts +0 -57
  322. package/src/developer-agent/context.js +0 -662
  323. package/src/developer-agent/generator-planning.d.ts +0 -34
  324. package/src/developer-agent/generator-planning.js +0 -759
  325. package/src/developer-agent/generator-preview.d.ts +0 -8
  326. package/src/developer-agent/generator-preview.js +0 -650
  327. package/src/developer-agent/git-inspection.d.ts +0 -112
  328. package/src/developer-agent/git-inspection.js +0 -887
  329. package/src/developer-agent/handoff.d.ts +0 -43
  330. package/src/developer-agent/handoff.js +0 -713
  331. package/src/developer-agent/index.d.ts +0 -10
  332. package/src/developer-agent/index.js +0 -14
  333. package/src/developer-agent/model.d.ts +0 -497
  334. package/src/developer-agent/model.js +0 -144
  335. package/src/developer-agent/operation-registry.d.ts +0 -61
  336. package/src/developer-agent/operation-registry.js +0 -1591
  337. package/src/developer-agent/ordering.d.ts +0 -9
  338. package/src/developer-agent/ordering.js +0 -15
  339. package/src/developer-agent/planning.d.ts +0 -25
  340. package/src/developer-agent/planning.js +0 -481
  341. package/src/developer-agent/preview-changes.js +0 -225
  342. package/src/developer-agent/preview-source.d.ts +0 -2
  343. package/src/developer-agent/preview-source.js +0 -19
  344. package/src/developer-agent/validation.d.ts +0 -30
  345. package/src/developer-agent/validation.js +0 -2729
  346. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  347. package/src/developer-agent/workspace-inspection.js +0 -1236
  348. package/src/developer-agent/workspace-path.d.ts +0 -6
  349. package/src/developer-agent/workspace-path.js +0 -22
  350. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  351. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  352. package/src/executors/blueprint-trust/schema.json +0 -27
  353. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  354. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  355. package/src/executors/blueprint-verification/schema.json +0 -44
  356. package/src/executors/developer-context/developer-context.d.ts +0 -38
  357. package/src/executors/developer-context/developer-context.js +0 -78
  358. package/src/executors/developer-context/schema.json +0 -87
  359. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  360. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  361. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  362. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  363. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  364. package/src/executors/github-bootstrap/schema.json +0 -50
  365. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  366. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
  367. package/src/executors/infrastructure-plan/schema.json +0 -38
  368. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  369. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  370. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  371. package/src/executors/secret-guardrails/schema.json +0 -6
  372. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  373. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  374. package/src/executors/secret-initialize/schema.json +0 -42
  375. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  376. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  377. package/src/executors/secret-metadata/schema.json +0 -36
  378. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  379. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  380. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  381. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  382. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  383. package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
  384. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  385. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  386. package/src/executors/work-markers/schema.json +0 -14
  387. package/src/executors/work-markers/work-markers.d.ts +0 -6
  388. package/src/executors/work-markers/work-markers.js +0 -20
  389. package/src/foundation/cost-estimate.d.ts +0 -175
  390. package/src/foundation/cost-estimate.js +0 -706
  391. package/src/foundation/private-smoke-admission.d.ts +0 -45
  392. package/src/foundation/private-smoke-admission.js +0 -180
  393. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  394. package/src/foundation/private-smoke-control-plane.js +0 -184
  395. package/src/foundation/root-site-readiness.d.ts +0 -27
  396. package/src/foundation/root-site-readiness.js +0 -78
  397. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  398. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  399. package/src/foundation/router-waf.d.ts +0 -149
  400. package/src/foundation/router-waf.js +0 -809
  401. package/src/frontend-security/index.d.ts +0 -1
  402. package/src/frontend-security/index.js +0 -5
  403. package/src/frontend-security/security-headers.d.ts +0 -50
  404. package/src/frontend-security/security-headers.js +0 -418
  405. package/src/generators/blueprint/blueprint.d.ts +0 -5
  406. package/src/generators/blueprint/blueprint.js +0 -102
  407. package/src/generators/blueprint/files.d.ts +0 -6
  408. package/src/generators/blueprint/files.js +0 -217
  409. package/src/generators/blueprint/schema.d.ts +0 -4
  410. package/src/generators/blueprint/schema.json +0 -18
  411. package/src/generators/feature-registry.d.ts +0 -13
  412. package/src/generators/feature-registry.js +0 -73
  413. package/src/generators/function/function-registration.d.ts +0 -24
  414. package/src/generators/function/function-registration.js +0 -66
  415. package/src/generators/observability-infrastructure.d.ts +0 -2
  416. package/src/generators/observability-infrastructure.js +0 -31
  417. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  418. package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
  419. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  420. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  421. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  422. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  423. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  424. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  425. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  426. package/src/generators/preset/workspace-files-developer-agent.js +0 -644
  427. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  428. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  429. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  430. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  431. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  432. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  433. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  434. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  435. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  436. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  437. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  438. package/src/generators/preset/workspace-files-stage-authority.js +0 -586
  439. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
  440. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
  441. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  442. package/src/generators/preset/workspace-files-thin-docs.js +0 -386
  443. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  444. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  445. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  446. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  447. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  448. package/src/generators/repository-policy/repository-policy.js +0 -294
  449. package/src/generators/repository-policy/schema.d.ts +0 -30
  450. package/src/generators/repository-policy/schema.json +0 -127
  451. package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
  452. package/src/generators/site/built-in-site-smoke-files.js +0 -37
  453. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
  454. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
  455. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  456. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
  457. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  458. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
  459. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  460. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  461. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  462. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  463. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  464. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  465. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  466. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  467. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  468. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  469. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  470. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  471. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  472. package/src/generators/slice/built-in-plan-data-files.js +0 -618
  473. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  474. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  475. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  476. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  477. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  478. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  479. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  480. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  481. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  482. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  483. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  484. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  485. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  486. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  487. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
  488. package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
  489. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
  491. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
  492. package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
  493. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  494. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  495. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  496. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
  497. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  498. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  499. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  501. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  503. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  505. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  507. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  509. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  510. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  511. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  512. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  513. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  514. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  515. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  516. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  517. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  518. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  519. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  521. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  523. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  524. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  525. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
  526. package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
  527. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  528. package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
  529. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  531. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
  532. package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
  533. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
  534. package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
  535. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  536. package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
  537. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  538. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  539. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  540. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
  541. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  542. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  543. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  545. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
  547. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  548. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  549. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  551. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  552. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  553. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  554. package/src/generators/slice/built-in-plan-verification-files.js +0 -442
  555. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  557. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  558. package/src/generators/slice/data-policy-review-seed.js +0 -22
  559. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
  560. package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
  561. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
  562. package/src/generators/slice/deployed-smoke-readiness.js +0 -309
  563. package/src/generators/slice/local-source-identity.d.ts +0 -2
  564. package/src/generators/slice/local-source-identity.js +0 -31
  565. package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
  566. package/src/generators/slice/pnpm-launch-script.js +0 -28
  567. package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
  568. package/src/generators/upgrade/custom-domain-notice.js +0 -38
  569. package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
  570. package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
  571. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  572. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  573. package/src/generators/workload/performance-registration.d.ts +0 -33
  574. package/src/generators/workload/performance-registration.js +0 -224
  575. package/src/generators/workload/reliability-registration.d.ts +0 -16
  576. package/src/generators/workload/reliability-registration.js +0 -150
  577. package/src/generators/workload/service-performance-files.d.ts +0 -5
  578. package/src/generators/workload/service-performance-files.js +0 -1883
  579. package/src/git-policy/action-pins.d.ts +0 -43
  580. package/src/git-policy/action-pins.js +0 -50
  581. package/src/git-policy/github-bootstrap.d.ts +0 -95
  582. package/src/git-policy/github-bootstrap.js +0 -1250
  583. package/src/git-policy/index.d.ts +0 -3
  584. package/src/git-policy/index.js +0 -7
  585. package/src/git-policy/routing.d.ts +0 -21
  586. package/src/git-policy/routing.js +0 -138
  587. package/src/infrastructure-change/convergence.d.ts +0 -13
  588. package/src/infrastructure-change/convergence.js +0 -85
  589. package/src/infrastructure-change/drift.d.ts +0 -13
  590. package/src/infrastructure-change/drift.js +0 -112
  591. package/src/infrastructure-change/index.d.ts +0 -7
  592. package/src/infrastructure-change/index.js +0 -11
  593. package/src/infrastructure-change/local-capability.d.ts +0 -73
  594. package/src/infrastructure-change/local-capability.js +0 -114
  595. package/src/infrastructure-change/model.d.ts +0 -274
  596. package/src/infrastructure-change/model.js +0 -29
  597. package/src/infrastructure-change/normalize.d.ts +0 -16
  598. package/src/infrastructure-change/normalize.js +0 -285
  599. package/src/infrastructure-change/plan.d.ts +0 -67
  600. package/src/infrastructure-change/plan.js +0 -671
  601. package/src/infrastructure-change/risk.d.ts +0 -9
  602. package/src/infrastructure-change/risk.js +0 -349
  603. package/src/infrastructure-change/summary.d.ts +0 -20
  604. package/src/infrastructure-change/summary.js +0 -130
  605. package/src/performance/cost-collection.d.ts +0 -225
  606. package/src/performance/cost-collection.js +0 -827
  607. package/src/performance/cost-controls.d.ts +0 -135
  608. package/src/performance/cost-controls.js +0 -347
  609. package/src/performance/evidence.d.ts +0 -140
  610. package/src/performance/evidence.js +0 -601
  611. package/src/performance/index.d.ts +0 -10
  612. package/src/performance/index.js +0 -14
  613. package/src/performance/load-safety.d.ts +0 -84
  614. package/src/performance/load-safety.js +0 -348
  615. package/src/performance/model.d.ts +0 -129
  616. package/src/performance/model.js +0 -451
  617. package/src/performance/pr-artifact-budget.d.ts +0 -42
  618. package/src/performance/pr-artifact-budget.js +0 -151
  619. package/src/performance/runner.d.ts +0 -75
  620. package/src/performance/runner.js +0 -227
  621. package/src/performance/scenario-endpoint.d.ts +0 -1
  622. package/src/performance/scenario-endpoint.js +0 -5
  623. package/src/performance/scenario.d.ts +0 -215
  624. package/src/performance/scenario.js +0 -744
  625. package/src/performance/unit-cost.d.ts +0 -105
  626. package/src/performance/unit-cost.js +0 -364
  627. package/src/release/index.d.ts +0 -2
  628. package/src/release/index.js +0 -6
  629. package/src/release/lifecycle.d.ts +0 -132
  630. package/src/release/lifecycle.js +0 -411
  631. package/src/release/manifest.d.ts +0 -148
  632. package/src/release/manifest.js +0 -503
  633. package/src/release/rollout.d.ts +0 -170
  634. package/src/release/rollout.js +0 -578
  635. package/src/release/source-authority.d.ts +0 -19
  636. package/src/release/source-authority.js +0 -212
  637. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  638. package/src/schemas/api-contract-baseline-v1.json +0 -674
  639. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  640. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  641. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  642. package/src/schemas/blueprint-v1.json +0 -188
  643. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  644. package/src/schemas/performance-policy-v1.json +0 -335
  645. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  646. package/src/schemas/testing-evidence-result-v1.json +0 -319
  647. package/src/secrets/aws-control-plane.d.ts +0 -29
  648. package/src/secrets/aws-control-plane.js +0 -322
  649. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  650. package/src/secrets/generated-aws-control-plane.js +0 -322
  651. package/src/secrets/guardrails.d.ts +0 -26
  652. package/src/secrets/guardrails.js +0 -328
  653. package/src/secrets/metadata.d.ts +0 -48
  654. package/src/secrets/metadata.js +0 -199
  655. package/src/secrets/operator.d.ts +0 -190
  656. package/src/secrets/operator.js +0 -701
  657. package/src/secrets/verification.d.ts +0 -18
  658. package/src/secrets/verification.js +0 -152
  659. package/src/supply-chain/action-pins.d.ts +0 -26
  660. package/src/supply-chain/action-pins.js +0 -262
  661. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  662. package/src/supply-chain/blueprint-trust-git.js +0 -1666
  663. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  664. package/src/supply-chain/blueprint-trust-process.js +0 -88
  665. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  666. package/src/supply-chain/blueprint-trust.js +0 -1558
  667. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  668. package/src/supply-chain/blueprint-verification-authority.js +0 -679
  669. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  670. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  671. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  672. package/src/supply-chain/build-output-bounds.js +0 -12
  673. package/src/supply-chain/build-output.d.ts +0 -41
  674. package/src/supply-chain/build-output.js +0 -551
  675. package/src/supply-chain/common.d.ts +0 -21
  676. package/src/supply-chain/common.js +0 -107
  677. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  678. package/src/supply-chain/container-artifact-contract.js +0 -208
  679. package/src/supply-chain/container-release.d.ts +0 -119
  680. package/src/supply-chain/container-release.js +0 -496
  681. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  682. package/src/supply-chain/ecr-applicability.js +0 -103
  683. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  684. package/src/supply-chain/ecr-scanning.js +0 -325
  685. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  686. package/src/supply-chain/ecs-deployed-image.js +0 -302
  687. package/src/supply-chain/errors.d.ts +0 -6
  688. package/src/supply-chain/errors.js +0 -15
  689. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  690. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
  691. package/src/supply-chain/generated-command.d.ts +0 -1
  692. package/src/supply-chain/generated-command.js +0 -775
  693. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  694. package/src/supply-chain/generated-container-release-command.js +0 -3248
  695. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  696. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  697. package/src/supply-chain/generated-files.d.ts +0 -13
  698. package/src/supply-chain/generated-files.js +0 -421
  699. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  700. package/src/supply-chain/generated-scanner-command.js +0 -778
  701. package/src/supply-chain/index.d.ts +0 -28
  702. package/src/supply-chain/index.js +0 -36
  703. package/src/supply-chain/inventory.d.ts +0 -96
  704. package/src/supply-chain/inventory.js +0 -828
  705. package/src/supply-chain/license-expression.d.ts +0 -7
  706. package/src/supply-chain/license-expression.js +0 -128
  707. package/src/supply-chain/policy.d.ts +0 -105
  708. package/src/supply-chain/policy.js +0 -304
  709. package/src/supply-chain/publication.d.ts +0 -48
  710. package/src/supply-chain/publication.js +0 -85
  711. package/src/supply-chain/sbom.d.ts +0 -228
  712. package/src/supply-chain/sbom.js +0 -913
  713. package/src/supply-chain/scanner.d.ts +0 -77
  714. package/src/supply-chain/scanner.js +0 -514
  715. package/src/supply-chain/vendored-source.d.ts +0 -95
  716. package/src/supply-chain/vendored-source.js +0 -315
  717. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  718. package/src/testing-evidence/fixture-scope.js +0 -142
  719. package/src/testing-evidence/index.d.ts +0 -5
  720. package/src/testing-evidence/index.js +0 -9
  721. package/src/testing-evidence/quarantine.d.ts +0 -48
  722. package/src/testing-evidence/quarantine.js +0 -253
  723. package/src/testing-evidence/result.d.ts +0 -109
  724. package/src/testing-evidence/result.js +0 -585
  725. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  726. package/src/testing-evidence/runner-adapter.js +0 -288
  727. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  728. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  729. package/src/work-markers/index.d.ts +0 -1
  730. package/src/work-markers/index.js +0 -5
  731. package/src/work-markers/work-markers.d.ts +0 -39
  732. package/src/work-markers/work-markers.js +0 -363
  733. package/src/workload-roles/account-baseline.d.ts +0 -143
  734. package/src/workload-roles/account-baseline.js +0 -980
  735. package/src/workload-roles/authority.d.ts +0 -40
  736. package/src/workload-roles/authority.js +0 -202
  737. package/src/workload-roles/aws-adapter.d.ts +0 -99
  738. package/src/workload-roles/aws-adapter.js +0 -416
  739. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  740. package/src/workload-roles/aws-internal-handler.js +0 -58
  741. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  742. package/src/workload-roles/aws-s3-state.js +0 -191
  743. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  744. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  745. package/src/workload-roles/boundary.d.ts +0 -34
  746. package/src/workload-roles/boundary.js +0 -137
  747. package/src/workload-roles/convergence.d.ts +0 -66
  748. package/src/workload-roles/convergence.js +0 -186
  749. package/src/workload-roles/handler.d.ts +0 -43
  750. package/src/workload-roles/handler.js +0 -158
  751. package/src/workload-roles/history.d.ts +0 -47
  752. package/src/workload-roles/history.js +0 -324
  753. package/src/workload-roles/injection.d.ts +0 -119
  754. package/src/workload-roles/injection.js +0 -495
  755. package/src/workload-roles/manifest.d.ts +0 -54
  756. package/src/workload-roles/manifest.js +0 -343
  757. package/src/workload-roles/provisioner.d.ts +0 -70
  758. package/src/workload-roles/provisioner.js +0 -239
  759. package/src/workload-roles/registration.d.ts +0 -102
  760. package/src/workload-roles/registration.js +0 -462
  761. package/src/workload-roles/stage-boundary.d.ts +0 -31
  762. package/src/workload-roles/stage-boundary.js +0 -208
  763. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  764. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,2618 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderProductTestingFiles = renderProductTestingFiles;
4
- const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
5
- const local_source_identity_js_1 = require("./local-source-identity.js");
6
- const built_in_plan_testing_persistence_files_js_1 = require("./built-in-plan-testing-persistence-files.js");
7
- const deployed_smoke_readiness_js_1 = require("./deployed-smoke-readiness.js");
8
- const deployed_smoke_diagnostics_js_1 = require("./deployed-smoke-diagnostics.js");
9
- const pnpm_launch_script_js_1 = require("./pnpm-launch-script.js");
10
- /** @internal */
11
- function renderProductTestingFiles(name, pascalName, sql = false) {
12
- return {
13
- ...(0, built_in_plan_testing_persistence_files_js_1.renderTestingPersistenceFiles)(name, pascalName, sql),
14
- 'scripts/deployed-smoke-readiness.mjs': deployed_smoke_readiness_js_1.deployedSmokeReadinessScript,
15
- 'docs/testing.md': `# ${name} testing
16
-
17
- Use the narrowest proof layer that can establish the behavior. Source tests are
18
- hermetic and credential-free. The \`test-integration\` target owns a disposable
19
- DynamoDB Local container and one isolated table per worker. Declared SQL adds
20
- a PostgreSQL container and one migrated database per worker. It runs deterministic
21
- fixtures and removes every resource it creates.
22
- It never uses the persistent database started by \`ebk dev\`.
23
-
24
- Every fixture run records its seed and run scope. Keep fixture data synthetic.
25
- Do not copy customer data, credentials, browser storage, tokens, request bodies,
26
- or protected identifiers into source, test output, or retained artifacts.
27
-
28
- The published testing-evidence JSON Schemas validate structural interchange
29
- only. Promotion and quarantine decisions must use
30
- \`validateTestingEvidenceResult\` and \`validateTestingEvidenceQuarantine\`;
31
- those validators enforce cross-field outcome rules and trusted time/workflow
32
- context that JSON Schema cannot establish alone.
33
-
34
- \`smoke-deployed-check\` only proves that Playwright can discover the suite. It
35
- does not contact or prove a deployment. The root governed lifecycle runs each
36
- Slice's \`smoke-deployed\` target immediately after its successful native SST
37
- deployment and migration. Local and GitHub execution use the same stage
38
- deployment role and exact deployed outputs; no separate smoke role, workflow,
39
- target registry, or staging-evidence reconciliation graph exists.
40
-
41
- The generated Next.js component selects native SST invalidation completion
42
- before deployment returns. This is not a readiness or application guarantee;
43
- the subsequent readiness and browser gates still apply.
44
-
45
- Before synthetic users or browser assertions, a read-only prerequisite checks
46
- the exact API and web service, stage and deployed build. Transient gateway or
47
- network unavailability has one fixed thirty-second readiness bound. The one
48
- exception is the Router's own CloudFront error page for the web route: the
49
- pinned SST Router reads routing from an eventually consistent CloudFront
50
- KeyValueStore, so a newly deployed route can briefly reach the placeholder
51
- origin at an edge. Only that classified page may extend readiness, to at most
52
- three hundred seconds; any other failure ends the extension. Readiness then
53
- requires consecutive healthy rounds on fresh connections spanning thirty
54
- seconds; any fallthrough restarts that window. Wrong build
55
- identity, malformed responses, certificate errors, redirects and access denials
56
- fail immediately. Bounded status, request-start time, duration, valid
57
- CloudFront request-ID/POP/cache-result observations and the edge-routing
58
- classification are retained in \`deployed-readiness.json\`; no URLs, response
59
- bodies, cookies, arbitrary headers or credentials are retained. Duration
60
- measures the request through response headers (or transport failure), not
61
- response-body processing.
62
- This prerequisite is not application acceptance and does not change browser or
63
- event deadlines. Subsequent failed-then-passed assertions remain flaky/failing.
64
-
65
- Development and staging smoke observe the exact event for at most sixteen
66
- minutes; production observes it for at most ninety seconds. Ordinary delivery
67
- uses DynamoDB Streams or SQL post-commit publication/notification, not a wait
68
- for the recovery schedule. New SQL recovery defaults to hourly; a missed
69
- notification may therefore leave a bounded smoke unsuccessful while its durable
70
- intent remains recoverable. These observation limits include CloudWatch Logs
71
- request latency; the runner aborts an in-flight request when time runs out.
72
- Do not change maintenance pauses or increase timeouts merely to claim success.
73
-
74
- The runner creates one run-scoped synthetic customer in the Slice's narrow
75
- \`<slice>-test-writer\` group and one distinct synthetic reviewer in
76
- \`<slice>-admin\`. It never grants the customer administrator authority, strips
77
- AWS credentials from the browser child, observes the published event only from
78
- the credential-bearing parent, removes both principals and all raw browser and
79
- log state, and retains only allowlisted sanitized evidence. A failed browser
80
- run also keeps the last 4 KiB of its output, with every synthetic credential
81
- and email replaced, as private local
82
- \`.ebk/evidence/playwright-smoke-output-<attempt>.txt\`; the hosted workflow
83
- does not upload it. A failed smoke ends the lifecycle immediately and no
84
- successful deployment receipt is written.
85
-
86
- One optional evidence-level retry replays the complete, identical browser or
87
- live-integration proof. Consequently \`counts.retried\` is always zero or one.
88
- The evidence adapter retains both attempts; any pass-after-fail outcome is
89
- \`flaky\`, never \`passed\`. Runner-internal retries are forbidden. Source and
90
- contract tests receive no automatic retry.
91
-
92
- Skipped integration and Playwright tests fail unless their stable hashed test
93
- ID matches one active runner-specific quarantine record. Matched skips count as
94
- quarantined, and a record that is not observed by its runner also fails closed.
95
- Local quarantine uses reviewed date expiry. A run-count record binds an
96
- absolute \`.github/workflows/*.yml\` path and \`expiresAfterRun\`; it is accepted
97
- only when GitHub supplies a matching \`GITHUB_WORKFLOW_REF\` and positive
98
- \`GITHUB_RUN_NUMBER\`, and it must expire within 25 trusted workflow runs.
99
- `,
100
- 'testing/fixtures/records.ts': `import { createTypedFixtureBuilder } from '@empire-builder-kit/nx/testing-evidence';
101
-
102
- export interface ${pascalName}RecordFixture {
103
- id: string;
104
- name: string;
105
- }
106
-
107
- export const build${pascalName}RecordFixture =
108
- createTypedFixtureBuilder<${pascalName}RecordFixture>((fixture) => {
109
- const token = fixture.token('record-id', 32);
110
- return {
111
- id: [
112
- token.slice(0, 8),
113
- token.slice(8, 12),
114
- '4' + token.slice(13, 16),
115
- '8' + token.slice(17, 20),
116
- token.slice(20, 32),
117
- ].join('-'),
118
- name: \`Synthetic ${pascalName} \${fixture.token('record-name', 12)}\`,
119
- };
120
- });
121
- `,
122
- 'testing/quarantine.json': (0, built_in_plan_shared_js_1.json)({
123
- records: [],
124
- schemaVersion: 1,
125
- }),
126
- 'testing/quarantine-runtime.mjs': `import { createHash } from 'node:crypto';
127
- import { isAbsolute, relative } from 'node:path';
128
-
129
- function portableTestPath(projectRoot, value) {
130
- const path = isAbsolute(value)
131
- ? relative(projectRoot, value)
132
- : value;
133
- const normalized = path.replaceAll('\\\\', '/').replace(/^\\.\\//, '');
134
- if (
135
- !normalized ||
136
- normalized === '..' ||
137
- normalized.startsWith('../') ||
138
- normalized.includes('/../')
139
- ) {
140
- throw new Error('Runner report contains a test outside the Product Slice.');
141
- }
142
- return normalized;
143
- }
144
-
145
- function testId(runner, parts, classification = 'general') {
146
- return (
147
- runner +
148
- ':' +
149
- classification +
150
- ':' +
151
- createHash('sha256').update(parts.join('\\0')).digest('hex')
152
- );
153
- }
154
-
155
- export function githubWorkflowRun(environment = process.env) {
156
- const reference = environment.GITHUB_WORKFLOW_REF;
157
- const number = Number(environment.GITHUB_RUN_NUMBER);
158
- if (!reference || !Number.isSafeInteger(number) || number < 1) {
159
- return undefined;
160
- }
161
- const match =
162
- /\\/(\\.github\\/workflows\\/[A-Za-z0-9._/-]+\\.ya?ml)@/.exec(reference);
163
- return match ? { number, workflow: match[1] } : undefined;
164
- }
165
-
166
- export function playwrightSkippedTestIds(report, projectRoot) {
167
- const ids = [];
168
- const visit = (suite, titles = []) => {
169
- const nextTitles = suite.title ? [...titles, suite.title] : titles;
170
- for (const spec of suite.specs ?? []) {
171
- const file = portableTestPath(
172
- projectRoot,
173
- spec.file ?? suite.file ?? '',
174
- );
175
- for (const test of spec.tests ?? []) {
176
- const results = test.results ?? [];
177
- if (
178
- test.expectedStatus === 'skipped' ||
179
- (results.length > 0 &&
180
- results.every(({ status }) => status === 'skipped'))
181
- ) {
182
- ids.push(
183
- testId('playwright', [
184
- file,
185
- ...nextTitles,
186
- spec.title ?? '',
187
- test.projectName ?? test.projectId ?? '',
188
- ], file === 'e2e/frontend-accessibility.spec.ts'
189
- ? 'accessibility'
190
- : 'general'),
191
- );
192
- }
193
- }
194
- }
195
- for (const child of suite.suites ?? []) visit(child, nextTitles);
196
- };
197
- for (const suite of report?.suites ?? []) visit(suite);
198
- return [...new Set(ids)].sort();
199
- }
200
-
201
- export function vitestIntegrationSkippedTestIds(reports, projectRoot) {
202
- const ids = [];
203
- for (const report of reports) {
204
- for (const fileResult of report?.testResults ?? []) {
205
- const file = portableTestPath(
206
- projectRoot,
207
- fileResult.name ?? '',
208
- );
209
- for (const assertion of fileResult.assertionResults ?? []) {
210
- if (['pending', 'skipped', 'todo'].includes(assertion.status)) {
211
- ids.push(
212
- testId('vitest-integration', [
213
- file,
214
- assertion.fullName ?? assertion.title ?? '',
215
- ]),
216
- );
217
- }
218
- }
219
- }
220
- }
221
- return [...new Set(ids)].sort();
222
- }
223
-
224
- export function reconcileRunnerQuarantine(options) {
225
- const prefix = options.runner + ':';
226
- const records = options.records.filter(({ testId }) =>
227
- testId.startsWith(prefix),
228
- );
229
- const declared = new Map(records.map((record) => [record.testId, record]));
230
- const skipped = [...new Set(options.skippedTestIds)].sort();
231
- const matched = skipped.filter((id) => declared.has(id));
232
- const unmatched = skipped.filter((id) => !declared.has(id));
233
- const observed = new Set(skipped);
234
- const unobserved = [...declared.keys()]
235
- .filter((id) => !observed.has(id))
236
- .sort();
237
- const findings = [];
238
- if (unmatched.length > 0) {
239
- findings.push({
240
- classification: 'environment-drift',
241
- summary:
242
- 'Skipped tests lack active quarantine records: ' +
243
- unmatched.slice(0, 8).join(', ') +
244
- (unmatched.length > 8 ? ', ...' : ''),
245
- });
246
- }
247
- if (unobserved.length > 0) {
248
- findings.push({
249
- classification: 'environment-drift',
250
- summary:
251
- 'Active quarantine records did not match skipped tests: ' +
252
- unobserved.slice(0, 8).join(', ') +
253
- (unobserved.length > 8 ? ', ...' : ''),
254
- });
255
- }
256
- return {
257
- findings,
258
- quarantined: matched.length,
259
- skipped: unmatched.length,
260
- };
261
- }
262
- `,
263
- 'scripts/run-integration-tests.mjs': `import { spawn, spawnSync } from 'node:child_process';
264
- import { createHash, randomUUID } from 'node:crypto';
265
- import {
266
- existsSync,
267
- lstatSync,
268
- mkdirSync,
269
- readFileSync,
270
- realpathSync,
271
- ${sql ? ' readdirSync,\n' : ''}\
272
- rmSync,
273
- statSync,
274
- writeFileSync,
275
- } from 'node:fs';
276
- import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
277
- import { createRequire } from 'node:module';
278
- import { TextDecoder } from 'node:util';
279
- ${sql ? "import pg from 'pg';" : ''}
280
- import { CreateTableCommand, DynamoDBClient, ListTablesCommand } from '@aws-sdk/client-dynamodb';
281
- import { DYNAMO_PENDING_INDEX } from '@empire-builder-kit/runtime/key-value';
282
- import {
283
- githubWorkflowRun,
284
- reconcileRunnerQuarantine,
285
- vitestIntegrationSkippedTestIds,
286
- } from '../testing/quarantine-runtime.mjs';
287
-
288
- const require = createRequire(import.meta.url);
289
- const {
290
- ${sql ? ' createLocalTestScope,\n' : ''}\
291
- createTestingEvidenceFromRunnerAttempts,
292
- inspectTestingEvidenceArtifact,
293
- normalizeEbkIntegrationEvidenceAttempt,
294
- sanitizeTestingEvidenceSummary,
295
- validateTestingEvidenceQuarantine,
296
- } = require('@empire-builder-kit/nx/testing-evidence');
297
- ${sql ? 'const { Client } = pg;' : ''}
298
- const fatalUtf8Decoder = new TextDecoder('utf-8', { fatal: true });
299
- const projectRoot = process.cwd();
300
- const workspaceRoot = resolve(projectRoot, '../..');
301
- const evidenceRoot = join(projectRoot, '.ebk', 'evidence');
302
- const rawRoot = join(evidenceRoot, 'raw');
303
- rmSync(rawRoot, { force: true, recursive: true });
304
- mkdirSync(rawRoot, { recursive: true });
305
- const sanitizedIntegrationReportPath = join(
306
- evidenceRoot,
307
- 'test-integration-report.json',
308
- );
309
- rmSync(sanitizedIntegrationReportPath, { force: true });
310
-
311
- const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
312
- const run = (command, args, options = {}) => {
313
- const result = spawnSync(command, args, {
314
- cwd: options.cwd ?? projectRoot,
315
- encoding: 'utf8',
316
- env: options.env ?? process.env,
317
- shell: false,
318
- stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],
319
- windowsHide: true,
320
- });
321
- if (result.error || result.status !== 0) {
322
- throw new Error(
323
- sanitizeTestingEvidenceSummary(
324
- result.error?.message ||
325
- result.stderr ||
326
- result.stdout ||
327
- command + ' failed.',
328
- ),
329
- );
330
- }
331
- return result.stdout.trim();
332
- };
333
- ${local_source_identity_js_1.localSourceCommitFunction}
334
- const gitCommit = localSourceCommit();
335
- const workspacePackage = readJson(join(workspaceRoot, 'package.json'));
336
- const ownership = readJson(join(projectRoot, '.ebk', 'ownership.json'));
337
- const frameworkCandidate =
338
- workspacePackage.dependencies?.['@empire-builder-kit/runtime'];
339
- if (typeof frameworkCandidate !== 'string' || !frameworkCandidate) {
340
- throw new Error('The workspace runtime candidate is unavailable.');
341
- }
342
-
343
- function pathIsInsideInstalledRoot(root, candidate) {
344
- const fromRoot = relative(root, candidate);
345
- return (
346
- fromRoot.length > 0 &&
347
- fromRoot !== '..' &&
348
- !fromRoot.startsWith('..' + sep) &&
349
- !isAbsolute(fromRoot)
350
- );
351
- }
352
-
353
- function resolveInstalledVitestCommand(options = {}) {
354
- const expectedVersion = workspacePackage.devDependencies?.vitest;
355
- if (
356
- typeof expectedVersion !== 'string' ||
357
- !/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(expectedVersion)
358
- ) {
359
- throw new Error(
360
- 'Integration tests require one exact workspace Vitest version.',
361
- );
362
- }
363
- const nodeModulesPath = join(workspaceRoot, 'node_modules');
364
- const nodeModulesMetadata = lstatSync(nodeModulesPath);
365
- if (
366
- nodeModulesMetadata.isSymbolicLink() ||
367
- !nodeModulesMetadata.isDirectory()
368
- ) {
369
- throw new Error(
370
- 'Integration tests require one real workspace node_modules authority.',
371
- );
372
- }
373
- const canonicalNodeModules = realpathSync(nodeModulesPath);
374
- const packageResolver =
375
- options.packageResolver ?? ((specifier) => require.resolve(specifier));
376
- const requestedManifest = packageResolver('vitest/package.json');
377
- const manifestMetadata = lstatSync(requestedManifest);
378
- const canonicalManifest = realpathSync(requestedManifest);
379
- if (
380
- manifestMetadata.isSymbolicLink() ||
381
- !manifestMetadata.isFile() ||
382
- manifestMetadata.size < 2 ||
383
- manifestMetadata.size > 64 * 1024 ||
384
- !pathIsInsideInstalledRoot(canonicalNodeModules, canonicalManifest)
385
- ) {
386
- throw new Error(
387
- 'Integration tests require one confined regular Vitest manifest.',
388
- );
389
- }
390
- const manifest = readJson(canonicalManifest);
391
- if (
392
- manifest.name !== 'vitest' ||
393
- manifest.version !== expectedVersion ||
394
- manifest.bin?.vitest !== './vitest.mjs'
395
- ) {
396
- throw new Error(
397
- 'Integration tests require the exact installed Vitest package authority.',
398
- );
399
- }
400
- const packageRoot = dirname(canonicalManifest);
401
- const requestedEntryPoint = resolve(packageRoot, manifest.bin.vitest);
402
- const entryMetadata = lstatSync(requestedEntryPoint);
403
- const canonicalEntryPoint = realpathSync(requestedEntryPoint);
404
- if (
405
- entryMetadata.isSymbolicLink() ||
406
- !entryMetadata.isFile() ||
407
- entryMetadata.size < 2 ||
408
- entryMetadata.size > 64 * 1024 ||
409
- !pathIsInsideInstalledRoot(packageRoot, canonicalEntryPoint) ||
410
- !pathIsInsideInstalledRoot(canonicalNodeModules, canonicalEntryPoint)
411
- ) {
412
- throw new Error(
413
- 'Integration tests require one confined regular Vitest entrypoint.',
414
- );
415
- }
416
- const requestedNode = options.nodeExecutable ?? process.execPath;
417
- if (typeof requestedNode !== 'string' || !isAbsolute(requestedNode)) {
418
- throw new Error('Integration tests require one absolute Node authority.');
419
- }
420
- const canonicalNode = realpathSync(requestedNode);
421
- const nodeMetadata = lstatSync(canonicalNode);
422
- if (nodeMetadata.isSymbolicLink() || !nodeMetadata.isFile()) {
423
- throw new Error('Integration tests require one real Node executable.');
424
- }
425
- return { command: canonicalNode, entryPoint: canonicalEntryPoint };
426
- }
427
-
428
- const installedVitestCommand = resolveInstalledVitestCommand();
429
- const blueprintCandidates = [
430
- ownership.blueprint.name + '@' + ownership.blueprint.version,
431
- ];
432
- const requestedRunId = process.env.EBK_TEST_RUN_ID;
433
- const runId = requestedRunId ?? randomUUID().replaceAll('-', '');
434
- const seed = process.env.EBK_TEST_SEED ?? runId;
435
- const validRunId = /^[a-z0-9]{1,32}$/.test(runId);
436
- const validSeed = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(seed);
437
- const evidenceRunId = validRunId ? runId : 'invalid-run-id';
438
- const evidenceSeed = validSeed ? seed : 'invalid-seed';
439
- const workers = Number(process.env.EBK_TEST_WORKERS ?? 1);
440
- const validWorkers =
441
- Number.isSafeInteger(workers) && workers >= 1 && workers <= 8;
442
- const composeProject = 'ebk-test-${name}-' + runId;
443
- const composeArgs = [
444
- 'compose',
445
- '-f',
446
- 'database/test-compose.yml',
447
- '--project-name',
448
- composeProject,
449
- ];
450
- const resultPath = join(evidenceRoot, 'test-integration.json');
451
- const source = {
452
- blueprintCandidates,
453
- commit: gitCommit,
454
- frameworkCandidate,
455
- };
456
- const operation = {
457
- commandVersion: '1',
458
- project: '${name}',
459
- proofLayer: 'local-integration',
460
- target: 'test-integration',
461
- };
462
- let quarantineRecords = [];
463
-
464
- function writeResult(result) {
465
- writeFileSync(resultPath, JSON.stringify(result, null, 2) + '\\n', 'utf8');
466
- process.stdout.write(JSON.stringify(result) + '\\n');
467
- }
468
-
469
- function preflightFailure(classification, summary, startedAt) {
470
- const completedAt = new Date().toISOString();
471
- const result = createTestingEvidenceFromRunnerAttempts({
472
- attempts: [],
473
- cleanup: { outcome: 'not-required' },
474
- environment: { class: 'local-docker', deployed: false },
475
- operation,
476
- preflight: {
477
- completedAt,
478
- findings: [{ classification, summary }],
479
- startedAt,
480
- },
481
- proofStarted: false,
482
- runScope: evidenceRunId,
483
- seed: evidenceSeed,
484
- slice: '${name}',
485
- source,
486
- workspace: workspacePackage.name,
487
- });
488
- rmSync(sanitizedIntegrationReportPath, { force: true });
489
- rmSync(rawRoot, { force: true, recursive: true });
490
- writeResult(result);
491
- process.exitCode = 1;
492
- }
493
-
494
- function pruneStaleTestProjects() {
495
- const candidateIds = run('docker', [
496
- 'ps',
497
- '-aq',
498
- '--filter',
499
- 'label=dev.empirebuilderkit.owner=test-integration',
500
- '--filter',
501
- 'label=dev.empirebuilderkit.slice=${name}',
502
- ]);
503
- if (!candidateIds) return;
504
- const candidates = JSON.parse(
505
- run('docker', ['inspect', ...candidateIds.split(/\\s+/)]),
506
- );
507
- const now = Date.now();
508
- const cutoff = now - 24 * 60 * 60 * 1000;
509
- const projects = new Set();
510
- for (const observation of candidates) {
511
- const labels = observation.Config?.Labels ?? {};
512
- const project = labels['com.docker.compose.project'];
513
- const observedRunId = labels['dev.empirebuilderkit.run'];
514
- const createdAt = Date.parse(observation.Created);
515
- if (
516
- labels['dev.empirebuilderkit.owner'] !== 'test-integration' ||
517
- labels['dev.empirebuilderkit.slice'] !== '${name}' ||
518
- typeof project !== 'string' ||
519
- typeof observedRunId !== 'string' ||
520
- !/^[a-z0-9]{1,32}$/.test(observedRunId) ||
521
- project !== 'ebk-test-${name}-' + observedRunId ||
522
- !Number.isFinite(createdAt) ||
523
- createdAt > now ||
524
- project === composeProject
525
- ) {
526
- throw new Error(
527
- 'A stale integration resource has ambiguous ownership or age.',
528
- );
529
- }
530
- projects.add(project);
531
- }
532
- for (const project of [...projects].sort()) {
533
- const memberIds = run('docker', [
534
- 'ps',
535
- '-aq',
536
- '--filter',
537
- 'label=com.docker.compose.project=' + project,
538
- ]);
539
- if (!memberIds) {
540
- throw new Error(
541
- 'A stale integration project has no inspectable members.',
542
- );
543
- }
544
- const members = JSON.parse(
545
- run('docker', ['inspect', ...memberIds.split(/\\s+/)]),
546
- );
547
- const ages = [];
548
- let running = false;
549
- for (const observation of members) {
550
- const labels = observation.Config?.Labels ?? {};
551
- const observedRunId = labels['dev.empirebuilderkit.run'];
552
- const createdAt = Date.parse(observation.Created);
553
- if (
554
- labels['com.docker.compose.project'] !== project ||
555
- labels['dev.empirebuilderkit.owner'] !== 'test-integration' ||
556
- labels['dev.empirebuilderkit.slice'] !== '${name}' ||
557
- typeof observedRunId !== 'string' ||
558
- !/^[a-z0-9]{1,32}$/.test(observedRunId) ||
559
- project !== 'ebk-test-${name}-' + observedRunId ||
560
- project === composeProject ||
561
- !Number.isFinite(createdAt) ||
562
- createdAt > now ||
563
- typeof observation.State?.Running !== 'boolean'
564
- ) {
565
- throw new Error(
566
- 'A stale integration project has ambiguous members or age.',
567
- );
568
- }
569
- ages.push(createdAt);
570
- running ||= observation.State.Running;
571
- }
572
- const oldMembers = ages.filter((createdAt) => createdAt <= cutoff).length;
573
- if (oldMembers > 0 && oldMembers !== ages.length) {
574
- throw new Error(
575
- 'A stale integration project contains mixed-age members.',
576
- );
577
- }
578
- if (oldMembers === 0 || running) continue;
579
- run('docker', [
580
- 'compose',
581
- '-f',
582
- 'database/test-compose.yml',
583
- '--project-name',
584
- project,
585
- 'down',
586
- '--remove-orphans',
587
- '--volumes',
588
- ]);
589
- }
590
- }
591
-
592
- ${sql
593
- ? `async function prepareDatabase(adminUrl, databaseName) {
594
- const admin = new Client({ connectionString: adminUrl });
595
- await admin.connect();
596
- try {
597
- await admin.query('CREATE DATABASE "' + databaseName + '"');
598
- } finally {
599
- await admin.end();
600
- }
601
- const databaseUrl = adminUrl.replace(/\\/postgres$/, '/' + databaseName);
602
- const client = new Client({ connectionString: databaseUrl });
603
- await client.connect();
604
- try {
605
- for (const file of readdirSync(join(projectRoot, 'database', 'migrations'))
606
- .filter((path) => path.endsWith('.sql'))
607
- .sort()) {
608
- await client.query(
609
- readFileSync(join(projectRoot, 'database', 'migrations', file), 'utf8'),
610
- );
611
- }
612
- } finally {
613
- await client.end();
614
- }
615
- return databaseUrl;
616
- }`
617
- : ''}
618
-
619
- function localDynamoClient(endpoint) {
620
- const url = new URL(endpoint);
621
- if (url.protocol !== 'http:' || url.hostname !== '127.0.0.1' || !url.port ||
622
- url.username || url.password || url.search || url.hash || url.pathname !== '/')
623
- throw new Error('Integration DynamoDB must use its owned loopback endpoint.');
624
- return new DynamoDBClient({ endpoint, region: 'us-east-1', maxAttempts: 1,
625
- credentials: { accessKeyId: 'LOCALFIXTURE', secretAccessKey: 'local-fixture-not-an-aws-credential' } });
626
- }
627
-
628
- async function waitForLocalDynamo(endpoint) {
629
- const client = localDynamoClient(endpoint);
630
- const deadline = Date.now() + 30_000;
631
- try {
632
- for (;;) {
633
- try { await client.send(new ListTablesCommand({ Limit: 1 })); return; }
634
- catch (error) {
635
- if (Date.now() >= deadline) throw error;
636
- await new Promise((resolveWait) => setTimeout(resolveWait, 200));
637
- }
638
- }
639
- } finally { client.destroy(); }
640
- }
641
-
642
- async function prepareKeyValue(endpoint, attempt, worker) {
643
- if (!validRunId || ![1, 2].includes(attempt) || !Number.isInteger(worker) || worker < 0 || worker > 7)
644
- throw new Error('Integration table identity is invalid.');
645
- const tableName = 'ebk-test-${name}-' + runId + '-a' + attempt + '-w' + worker;
646
- const client = localDynamoClient(endpoint);
647
- try {
648
- await client.send(new CreateTableCommand({ TableName: tableName, BillingMode: 'PAY_PER_REQUEST',
649
- AttributeDefinitions: [
650
- { AttributeName: 'pk', AttributeType: 'S' }, { AttributeName: 'sk', AttributeType: 'S' },
651
- { AttributeName: 'pendingPk', AttributeType: 'S' }, { AttributeName: 'pendingAt', AttributeType: 'N' },
652
- ],
653
- KeySchema: [{ AttributeName: 'pk', KeyType: 'HASH' }, { AttributeName: 'sk', KeyType: 'RANGE' }],
654
- GlobalSecondaryIndexes: [{ IndexName: DYNAMO_PENDING_INDEX,
655
- KeySchema: [{ AttributeName: 'pendingPk', KeyType: 'HASH' }, { AttributeName: 'pendingAt', KeyType: 'RANGE' }],
656
- Projection: { ProjectionType: 'ALL' } }],
657
- StreamSpecification: { StreamEnabled: true, StreamViewType: 'NEW_AND_OLD_IMAGES' },
658
- }));
659
- return tableName;
660
- } finally { client.destroy(); }
661
- }
662
-
663
- function runWorker(worker, persistence, reportPath, attempt) {
664
- const arguments_ = [
665
- installedVitestCommand.entryPoint,
666
- 'run',
667
- '--config',
668
- 'vitest.integration.config.ts',
669
- '--maxWorkers=1',
670
- '--reporter=./testing/strict-json-reporter.mjs',
671
- '--outputFile=' + reportPath,
672
- ...(workers > 1 ? ['--shard=' + (worker + 1) + '/' + workers] : []),
673
- ];
674
- return new Promise((resolveWorker) => {
675
- const workerEnvironmentNames = new Set([
676
- 'APPDATA',
677
- 'CI',
678
- 'ComSpec',
679
- 'COMSPEC',
680
- 'HOME',
681
- 'LANG',
682
- 'LC_ALL',
683
- 'LOCALAPPDATA',
684
- 'PATH',
685
- 'PATHEXT',
686
- 'SystemRoot',
687
- 'SYSTEMROOT',
688
- 'TEMP',
689
- 'TMP',
690
- 'TMPDIR',
691
- 'TZ',
692
- 'USERPROFILE',
693
- ]);
694
- const childEnvironment = Object.fromEntries(
695
- Object.entries(process.env).filter(
696
- ([name, value]) =>
697
- workerEnvironmentNames.has(name) && typeof value === 'string',
698
- ),
699
- );
700
- const child = spawn(installedVitestCommand.command, arguments_, {
701
- cwd: projectRoot,
702
- env: {
703
- ...childEnvironment,
704
- ...(persistence.databaseUrl ? { DATABASE_URL: persistence.databaseUrl } : {}),
705
- EBK_TEST_DYNAMODB_ENDPOINT: persistence.endpoint,
706
- EBK_TEST_DYNAMODB_TABLE: persistence.tableName,
707
- EBK_STAGE: 'development',
708
- EVENT_BUS_NAME: 'local-integration-events',
709
- EBK_TEST_ATTEMPT: String(attempt),
710
- EBK_TEST_RUN_ID: runId,
711
- EBK_TEST_SEED: seed,
712
- EBK_TEST_WORKER: String(worker),
713
- },
714
- shell: false,
715
- stdio: ['ignore', 'pipe', 'pipe'],
716
- windowsHide: true,
717
- });
718
- const maximumDiagnosticCharacters = 64 * 1024;
719
- let diagnostic = '';
720
- const appendDiagnostic = (chunk) => {
721
- if (diagnostic.length >= maximumDiagnosticCharacters) return;
722
- diagnostic += chunk
723
- .toString()
724
- .slice(0, maximumDiagnosticCharacters - diagnostic.length);
725
- };
726
- child.stdout.on('data', (chunk) => {
727
- appendDiagnostic(chunk);
728
- });
729
- child.stderr.on('data', (chunk) => {
730
- appendDiagnostic(chunk);
731
- });
732
- child.once('error', (error) => {
733
- resolveWorker({ diagnostic: error.message, status: 1, worker });
734
- });
735
- child.once('close', (status) => {
736
- resolveWorker({ diagnostic, status: status ?? 1, worker });
737
- });
738
- });
739
- }
740
-
741
- function readBoundedVitestReport(reportPath) {
742
- if (!existsSync(reportPath)) {
743
- return {
744
- finding: {
745
- classification: 'evidence-incomplete',
746
- summary: 'A Vitest worker did not emit its machine-readable report.',
747
- },
748
- };
749
- }
750
- const size = statSync(reportPath).size;
751
- if (!Number.isSafeInteger(size) || size < 2 || size > 5 * 1024 * 1024) {
752
- return {
753
- finding: {
754
- classification: 'evidence-incomplete',
755
- summary:
756
- 'A Vitest worker report was empty or exceeded the five-megabyte inspection bound.',
757
- },
758
- };
759
- }
760
- let report;
761
- try {
762
- const bytes = readFileSync(reportPath);
763
- if (bytes.byteLength !== size) {
764
- throw new Error('vitest-report-size-changed');
765
- }
766
- report = JSON.parse(fatalUtf8Decoder.decode(bytes));
767
- } catch {
768
- return {
769
- finding: {
770
- classification: 'evidence-incomplete',
771
- summary: 'A Vitest worker emitted malformed machine-readable output.',
772
- },
773
- };
774
- }
775
- const counts = [
776
- report?.numTotalTests,
777
- report?.numFailedTests,
778
- report?.numPassedTests,
779
- report?.numPendingTests,
780
- report?.numTodoTests,
781
- ];
782
- if (
783
- !report ||
784
- typeof report !== 'object' ||
785
- Array.isArray(report) ||
786
- !Array.isArray(report.testResults) ||
787
- !report.ebkPolicy ||
788
- typeof report.ebkPolicy !== 'object' ||
789
- Array.isArray(report.ebkPolicy) ||
790
- JSON.stringify(Object.keys(report.ebkPolicy).sort()) !==
791
- JSON.stringify([
792
- 'expectedFailures',
793
- 'focusedTests',
794
- 'retryConfiguredTests',
795
- ]) ||
796
- counts.some(
797
- (count) =>
798
- !Number.isSafeInteger(count) ||
799
- count < 0,
800
- ) ||
801
- !Number.isSafeInteger(report.ebkPolicy.expectedFailures) ||
802
- report.ebkPolicy.expectedFailures < 0 ||
803
- !Number.isSafeInteger(report.ebkPolicy.focusedTests) ||
804
- report.ebkPolicy.focusedTests < 0 ||
805
- !Number.isSafeInteger(report.ebkPolicy.retryConfiguredTests) ||
806
- report.ebkPolicy.retryConfiguredTests < 0
807
- ) {
808
- return {
809
- finding: {
810
- classification: 'evidence-incomplete',
811
- summary:
812
- 'A Vitest worker report did not satisfy the bounded JSON result contract.',
813
- },
814
- };
815
- }
816
- const observed = {
817
- failed: 0,
818
- passed: 0,
819
- pending: 0,
820
- todo: 0,
821
- total: 0,
822
- };
823
- for (const testResult of report.testResults) {
824
- if (
825
- !testResult ||
826
- typeof testResult !== 'object' ||
827
- Array.isArray(testResult) ||
828
- !Array.isArray(testResult.assertionResults)
829
- ) {
830
- return {
831
- finding: {
832
- classification: 'evidence-incomplete',
833
- summary:
834
- 'A Vitest worker report did not contain inspectable assertion results.',
835
- },
836
- };
837
- }
838
- for (const assertion of testResult.assertionResults) {
839
- const status = assertion?.status;
840
- if (
841
- !assertion ||
842
- typeof assertion !== 'object' ||
843
- Array.isArray(assertion) ||
844
- !['failed', 'passed', 'pending', 'skipped', 'todo'].includes(status)
845
- ) {
846
- return {
847
- finding: {
848
- classification: 'evidence-incomplete',
849
- summary:
850
- 'A Vitest worker report contained an unsupported assertion result.',
851
- },
852
- };
853
- }
854
- observed.total += 1;
855
- if (status === 'failed') observed.failed += 1;
856
- if (status === 'passed') observed.passed += 1;
857
- if (status === 'pending' || status === 'skipped') observed.pending += 1;
858
- if (status === 'todo') observed.todo += 1;
859
- }
860
- }
861
- if (
862
- observed.total !== report.numTotalTests ||
863
- observed.failed !== report.numFailedTests ||
864
- observed.passed !== report.numPassedTests ||
865
- observed.pending !== report.numPendingTests ||
866
- observed.todo !== report.numTodoTests
867
- ) {
868
- return {
869
- finding: {
870
- classification: 'evidence-incomplete',
871
- summary:
872
- 'A Vitest worker report aggregate did not reconcile to its assertion results.',
873
- },
874
- };
875
- }
876
- if (
877
- report.ebkPolicy.expectedFailures > 0 ||
878
- report.ebkPolicy.focusedTests > 0 ||
879
- report.ebkPolicy.retryConfiguredTests > 0
880
- ) {
881
- return {
882
- finding: {
883
- classification: 'assertion-failed',
884
- summary:
885
- 'Vitest focused tests, expected-failure semantics, and runner-internal retries are forbidden in integration proof.',
886
- },
887
- report,
888
- };
889
- }
890
- return { report };
891
- }
892
-
893
- async function runAttempt(attempt, endpoint${sql ? ', adminUrl' : ''}) {
894
- const attemptStartedAt = new Date().toISOString();
895
- const findings = [];
896
- const reports = [];
897
- const reportPaths = [];
898
- let workerResults = [];
899
- try {
900
- const persistenceWorkers = [];
901
- for (let worker = 0; worker < workers; worker += 1) {
902
- ${sql
903
- ? `const scope = createLocalTestScope({
904
- capabilities: {
905
- canCreateDatabase: true,
906
- canForceDropDatabase: true,
907
- migrationSchemaIsolationProven: false,
908
- },
909
- identity: {
910
- attempt,
911
- commit: gitCommit,
912
- runId,
913
- seed,
914
- stage: 'development',
915
- worker,
916
- workspace: workspacePackage.name,
917
- },
918
- sharedDatabaseName: 'postgres',
919
- });
920
- const databaseUrl = await prepareDatabase(adminUrl, scope.databaseName);`
921
- : ''}
922
- persistenceWorkers.push({ endpoint, tableName: await prepareKeyValue(endpoint, attempt, worker)${sql ? ', databaseUrl' : ''} });
923
- }
924
- workerResults = await Promise.all(
925
- persistenceWorkers.map((persistence, worker) => {
926
- const reportPath = join(
927
- rawRoot,
928
- 'vitest-attempt-' + attempt + '-worker-' + worker + '.json',
929
- );
930
- reportPaths.push(reportPath);
931
- return runWorker(worker, persistence, reportPath, attempt);
932
- }),
933
- );
934
- const workerDiagnostics = [];
935
- for (const workerResult of workerResults) {
936
- const reportPath = join(
937
- rawRoot,
938
- 'vitest-attempt-' +
939
- attempt +
940
- '-worker-' +
941
- workerResult.worker +
942
- '.json',
943
- );
944
- const observedReport = readBoundedVitestReport(reportPath);
945
- if (observedReport.report) reports.push(observedReport.report);
946
- if (observedReport.finding) findings.push(observedReport.finding);
947
- if (workerResult.status !== 0) {
948
- workerDiagnostics.push({
949
- classification: 'assertion-failed',
950
- summary: sanitizeTestingEvidenceSummary(workerResult.diagnostic),
951
- });
952
- }
953
- }
954
- const failedTestNames = [
955
- ...new Set(
956
- reports
957
- .flatMap((report) => report.testResults ?? [])
958
- .flatMap((fileResult) => fileResult.assertionResults ?? [])
959
- .filter(({ status }) => status === 'failed')
960
- .map(
961
- ({ fullName, title }) => fullName || title || 'unnamed test',
962
- ),
963
- ),
964
- ].sort();
965
- // The named finding must precede worker diagnostics: retained evidence
966
- // keeps the first finding per classification, so a leading raw-report
967
- // pointer would mask the test identities.
968
- if (failedTestNames.length > 0) {
969
- findings.push({
970
- classification: 'assertion-failed',
971
- summary: sanitizeTestingEvidenceSummary(
972
- 'Failed integration tests: ' + failedTestNames.join(' | '),
973
- ),
974
- });
975
- }
976
- findings.push(...workerDiagnostics);
977
- if (
978
- reports.some(
979
- (report) =>
980
- !inspectTestingEvidenceArtifact({
981
- contents: JSON.stringify(report),
982
- }).safe,
983
- )
984
- ) {
985
- findings.push({
986
- classification: 'sensitive-artifact',
987
- summary:
988
- 'A raw runner report matched protected artifact data and was not retained.',
989
- });
990
- }
991
- } catch (error) {
992
- findings.push({
993
- classification: 'infrastructure-unavailable',
994
- summary: error instanceof Error ? error.message : String(error),
995
- });
996
- }
997
- const totals = reports.reduce(
998
- (sum, report) => ({
999
- failed: sum.failed + Number(report.numFailedTests ?? 0),
1000
- passed: sum.passed + Number(report.numPassedTests ?? 0),
1001
- skipped:
1002
- sum.skipped +
1003
- Number(report.numPendingTests ?? 0) +
1004
- Number(report.numTodoTests ?? 0),
1005
- }),
1006
- { failed: 0, passed: 0, skipped: 0 },
1007
- );
1008
- const reportedSkipped = totals.skipped;
1009
- const quarantine = reconcileRunnerQuarantine({
1010
- records: quarantineRecords,
1011
- runner: 'vitest-integration',
1012
- skippedTestIds: vitestIntegrationSkippedTestIds(
1013
- reports,
1014
- projectRoot,
1015
- ),
1016
- });
1017
- findings.push(...quarantine.findings);
1018
- if (reportedSkipped !== quarantine.quarantined + quarantine.skipped) {
1019
- findings.push({
1020
- classification: 'evidence-incomplete',
1021
- summary:
1022
- 'Vitest skipped-test counts could not be reconciled to stable test identities.',
1023
- });
1024
- }
1025
- totals.skipped = quarantine.skipped;
1026
- if (
1027
- (workerResults.some(({ status }) => status !== 0) ||
1028
- findings.length > 0) &&
1029
- totals.failed === 0
1030
- ) {
1031
- totals.failed = 1;
1032
- }
1033
- return {
1034
- normalized: normalizeEbkIntegrationEvidenceAttempt({
1035
- attempt,
1036
- completedAt: new Date().toISOString(),
1037
- failed: totals.failed,
1038
- findings,
1039
- ...(attempt === 2 ? { identicalToPrevious: true } : {}),
1040
- passed: totals.passed,
1041
- quarantined: quarantine.quarantined,
1042
- skipped: totals.skipped,
1043
- startedAt: attemptStartedAt,
1044
- }),
1045
- reportPaths,
1046
- reports,
1047
- };
1048
- }
1049
-
1050
- function failClosedArtifact(attempts, classification, sanitizedSummary) {
1051
- const last = attempts.at(-1);
1052
- if (!last) {
1053
- throw new Error('A proof artifact failed without an owning attempt.');
1054
- }
1055
- const findings = [
1056
- ...last.findings.filter(
1057
- (finding) => finding.classification !== classification,
1058
- ),
1059
- { classification, sanitizedSummary },
1060
- ];
1061
- if (
1062
- !findings.some(({ classification: observed }) =>
1063
- [
1064
- 'assertion-failed',
1065
- 'authorization-denied',
1066
- 'contract-incompatible',
1067
- 'environment-drift',
1068
- 'infrastructure-unavailable',
1069
- 'prerequisite-missing',
1070
- 'sensitive-artifact',
1071
- ].includes(observed),
1072
- )
1073
- ) {
1074
- findings.push({
1075
- classification: 'assertion-failed',
1076
- sanitizedSummary: 'The bounded runner artifact was not retained.',
1077
- });
1078
- }
1079
- attempts[attempts.length - 1] = {
1080
- ...last,
1081
- failed: Math.max(last.failed, 1),
1082
- findings: findings.sort((left, right) =>
1083
- left.classification < right.classification
1084
- ? -1
1085
- : left.classification > right.classification
1086
- ? 1
1087
- : 0,
1088
- ),
1089
- };
1090
- }
1091
-
1092
- const startedAt = new Date().toISOString();
1093
- if (!validRunId || !validSeed || !validWorkers) {
1094
- preflightFailure(
1095
- 'prerequisite-missing',
1096
- 'Integration proof requires a non-empty normalized run id, bounded printable seed, and one through eight workers.',
1097
- startedAt,
1098
- );
1099
- }
1100
- if (process.exitCode === undefined) {
1101
- let quarantine;
1102
- try {
1103
- quarantine = validateTestingEvidenceQuarantine(
1104
- readJson(join(projectRoot, 'testing', 'quarantine.json')),
1105
- {
1106
- now: startedAt,
1107
- workflowRun: githubWorkflowRun(),
1108
- },
1109
- );
1110
- } catch {
1111
- preflightFailure(
1112
- 'environment-drift',
1113
- 'The testing quarantine file is missing or malformed.',
1114
- startedAt,
1115
- );
1116
- }
1117
- if (process.exitCode === undefined && quarantine && !quarantine.valid) {
1118
- preflightFailure(
1119
- 'environment-drift',
1120
- quarantine.issues
1121
- .map(({ message, path }) => path + ' ' + message)
1122
- .join('; '),
1123
- startedAt,
1124
- );
1125
- }
1126
- if (process.exitCode === undefined && quarantine?.valid) {
1127
- quarantineRecords = quarantine.value.records;
1128
- try {
1129
- run('docker', ['version', '--format', '{{.Server.Version}}']);
1130
- pruneStaleTestProjects();
1131
- } catch (error) {
1132
- preflightFailure(
1133
- 'prerequisite-missing',
1134
- error instanceof Error ? error.message : String(error),
1135
- startedAt,
1136
- );
1137
- }
1138
- }
1139
- }
1140
-
1141
- if (process.exitCode === undefined) {
1142
- let cleanup = { outcome: 'not-required' };
1143
- let proofStarted = false;
1144
- let preflightSummary = 'The integration proof did not start.';
1145
- const attempts = [];
1146
- const reports = [];
1147
- const reportPaths = [];
1148
- try {
1149
- // Even a partially failed compose up can create owned resources.
1150
- proofStarted = true;
1151
- run('docker', [...composeArgs, 'up', '--detach', '--wait'], {
1152
- env: { ...process.env, EBK_TEST_RUN_ID: runId },
1153
- });
1154
- const keyValueAddress = run('docker', [...composeArgs, 'port', 'key-value', '8000']);
1155
- const keyValuePort = /:(\\d+)\\s*$/.exec(keyValueAddress)?.[1];
1156
- if (!keyValuePort) throw new Error('Docker did not report the integration DynamoDB port.');
1157
- const endpoint = 'http://127.0.0.1:' + keyValuePort;
1158
- await waitForLocalDynamo(endpoint);
1159
- ${sql
1160
- ? `const address = run('docker', [
1161
- ...composeArgs,
1162
- 'port',
1163
- 'database',
1164
- '5432',
1165
- ]);
1166
- const port = /:(\\d+)\\s*$/.exec(address)?.[1];
1167
- if (!port) throw new Error('Docker did not report the integration port.');
1168
- const adminUrl =
1169
- 'postgresql://ebk_test:ebk_test@127.0.0.1:' + port + '/postgres';`
1170
- : ''}
1171
- const first = await runAttempt(1, endpoint${sql ? ', adminUrl' : ''});
1172
- attempts.push(first.normalized);
1173
- reports.push(...first.reports);
1174
- reportPaths.push(...first.reportPaths);
1175
- if (first.normalized.failed > 0) {
1176
- const second = await runAttempt(2, endpoint${sql ? ', adminUrl' : ''});
1177
- attempts.push(second.normalized);
1178
- reports.push(...second.reports);
1179
- reportPaths.push(...second.reportPaths);
1180
- }
1181
- } catch (error) {
1182
- if (proofStarted) {
1183
- attempts.push(
1184
- normalizeEbkIntegrationEvidenceAttempt({
1185
- attempt: 1,
1186
- completedAt: new Date().toISOString(),
1187
- failed: 1,
1188
- findings: [
1189
- {
1190
- classification: 'infrastructure-unavailable',
1191
- summary: error instanceof Error ? error.message : String(error),
1192
- },
1193
- ],
1194
- passed: 0,
1195
- quarantined: 0,
1196
- skipped: 0,
1197
- startedAt,
1198
- }),
1199
- );
1200
- } else {
1201
- preflightSummary =
1202
- error instanceof Error ? error.message : String(error);
1203
- }
1204
- } finally {
1205
- try {
1206
- if (proofStarted) {
1207
- run('docker', [
1208
- ...composeArgs,
1209
- 'down',
1210
- '--remove-orphans',
1211
- '--volumes',
1212
- ]);
1213
- cleanup = { outcome: 'passed' };
1214
- }
1215
- } catch (error) {
1216
- cleanup = {
1217
- outcome: 'failed',
1218
- sanitizedSummary:
1219
- error instanceof Error ? error.message : String(error),
1220
- };
1221
- }
1222
- }
1223
-
1224
- if (!proofStarted) {
1225
- preflightFailure(
1226
- 'prerequisite-missing',
1227
- preflightSummary,
1228
- startedAt,
1229
- );
1230
- } else {
1231
- const artifacts = [];
1232
- try {
1233
- if (reports.length > 0) {
1234
- const combinedReport = JSON.stringify({ reports }, null, 2) + '\\n';
1235
- const combinedReportBytes = Buffer.byteLength(
1236
- combinedReport,
1237
- 'utf8',
1238
- );
1239
- if (combinedReportBytes > 5 * 1024 * 1024) {
1240
- failClosedArtifact(
1241
- attempts,
1242
- 'evidence-incomplete',
1243
- 'The combined Vitest report exceeded the five-megabyte retention bound.',
1244
- );
1245
- rmSync(sanitizedIntegrationReportPath, { force: true });
1246
- } else {
1247
- let inspection;
1248
- try {
1249
- inspection = inspectTestingEvidenceArtifact({
1250
- contents: combinedReport,
1251
- });
1252
- } catch {
1253
- inspection = { safe: false };
1254
- }
1255
- if (!inspection.safe) {
1256
- failClosedArtifact(
1257
- attempts,
1258
- 'sensitive-artifact',
1259
- 'The combined Vitest report matched protected artifact data and was removed.',
1260
- );
1261
- rmSync(sanitizedIntegrationReportPath, { force: true });
1262
- } else {
1263
- writeFileSync(
1264
- sanitizedIntegrationReportPath,
1265
- combinedReport,
1266
- 'utf8',
1267
- );
1268
- artifacts.push({
1269
- digest:
1270
- 'sha256:' +
1271
- createHash('sha256').update(combinedReport).digest('hex'),
1272
- name: relative(projectRoot, sanitizedIntegrationReportPath)
1273
- .replaceAll('\\\\', '/'),
1274
- retentionClass: 'source-result',
1275
- });
1276
- }
1277
- }
1278
- }
1279
- } finally {
1280
- for (const reportPath of reportPaths) {
1281
- rmSync(reportPath, { force: true });
1282
- }
1283
- rmSync(rawRoot, { force: true, recursive: true });
1284
- }
1285
- const result = createTestingEvidenceFromRunnerAttempts({
1286
- artifacts,
1287
- attempts,
1288
- cleanup,
1289
- environment: { class: 'local-docker', deployed: false },
1290
- operation,
1291
- proofStarted: true,
1292
- runScope: runId,
1293
- seed,
1294
- slice: '${name}',
1295
- source,
1296
- workspace: workspacePackage.name,
1297
- });
1298
- writeResult(result);
1299
- if (result.outcome !== 'passed') process.exitCode = 1;
1300
- }
1301
- }
1302
- `,
1303
- 'scripts/run-smoke-deployed.mjs': `import { sliceAuthorizationGroupNames } from '../authorization/groups.mjs';
1304
- import { waitForDeployedSmokeReadiness } from './deployed-smoke-readiness.mjs';
1305
- import {
1306
- AdminAddUserToGroupCommand,
1307
- AdminCreateUserCommand,
1308
- AdminDeleteUserCommand,
1309
- AdminSetUserPasswordCommand,
1310
- CognitoIdentityProviderClient,
1311
- DescribeUserPoolClientCommand,
1312
- } from '@aws-sdk/client-cognito-identity-provider';
1313
- import {
1314
- CloudWatchLogsClient,
1315
- FilterLogEventsCommand,
1316
- } from '@aws-sdk/client-cloudwatch-logs';
1317
- import { spawnSync } from 'node:child_process';
1318
- import { createHash, randomBytes, randomUUID } from 'node:crypto';
1319
- import {
1320
- closeSync,
1321
- existsSync,
1322
- mkdirSync,
1323
- openSync,
1324
- readFileSync,
1325
- readSync,
1326
- rmSync,
1327
- statSync,
1328
- writeFileSync,
1329
- } from 'node:fs';
1330
- import { join, relative, resolve } from 'node:path';
1331
- import { performance } from 'node:perf_hooks';
1332
- import { createRequire } from 'node:module';
1333
- import { TextDecoder } from 'node:util';
1334
- import {
1335
- githubWorkflowRun,
1336
- playwrightSkippedTestIds,
1337
- reconcileRunnerQuarantine,
1338
- } from '../testing/quarantine-runtime.mjs';
1339
- import { assertWorkspaceStageOwnershipForWorkspace } from '@empire-builder-kit/nx/workspace-deployment';
1340
-
1341
- const require = createRequire(import.meta.url);
1342
- const {
1343
- createTestingEvidenceFromRunnerAttempts,
1344
- inspectTestingEvidenceArtifact,
1345
- normalizePlaywrightEvidenceAttempt,
1346
- sanitizeTestingEvidenceSummary,
1347
- validateTestingEvidenceQuarantine,
1348
- } = require('@empire-builder-kit/nx/testing-evidence');
1349
- const fatalUtf8Decoder = new TextDecoder('utf-8', { fatal: true });
1350
- const projectRoot = process.cwd();
1351
- const workspaceRoot = resolve(projectRoot, '../..');
1352
- const evidenceRoot = join(projectRoot, '.ebk', 'evidence');
1353
- const rawRoot = join(evidenceRoot, 'raw');
1354
- rmSync(rawRoot, { force: true, recursive: true });
1355
- mkdirSync(rawRoot, { recursive: true });
1356
- const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
1357
- const run = (command, args, options = {}) => {
1358
- const result = spawnSync(command, args, {
1359
- cwd: options.cwd ?? projectRoot,
1360
- encoding: 'utf8',
1361
- env: options.env ?? process.env,
1362
- shell: false,
1363
- stdio: ['ignore', 'pipe', 'pipe'],
1364
- windowsHide: true,
1365
- });
1366
- if (result.error || result.status !== 0) {
1367
- throw new Error(
1368
- sanitizeTestingEvidenceSummary(
1369
- result.error?.message ||
1370
- result.stderr ||
1371
- result.stdout ||
1372
- command + ' failed.',
1373
- ),
1374
- );
1375
- }
1376
- return result.stdout.trim();
1377
- };
1378
- const gitCommit =
1379
- process.env.EBK_SOURCE_COMMIT ??
1380
- run('git', ['rev-parse', 'HEAD'], { cwd: workspaceRoot });
1381
- // The deployed Functions report the build identity the packaged executor
1382
- // hands over (EBK_DEPLOYED_SOURCE_COMMIT: the release source of promoted
1383
- // immutable artifacts); evidence keeps binding the source commit this run
1384
- // executes under.
1385
- const deployedSourceCommit = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(
1386
- process.env.EBK_DEPLOYED_SOURCE_COMMIT ?? '',
1387
- )
1388
- ? process.env.EBK_DEPLOYED_SOURCE_COMMIT
1389
- : gitCommit;
1390
- const workspacePackage = readJson(join(workspaceRoot, 'package.json'));
1391
- const ownership = readJson(join(projectRoot, '.ebk', 'ownership.json'));
1392
- const frameworkCandidate =
1393
- workspacePackage.dependencies?.['@empire-builder-kit/runtime'];
1394
- if (typeof frameworkCandidate !== 'string' || !frameworkCandidate) {
1395
- throw new Error('The workspace runtime candidate is unavailable.');
1396
- }
1397
- const stage = process.env.EBK_STAGE ?? '';
1398
- const validSourceCommit =
1399
- /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(gitCommit);
1400
- const smokeUrl = process.env.EBK_SMOKE_URL ?? '';
1401
- const smokeApiUrl = process.env.EBK_SMOKE_API_URL ?? '';
1402
- const userPoolId = process.env.EBK_SMOKE_USER_POOL_ID ?? '';
1403
- const clientId = process.env.EBK_SMOKE_CLIENT_ID ?? '';
1404
- const smokeAuthority =
1405
- process.env.EBK_SMOKE_AUTHORITY_VERSION ?? '';
1406
- const lifecycleAdapter = process.env.EBK_NX_STAGE_LIFECYCLE ?? '';
1407
- const deployedEnvironmentClass =
1408
- lifecycleAdapter === 'local'
1409
- ? 'local-federated'
1410
- : lifecycleAdapter === 'github'
1411
- ? 'protected-github'
1412
- : undefined;
1413
- const unexpectedArguments = process.argv.slice(2);
1414
- const requestedRunId = process.env.EBK_TEST_RUN_ID;
1415
- const runId = requestedRunId ?? randomUUID().replaceAll('-', '');
1416
- const seed = process.env.EBK_TEST_SEED ?? runId;
1417
- const validRunId = /^[a-z0-9]{1,32}$/.test(runId);
1418
- const validSeed = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(seed);
1419
- const evidenceRunId = validRunId ? runId : 'invalid-run-id';
1420
- const evidenceSeed = validSeed ? seed : 'invalid-seed';
1421
- const resultPath = join(evidenceRoot, 'smoke-deployed.json');
1422
- const sanitizedReportPath = join(evidenceRoot, 'playwright-smoke.json');
1423
- const readinessPath = join(evidenceRoot, 'deployed-readiness.json');
1424
- rmSync(resultPath, { force: true });
1425
- rmSync(sanitizedReportPath, { force: true });
1426
- rmSync(readinessPath, { force: true });
1427
- const rawPath = (attempt) =>
1428
- join(rawRoot, 'playwright-smoke-' + attempt + '.json');
1429
- const dataCleanupPath = (attempt) =>
1430
- join(rawRoot, 'data-cleanup-' + attempt + '.json');
1431
- const playwrightOutputTailPath = (attempt) =>
1432
- join(evidenceRoot, 'playwright-smoke-output-' + attempt + '.txt');
1433
- for (const attempt of [1, 2]) {
1434
- rmSync(playwrightOutputTailPath(attempt), { force: true });
1435
- }
1436
- const source = {
1437
- blueprintCandidates: [
1438
- ownership.blueprint.name + '@' + ownership.blueprint.version,
1439
- ],
1440
- commit: validSourceCommit ? gitCommit : '0'.repeat(40),
1441
- frameworkCandidate,
1442
- };
1443
- const operation = {
1444
- commandVersion: '1',
1445
- project: '${name}',
1446
- proofLayer: 'deployed-smoke',
1447
- target: 'smoke-deployed',
1448
- };
1449
- const startedAt = new Date().toISOString();
1450
- let quarantineRecords = [];
1451
-
1452
- function writeResult(result) {
1453
- writeFileSync(resultPath, JSON.stringify(result, null, 2) + '\\n', 'utf8');
1454
- process.stdout.write(JSON.stringify(result) + '\\n');
1455
- }
1456
-
1457
- function readBoundedUtf8(path, minimumBytes, maximumBytes) {
1458
- const size = statSync(path).size;
1459
- if (
1460
- !Number.isSafeInteger(size) ||
1461
- size < minimumBytes ||
1462
- size > maximumBytes
1463
- ) {
1464
- throw new Error('invalid-bounded-file-size');
1465
- }
1466
- const bytes = readFileSync(path);
1467
- if (bytes.byteLength !== size) {
1468
- throw new Error('bounded-file-size-changed');
1469
- }
1470
- return fatalUtf8Decoder.decode(bytes);
1471
- }
1472
-
1473
- function readDataCleanupOutcome(path) {
1474
- try {
1475
- if (!existsSync(path)) throw new Error('missing-cleanup-outcome');
1476
- const value = JSON.parse(readBoundedUtf8(path, 2, 1024));
1477
- if (
1478
- !value ||
1479
- typeof value !== 'object' ||
1480
- Array.isArray(value) ||
1481
- JSON.stringify(Object.keys(value).sort()) !==
1482
- JSON.stringify(['outcome', 'schemaVersion']) ||
1483
- value.schemaVersion !== 1 ||
1484
- !['not-required', 'passed'].includes(value.outcome)
1485
- ) {
1486
- throw new Error('invalid-cleanup-outcome');
1487
- }
1488
- return { outcome: value.outcome };
1489
- } catch {
1490
- return {
1491
- outcome: 'failed',
1492
- sanitizedSummary:
1493
- 'The deployed smoke record cleanup was not proved.',
1494
- };
1495
- }
1496
- }
1497
-
1498
- function failPreflight(
1499
- classification,
1500
- summary,
1501
- cleanup = { outcome: 'not-required' },
1502
- ) {
1503
- const result = createTestingEvidenceFromRunnerAttempts({
1504
- attempts: [],
1505
- cleanup,
1506
- environment: {
1507
- class: deployedEnvironmentClass ?? 'unresolved-adapter',
1508
- deployed: true,
1509
- stage: stage || 'unresolved',
1510
- },
1511
- operation,
1512
- preflight: {
1513
- completedAt: new Date().toISOString(),
1514
- findings: [{ classification, summary }],
1515
- startedAt,
1516
- },
1517
- proofStarted: false,
1518
- runScope: evidenceRunId,
1519
- seed: evidenceSeed,
1520
- slice: '${name}',
1521
- source,
1522
- workspace: workspacePackage.name,
1523
- });
1524
- rmSync(sanitizedReportPath, { force: true });
1525
- rmSync(rawRoot, { force: true, recursive: true });
1526
- writeResult(result);
1527
- process.exitCode = 1;
1528
- }
1529
-
1530
- function credentialFreeHttpsUrl(value) {
1531
- let parsed;
1532
- try {
1533
- parsed = new URL(value);
1534
- } catch {
1535
- return undefined;
1536
- }
1537
- return parsed.protocol === 'https:' &&
1538
- !parsed.username &&
1539
- !parsed.password &&
1540
- !parsed.search &&
1541
- !parsed.hash
1542
- ? parsed
1543
- : undefined;
1544
- }
1545
-
1546
- function permissionFailure(error, operation, authority = 'Cognito principal') {
1547
- const name =
1548
- error && typeof error === 'object' && 'name' in error
1549
- ? String(error.name)
1550
- : 'UnknownAwsError';
1551
- const denied = [
1552
- 'AccessDeniedException',
1553
- 'NotAuthorizedException',
1554
- 'UnauthorizedException',
1555
- ].includes(name);
1556
- return {
1557
- classification: denied
1558
- ? 'authorization-denied'
1559
- : 'infrastructure-unavailable',
1560
- summary: denied
1561
- ? 'The protected smoke role lacks the declared ' +
1562
- authority +
1563
- ' permission for ' +
1564
- operation +
1565
- '.'
1566
- : authority +
1567
- ' ' +
1568
- operation +
1569
- ' failed with ' +
1570
- name.replace(/[^A-Za-z0-9_-]/g, '').slice(0, 80) +
1571
- '.',
1572
- };
1573
- }
1574
-
1575
- ${deployed_smoke_diagnostics_js_1.deployedSmokeOwnershipFindingFunctions}
1576
- ${deployed_smoke_diagnostics_js_1.playwrightOutputTailFunctions}
1577
- function isCognitoUserAbsent(error) {
1578
- return (
1579
- error &&
1580
- typeof error === 'object' &&
1581
- 'name' in error &&
1582
- error.name === 'UserNotFoundException'
1583
- );
1584
- }
1585
-
1586
- function structuredLogRecord(message) {
1587
- let candidate = message;
1588
- for (let depth = 0; depth < 4; depth += 1) {
1589
- if (typeof candidate === 'string') {
1590
- try {
1591
- candidate = JSON.parse(candidate);
1592
- } catch {
1593
- return undefined;
1594
- }
1595
- }
1596
- if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {
1597
- return undefined;
1598
- }
1599
- if (
1600
- candidate.schemaVersion === 1 &&
1601
- typeof candidate.component === 'string'
1602
- ) {
1603
- return candidate;
1604
- }
1605
- candidate = candidate.message ?? candidate.record;
1606
- }
1607
- return undefined;
1608
- }
1609
-
1610
- function validObservationIntent(value) {
1611
- return (
1612
- value &&
1613
- typeof value === 'object' &&
1614
- !Array.isArray(value) &&
1615
- JSON.stringify(Object.keys(value).sort()) ===
1616
- JSON.stringify(['correlationId', 'eventId', 'schemaVersion']) &&
1617
- value.schemaVersion === 1 &&
1618
- /^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(value.eventId) &&
1619
- /^synthetic-[0-9a-f]{32}$/.test(value.correlationId)
1620
- );
1621
- }
1622
-
1623
- // Names the failed specs by their static titles so retained evidence says
1624
- // which journey failed without carrying runner output.
1625
- function playwrightFailureDiagnostic(report) {
1626
- const titles = [];
1627
- const visit = (suite, parents) => {
1628
- const nextTitles = suite.title ? [...parents, suite.title] : parents;
1629
- for (const spec of suite.specs ?? []) {
1630
- if (spec?.ok === false && titles.length < 8) {
1631
- titles.push(
1632
- [...nextTitles, spec.title ?? '']
1633
- .filter(Boolean)
1634
- .join(' > ')
1635
- .slice(0, 160),
1636
- );
1637
- }
1638
- }
1639
- for (const child of suite.suites ?? []) visit(child, nextTitles);
1640
- };
1641
- for (const suite of report?.suites ?? []) visit(suite, []);
1642
- return titles.length > 0
1643
- ? 'Playwright smoke assertions failed: ' + titles.join('; ')
1644
- : 'Playwright smoke assertions failed.';
1645
- }
1646
-
1647
- function inspectPlaywrightReportPolicy(report) {
1648
- const config = report?.config;
1649
- const stats = report?.stats;
1650
- const countNames = ['expected', 'flaky', 'skipped', 'unexpected'];
1651
- if (
1652
- !report ||
1653
- typeof report !== 'object' ||
1654
- Array.isArray(report) ||
1655
- !Array.isArray(report.suites) ||
1656
- !config ||
1657
- typeof config !== 'object' ||
1658
- Array.isArray(config) ||
1659
- typeof config.forbidOnly !== 'boolean' ||
1660
- !stats ||
1661
- typeof stats !== 'object' ||
1662
- Array.isArray(stats) ||
1663
- countNames.some(
1664
- (name) =>
1665
- !Number.isSafeInteger(stats[name]) ||
1666
- stats[name] < 0,
1667
- )
1668
- ) {
1669
- return { invalid: true };
1670
- }
1671
- const observed = {
1672
- expected: 0,
1673
- flaky: 0,
1674
- skipped: 0,
1675
- unexpected: 0,
1676
- };
1677
- let expectedFailureCount = 0;
1678
- let testCount = 0;
1679
- const suites = [...report.suites];
1680
- while (suites.length > 0) {
1681
- const suite = suites.pop();
1682
- if (
1683
- !suite ||
1684
- typeof suite !== 'object' ||
1685
- Array.isArray(suite) ||
1686
- (suite.suites !== undefined && !Array.isArray(suite.suites)) ||
1687
- (suite.specs !== undefined && !Array.isArray(suite.specs))
1688
- ) {
1689
- return { invalid: true };
1690
- }
1691
- suites.push(...(suite.suites ?? []));
1692
- for (const spec of suite.specs ?? []) {
1693
- if (
1694
- !spec ||
1695
- typeof spec !== 'object' ||
1696
- Array.isArray(spec) ||
1697
- !Array.isArray(spec.tests)
1698
- ) {
1699
- return { invalid: true };
1700
- }
1701
- for (const testCase of spec.tests) {
1702
- if (
1703
- !testCase ||
1704
- typeof testCase !== 'object' ||
1705
- Array.isArray(testCase) ||
1706
- !['expected', 'flaky', 'skipped', 'unexpected'].includes(
1707
- testCase.status,
1708
- ) ||
1709
- !['failed', 'passed', 'skipped', 'timedOut'].includes(
1710
- testCase.expectedStatus,
1711
- )
1712
- ) {
1713
- return { invalid: true };
1714
- }
1715
- observed[testCase.status] += 1;
1716
- testCount += 1;
1717
- if (
1718
- testCase.expectedStatus === 'failed' ||
1719
- testCase.expectedStatus === 'timedOut'
1720
- ) {
1721
- expectedFailureCount += 1;
1722
- }
1723
- }
1724
- }
1725
- }
1726
- if (
1727
- testCount === 0 ||
1728
- countNames.some((name) => observed[name] !== stats[name])
1729
- ) {
1730
- return { invalid: true };
1731
- }
1732
- return {
1733
- expectedFailureCount,
1734
- flakyCount: stats.flaky,
1735
- focusedConfiguration: !config.forbidOnly,
1736
- invalid: false,
1737
- };
1738
- }
1739
-
1740
- function requiresScheduledDeliveryObservation(stage) {
1741
- return ['development', 'staging', 'production'].includes(stage);
1742
- }
1743
-
1744
- ${pnpm_launch_script_js_1.pnpmLaunchFunction}
1745
- // A successful browser journey may have deleted its synthetic record, while
1746
- // its mutation receipt remains. Replaying that same journey/run scope cannot
1747
- // recreate the record, even when the first cleanup completed successfully.
1748
- function shouldRetryDeployedSmoke(execution) {
1749
- return (
1750
- execution.failed > 0 &&
1751
- execution.dataCleanup?.outcome === 'not-required' &&
1752
- execution.observationFindings.length === 0
1753
- );
1754
- }
1755
-
1756
- function scheduledDeliveryDeadlineFinding() {
1757
- return {
1758
- classification: 'assertion-failed',
1759
- summary:
1760
- 'The exact published event and correlation were not observed in the managed event-consumer log group within the bounded window.',
1761
- };
1762
- }
1763
-
1764
- async function observePublishedEvent(logs, observationPath, attemptStartedAt) {
1765
- let intent;
1766
- try {
1767
- const contents = readBoundedUtf8(observationPath, 2, 1024);
1768
- intent = JSON.parse(contents);
1769
- } catch {
1770
- return {
1771
- classification: 'evidence-incomplete',
1772
- summary:
1773
- 'The browser did not emit a valid credential-free event observation intent.',
1774
- };
1775
- }
1776
- if (!validObservationIntent(intent)) {
1777
- return {
1778
- classification: 'evidence-incomplete',
1779
- summary:
1780
- 'The browser emitted an invalid credential-free event observation intent.',
1781
- };
1782
- }
1783
- const logGroupName = '/ebk/' + stage + '/${name}/event-consumer';
1784
- const startTime = Math.max(0, Date.parse(attemptStartedAt) - 5_000);
1785
- const timeoutMilliseconds = stage === 'production' ? 90_000 : 960_000;
1786
- const deadline = performance.now() + timeoutMilliseconds;
1787
- let consecutiveUnavailableReads = 0;
1788
- while (true) {
1789
- const remainingRequestMilliseconds = deadline - performance.now();
1790
- if (remainingRequestMilliseconds <= 0) break;
1791
- let response;
1792
- try {
1793
- response = await logs.send(
1794
- new FilterLogEventsCommand({
1795
- filterPattern: '"' + intent.eventId + '"',
1796
- limit: 100,
1797
- logGroupName,
1798
- startTime,
1799
- }),
1800
- {
1801
- abortSignal: AbortSignal.timeout(
1802
- Math.max(1, Math.ceil(remainingRequestMilliseconds)),
1803
- ),
1804
- },
1805
- );
1806
- } catch (error) {
1807
- if (error?.name === 'ServiceUnavailableException') {
1808
- consecutiveUnavailableReads += 1;
1809
- // Retry the read, not the already-mutating browser journey. Keep this
1810
- // much shorter than the delivery deadline when Logs is unavailable.
1811
- const remainingDelayMilliseconds = deadline - performance.now();
1812
- const retryDelayMilliseconds = 1_000 * consecutiveUnavailableReads;
1813
- if (
1814
- consecutiveUnavailableReads >= 3 ||
1815
- remainingDelayMilliseconds <= retryDelayMilliseconds
1816
- ) {
1817
- return permissionFailure(
1818
- error,
1819
- 'event-consumer observation',
1820
- 'CloudWatch Logs',
1821
- );
1822
- }
1823
- await new Promise((resolveDelay) =>
1824
- setTimeout(resolveDelay, retryDelayMilliseconds),
1825
- );
1826
- continue;
1827
- }
1828
- if (['AbortError', 'TimeoutError'].includes(error?.name)) {
1829
- return scheduledDeliveryDeadlineFinding();
1830
- }
1831
- return permissionFailure(
1832
- error,
1833
- 'event-consumer observation',
1834
- 'CloudWatch Logs',
1835
- );
1836
- }
1837
- consecutiveUnavailableReads = 0;
1838
- if (performance.now() > deadline) {
1839
- return scheduledDeliveryDeadlineFinding();
1840
- }
1841
- const observed = (response.events ?? []).some(({ message }) => {
1842
- const record = structuredLogRecord(message);
1843
- return (
1844
- record?.component === 'event-consumer' &&
1845
- record?.correlationId === intent.correlationId &&
1846
- record?.eventId === intent.eventId &&
1847
- record?.eventType === '${pascalName}Created' &&
1848
- record?.feature === 'events' &&
1849
- record?.operation === 'consume-created' &&
1850
- record?.outcome === 'success' &&
1851
- record?.slice === '${name}' &&
1852
- record?.stage === stage
1853
- );
1854
- });
1855
- if (observed) return undefined;
1856
- const remainingDelayMilliseconds = deadline - performance.now();
1857
- if (remainingDelayMilliseconds <= 0) break;
1858
- await new Promise((resolveDelay) =>
1859
- setTimeout(resolveDelay, Math.min(3_000, remainingDelayMilliseconds)),
1860
- );
1861
- }
1862
- return scheduledDeliveryDeadlineFinding();
1863
- }
1864
-
1865
- const url = credentialFreeHttpsUrl(smokeUrl);
1866
- const apiUrl = credentialFreeHttpsUrl(smokeApiUrl);
1867
- const expectedProductPath = '/${name}';
1868
- const normalizedProductPath = url?.pathname.replace(/\\/$/, '') || '/';
1869
- const validIdentity =
1870
- /^[A-Za-z0-9_-]{1,128}_[A-Za-z0-9]{1,128}$/.test(userPoolId) &&
1871
- /^[a-z0-9]{1,128}$/.test(clientId);
1872
- if (
1873
- !['development', 'staging', 'production'].includes(stage) ||
1874
- !url ||
1875
- !apiUrl ||
1876
- normalizedProductPath !== expectedProductPath ||
1877
- // A bound Slice API is mapped under /<slice> on the Foundation's api.<root>.
1878
- !['/', expectedProductPath].includes(apiUrl.pathname.replace(/\\/$/, '') || '/') ||
1879
- !validIdentity ||
1880
- !validSourceCommit ||
1881
- !validRunId ||
1882
- !validSeed ||
1883
- !deployedEnvironmentClass ||
1884
- unexpectedArguments.length > 0 ||
1885
- smokeAuthority !== 'cognito-admin-cloudwatch-observe-v1' ||
1886
- !process.env.AWS_REGION
1887
- ) {
1888
- failPreflight(
1889
- 'prerequisite-missing',
1890
- 'Deployed smoke requires development, staging, or production, one exact source commit, native credential-free HTTPS web and API outputs, exact Cognito identity, bounded run/seed identity, AWS region, and cognito-admin-cloudwatch-observe-v1 authority acknowledgement.',
1891
- );
1892
- }
1893
- if (process.exitCode === undefined) {
1894
- let ownershipFailure;
1895
- try {
1896
- const ownership = await assertWorkspaceStageOwnershipForWorkspace(workspaceRoot, stage, {
1897
- ...(process.env.AWS_PROFILE ? { profile: process.env.AWS_PROFILE } : {}),
1898
- ...(process.env.AWS_CONFIG_FILE ? { configFilepath: process.env.AWS_CONFIG_FILE } : {}),
1899
- ...(process.env.AWS_SHARED_CREDENTIALS_FILE
1900
- ? { credentialsFilepath: process.env.AWS_SHARED_CREDENTIALS_FILE }
1901
- : {}),
1902
- });
1903
- ownershipFailure = ownershipRegionFinding(ownership, process.env.AWS_REGION);
1904
- } catch (error) {
1905
- ownershipFailure = ownershipErrorFinding(error);
1906
- }
1907
- if (ownershipFailure) {
1908
- failPreflight(ownershipFailure.classification, ownershipFailure.summary);
1909
- }
1910
- }
1911
- if (process.exitCode === undefined) {
1912
- let quarantine;
1913
- try {
1914
- quarantine = validateTestingEvidenceQuarantine(
1915
- readJson(join(projectRoot, 'testing', 'quarantine.json')),
1916
- {
1917
- now: startedAt,
1918
- workflowRun: githubWorkflowRun(),
1919
- },
1920
- );
1921
- } catch {
1922
- failPreflight(
1923
- 'environment-drift',
1924
- 'The testing quarantine file is missing or malformed.',
1925
- );
1926
- }
1927
- if (process.exitCode === undefined && quarantine && !quarantine.valid) {
1928
- failPreflight(
1929
- 'environment-drift',
1930
- quarantine.issues
1931
- .map(({ message, path }) => path + ' ' + message)
1932
- .join('; '),
1933
- );
1934
- }
1935
- if (process.exitCode === undefined && quarantine?.valid) {
1936
- quarantineRecords = quarantine.value.records;
1937
- }
1938
- }
1939
-
1940
- if (process.exitCode === undefined) {
1941
- const readiness = await waitForDeployedSmokeReadiness({
1942
- apiUrl: smokeApiUrl,
1943
- webUrl: smokeUrl,
1944
- service: '${name}',
1945
- stage,
1946
- sourceCommit: deployedSourceCommit,
1947
- });
1948
- writeFileSync(readinessPath, JSON.stringify({
1949
- schemaVersion: 1, source, deployedSourceCommit, stage, slice: '${name}',
1950
- result: readiness,
1951
- }, null, 2) + '\\n', { encoding: 'utf8', mode: 0o600 });
1952
- if (readiness.outcome !== 'ready') {
1953
- failPreflight(readiness.classification, readiness.summary);
1954
- }
1955
- }
1956
-
1957
- if (process.exitCode === undefined) {
1958
- const cognito = new CognitoIdentityProviderClient({
1959
- region: process.env.AWS_REGION,
1960
- });
1961
- const logs = new CloudWatchLogsClient({
1962
- region: process.env.AWS_REGION,
1963
- });
1964
- const principalEmail =
1965
- ('ebk-smoke-${name}-' + runId).slice(0, 60) + '@example.invalid';
1966
- const reviewerEmail =
1967
- ('ebk-review-${name}-' + runId).slice(0, 60) + '@example.invalid';
1968
- let principalPassword =
1969
- 'Ebk!' + randomBytes(30).toString('base64url') + '9aA';
1970
- let reviewerPassword =
1971
- 'Ebk!' + randomBytes(30).toString('base64url') + '9aA';
1972
- let principalCleanupRequired = false;
1973
- let reviewerCleanupRequired = false;
1974
- let setupFailure;
1975
- let preflightCleanup = { outcome: 'not-required' };
1976
- try {
1977
- await cognito.send(
1978
- new DescribeUserPoolClientCommand({
1979
- ClientId: clientId,
1980
- UserPoolId: userPoolId,
1981
- }),
1982
- );
1983
- principalCleanupRequired = true;
1984
- await cognito.send(
1985
- new AdminCreateUserCommand({
1986
- MessageAction: 'SUPPRESS',
1987
- UserAttributes: [
1988
- { Name: 'email', Value: principalEmail },
1989
- { Name: 'email_verified', Value: 'true' },
1990
- ],
1991
- Username: principalEmail,
1992
- UserPoolId: userPoolId,
1993
- }),
1994
- );
1995
- await cognito.send(
1996
- new AdminSetUserPasswordCommand({
1997
- Password: principalPassword,
1998
- Permanent: true,
1999
- Username: principalEmail,
2000
- UserPoolId: userPoolId,
2001
- }),
2002
- );
2003
- await cognito.send(
2004
- new AdminAddUserToGroupCommand({
2005
- GroupName: sliceAuthorizationGroupNames(stage).testWriter,
2006
- Username: principalEmail,
2007
- UserPoolId: userPoolId,
2008
- }),
2009
- );
2010
- reviewerCleanupRequired = true;
2011
- await cognito.send(
2012
- new AdminCreateUserCommand({
2013
- MessageAction: 'SUPPRESS',
2014
- UserAttributes: [
2015
- { Name: 'email', Value: reviewerEmail },
2016
- { Name: 'email_verified', Value: 'true' },
2017
- ],
2018
- Username: reviewerEmail,
2019
- UserPoolId: userPoolId,
2020
- }),
2021
- );
2022
- await cognito.send(
2023
- new AdminSetUserPasswordCommand({
2024
- Password: reviewerPassword,
2025
- Permanent: true,
2026
- Username: reviewerEmail,
2027
- UserPoolId: userPoolId,
2028
- }),
2029
- );
2030
- await cognito.send(
2031
- new AdminAddUserToGroupCommand({
2032
- GroupName: sliceAuthorizationGroupNames(stage).admin,
2033
- Username: reviewerEmail,
2034
- UserPoolId: userPoolId,
2035
- }),
2036
- );
2037
- } catch (error) {
2038
- setupFailure = permissionFailure(error, 'setup');
2039
- }
2040
- if (setupFailure && reviewerCleanupRequired) {
2041
- try {
2042
- await cognito.send(
2043
- new AdminDeleteUserCommand({
2044
- Username: reviewerEmail,
2045
- UserPoolId: userPoolId,
2046
- }),
2047
- );
2048
- reviewerCleanupRequired = false;
2049
- if (preflightCleanup.outcome !== 'failed') {
2050
- preflightCleanup = { outcome: 'passed' };
2051
- }
2052
- } catch (error) {
2053
- if (isCognitoUserAbsent(error)) {
2054
- reviewerCleanupRequired = false;
2055
- if (preflightCleanup.outcome !== 'failed') {
2056
- preflightCleanup = { outcome: 'passed' };
2057
- }
2058
- } else {
2059
- preflightCleanup = {
2060
- outcome: 'failed',
2061
- sanitizedSummary: permissionFailure(error, 'cleanup').summary,
2062
- };
2063
- }
2064
- }
2065
- }
2066
- if (setupFailure && principalCleanupRequired) {
2067
- try {
2068
- await cognito.send(
2069
- new AdminDeleteUserCommand({
2070
- Username: principalEmail,
2071
- UserPoolId: userPoolId,
2072
- }),
2073
- );
2074
- principalCleanupRequired = false;
2075
- if (preflightCleanup.outcome !== 'failed') {
2076
- preflightCleanup = { outcome: 'passed' };
2077
- }
2078
- } catch (error) {
2079
- if (isCognitoUserAbsent(error)) {
2080
- principalCleanupRequired = false;
2081
- if (preflightCleanup.outcome !== 'failed') {
2082
- preflightCleanup = { outcome: 'passed' };
2083
- }
2084
- } else {
2085
- preflightCleanup = {
2086
- outcome: 'failed',
2087
- sanitizedSummary: permissionFailure(error, 'cleanup').summary,
2088
- };
2089
- }
2090
- }
2091
- }
2092
- if (setupFailure) {
2093
- principalPassword = undefined;
2094
- reviewerPassword = undefined;
2095
- failPreflight(
2096
- setupFailure.classification,
2097
- setupFailure.summary,
2098
- preflightCleanup,
2099
- );
2100
- }
2101
-
2102
- if (process.exitCode !== undefined) {
2103
- rmSync(rawRoot, { force: true, recursive: true });
2104
- } else {
2105
- const playwright = pnpmLaunch([
2106
- 'exec',
2107
- 'playwright',
2108
- 'test',
2109
- '--reporter=json',
2110
- ]);
2111
- const executeAttempt = async (attempt) => {
2112
- const attemptStartedAt = new Date().toISOString();
2113
- const path = rawPath(attempt);
2114
- const observationPath = join(
2115
- rawRoot,
2116
- 'event-observation-' + attempt + '.json',
2117
- );
2118
- const cleanupPath = dataCleanupPath(attempt);
2119
- const outputPath = join(rawRoot, 'playwright-output-' + attempt + '.log');
2120
- rmSync(observationPath, { force: true });
2121
- rmSync(cleanupPath, { force: true });
2122
- let dataCleanup = {
2123
- outcome: 'failed',
2124
- sanitizedSummary:
2125
- 'The deployed smoke record cleanup was not proved.',
2126
- };
2127
- let execution;
2128
- let observationFinding;
2129
- let reportPolicyFinding;
2130
- let report;
2131
- let reportCredentialLeak = false;
2132
- let reportInvalid = false;
2133
- try {
2134
- const browserEnvironmentNames = new Set([
2135
- 'APPDATA',
2136
- 'CI',
2137
- 'ComSpec',
2138
- 'COMSPEC',
2139
- 'HOME',
2140
- 'LANG',
2141
- 'LC_ALL',
2142
- 'LOCALAPPDATA',
2143
- 'PATH',
2144
- 'PATHEXT',
2145
- 'PLAYWRIGHT_BROWSERS_PATH',
2146
- 'SystemRoot',
2147
- 'SYSTEMROOT',
2148
- 'TEMP',
2149
- 'TMP',
2150
- 'TMPDIR',
2151
- 'USERPROFILE',
2152
- ]);
2153
- const childEnvironment = Object.fromEntries(
2154
- Object.entries(process.env).filter(
2155
- ([name, value]) =>
2156
- browserEnvironmentNames.has(name) &&
2157
- typeof value === 'string',
2158
- ),
2159
- );
2160
- // Output goes to a private raw file, not a pipe, so its size can
2161
- // never stop the run; only a failed run keeps its scrubbed tail.
2162
- const output = openSync(outputPath, 'w', 0o600);
2163
- try {
2164
- execution = spawnSync(
2165
- playwright.command,
2166
- playwright.args,
2167
- {
2168
- cwd: projectRoot,
2169
- encoding: 'utf8',
2170
- env: {
2171
- ...childEnvironment,
2172
- EBK_SOURCE_COMMIT: deployedSourceCommit,
2173
- EBK_STAGE: stage,
2174
- EBK_SMOKE_API_URL: apiUrl.href,
2175
- EBK_SMOKE_DATA_CLEANUP_PATH: cleanupPath,
2176
- EBK_SMOKE_EMAIL: principalEmail,
2177
- EBK_FRONTEND_SECURITY_PROFILE: 'deployed-https',
2178
- EBK_SMOKE_PASSWORD: principalPassword,
2179
- EBK_SMOKE_REVIEWER_EMAIL: reviewerEmail,
2180
- EBK_SMOKE_REVIEWER_PASSWORD: reviewerPassword,
2181
- EBK_SMOKE_OBSERVATION_PATH: observationPath,
2182
- EBK_SMOKE_URL: url.href,
2183
- EBK_TEST_RUN_ID: runId,
2184
- EBK_TEST_SEED: seed,
2185
- PLAYWRIGHT_JSON_OUTPUT_NAME: path,
2186
- },
2187
- shell: false,
2188
- stdio: ['ignore', output, output],
2189
- windowsHide: true,
2190
- },
2191
- );
2192
- } finally {
2193
- closeSync(output);
2194
- }
2195
- if (existsSync(path)) {
2196
- try {
2197
- const reportContents = readBoundedUtf8(
2198
- path,
2199
- 2,
2200
- 5 * 1024 * 1024,
2201
- );
2202
- if (
2203
- (typeof principalPassword === 'string' &&
2204
- reportContents.includes(principalPassword)) ||
2205
- (typeof reviewerPassword === 'string' &&
2206
- reportContents.includes(reviewerPassword))
2207
- ) {
2208
- reportCredentialLeak = true;
2209
- } else {
2210
- report = JSON.parse(reportContents);
2211
- const policy = inspectPlaywrightReportPolicy(report);
2212
- if (policy.invalid) {
2213
- report = undefined;
2214
- reportInvalid = true;
2215
- } else if (policy.flakyCount > 0) {
2216
- reportPolicyFinding = {
2217
- classification: 'assertion-failed',
2218
- summary:
2219
- 'Playwright runner-internal retries are forbidden in deployed proof.',
2220
- };
2221
- } else if (
2222
- policy.expectedFailureCount > 0 ||
2223
- policy.focusedConfiguration
2224
- ) {
2225
- reportPolicyFinding = {
2226
- classification: 'assertion-failed',
2227
- summary:
2228
- 'Playwright focused tests and expected-failure semantics are forbidden in deployed proof.',
2229
- };
2230
- }
2231
- }
2232
- } catch {
2233
- reportInvalid = true;
2234
- }
2235
- } else {
2236
- reportInvalid = true;
2237
- }
2238
- if (
2239
- execution?.status === 0 &&
2240
- requiresScheduledDeliveryObservation(stage)
2241
- ) {
2242
- observationFinding = await observePublishedEvent(
2243
- logs,
2244
- observationPath,
2245
- attemptStartedAt,
2246
- );
2247
- }
2248
- } finally {
2249
- dataCleanup = readDataCleanupOutcome(cleanupPath);
2250
- rmSync(path, { force: true });
2251
- rmSync(observationPath, { force: true });
2252
- rmSync(cleanupPath, { force: true });
2253
- rmSync(join(projectRoot, 'test-results'), {
2254
- force: true,
2255
- recursive: true,
2256
- });
2257
- rmSync(join(projectRoot, 'playwright-report'), {
2258
- force: true,
2259
- recursive: true,
2260
- });
2261
- }
2262
- const stats = report?.stats ?? {};
2263
- const reportedSkipped = Number(stats.skipped ?? 0);
2264
- const quarantine = reconcileRunnerQuarantine({
2265
- records: quarantineRecords,
2266
- runner: 'playwright',
2267
- skippedTestIds: report
2268
- ? playwrightSkippedTestIds(report, projectRoot)
2269
- : [],
2270
- });
2271
- const reportedUnexpected = Number(stats.unexpected ?? 0);
2272
- const processSucceeded =
2273
- execution?.status === 0 &&
2274
- execution.signal === null &&
2275
- execution.error === undefined;
2276
- const runnerFailed = Math.max(
2277
- Number.isSafeInteger(reportedUnexpected) &&
2278
- reportedUnexpected >= 0
2279
- ? reportedUnexpected
2280
- : 1,
2281
- processSucceeded &&
2282
- !reportCredentialLeak &&
2283
- !reportInvalid &&
2284
- report
2285
- ? 0
2286
- : 1,
2287
- );
2288
- const failed = Math.max(
2289
- runnerFailed,
2290
- observationFinding ? 1 : 0,
2291
- reportPolicyFinding ? 1 : 0,
2292
- );
2293
- const outputTailKept =
2294
- runnerFailed > 0 &&
2295
- retainPlaywrightOutputTail(outputPath, playwrightOutputTailPath(attempt), [
2296
- principalPassword,
2297
- reviewerPassword,
2298
- principalEmail,
2299
- reviewerEmail,
2300
- ]);
2301
- rmSync(outputPath, { force: true });
2302
- return {
2303
- attempt,
2304
- completedAt: new Date().toISOString(),
2305
- dataCleanup,
2306
- diagnostic:
2307
- [
2308
- (reportInvalid
2309
- ? 'Playwright emitted malformed machine-readable output.'
2310
- : undefined) ||
2311
- (reportCredentialLeak
2312
- ? 'Playwright output contained the synthetic principal credential and was removed.'
2313
- : undefined) ||
2314
- (execution?.error
2315
- ? 'The Playwright process could not start.'
2316
- : playwrightFailureDiagnostic(report)),
2317
- outputTailKept ? playwrightOutputTailNote : undefined,
2318
- ]
2319
- .filter(Boolean)
2320
- .join(' ') || undefined,
2321
- failed,
2322
- artifactSensitive: reportCredentialLeak,
2323
- observationFindings: observationFinding
2324
- ? [observationFinding]
2325
- : [],
2326
- policyFindings: reportPolicyFinding
2327
- ? [reportPolicyFinding]
2328
- : [],
2329
- passed: Number(stats.expected ?? 0),
2330
- report,
2331
- reportInvalid,
2332
- runnerFailed,
2333
- quarantineFindings: [
2334
- ...quarantine.findings,
2335
- ...(reportedSkipped !==
2336
- quarantine.quarantined + quarantine.skipped
2337
- ? [
2338
- {
2339
- classification: 'evidence-incomplete',
2340
- summary:
2341
- 'Playwright skipped-test counts could not be reconciled to stable test identities.',
2342
- },
2343
- ]
2344
- : []),
2345
- ],
2346
- quarantined: quarantine.quarantined,
2347
- skipped: quarantine.skipped,
2348
- startedAt: attemptStartedAt,
2349
- };
2350
- };
2351
- const executions = [];
2352
- const artifacts = [];
2353
- let cleanup = { outcome: 'passed' };
2354
- try {
2355
- executions.push(await executeAttempt(1));
2356
- if (shouldRetryDeployedSmoke(executions[0])) {
2357
- executions.push(await executeAttempt(2));
2358
- }
2359
- const reports = executions
2360
- .filter(({ report }) => report !== undefined)
2361
- .map(({ attempt, report }) => ({ attempt, report }));
2362
- if (reports.length > 0) {
2363
- const raw = JSON.stringify({ reports }, null, 2) + '\\n';
2364
- let inspection;
2365
- try {
2366
- inspection =
2367
- (typeof principalPassword === 'string' &&
2368
- raw.includes(principalPassword)) ||
2369
- (typeof reviewerPassword === 'string' &&
2370
- raw.includes(reviewerPassword))
2371
- ? { safe: false }
2372
- : inspectTestingEvidenceArtifact({
2373
- contents: raw,
2374
- });
2375
- } catch {
2376
- inspection = { safe: false };
2377
- }
2378
- if (inspection.safe) {
2379
- writeFileSync(sanitizedReportPath, raw, 'utf8');
2380
- artifacts.push({
2381
- digest:
2382
- 'sha256:' + createHash('sha256').update(raw).digest('hex'),
2383
- name: relative(projectRoot, sanitizedReportPath)
2384
- .replaceAll('\\\\', '/'),
2385
- retentionClass: 'protected-promotion-proof',
2386
- });
2387
- } else {
2388
- rmSync(sanitizedReportPath, { force: true });
2389
- executions[executions.length - 1].artifactSensitive = true;
2390
- }
2391
- }
2392
- } catch {
2393
- rmSync(sanitizedReportPath, { force: true });
2394
- const execution = executions.at(-1);
2395
- if (execution) {
2396
- execution.diagnostic =
2397
- 'The deployed browser runner failed before producing safe evidence.';
2398
- execution.failed = Math.max(execution.failed, 1);
2399
- execution.reportInvalid = true;
2400
- } else {
2401
- const failedAt = new Date().toISOString();
2402
- executions.push({
2403
- attempt: 1,
2404
- completedAt: failedAt,
2405
- dataCleanup: {
2406
- outcome: 'failed',
2407
- sanitizedSummary:
2408
- 'The deployed smoke record cleanup was not proved.',
2409
- },
2410
- diagnostic:
2411
- 'The deployed browser runner failed before producing safe evidence.',
2412
- failed: 1,
2413
- passed: 0,
2414
- reportInvalid: true,
2415
- skipped: 0,
2416
- startedAt: failedAt,
2417
- });
2418
- }
2419
- } finally {
2420
- principalPassword = undefined;
2421
- reviewerPassword = undefined;
2422
- if (artifacts.length === 0) {
2423
- rmSync(sanitizedReportPath, { force: true });
2424
- }
2425
- rmSync(rawRoot, { force: true, recursive: true });
2426
- rmSync(join(projectRoot, 'test-results'), {
2427
- force: true,
2428
- recursive: true,
2429
- });
2430
- rmSync(join(projectRoot, 'playwright-report'), {
2431
- force: true,
2432
- recursive: true,
2433
- });
2434
- if (principalCleanupRequired) {
2435
- try {
2436
- await cognito.send(
2437
- new AdminDeleteUserCommand({
2438
- Username: principalEmail,
2439
- UserPoolId: userPoolId,
2440
- }),
2441
- );
2442
- principalCleanupRequired = false;
2443
- } catch (error) {
2444
- if (isCognitoUserAbsent(error)) {
2445
- principalCleanupRequired = false;
2446
- } else {
2447
- cleanup = {
2448
- outcome: 'failed',
2449
- sanitizedSummary: permissionFailure(error, 'cleanup').summary,
2450
- };
2451
- }
2452
- }
2453
- }
2454
- if (reviewerCleanupRequired) {
2455
- try {
2456
- await cognito.send(
2457
- new AdminDeleteUserCommand({
2458
- Username: reviewerEmail,
2459
- UserPoolId: userPoolId,
2460
- }),
2461
- );
2462
- reviewerCleanupRequired = false;
2463
- } catch (error) {
2464
- if (isCognitoUserAbsent(error)) {
2465
- reviewerCleanupRequired = false;
2466
- } else {
2467
- cleanup = {
2468
- outcome: 'failed',
2469
- sanitizedSummary: permissionFailure(error, 'cleanup').summary,
2470
- };
2471
- }
2472
- }
2473
- }
2474
- }
2475
- if (
2476
- executions.some(
2477
- ({ dataCleanup }) => dataCleanup?.outcome === 'failed',
2478
- )
2479
- ) {
2480
- cleanup = {
2481
- outcome: 'failed',
2482
- sanitizedSummary:
2483
- cleanup.outcome === 'failed'
2484
- ? 'Synthetic principal or deployed record cleanup failed.'
2485
- : 'The deployed smoke record cleanup was not proved.',
2486
- };
2487
- }
2488
- const attempts = executions.map((execution) =>
2489
- normalizePlaywrightEvidenceAttempt({
2490
- attempt: execution.attempt,
2491
- completedAt: execution.completedAt,
2492
- failed: execution.failed,
2493
- findings: [
2494
- ...(execution.runnerFailed > 0
2495
- ? [
2496
- {
2497
- classification: 'assertion-failed',
2498
- summary: sanitizeTestingEvidenceSummary(
2499
- execution.diagnostic,
2500
- ),
2501
- },
2502
- ]
2503
- : []),
2504
- ...(execution.artifactSensitive
2505
- ? [
2506
- {
2507
- classification: 'sensitive-artifact',
2508
- summary:
2509
- 'The Playwright report matched protected artifact data and was not retained.',
2510
- },
2511
- ]
2512
- : []),
2513
- ...(execution.reportInvalid
2514
- ? [
2515
- {
2516
- classification: 'evidence-incomplete',
2517
- summary:
2518
- 'Playwright emitted malformed machine-readable output; raw output was removed.',
2519
- },
2520
- ]
2521
- : []),
2522
- ...(execution.quarantineFindings ?? []),
2523
- ...(execution.observationFindings ?? []),
2524
- ...(execution.policyFindings ?? []),
2525
- ],
2526
- ...(execution.attempt === 2
2527
- ? { identicalToPrevious: true }
2528
- : {}),
2529
- passed: execution.passed,
2530
- quarantined: execution.quarantined ?? 0,
2531
- skipped: execution.skipped,
2532
- startedAt: execution.startedAt,
2533
- }),
2534
- );
2535
- const result = createTestingEvidenceFromRunnerAttempts({
2536
- artifacts,
2537
- attempts,
2538
- cleanup,
2539
- environment: {
2540
- class: deployedEnvironmentClass,
2541
- deployed: true,
2542
- stage,
2543
- },
2544
- operation,
2545
- proofStarted: true,
2546
- runScope: runId,
2547
- seed,
2548
- slice: '${name}',
2549
- source,
2550
- workspace: workspacePackage.name,
2551
- });
2552
- writeResult(result);
2553
- if (result.outcome !== 'passed') process.exitCode = 1;
2554
- }
2555
- }
2556
- `,
2557
- 'testing/strict-json-reporter.mjs': `import { JsonReporter } from 'vitest/node';
2558
-
2559
- export default class StrictJsonReporter extends JsonReporter {
2560
- expectedFailures = 0;
2561
- focusedTests = 0;
2562
- retryConfiguredTests = 0;
2563
-
2564
- async onTestRunEnd(testModules, unhandledErrors, reason) {
2565
- for (const testModule of testModules) {
2566
- for (const testCase of testModule.children.allTests()) {
2567
- if (testCase.options.fails) this.expectedFailures += 1;
2568
- if (testCase.options.mode === 'only') this.focusedTests += 1;
2569
- if ((testCase.options.retry ?? 0) > 0) {
2570
- this.retryConfiguredTests += 1;
2571
- }
2572
- }
2573
- for (const testSuite of testModule.children.allSuites()) {
2574
- if (testSuite.options.mode === 'only') this.focusedTests += 1;
2575
- }
2576
- }
2577
- await super.onTestRunEnd(testModules, unhandledErrors, reason);
2578
- if (
2579
- this.expectedFailures > 0 ||
2580
- this.focusedTests > 0 ||
2581
- this.retryConfiguredTests > 0
2582
- ) {
2583
- process.exitCode = 1;
2584
- }
2585
- }
2586
-
2587
- async writeReport(serializedReport) {
2588
- const report = JSON.parse(serializedReport);
2589
- report.ebkPolicy = {
2590
- expectedFailures: this.expectedFailures,
2591
- focusedTests: this.focusedTests,
2592
- retryConfiguredTests: this.retryConfiguredTests,
2593
- };
2594
- await super.writeReport(JSON.stringify(report));
2595
- }
2596
- }
2597
- `,
2598
- 'vitest.integration.config.ts': `import { defineConfig } from 'vitest/config';
2599
-
2600
- export default defineConfig({
2601
- test: {
2602
- allowOnly: false,
2603
- environment: 'node',
2604
- env: { EBK_STAGE: 'development' },
2605
- // Hosted runners share four cores between Vitest, the proof registry,
2606
- // and the dockerized database; rendezvous-orchestrated integration
2607
- // proofs need a loaded-host budget, not the five-second idle default.
2608
- hookTimeout: 30_000,
2609
- include: ['integration/**/*.spec.ts'],
2610
- maxWorkers: 1,
2611
- retry: 0,
2612
- testTimeout: 30_000,
2613
- },
2614
- });
2615
- `,
2616
- };
2617
- }
2618
- //# sourceMappingURL=built-in-plan-testing-files.js.map