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