@empire-builder-kit/nx 1.0.0-rc.47 → 1.0.0-rc.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -169
- package/executors.json +24 -79
- package/generators.json +8 -18
- package/package.json +13 -71
- package/src/aws/identity.d.ts +1 -1
- package/src/aws-authority/boundary-transforms.d.ts +9 -0
- package/src/aws-authority/boundary-transforms.js +78 -0
- package/src/aws-authority/contracts.d.ts +116 -0
- package/src/aws-authority/contracts.js +40 -0
- package/src/aws-authority/deployment-guardrails.d.ts +4 -0
- package/src/aws-authority/deployment-guardrails.js +543 -0
- package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
- package/src/aws-authority/deployment-policy-groups.js +299 -0
- package/src/aws-authority/deployment-resources.d.ts +64 -0
- package/src/aws-authority/deployment-resources.js +265 -0
- package/src/aws-authority/deployment-services.d.ts +3 -0
- package/src/aws-authority/deployment-services.js +717 -0
- package/src/aws-authority/development-authority.d.ts +11 -0
- package/src/aws-authority/development-authority.js +160 -0
- package/src/aws-authority/guardrail-actions.d.ts +87 -0
- package/src/aws-authority/guardrail-actions.js +463 -0
- package/src/aws-authority/policy-document.d.ts +15 -0
- package/src/aws-authority/policy-document.js +264 -0
- package/src/aws-authority/runtime-boundary.d.ts +7 -0
- package/src/aws-authority/runtime-boundary.js +211 -0
- package/src/aws-authority/service-actions.d.ts +96 -0
- package/src/aws-authority/service-actions.js +512 -0
- package/src/aws-authority/stage-authority.d.ts +6 -272
- package/src/aws-authority/stage-authority.js +109 -3609
- package/src/aws-authority/stage-identity.d.ts +6 -0
- package/src/aws-authority/stage-identity.js +134 -0
- package/src/cli/bootstrap.d.ts +0 -20
- package/src/cli/bootstrap.js +2 -153
- package/src/cli/dev-command.d.ts +2 -4
- package/src/cli/dev-command.js +1 -19
- package/src/cli/main.d.ts +0 -4
- package/src/cli/main.js +22 -80
- package/src/cli/output.d.ts +2 -4
- package/src/cli/output.js +2 -8
- package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
- package/src/executors/deployment-plan/deployment-plan.js +3 -68
- package/src/executors/dev-doctor/dev-doctor.js +2 -2
- package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
- package/src/executors/local-deploy/deployed-smoke.js +115 -0
- package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
- package/src/executors/local-deploy/deployment-authority.js +81 -0
- package/src/executors/local-deploy/deployment-child.d.ts +18 -0
- package/src/executors/local-deploy/deployment-child.js +77 -0
- package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
- package/src/executors/local-deploy/deployment-contracts.js +3 -0
- package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
- package/src/executors/local-deploy/deployment-projects.js +16 -0
- package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
- package/src/executors/local-deploy/deployment-receipt.js +55 -0
- package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
- package/src/executors/local-deploy/deployment-scope.js +239 -0
- package/src/executors/local-deploy/deployment-source.d.ts +13 -0
- package/src/executors/local-deploy/deployment-source.js +86 -0
- package/src/executors/local-deploy/local-deploy.d.ts +5 -121
- package/src/executors/local-deploy/local-deploy.js +55 -936
- package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
- package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
- package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
- package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
- package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
- package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
- package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
- package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
- package/src/executors/sst-lifecycle/task-unlock.js +3 -3
- package/src/foundation/discovery.d.ts +1 -5
- package/src/foundation/discovery.js +0 -2
- package/src/foundation/index.d.ts +0 -2
- package/src/foundation/index.js +0 -9
- package/src/foundation/local-private-smoke-access.d.ts +6 -15
- package/src/foundation/local-private-smoke-access.js +8 -192
- package/src/foundation/observability.d.ts +16 -26
- package/src/foundation/observability.js +34 -135
- package/src/foundation/preflight.js +0 -14
- package/src/foundation/private-smoke-access.d.ts +7 -14
- package/src/foundation/private-smoke-access.js +4 -126
- package/src/foundation/root-site-workspace.d.ts +35 -0
- package/src/foundation/root-site-workspace.js +80 -0
- package/src/foundation/root-site.d.ts +8 -7
- package/src/foundation/root-site.js +17 -9
- package/src/generators/formatting.js +5 -4
- package/src/generators/function/function.d.ts +9 -5
- package/src/generators/function/function.js +106 -136
- package/src/generators/function/schema.json +2 -2
- package/src/generators/function-access/function-access.d.ts +0 -6
- package/src/generators/function-access/function-access.js +41 -109
- package/src/generators/observability-policy.js +1 -2
- package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
- package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
- package/src/generators/post-generation-install.d.ts +1 -8
- package/src/generators/post-generation-install.js +11 -139
- package/src/generators/preset/dependency-overrides.d.ts +13 -19
- package/src/generators/preset/dependency-overrides.js +12 -56
- package/src/generators/preset/generator.js +0 -3
- package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
- package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
- package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
- package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
- package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
- package/src/generators/preset/workspace-files-foundation.js +170 -0
- package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
- package/src/generators/preset/workspace-files-ownership.js +124 -0
- package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
- package/src/generators/preset/workspace-files-root-config.js +356 -0
- package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
- package/src/generators/preset/workspace-files-root-docs.js +109 -0
- package/src/generators/preset/workspace-files-shared.d.ts +18 -0
- package/src/generators/preset/workspace-files-shared.js +7 -0
- package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
- package/src/generators/preset/workspace-files-workflows.js +306 -0
- package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
- package/src/generators/preset/workspace-files-workspace-health.js +148 -0
- package/src/generators/preset/workspace-files.d.ts +10 -24
- package/src/generators/preset/workspace-files.js +48 -10705
- package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
- package/src/generators/site/built-in-site-documentation-files.js +15 -56
- package/src/generators/site/built-in-site-files.d.ts +4 -1
- package/src/generators/site/built-in-site-files.js +12 -11
- package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
- package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
- package/src/generators/site/built-in-site-plan.d.ts +5 -1
- package/src/generators/site/built-in-site-plan.js +7 -5
- package/src/generators/site/built-in-site-project-files.d.ts +10 -2
- package/src/generators/site/built-in-site-project-files.js +131 -177
- package/src/generators/site/built-in-site-script-files.d.ts +2 -0
- package/src/generators/site/built-in-site-script-files.js +76 -280
- package/src/generators/site/built-in-site-shared.d.ts +64 -4
- package/src/generators/site/built-in-site-shared.js +307 -14
- package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
- package/src/generators/site/built-in-site-sst-config-files.js +90 -22
- package/src/generators/site/built-in-site-web-files.d.ts +2 -1
- package/src/generators/site/built-in-site-web-files.js +19 -225
- package/src/generators/site/schema.d.ts +5 -0
- package/src/generators/site/schema.json +6 -0
- package/src/generators/site/site.d.ts +0 -8
- package/src/generators/site/site.js +17 -85
- package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
- package/src/generators/slice/built-in-plan-api-files.js +30 -890
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
- package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
- package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
- package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
- package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
- package/src/generators/slice/built-in-plan-project-files.js +79 -897
- package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
- package/src/generators/slice/built-in-plan-shared.js +4 -57
- package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
- package/src/generators/slice/built-in-plan-web-files.js +14 -540
- package/src/generators/slice/built-in-plan.d.ts +2 -3
- package/src/generators/slice/built-in-plan.js +79 -277
- package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
- package/src/generators/slice/generation-tree.js +161 -0
- package/src/generators/slice/schema.json +12 -4
- package/src/generators/slice/slice-config.d.ts +7 -0
- package/src/generators/slice/slice-config.js +125 -0
- package/src/generators/slice/slice.js +29 -261
- package/src/generators/slice/sql-bootstrap.d.ts +1 -0
- package/src/generators/slice/sql-bootstrap.js +505 -0
- package/src/generators/slice/sql-client.d.ts +1 -0
- package/src/generators/slice/sql-client.js +107 -0
- package/src/generators/slice/sql-infrastructure.d.ts +1 -0
- package/src/generators/slice/sql-infrastructure.js +225 -0
- package/src/generators/slice/sql-logging.d.ts +1 -0
- package/src/generators/slice/sql-logging.js +266 -0
- package/src/generators/slice/sql-migration.d.ts +2 -0
- package/src/generators/slice/sql-migration.js +202 -0
- package/src/generators/slice/standard-slice-contract.d.ts +25 -0
- package/src/generators/slice/standard-slice-contract.js +64 -0
- package/src/generators/sql/schema.json +1 -1
- package/src/generators/sql/sql.d.ts +1 -1
- package/src/generators/sql/sql.js +13 -7
- package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
- package/src/generators/upgrade/framework-package-upgrade.js +16 -39
- package/src/generators/upgrade/framework-packages.d.ts +25 -0
- package/src/generators/upgrade/framework-packages.js +138 -0
- package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
- package/src/generators/upgrade/function-authentication-notice.js +24 -44
- package/src/generators/upgrade/schema.d.ts +0 -3
- package/src/generators/upgrade/schema.json +6 -16
- package/src/generators/upgrade/slice-compositions.d.ts +20 -0
- package/src/generators/upgrade/slice-compositions.js +100 -0
- package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
- package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
- package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
- package/src/generators/upgrade/slice-upgrade.js +231 -0
- package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
- package/src/generators/upgrade/upgrade-plan.js +33 -197
- package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
- package/src/generators/upgrade/upgrade-preflight.js +64 -0
- package/src/generators/upgrade/upgrade.d.ts +8 -53
- package/src/generators/upgrade/upgrade.js +23 -1571
- package/src/generators/workload/schema.json +2 -2
- package/src/generators/workload/workload.d.ts +11 -11
- package/src/generators/workload/workload.js +166 -1255
- package/src/index.d.ts +0 -5
- package/src/index.js +0 -5
- package/src/local-dev/browser-verification.d.ts +0 -7
- package/src/local-dev/browser-verification.js +0 -136
- package/src/local-dev/contracts.d.ts +6 -0
- package/src/local-dev/contracts.js +17 -9
- package/src/local-dev/environment-checks.d.ts +126 -0
- package/src/local-dev/environment-checks.js +81 -0
- package/src/local-dev/environment-inspector.d.ts +3 -124
- package/src/local-dev/environment-inspector.js +9 -148
- package/src/local-dev/private-state.d.ts +1 -0
- package/src/local-dev/private-state.js +19 -23
- package/src/local-dev/process-identity.js +4 -2
- package/src/local-dev/slice-runner-child.d.ts +37 -0
- package/src/local-dev/slice-runner-child.js +127 -0
- package/src/local-dev/slice-runner-recovery.d.ts +32 -0
- package/src/local-dev/slice-runner-recovery.js +216 -0
- package/src/local-dev/slice-runner-state.d.ts +82 -0
- package/src/local-dev/slice-runner-state.js +265 -0
- package/src/local-dev/slice-runner.d.ts +4 -117
- package/src/local-dev/slice-runner.js +59 -594
- package/src/local-dev/tls.js +8 -97
- package/src/ownership/index.d.ts +1 -0
- package/src/ownership/index.js +6 -0
- package/src/ownership/pnpm-workspace.d.ts +77 -0
- package/src/ownership/pnpm-workspace.js +225 -0
- package/src/ownership/site-record.d.ts +8 -0
- package/src/ownership/site-record.js +17 -2
- package/src/repository-policy/capacity-migration.d.ts +1 -1
- package/src/repository-policy/capacity-migration.js +1 -1
- package/src/repository-policy/foundation-router.d.ts +17 -0
- package/src/repository-policy/foundation-router.js +44 -0
- package/src/repository-policy/index.d.ts +2 -0
- package/src/repository-policy/index.js +2 -0
- package/src/repository-policy/policy-accounts.d.ts +22 -0
- package/src/repository-policy/policy-accounts.js +134 -0
- package/src/repository-policy/policy-files.d.ts +8 -0
- package/src/repository-policy/policy-files.js +201 -0
- package/src/repository-policy/policy-internal.d.ts +2 -0
- package/src/repository-policy/policy-internal.js +11 -0
- package/src/repository-policy/policy-model.d.ts +95 -0
- package/src/repository-policy/policy-model.js +42 -0
- package/src/repository-policy/policy-validation.d.ts +4 -0
- package/src/repository-policy/policy-validation.js +308 -0
- package/src/repository-policy/policy.d.ts +5 -120
- package/src/repository-policy/policy.js +34 -662
- package/src/repository-policy/public-dns.d.ts +4 -0
- package/src/repository-policy/public-dns.js +102 -5
- package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
- package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
- package/src/schemas/repository-policy-v1.json +40 -3
- package/src/secrets/index.d.ts +0 -5
- package/src/secrets/index.js +0 -5
- package/src/slice-infra/index.d.ts +57 -0
- package/src/slice-infra/index.js +117 -0
- package/src/slice-scripts/build.d.ts +27 -0
- package/src/slice-scripts/build.js +120 -0
- package/src/slice-scripts/database.d.ts +87 -0
- package/src/slice-scripts/database.js +328 -0
- package/src/slice-scripts/index.d.ts +11 -0
- package/src/slice-scripts/index.js +23 -0
- package/src/slice-scripts/root-site-routes.d.ts +11 -0
- package/src/slice-scripts/root-site-routes.js +83 -0
- package/src/slice-scripts/sql-migration-engine.mjs +180 -0
- package/src/workload-roles/effective-policy.d.ts +0 -37
- package/src/workload-roles/effective-policy.js +1 -174
- package/src/workload-roles/standard-slice.d.ts +2 -19
- package/src/workload-roles/standard-slice.js +3 -129
- package/src/api-contract/baseline-update.d.ts +0 -82
- package/src/api-contract/baseline-update.js +0 -225
- package/src/api-contract/compatibility.d.ts +0 -30
- package/src/api-contract/compatibility.js +0 -643
- package/src/api-contract/contract-graph.d.ts +0 -35
- package/src/api-contract/contract-graph.js +0 -141
- package/src/api-contract/evidence.d.ts +0 -23
- package/src/api-contract/evidence.js +0 -87
- package/src/api-contract/index.d.ts +0 -6
- package/src/api-contract/index.js +0 -10
- package/src/api-contract/model.d.ts +0 -144
- package/src/api-contract/model.js +0 -993
- package/src/api-contract/rollout.d.ts +0 -32
- package/src/api-contract/rollout.js +0 -88
- package/src/authorization/compatibility.d.ts +0 -62
- package/src/authorization/compatibility.js +0 -175
- package/src/authorization/index.d.ts +0 -1
- package/src/authorization/index.js +0 -5
- package/src/blueprints/execution.d.ts +0 -55
- package/src/blueprints/execution.js +0 -329
- package/src/blueprints/external-sandbox.d.ts +0 -53
- package/src/blueprints/external-sandbox.js +0 -1194
- package/src/blueprints/index.d.ts +0 -5
- package/src/blueprints/index.js +0 -9
- package/src/blueprints/inputs.d.ts +0 -43
- package/src/blueprints/inputs.js +0 -103
- package/src/blueprints/manifest.d.ts +0 -281
- package/src/blueprints/manifest.js +0 -424
- package/src/blueprints/resolver.d.ts +0 -37
- package/src/blueprints/resolver.js +0 -387
- package/src/blueprints/transitions.d.ts +0 -20
- package/src/blueprints/transitions.js +0 -61
- package/src/cli/agent-command.d.ts +0 -30
- package/src/cli/agent-command.js +0 -204
- package/src/cli/agent-runtime.d.ts +0 -25
- package/src/cli/agent-runtime.js +0 -498
- package/src/cli/blueprint-authority.d.ts +0 -9
- package/src/cli/blueprint-authority.js +0 -43
- package/src/cli/blueprint-command.d.ts +0 -24
- package/src/cli/blueprint-command.js +0 -63
- package/src/data-lifecycle/index.d.ts +0 -3
- package/src/data-lifecycle/index.js +0 -7
- package/src/data-lifecycle/model.d.ts +0 -172
- package/src/data-lifecycle/model.js +0 -95
- package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
- package/src/data-lifecycle/sensitive-artifacts.js +0 -146
- package/src/data-lifecycle/validation.d.ts +0 -32
- package/src/data-lifecycle/validation.js +0 -837
- package/src/database-retirement/contract.d.ts +0 -68
- package/src/database-retirement/contract.js +0 -166
- package/src/database-retirement/index.d.ts +0 -1
- package/src/database-retirement/index.js +0 -5
- package/src/developer-agent/context.d.ts +0 -57
- package/src/developer-agent/context.js +0 -662
- package/src/developer-agent/generator-planning.d.ts +0 -34
- package/src/developer-agent/generator-planning.js +0 -759
- package/src/developer-agent/generator-preview.d.ts +0 -8
- package/src/developer-agent/generator-preview.js +0 -650
- package/src/developer-agent/git-inspection.d.ts +0 -112
- package/src/developer-agent/git-inspection.js +0 -887
- package/src/developer-agent/handoff.d.ts +0 -43
- package/src/developer-agent/handoff.js +0 -713
- package/src/developer-agent/index.d.ts +0 -10
- package/src/developer-agent/index.js +0 -14
- package/src/developer-agent/model.d.ts +0 -497
- package/src/developer-agent/model.js +0 -144
- package/src/developer-agent/operation-registry.d.ts +0 -61
- package/src/developer-agent/operation-registry.js +0 -1591
- package/src/developer-agent/ordering.d.ts +0 -9
- package/src/developer-agent/ordering.js +0 -15
- package/src/developer-agent/planning.d.ts +0 -25
- package/src/developer-agent/planning.js +0 -481
- package/src/developer-agent/preview-changes.js +0 -225
- package/src/developer-agent/preview-source.d.ts +0 -2
- package/src/developer-agent/preview-source.js +0 -19
- package/src/developer-agent/validation.d.ts +0 -30
- package/src/developer-agent/validation.js +0 -2729
- package/src/developer-agent/workspace-inspection.d.ts +0 -20
- package/src/developer-agent/workspace-inspection.js +0 -1236
- package/src/developer-agent/workspace-path.d.ts +0 -6
- package/src/developer-agent/workspace-path.js +0 -22
- package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
- package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
- package/src/executors/blueprint-trust/schema.json +0 -27
- package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
- package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
- package/src/executors/blueprint-verification/schema.json +0 -44
- package/src/executors/developer-context/developer-context.d.ts +0 -38
- package/src/executors/developer-context/developer-context.js +0 -78
- package/src/executors/developer-context/schema.json +0 -87
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
- package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
- package/src/executors/foundation-profile-preflight/schema.json +0 -32
- package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
- package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
- package/src/executors/github-bootstrap/schema.json +0 -50
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
- package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
- package/src/executors/infrastructure-plan/schema.json +0 -38
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
- package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
- package/src/executors/router-waf-rehearsal/schema.json +0 -29
- package/src/executors/secret-guardrails/schema.json +0 -6
- package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
- package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
- package/src/executors/secret-initialize/schema.json +0 -42
- package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
- package/src/executors/secret-initialize/secret-initialize.js +0 -297
- package/src/executors/secret-metadata/schema.json +0 -36
- package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
- package/src/executors/secret-metadata/secret-metadata.js +0 -230
- package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
- package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
- package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
- package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
- package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
- package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
- package/src/executors/work-markers/schema.json +0 -14
- package/src/executors/work-markers/work-markers.d.ts +0 -6
- package/src/executors/work-markers/work-markers.js +0 -20
- package/src/foundation/cost-estimate.d.ts +0 -175
- package/src/foundation/cost-estimate.js +0 -706
- package/src/foundation/private-smoke-admission.d.ts +0 -45
- package/src/foundation/private-smoke-admission.js +0 -180
- package/src/foundation/private-smoke-control-plane.d.ts +0 -18
- package/src/foundation/private-smoke-control-plane.js +0 -184
- package/src/foundation/root-site-readiness.d.ts +0 -27
- package/src/foundation/root-site-readiness.js +0 -78
- package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
- package/src/foundation/router-waf-rate-rehearsal.js +0 -210
- package/src/foundation/router-waf.d.ts +0 -149
- package/src/foundation/router-waf.js +0 -809
- package/src/frontend-security/index.d.ts +0 -1
- package/src/frontend-security/index.js +0 -5
- package/src/frontend-security/security-headers.d.ts +0 -50
- package/src/frontend-security/security-headers.js +0 -418
- package/src/generators/blueprint/blueprint.d.ts +0 -5
- package/src/generators/blueprint/blueprint.js +0 -102
- package/src/generators/blueprint/files.d.ts +0 -6
- package/src/generators/blueprint/files.js +0 -217
- package/src/generators/blueprint/schema.d.ts +0 -4
- package/src/generators/blueprint/schema.json +0 -18
- package/src/generators/feature-registry.d.ts +0 -13
- package/src/generators/feature-registry.js +0 -73
- package/src/generators/function/function-registration.d.ts +0 -24
- package/src/generators/function/function-registration.js +0 -66
- package/src/generators/observability-infrastructure.d.ts +0 -2
- package/src/generators/observability-infrastructure.js +0 -31
- package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
- package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
- package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
- package/src/generators/preset/workspace-files-agent-development.js +0 -42
- package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
- package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
- package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
- package/src/generators/preset/workspace-files-ci-install.js +0 -196
- package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
- package/src/generators/preset/workspace-files-developer-agent.js +0 -644
- package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
- package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
- package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
- package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
- package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
- package/src/generators/preset/workspace-files-performance-cost.js +0 -866
- package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
- package/src/generators/preset/workspace-files-performance-load.js +0 -815
- package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
- package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
- package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
- package/src/generators/preset/workspace-files-stage-authority.js +0 -586
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
- package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
- package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
- package/src/generators/preset/workspace-files-thin-docs.js +0 -386
- package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
- package/src/generators/preset/workspace-files-thin-release.js +0 -26
- package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
- package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
- package/src/generators/repository-policy/repository-policy.d.ts +0 -4
- package/src/generators/repository-policy/repository-policy.js +0 -294
- package/src/generators/repository-policy/schema.d.ts +0 -30
- package/src/generators/repository-policy/schema.json +0 -127
- package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
- package/src/generators/site/built-in-site-smoke-files.js +0 -37
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
- package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
- package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
- package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
- package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
- package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
- package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
- package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
- package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
- package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-files.js +0 -618
- package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
- package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
- package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
- package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
- package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
- package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
- package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
- package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
- package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
- package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
- package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
- package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
- package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
- package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
- package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
- package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
- package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
- package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
- package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
- package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
- package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
- package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
- package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
- package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
- package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
- package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
- package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
- package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
- package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
- package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
- package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
- package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
- package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
- package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
- package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
- package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-release-files.js +0 -6585
- package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
- package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
- package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
- package/src/generators/slice/built-in-plan-sql-events.js +0 -276
- package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
- package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
- package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
- package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
- package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
- package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
- package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-verification-files.js +0 -442
- package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
- package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
- package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
- package/src/generators/slice/data-policy-review-seed.js +0 -22
- package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
- package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
- package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
- package/src/generators/slice/deployed-smoke-readiness.js +0 -309
- package/src/generators/slice/local-source-identity.d.ts +0 -2
- package/src/generators/slice/local-source-identity.js +0 -31
- package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
- package/src/generators/slice/pnpm-launch-script.js +0 -28
- package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
- package/src/generators/upgrade/custom-domain-notice.js +0 -38
- package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
- package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
- package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
- package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
- package/src/generators/workload/performance-registration.d.ts +0 -33
- package/src/generators/workload/performance-registration.js +0 -224
- package/src/generators/workload/reliability-registration.d.ts +0 -16
- package/src/generators/workload/reliability-registration.js +0 -150
- package/src/generators/workload/service-performance-files.d.ts +0 -5
- package/src/generators/workload/service-performance-files.js +0 -1883
- package/src/git-policy/action-pins.d.ts +0 -43
- package/src/git-policy/action-pins.js +0 -50
- package/src/git-policy/github-bootstrap.d.ts +0 -95
- package/src/git-policy/github-bootstrap.js +0 -1250
- package/src/git-policy/index.d.ts +0 -3
- package/src/git-policy/index.js +0 -7
- package/src/git-policy/routing.d.ts +0 -21
- package/src/git-policy/routing.js +0 -138
- package/src/infrastructure-change/convergence.d.ts +0 -13
- package/src/infrastructure-change/convergence.js +0 -85
- package/src/infrastructure-change/drift.d.ts +0 -13
- package/src/infrastructure-change/drift.js +0 -112
- package/src/infrastructure-change/index.d.ts +0 -7
- package/src/infrastructure-change/index.js +0 -11
- package/src/infrastructure-change/local-capability.d.ts +0 -73
- package/src/infrastructure-change/local-capability.js +0 -114
- package/src/infrastructure-change/model.d.ts +0 -274
- package/src/infrastructure-change/model.js +0 -29
- package/src/infrastructure-change/normalize.d.ts +0 -16
- package/src/infrastructure-change/normalize.js +0 -285
- package/src/infrastructure-change/plan.d.ts +0 -67
- package/src/infrastructure-change/plan.js +0 -671
- package/src/infrastructure-change/risk.d.ts +0 -9
- package/src/infrastructure-change/risk.js +0 -349
- package/src/infrastructure-change/summary.d.ts +0 -20
- package/src/infrastructure-change/summary.js +0 -130
- package/src/performance/cost-collection.d.ts +0 -225
- package/src/performance/cost-collection.js +0 -827
- package/src/performance/cost-controls.d.ts +0 -135
- package/src/performance/cost-controls.js +0 -347
- package/src/performance/evidence.d.ts +0 -140
- package/src/performance/evidence.js +0 -601
- package/src/performance/index.d.ts +0 -10
- package/src/performance/index.js +0 -14
- package/src/performance/load-safety.d.ts +0 -84
- package/src/performance/load-safety.js +0 -348
- package/src/performance/model.d.ts +0 -129
- package/src/performance/model.js +0 -451
- package/src/performance/pr-artifact-budget.d.ts +0 -42
- package/src/performance/pr-artifact-budget.js +0 -151
- package/src/performance/runner.d.ts +0 -75
- package/src/performance/runner.js +0 -227
- package/src/performance/scenario-endpoint.d.ts +0 -1
- package/src/performance/scenario-endpoint.js +0 -5
- package/src/performance/scenario.d.ts +0 -215
- package/src/performance/scenario.js +0 -744
- package/src/performance/unit-cost.d.ts +0 -105
- package/src/performance/unit-cost.js +0 -364
- package/src/release/index.d.ts +0 -2
- package/src/release/index.js +0 -6
- package/src/release/lifecycle.d.ts +0 -132
- package/src/release/lifecycle.js +0 -411
- package/src/release/manifest.d.ts +0 -148
- package/src/release/manifest.js +0 -503
- package/src/release/rollout.d.ts +0 -170
- package/src/release/rollout.js +0 -578
- package/src/release/source-authority.d.ts +0 -19
- package/src/release/source-authority.js +0 -212
- package/src/schemas/aggregate-count-evidence-v1.json +0 -135
- package/src/schemas/api-contract-baseline-v1.json +0 -674
- package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
- package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
- package/src/schemas/blueprint-input-schema-v1.json +0 -23
- package/src/schemas/blueprint-v1.json +0 -188
- package/src/schemas/data-lifecycle-policy-v1.json +0 -517
- package/src/schemas/performance-policy-v1.json +0 -335
- package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
- package/src/schemas/testing-evidence-result-v1.json +0 -319
- package/src/secrets/aws-control-plane.d.ts +0 -29
- package/src/secrets/aws-control-plane.js +0 -322
- package/src/secrets/generated-aws-control-plane.d.ts +0 -33
- package/src/secrets/generated-aws-control-plane.js +0 -322
- package/src/secrets/guardrails.d.ts +0 -26
- package/src/secrets/guardrails.js +0 -328
- package/src/secrets/metadata.d.ts +0 -48
- package/src/secrets/metadata.js +0 -199
- package/src/secrets/operator.d.ts +0 -190
- package/src/secrets/operator.js +0 -701
- package/src/secrets/verification.d.ts +0 -18
- package/src/secrets/verification.js +0 -152
- package/src/supply-chain/action-pins.d.ts +0 -26
- package/src/supply-chain/action-pins.js +0 -262
- package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
- package/src/supply-chain/blueprint-trust-git.js +0 -1666
- package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
- package/src/supply-chain/blueprint-trust-process.js +0 -88
- package/src/supply-chain/blueprint-trust.d.ts +0 -354
- package/src/supply-chain/blueprint-trust.js +0 -1558
- package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
- package/src/supply-chain/blueprint-verification-authority.js +0 -679
- package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
- package/src/supply-chain/blueprint-verification-execution.js +0 -639
- package/src/supply-chain/build-output-bounds.d.ts +0 -2
- package/src/supply-chain/build-output-bounds.js +0 -12
- package/src/supply-chain/build-output.d.ts +0 -41
- package/src/supply-chain/build-output.js +0 -551
- package/src/supply-chain/common.d.ts +0 -21
- package/src/supply-chain/common.js +0 -107
- package/src/supply-chain/container-artifact-contract.d.ts +0 -23
- package/src/supply-chain/container-artifact-contract.js +0 -208
- package/src/supply-chain/container-release.d.ts +0 -119
- package/src/supply-chain/container-release.js +0 -496
- package/src/supply-chain/ecr-applicability.d.ts +0 -19
- package/src/supply-chain/ecr-applicability.js +0 -103
- package/src/supply-chain/ecr-scanning.d.ts +0 -85
- package/src/supply-chain/ecr-scanning.js +0 -325
- package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
- package/src/supply-chain/ecs-deployed-image.js +0 -302
- package/src/supply-chain/errors.d.ts +0 -6
- package/src/supply-chain/errors.js +0 -15
- package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
- package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
- package/src/supply-chain/generated-command.d.ts +0 -1
- package/src/supply-chain/generated-command.js +0 -775
- package/src/supply-chain/generated-container-release-command.d.ts +0 -16
- package/src/supply-chain/generated-container-release-command.js +0 -3248
- package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
- package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
- package/src/supply-chain/generated-files.d.ts +0 -13
- package/src/supply-chain/generated-files.js +0 -421
- package/src/supply-chain/generated-scanner-command.d.ts +0 -1
- package/src/supply-chain/generated-scanner-command.js +0 -778
- package/src/supply-chain/index.d.ts +0 -28
- package/src/supply-chain/index.js +0 -36
- package/src/supply-chain/inventory.d.ts +0 -96
- package/src/supply-chain/inventory.js +0 -828
- package/src/supply-chain/license-expression.d.ts +0 -7
- package/src/supply-chain/license-expression.js +0 -128
- package/src/supply-chain/policy.d.ts +0 -105
- package/src/supply-chain/policy.js +0 -304
- package/src/supply-chain/publication.d.ts +0 -48
- package/src/supply-chain/publication.js +0 -85
- package/src/supply-chain/sbom.d.ts +0 -228
- package/src/supply-chain/sbom.js +0 -913
- package/src/supply-chain/scanner.d.ts +0 -77
- package/src/supply-chain/scanner.js +0 -514
- package/src/supply-chain/vendored-source.d.ts +0 -95
- package/src/supply-chain/vendored-source.js +0 -315
- package/src/testing-evidence/fixture-scope.d.ts +0 -53
- package/src/testing-evidence/fixture-scope.js +0 -142
- package/src/testing-evidence/index.d.ts +0 -5
- package/src/testing-evidence/index.js +0 -9
- package/src/testing-evidence/quarantine.d.ts +0 -48
- package/src/testing-evidence/quarantine.js +0 -253
- package/src/testing-evidence/result.d.ts +0 -109
- package/src/testing-evidence/result.js +0 -585
- package/src/testing-evidence/runner-adapter.d.ts +0 -51
- package/src/testing-evidence/runner-adapter.js +0 -288
- package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
- package/src/testing-evidence/sensitive-artifacts.js +0 -93
- package/src/work-markers/index.d.ts +0 -1
- package/src/work-markers/index.js +0 -5
- package/src/work-markers/work-markers.d.ts +0 -39
- package/src/work-markers/work-markers.js +0 -363
- package/src/workload-roles/account-baseline.d.ts +0 -143
- package/src/workload-roles/account-baseline.js +0 -980
- package/src/workload-roles/authority.d.ts +0 -40
- package/src/workload-roles/authority.js +0 -202
- package/src/workload-roles/aws-adapter.d.ts +0 -99
- package/src/workload-roles/aws-adapter.js +0 -416
- package/src/workload-roles/aws-internal-handler.d.ts +0 -27
- package/src/workload-roles/aws-internal-handler.js +0 -58
- package/src/workload-roles/aws-s3-state.d.ts +0 -52
- package/src/workload-roles/aws-s3-state.js +0 -191
- package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
- package/src/workload-roles/aws-sdk-control-plane.js +0 -291
- package/src/workload-roles/boundary.d.ts +0 -34
- package/src/workload-roles/boundary.js +0 -137
- package/src/workload-roles/convergence.d.ts +0 -66
- package/src/workload-roles/convergence.js +0 -186
- package/src/workload-roles/handler.d.ts +0 -43
- package/src/workload-roles/handler.js +0 -158
- package/src/workload-roles/history.d.ts +0 -47
- package/src/workload-roles/history.js +0 -324
- package/src/workload-roles/injection.d.ts +0 -119
- package/src/workload-roles/injection.js +0 -495
- package/src/workload-roles/manifest.d.ts +0 -54
- package/src/workload-roles/manifest.js +0 -343
- package/src/workload-roles/provisioner.d.ts +0 -70
- package/src/workload-roles/provisioner.js +0 -239
- package/src/workload-roles/registration.d.ts +0 -102
- package/src/workload-roles/registration.js +0 -462
- package/src/workload-roles/stage-boundary.d.ts +0 -31
- package/src/workload-roles/stage-boundary.js +0 -208
- /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
- /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
|
@@ -1,2444 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PRODUCT_PERFORMANCE_SEEDED_PATHS = void 0;
|
|
4
|
-
exports.renderProductPerformanceFiles = renderProductPerformanceFiles;
|
|
5
|
-
const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
|
|
6
|
-
const index_js_1 = require("../../performance/index.js");
|
|
7
|
-
const built_in_plan_key_value_performance_js_1 = require("./built-in-plan-key-value-performance.js");
|
|
8
|
-
exports.PRODUCT_PERFORMANCE_SEEDED_PATHS = [
|
|
9
|
-
'docs/runbooks/performance-capacity-cost.md',
|
|
10
|
-
'performance/aggregate-count-provider.ts',
|
|
11
|
-
'performance/cost-allocation.json',
|
|
12
|
-
'performance/cost-collection.json',
|
|
13
|
-
'performance/load-scenarios.json',
|
|
14
|
-
'performance/policy.json',
|
|
15
|
-
];
|
|
16
|
-
/** @internal */
|
|
17
|
-
function renderProductPerformanceFiles(name, deploymentProfile = 'starter') {
|
|
18
|
-
const databaseAdapter = 'ebk-dynamodb-v1';
|
|
19
|
-
const asyncAdapter = 'ebk-dynamodb-async-v1';
|
|
20
|
-
const databaseSignal = 'dynamodb:protected-request-budget-utilization-percent';
|
|
21
|
-
const asyncSignal = 'dynamodb:protected-run-unprocessed-effects-percent';
|
|
22
|
-
const pascalName = name
|
|
23
|
-
.split('-')
|
|
24
|
-
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
|
|
25
|
-
.join('');
|
|
26
|
-
const costDefaults = deploymentProfile === 'starter'
|
|
27
|
-
? {
|
|
28
|
-
accountMonthlyMaximumUsd: 250,
|
|
29
|
-
anomalyThresholdUsd: 10,
|
|
30
|
-
pilotMonthlyMaximumUsd: 50,
|
|
31
|
-
}
|
|
32
|
-
: {
|
|
33
|
-
accountMonthlyMaximumUsd: 1_000,
|
|
34
|
-
anomalyThresholdUsd: 50,
|
|
35
|
-
pilotMonthlyMaximumUsd: 250,
|
|
36
|
-
};
|
|
37
|
-
const rehearsalStage = deploymentProfile === 'starter' ? 'development' : 'staging';
|
|
38
|
-
const rehearsalStageTitle = rehearsalStage === 'development' ? 'Development' : 'Staging';
|
|
39
|
-
const protectedPerformanceStages = deploymentProfile === 'starter'
|
|
40
|
-
? ['development', 'production']
|
|
41
|
-
: ['staging', 'production'];
|
|
42
|
-
return {
|
|
43
|
-
'infra/performance-cost-controls.ts': `import {
|
|
44
|
-
createFoundationAccountCostControlPlan,
|
|
45
|
-
createPerformanceCostControlPlan,
|
|
46
|
-
requireExactFoundationAccountCostAuthority,
|
|
47
|
-
} from '@empire-builder-kit/nx/performance';
|
|
48
|
-
import accountCostPolicy from '../../foundation/performance/account-cost-policy.json';
|
|
49
|
-
import performancePolicy from '../performance/policy.json';
|
|
50
|
-
|
|
51
|
-
function budgetNotifications(
|
|
52
|
-
notifications: readonly {
|
|
53
|
-
comparisonOperator: 'GREATER_THAN';
|
|
54
|
-
notificationType: 'ACTUAL' | 'FORECASTED';
|
|
55
|
-
threshold: number;
|
|
56
|
-
thresholdType: 'PERCENTAGE';
|
|
57
|
-
}[],
|
|
58
|
-
alertTopicArn: any,
|
|
59
|
-
) {
|
|
60
|
-
return notifications.map((notification) => ({
|
|
61
|
-
...notification,
|
|
62
|
-
subscriberSnsTopicArns: [alertTopicArn],
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function create${pascalName}PerformanceCostControls(input: {
|
|
67
|
-
accountCostPolicyDigest: any;
|
|
68
|
-
accountMonthlyMaximumUsd: any;
|
|
69
|
-
alertTopicArn: any;
|
|
70
|
-
evaluatedAt?: string;
|
|
71
|
-
workspace: string;
|
|
72
|
-
}) {
|
|
73
|
-
const evaluatedAt = input.evaluatedAt ?? new Date().toISOString();
|
|
74
|
-
const foundationAccountCostControl = createFoundationAccountCostControlPlan({
|
|
75
|
-
evaluatedAt,
|
|
76
|
-
policy: accountCostPolicy,
|
|
77
|
-
rehearsalStage: '${rehearsalStage}',
|
|
78
|
-
region: process.env.AWS_REGION,
|
|
79
|
-
stage: $app.stage,
|
|
80
|
-
workspace: input.workspace,
|
|
81
|
-
});
|
|
82
|
-
const plan = createPerformanceCostControlPlan({
|
|
83
|
-
accountBudgetAuthority: foundationAccountCostControl.authority,
|
|
84
|
-
evaluatedAt,
|
|
85
|
-
policy: performancePolicy,
|
|
86
|
-
rehearsalStage: '${rehearsalStage}',
|
|
87
|
-
region: process.env.AWS_REGION,
|
|
88
|
-
stage: $app.stage,
|
|
89
|
-
workspace: input.workspace,
|
|
90
|
-
});
|
|
91
|
-
if (plan.status === 'disabled-non-protected-stage') {
|
|
92
|
-
return {
|
|
93
|
-
accountBudgetAuthority: plan.accountBudgetAuthority,
|
|
94
|
-
anomalyMonitor: undefined,
|
|
95
|
-
anomalySubscription: undefined,
|
|
96
|
-
materialDigest: plan.materialDigest,
|
|
97
|
-
pilotBudget: undefined,
|
|
98
|
-
policyDigest: plan.policyDigest,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
const deployedAccountBudgetAuthority = input.accountCostPolicyDigest.apply(
|
|
102
|
-
(policyDigest: string) =>
|
|
103
|
-
input.accountMonthlyMaximumUsd.apply((monthlyMaximumUsd: number) =>
|
|
104
|
-
requireExactFoundationAccountCostAuthority({
|
|
105
|
-
actual: {
|
|
106
|
-
kind: 'ebk-foundation-account-cost-authority',
|
|
107
|
-
monthlyMaximumUsd,
|
|
108
|
-
policyDigest,
|
|
109
|
-
stage: $app.stage,
|
|
110
|
-
workspace: input.workspace,
|
|
111
|
-
},
|
|
112
|
-
expected: plan.accountBudgetAuthority,
|
|
113
|
-
}),
|
|
114
|
-
),
|
|
115
|
-
);
|
|
116
|
-
const tags = {
|
|
117
|
-
'ebk:account-cost-policy-digest': deployedAccountBudgetAuthority.apply(
|
|
118
|
-
(authority: { policyDigest: string }) => authority.policyDigest,
|
|
119
|
-
),
|
|
120
|
-
'ebk:cost-control-material-digest': deployedAccountBudgetAuthority.apply(
|
|
121
|
-
() => plan.materialDigest,
|
|
122
|
-
),
|
|
123
|
-
'ebk:cost-scope':
|
|
124
|
-
plan.workspace + '/' + plan.slice + '/' + plan.stage,
|
|
125
|
-
'ebk:cost-policy-digest': plan.policyDigest,
|
|
126
|
-
'ebk:cost-route': plan.route.semanticRef,
|
|
127
|
-
'ebk:owner': plan.owner,
|
|
128
|
-
};
|
|
129
|
-
const pilotBudget = plan.pilotBudget
|
|
130
|
-
? new aws.budgets.Budget('${pascalName}PilotCostBudget', {
|
|
131
|
-
budgetType: plan.pilotBudget.budgetType,
|
|
132
|
-
filterExpression: plan.pilotBudget.filterExpression,
|
|
133
|
-
limitAmount: plan.pilotBudget.limitAmount,
|
|
134
|
-
limitUnit: plan.pilotBudget.limitUnit,
|
|
135
|
-
metrics: 'UnblendedCost',
|
|
136
|
-
name: plan.pilotBudget.name,
|
|
137
|
-
notifications: budgetNotifications(
|
|
138
|
-
plan.pilotBudget.notifications,
|
|
139
|
-
input.alertTopicArn,
|
|
140
|
-
),
|
|
141
|
-
tags,
|
|
142
|
-
timeUnit: plan.pilotBudget.timeUnit,
|
|
143
|
-
})
|
|
144
|
-
: undefined;
|
|
145
|
-
return {
|
|
146
|
-
accountBudgetAuthority: deployedAccountBudgetAuthority,
|
|
147
|
-
anomalyMonitor: undefined,
|
|
148
|
-
anomalySubscription: undefined,
|
|
149
|
-
materialDigest: plan.materialDigest,
|
|
150
|
-
pilotBudget,
|
|
151
|
-
policyDigest: plan.policyDigest,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
`,
|
|
155
|
-
'performance/policy.json': (0, built_in_plan_shared_js_1.json)({
|
|
156
|
-
$schema: '../../../node_modules/@empire-builder-kit/nx/schemas/performance-policy-v1.json',
|
|
157
|
-
authority: {
|
|
158
|
-
journeyAuthorityPath: 'docs/reliability/slo.json',
|
|
159
|
-
operationsAuthorityPath: 'operations/reliability.json',
|
|
160
|
-
releaseManifestPath: 'operations/release.json',
|
|
161
|
-
repositoryPolicyPath: '../../ebk.repository-policy.json',
|
|
162
|
-
},
|
|
163
|
-
budgets: [
|
|
164
|
-
{
|
|
165
|
-
comparator: 'maximum',
|
|
166
|
-
evidenceProvenance: ['test', 'actual'],
|
|
167
|
-
id: 'api-warm-p95',
|
|
168
|
-
journeyRef: 'journey:replace-with-api-journey',
|
|
169
|
-
metric: 'latency-milliseconds',
|
|
170
|
-
percentile: 95,
|
|
171
|
-
population: 'warm',
|
|
172
|
-
scenarioRef: 'scenario:api-peak',
|
|
173
|
-
status: 'example',
|
|
174
|
-
threshold: 750,
|
|
175
|
-
unit: 'milliseconds',
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
comparator: 'maximum',
|
|
179
|
-
evidenceProvenance: ['test', 'actual'],
|
|
180
|
-
id: 'async-backlog-p99',
|
|
181
|
-
journeyRef: 'journey:replace-with-async-journey',
|
|
182
|
-
metric: 'backlog-age-seconds',
|
|
183
|
-
percentile: 99,
|
|
184
|
-
population: 'all',
|
|
185
|
-
scenarioRef: 'scenario:async-burst',
|
|
186
|
-
status: 'example',
|
|
187
|
-
threshold: 300,
|
|
188
|
-
unit: 'seconds',
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
comparator: 'maximum',
|
|
192
|
-
evidenceProvenance: ['test', 'actual'],
|
|
193
|
-
id: 'database-cold-resume-p95',
|
|
194
|
-
journeyRef: 'journey:replace-with-database-journey',
|
|
195
|
-
metric: 'cold-resume-milliseconds',
|
|
196
|
-
percentile: 95,
|
|
197
|
-
population: 'cold',
|
|
198
|
-
scenarioRef: 'scenario:database-cold-resume',
|
|
199
|
-
status: 'example',
|
|
200
|
-
threshold: 15_000,
|
|
201
|
-
unit: 'milliseconds',
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
comparator: 'maximum',
|
|
205
|
-
evidenceProvenance: ['estimate', 'actual'],
|
|
206
|
-
id: 'monthly-cost',
|
|
207
|
-
journeyRef: 'journey:replace-with-business-outcome',
|
|
208
|
-
metric: 'monthly-cost-usd',
|
|
209
|
-
population: 'all',
|
|
210
|
-
scenarioRef: 'scenario:normal-month',
|
|
211
|
-
status: 'example',
|
|
212
|
-
threshold: costDefaults.accountMonthlyMaximumUsd,
|
|
213
|
-
unit: 'usd',
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
capacity: [
|
|
217
|
-
{
|
|
218
|
-
capacityUnit: 'requests-per-second',
|
|
219
|
-
configuredMaximum: null,
|
|
220
|
-
downstreamMaximum: null,
|
|
221
|
-
failureMode: 'api-throttles-or-overloads-database',
|
|
222
|
-
id: 'api-lambda',
|
|
223
|
-
kind: 'api-lambda',
|
|
224
|
-
protectionRef: 'control:api-lambda-concurrency',
|
|
225
|
-
quotaMaximum: null,
|
|
226
|
-
saturationSignalRef: 'runtime:nodejs-heap-utilization-percent',
|
|
227
|
-
status: 'requires-adopter-value',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
capacityUnit: 'messages-per-second',
|
|
231
|
-
configuredMaximum: null,
|
|
232
|
-
downstreamMaximum: null,
|
|
233
|
-
failureMode: 'backlog-age-grows-or-provider-throttles',
|
|
234
|
-
id: 'async-worker',
|
|
235
|
-
kind: 'async-worker',
|
|
236
|
-
protectionRef: 'control:async-worker-concurrency',
|
|
237
|
-
quotaMaximum: null,
|
|
238
|
-
saturationSignalRef: asyncSignal,
|
|
239
|
-
status: 'requires-adopter-value',
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
capacityUnit: 'concurrent-requests',
|
|
243
|
-
configuredMaximum: null,
|
|
244
|
-
downstreamMaximum: null,
|
|
245
|
-
failureMode: 'request-latency-or-throttling',
|
|
246
|
-
id: 'database',
|
|
247
|
-
kind: 'database',
|
|
248
|
-
protectionRef: 'control:database-request-concurrency',
|
|
249
|
-
quotaMaximum: null,
|
|
250
|
-
saturationSignalRef: databaseSignal,
|
|
251
|
-
status: 'requires-adopter-value',
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
capacityUnit: 'concurrent-requests',
|
|
255
|
-
configuredMaximum: null,
|
|
256
|
-
downstreamMaximum: null,
|
|
257
|
-
failureMode: 'service-saturates-or-overloads-dependency',
|
|
258
|
-
id: 'service-extension',
|
|
259
|
-
kind: 'service',
|
|
260
|
-
protectionRef: 'control:service-extension-concurrency',
|
|
261
|
-
quotaMaximum: null,
|
|
262
|
-
saturationSignalRef: 'adopter:service-saturation-percent',
|
|
263
|
-
status: 'requires-adopter-value',
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
cost: {
|
|
267
|
-
accountMonthlyMaximumUsd: costDefaults.accountMonthlyMaximumUsd,
|
|
268
|
-
actualNotificationThresholdPercent: 80,
|
|
269
|
-
anomalyRouteRef: 'alarm:cost-anomaly',
|
|
270
|
-
anomalyThresholdUsd: costDefaults.anomalyThresholdUsd,
|
|
271
|
-
forecastNotificationThresholdPercent: 100,
|
|
272
|
-
notificationRoute: 'foundation-alert-topic',
|
|
273
|
-
pilotMonthlyMaximumUsd: costDefaults.pilotMonthlyMaximumUsd,
|
|
274
|
-
sharedCostAllocationRef: 'performance/cost-allocation.json',
|
|
275
|
-
status: 'example',
|
|
276
|
-
testRunMaximumUsd: 25,
|
|
277
|
-
unitCostRefs: ['completed-business-journey', 'delivered-async-work'],
|
|
278
|
-
},
|
|
279
|
-
evidence: {
|
|
280
|
-
maximumAgeDays: { actual: 45, estimate: 30, test: 14 },
|
|
281
|
-
protectedEvidenceRequiresExactRelease: true,
|
|
282
|
-
},
|
|
283
|
-
kind: 'ebk-performance-policy',
|
|
284
|
-
load: {
|
|
285
|
-
allowedProtectedStages: [rehearsalStage],
|
|
286
|
-
maximumConcurrency: 100,
|
|
287
|
-
maximumDurationSeconds: 1_800,
|
|
288
|
-
maximumEstimatedCostUsd: 25,
|
|
289
|
-
maximumRatePerSecond: 200,
|
|
290
|
-
maximumRequests: 100_000,
|
|
291
|
-
productionExceptionalOnly: true,
|
|
292
|
-
},
|
|
293
|
-
owner: 'REPLACE_WITH_OWNER',
|
|
294
|
-
reviewAt: null,
|
|
295
|
-
schemaVersion: 1,
|
|
296
|
-
slice: name,
|
|
297
|
-
tags: {
|
|
298
|
-
forbiddenKeys: ['ebk:feature'],
|
|
299
|
-
requiredKeys: [
|
|
300
|
-
'ebk:cost-allocation',
|
|
301
|
-
'ebk:cost-scope',
|
|
302
|
-
'ebk:framework-version',
|
|
303
|
-
'ebk:managed-by',
|
|
304
|
-
'ebk:owner',
|
|
305
|
-
'ebk:slice',
|
|
306
|
-
'ebk:stage',
|
|
307
|
-
'ebk:workspace',
|
|
308
|
-
],
|
|
309
|
-
unsupportedResourcePolicy: 'report-with-reason-and-allocation',
|
|
310
|
-
},
|
|
311
|
-
}),
|
|
312
|
-
'performance/load-scenarios.json': (0, built_in_plan_shared_js_1.json)({
|
|
313
|
-
kind: 'ebk-protected-load-scenario-catalog',
|
|
314
|
-
scenarios: [
|
|
315
|
-
{
|
|
316
|
-
adapterStatus: 'managed',
|
|
317
|
-
adapterId: 'ebk-api-lambda-v1',
|
|
318
|
-
demandShape: 'normal-to-peak-ramp',
|
|
319
|
-
disabledUntilAdopted: true,
|
|
320
|
-
estimatedCostUsdPerRequest: 0.00001,
|
|
321
|
-
id: 'api-peak',
|
|
322
|
-
saturationSignalRef: 'runtime:nodejs-heap-utilization-percent',
|
|
323
|
-
workload: 'api-lambda',
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
adapterStatus: 'managed',
|
|
327
|
-
adapterId: asyncAdapter,
|
|
328
|
-
demandShape: 'bounded-flash-burst-and-recovery',
|
|
329
|
-
disabledUntilAdopted: true,
|
|
330
|
-
estimatedCostUsdPerRequest: 0.00002,
|
|
331
|
-
id: 'async-key-value-burst',
|
|
332
|
-
saturationSignalRef: asyncSignal,
|
|
333
|
-
workload: 'async-worker',
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
adapterStatus: 'managed',
|
|
337
|
-
adapterId: databaseAdapter,
|
|
338
|
-
demandShape: 'bounded-write-and-consistent-read',
|
|
339
|
-
disabledUntilAdopted: true,
|
|
340
|
-
estimatedCostUsdPerRequest: 0.0001,
|
|
341
|
-
id: 'database-read-write',
|
|
342
|
-
saturationSignalRef: databaseSignal,
|
|
343
|
-
workload: 'database',
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
adapterStatus: 'requires-adopter-service-endpoint',
|
|
347
|
-
adapterId: 'ebk-service-v1',
|
|
348
|
-
demandShape: 'bounded-steady-and-saturation-ramp',
|
|
349
|
-
disabledUntilAdopted: true,
|
|
350
|
-
estimatedCostUsdPerRequest: 0.00002,
|
|
351
|
-
id: 'service-extension',
|
|
352
|
-
saturationSignalRef: 'adopter:service-saturation-percent',
|
|
353
|
-
workload: 'service',
|
|
354
|
-
},
|
|
355
|
-
],
|
|
356
|
-
schemaVersion: 1,
|
|
357
|
-
slice: name,
|
|
358
|
-
}),
|
|
359
|
-
'performance/cost-allocation.json': (0, built_in_plan_shared_js_1.json)({
|
|
360
|
-
allocations: [
|
|
361
|
-
{
|
|
362
|
-
capabilityId: 'completed-business-journey',
|
|
363
|
-
driver: 'replace-with-reviewed-resource-allocation',
|
|
364
|
-
id: 'completed-business-journey',
|
|
365
|
-
status: 'requires-adopter-value',
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
capabilityId: 'delivered-async-work',
|
|
369
|
-
driver: 'replace-with-reviewed-resource-allocation',
|
|
370
|
-
id: 'delivered-async-work',
|
|
371
|
-
status: 'requires-adopter-value',
|
|
372
|
-
},
|
|
373
|
-
],
|
|
374
|
-
actualCostProvider: 'aws-billing-actual',
|
|
375
|
-
forecastProviders: ['infrastructure-plan', 'aws-price-estimate'],
|
|
376
|
-
kind: 'ebk-cost-allocation-contract',
|
|
377
|
-
provenanceLabels: ['estimate', 'test', 'actual'],
|
|
378
|
-
resourceTagKey: 'ebk:cost-allocation',
|
|
379
|
-
schemaVersion: 1,
|
|
380
|
-
sharedCostsRemainExplicit: true,
|
|
381
|
-
slice: name,
|
|
382
|
-
unitCosts: [
|
|
383
|
-
{
|
|
384
|
-
aggregateCountRef: 'operations:completed-business-journey',
|
|
385
|
-
anomalyIncreasePercent: 20,
|
|
386
|
-
id: 'completed-business-journey',
|
|
387
|
-
ownerRouteRef: 'alarm:cost-anomaly',
|
|
388
|
-
status: 'requires-adopter-value',
|
|
389
|
-
unit: 'completed-business-journey',
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
aggregateCountRef: 'operations:delivered-async-work',
|
|
393
|
-
anomalyIncreasePercent: 20,
|
|
394
|
-
id: 'delivered-async-work',
|
|
395
|
-
ownerRouteRef: 'alarm:cost-anomaly',
|
|
396
|
-
status: 'requires-adopter-value',
|
|
397
|
-
unit: 'delivered-async-work',
|
|
398
|
-
},
|
|
399
|
-
],
|
|
400
|
-
}),
|
|
401
|
-
'performance/cost-collection.json': (0, built_in_plan_shared_js_1.json)((0, index_js_1.createExternalCostCollectionContract)({
|
|
402
|
-
outputPath: '.ebk/evidence/performance-cost-actual.json',
|
|
403
|
-
owner: `${name}-product`,
|
|
404
|
-
slice: name,
|
|
405
|
-
})),
|
|
406
|
-
'operations/performance.json': (0, built_in_plan_shared_js_1.json)({
|
|
407
|
-
authorityHooks: {
|
|
408
|
-
alarmAndRouting: 'operations/reliability.json',
|
|
409
|
-
journeyAndSlo: 'docs/reliability/slo.json',
|
|
410
|
-
release: 'operations/release.json',
|
|
411
|
-
repositoryProfile: '../../ebk.repository-policy.json',
|
|
412
|
-
},
|
|
413
|
-
costCollection: {
|
|
414
|
-
contract: 'performance/cost-collection.json',
|
|
415
|
-
liveCollectorOwnerRequired: true,
|
|
416
|
-
operationsConsoleRequired: false,
|
|
417
|
-
},
|
|
418
|
-
costControls: {
|
|
419
|
-
accountBudgetAuthority: 'packages/foundation/performance/account-cost-policy.json',
|
|
420
|
-
accountBudgetBinding: 'foundation-discovery-schema-v6-policy-digest-and-amount',
|
|
421
|
-
accountBudgetInfrastructure: 'packages/foundation/infra/foundation.ts',
|
|
422
|
-
accountBudgetOwner: 'foundation',
|
|
423
|
-
accountBudgetStages: [rehearsalStage, 'production'],
|
|
424
|
-
anomalyMonitorScope: 'foundation-production-account-aws-services',
|
|
425
|
-
anomalySubscriptionOwner: 'foundation',
|
|
426
|
-
automaticSpendActions: 'forbidden',
|
|
427
|
-
infrastructure: 'infra/performance-cost-controls.ts',
|
|
428
|
-
owner: 'performance/policy.json#owner',
|
|
429
|
-
pilotBudgetOwner: 'product-slice',
|
|
430
|
-
pilotBudgetStage: rehearsalStage,
|
|
431
|
-
policy: 'performance/policy.json#cost',
|
|
432
|
-
route: 'foundation-alert-topic',
|
|
433
|
-
status: 'blocked-until-cost-policy-adopted',
|
|
434
|
-
},
|
|
435
|
-
unitCost: {
|
|
436
|
-
capabilities: ['completed-business-journey', 'delivered-async-work'],
|
|
437
|
-
evaluator: 'scripts/performance-unit-cost.mjs',
|
|
438
|
-
liveBillingAndAggregateEvidenceRequired: true,
|
|
439
|
-
operationsConsoleRequired: false,
|
|
440
|
-
status: 'incomplete-until-live-evidence',
|
|
441
|
-
},
|
|
442
|
-
evidence: {
|
|
443
|
-
exactReleaseRequiredForProtectedResults: true,
|
|
444
|
-
provenanceLabels: ['estimate', 'test', 'actual'],
|
|
445
|
-
rehearsalIsNotProduction: true,
|
|
446
|
-
},
|
|
447
|
-
liveEvidence: {
|
|
448
|
-
accountBudgetAndAnomalyRoute: 'required-pre-v1',
|
|
449
|
-
actualBillingAndTwoUnitCosts: 'required-pre-v1',
|
|
450
|
-
coldAndWarmLambdaNextPaths: 'required-pre-v1',
|
|
451
|
-
databaseColdResumeAndIdleCost: 'not-applicable-without-sql',
|
|
452
|
-
profileTransitionRehearsal: 'required-pre-v1',
|
|
453
|
-
protectedApiAsyncDatabaseLoad: 'required-pre-v1',
|
|
454
|
-
serviceRuntimeLoad: 'required-pre-v1-adopter-integration',
|
|
455
|
-
status: 'incomplete',
|
|
456
|
-
},
|
|
457
|
-
load: {
|
|
458
|
-
allowlistedScenarioAdapters: [
|
|
459
|
-
'ebk-api-lambda-v1',
|
|
460
|
-
asyncAdapter,
|
|
461
|
-
databaseAdapter,
|
|
462
|
-
],
|
|
463
|
-
localProtectedMutationForbidden: true,
|
|
464
|
-
productionExceptionalOnly: true,
|
|
465
|
-
protectedGuard: 'scripts/performance-load-guard.mjs',
|
|
466
|
-
protectedRunner: '.github/workflows/performance-load.yml',
|
|
467
|
-
runnerStatus: 'managed-fixed-scenario-v1',
|
|
468
|
-
serviceAdapterOwner: null,
|
|
469
|
-
serviceAdapterStatus: 'requires-adopter-service-runtime-endpoint',
|
|
470
|
-
},
|
|
471
|
-
metricDimensions: [
|
|
472
|
-
'Stage',
|
|
473
|
-
'Slice',
|
|
474
|
-
'Feature',
|
|
475
|
-
'Component',
|
|
476
|
-
'Operation',
|
|
477
|
-
'Outcome',
|
|
478
|
-
],
|
|
479
|
-
prohibitedMetricDimensions: [
|
|
480
|
-
'release',
|
|
481
|
-
'user',
|
|
482
|
-
'tenant',
|
|
483
|
-
'request',
|
|
484
|
-
'work-item',
|
|
485
|
-
'payload',
|
|
486
|
-
'raw-error',
|
|
487
|
-
],
|
|
488
|
-
schemaVersion: 1,
|
|
489
|
-
slice: name,
|
|
490
|
-
workloads: [
|
|
491
|
-
'api-lambda',
|
|
492
|
-
'async-worker',
|
|
493
|
-
'browser',
|
|
494
|
-
'database',
|
|
495
|
-
'job',
|
|
496
|
-
'service',
|
|
497
|
-
],
|
|
498
|
-
}),
|
|
499
|
-
'scripts/performance-policy-check.mjs': `import { existsSync, readFileSync } from 'node:fs';
|
|
500
|
-
import {
|
|
501
|
-
assessPerformancePolicyReadiness,
|
|
502
|
-
evaluateCapacitySafety,
|
|
503
|
-
unitCostLiveEvidenceStatus,
|
|
504
|
-
validatePerformancePolicy,
|
|
505
|
-
verifyPerformanceOperationalHooks,
|
|
506
|
-
} from '@empire-builder-kit/nx/performance';
|
|
507
|
-
|
|
508
|
-
const policy = validatePerformancePolicy(
|
|
509
|
-
JSON.parse(
|
|
510
|
-
readFileSync(
|
|
511
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
512
|
-
'utf8',
|
|
513
|
-
),
|
|
514
|
-
),
|
|
515
|
-
);
|
|
516
|
-
const requireReady = process.argv.includes('--require-ready');
|
|
517
|
-
const readAuthority = (authorityPath) => {
|
|
518
|
-
const [path] = authorityPath.split('#', 1);
|
|
519
|
-
const url = new URL('../' + path, import.meta.url);
|
|
520
|
-
return existsSync(url) ? JSON.parse(readFileSync(url, 'utf8')) : undefined;
|
|
521
|
-
};
|
|
522
|
-
for (const path of Object.values(policy.authority)) {
|
|
523
|
-
if (!readAuthority(path)) {
|
|
524
|
-
throw new Error('Performance authority is missing: ' + path);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
if (requireReady) {
|
|
528
|
-
await verifyPerformanceOperationalHooks(
|
|
529
|
-
policy,
|
|
530
|
-
(kind, authorityPath, semanticRef) => {
|
|
531
|
-
const authority = readAuthority(authorityPath);
|
|
532
|
-
if (!authority) return false;
|
|
533
|
-
if (kind === 'journey') {
|
|
534
|
-
return (
|
|
535
|
-
typeof semanticRef === 'string' &&
|
|
536
|
-
Array.isArray(authority.objectives) &&
|
|
537
|
-
authority.objectives.some(
|
|
538
|
-
(objective) => 'journey:' + objective?.journey === semanticRef,
|
|
539
|
-
)
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
|
-
if (kind === 'alarm') {
|
|
543
|
-
return (
|
|
544
|
-
typeof semanticRef === 'string' &&
|
|
545
|
-
authority.performanceReferences?.alarms?.includes(semanticRef)
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
if (kind === 'capacity-control') {
|
|
549
|
-
return (
|
|
550
|
-
typeof semanticRef === 'string' &&
|
|
551
|
-
authority.performanceReferences?.capacityControls?.includes(
|
|
552
|
-
semanticRef,
|
|
553
|
-
)
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
if (kind === 'capacity-signal') {
|
|
557
|
-
return (
|
|
558
|
-
typeof semanticRef === 'string' &&
|
|
559
|
-
authority.performanceReferences?.capacitySignals?.includes(
|
|
560
|
-
semanticRef,
|
|
561
|
-
)
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
return true;
|
|
565
|
-
},
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
const readiness = assessPerformancePolicyReadiness(policy);
|
|
569
|
-
const capacity = evaluateCapacitySafety(policy.capacity);
|
|
570
|
-
const result = {
|
|
571
|
-
capacity,
|
|
572
|
-
readiness,
|
|
573
|
-
schemaVersion: 1,
|
|
574
|
-
slice: policy.slice,
|
|
575
|
-
unitCost: unitCostLiveEvidenceStatus(policy),
|
|
576
|
-
};
|
|
577
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
578
|
-
if (
|
|
579
|
-
requireReady &&
|
|
580
|
-
(!readiness.ready || capacity.status !== 'safe')
|
|
581
|
-
) process.exitCode = 2;
|
|
582
|
-
`,
|
|
583
|
-
'scripts/performance-budget-check.mjs': `import { chmodSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
584
|
-
import { fileURLToPath } from 'node:url';
|
|
585
|
-
import {
|
|
586
|
-
collectManagedPrArtifactBudget,
|
|
587
|
-
} from '@empire-builder-kit/nx/performance';
|
|
588
|
-
|
|
589
|
-
const result = collectManagedPrArtifactBudget({
|
|
590
|
-
slice: '${name}',
|
|
591
|
-
sliceRoot: fileURLToPath(new URL('../', import.meta.url)),
|
|
592
|
-
});
|
|
593
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
594
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
595
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
596
|
-
const evidencePath = new URL(
|
|
597
|
-
'performance-budget.json',
|
|
598
|
-
evidenceDirectory,
|
|
599
|
-
);
|
|
600
|
-
writeFileSync(evidencePath, JSON.stringify(result, null, 2) + '\\n', {
|
|
601
|
-
encoding: 'utf8',
|
|
602
|
-
mode: 0o600,
|
|
603
|
-
});
|
|
604
|
-
chmodSync(evidencePath, 0o600);
|
|
605
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
606
|
-
if (result.outcome !== 'passed') process.exitCode = 2;
|
|
607
|
-
`,
|
|
608
|
-
'scripts/performance-evidence-evaluate.mjs': `import { chmodSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
609
|
-
import {
|
|
610
|
-
evaluatePerformanceBudgets,
|
|
611
|
-
validatePerformancePolicy,
|
|
612
|
-
} from '@empire-builder-kit/nx/performance';
|
|
613
|
-
|
|
614
|
-
const observationsPath = process.env.EBK_PERFORMANCE_OBSERVATIONS_PATH?.trim();
|
|
615
|
-
const releasePath = process.env.EBK_RELEASE_BINDING_PATH?.trim();
|
|
616
|
-
const now = process.env.EBK_EVIDENCE_NOW?.trim();
|
|
617
|
-
if (!observationsPath || !releasePath || !now) {
|
|
618
|
-
throw new Error(
|
|
619
|
-
'Adopted performance evidence requires exact observation, release-binding, and evidence-time paths.',
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
const policy = validatePerformancePolicy(
|
|
623
|
-
JSON.parse(
|
|
624
|
-
readFileSync(
|
|
625
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
626
|
-
'utf8',
|
|
627
|
-
),
|
|
628
|
-
),
|
|
629
|
-
);
|
|
630
|
-
const result = evaluatePerformanceBudgets({
|
|
631
|
-
expectedRelease: JSON.parse(readFileSync(releasePath, 'utf8')),
|
|
632
|
-
now,
|
|
633
|
-
observations: JSON.parse(readFileSync(observationsPath, 'utf8')),
|
|
634
|
-
policy,
|
|
635
|
-
});
|
|
636
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
637
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
638
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
639
|
-
const evidencePath = new URL(
|
|
640
|
-
'performance-adopted-budget.json',
|
|
641
|
-
evidenceDirectory,
|
|
642
|
-
);
|
|
643
|
-
writeFileSync(evidencePath, JSON.stringify(result, null, 2) + '\\n', {
|
|
644
|
-
encoding: 'utf8',
|
|
645
|
-
mode: 0o600,
|
|
646
|
-
});
|
|
647
|
-
chmodSync(evidencePath, 0o600);
|
|
648
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
649
|
-
if (result.outcome !== 'passed') process.exitCode = 2;
|
|
650
|
-
`,
|
|
651
|
-
'scripts/performance-unit-cost.mjs': `import { chmodSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
652
|
-
import {
|
|
653
|
-
evaluateUnitCostTrends,
|
|
654
|
-
validateAwsBillingActualEvidence,
|
|
655
|
-
validateCostAllocationContract,
|
|
656
|
-
validatePerformancePolicy,
|
|
657
|
-
} from '@empire-builder-kit/nx/performance';
|
|
658
|
-
|
|
659
|
-
const baselinePath = process.env.EBK_UNIT_COST_BASELINE_PATH?.trim();
|
|
660
|
-
const baselineBillingPath =
|
|
661
|
-
process.env.EBK_BASELINE_BILLING_EVIDENCE_PATH?.trim();
|
|
662
|
-
const expectedBaselineBillingDigest =
|
|
663
|
-
process.env.EBK_EXPECTED_BASELINE_BILLING_EVIDENCE_DIGEST?.trim();
|
|
664
|
-
const baselineReleasePath =
|
|
665
|
-
process.env.EBK_BASELINE_RELEASE_BINDING_PATH?.trim();
|
|
666
|
-
const billingPath = process.env.EBK_BILLING_OBSERVATION_PATH?.trim();
|
|
667
|
-
const expectedBillingDigest =
|
|
668
|
-
process.env.EBK_EXPECTED_BILLING_EVIDENCE_DIGEST?.trim();
|
|
669
|
-
const currentPath = process.env.EBK_UNIT_COST_CURRENT_PATH?.trim();
|
|
670
|
-
const releasePath = process.env.EBK_RELEASE_BINDING_PATH?.trim();
|
|
671
|
-
const evaluatedAt = process.env.EBK_EVIDENCE_NOW?.trim();
|
|
672
|
-
if (
|
|
673
|
-
!baselinePath ||
|
|
674
|
-
!baselineBillingPath ||
|
|
675
|
-
!expectedBaselineBillingDigest ||
|
|
676
|
-
!baselineReleasePath ||
|
|
677
|
-
!billingPath ||
|
|
678
|
-
!expectedBillingDigest ||
|
|
679
|
-
!currentPath ||
|
|
680
|
-
!releasePath ||
|
|
681
|
-
!evaluatedAt
|
|
682
|
-
) {
|
|
683
|
-
throw new Error(
|
|
684
|
-
'Unit-cost evaluation requires independently expected baseline/current billing digests, exact observations, release bindings, and evidence time.',
|
|
685
|
-
);
|
|
686
|
-
}
|
|
687
|
-
const allocation = validateCostAllocationContract(
|
|
688
|
-
JSON.parse(
|
|
689
|
-
readFileSync(
|
|
690
|
-
new URL('../performance/cost-allocation.json', import.meta.url),
|
|
691
|
-
'utf8',
|
|
692
|
-
),
|
|
693
|
-
),
|
|
694
|
-
{ requireAdopted: true },
|
|
695
|
-
);
|
|
696
|
-
const capabilities = allocation.unitCosts.map(
|
|
697
|
-
({ anomalyIncreasePercent, id, ownerRouteRef, unit }) => ({
|
|
698
|
-
anomalyIncreasePercent,
|
|
699
|
-
id,
|
|
700
|
-
ownerRouteRef,
|
|
701
|
-
unit,
|
|
702
|
-
}),
|
|
703
|
-
);
|
|
704
|
-
const baselineBilling = validateAwsBillingActualEvidence(
|
|
705
|
-
JSON.parse(readFileSync(baselineBillingPath, 'utf8')),
|
|
706
|
-
);
|
|
707
|
-
const billing = validateAwsBillingActualEvidence(
|
|
708
|
-
JSON.parse(readFileSync(billingPath, 'utf8')),
|
|
709
|
-
);
|
|
710
|
-
const policy = validatePerformancePolicy(
|
|
711
|
-
JSON.parse(
|
|
712
|
-
readFileSync(
|
|
713
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
714
|
-
'utf8',
|
|
715
|
-
),
|
|
716
|
-
),
|
|
717
|
-
);
|
|
718
|
-
const result = evaluateUnitCostTrends({
|
|
719
|
-
baseline: JSON.parse(readFileSync(baselinePath, 'utf8')),
|
|
720
|
-
baselineBillingEvidence: baselineBilling,
|
|
721
|
-
capabilities,
|
|
722
|
-
current: JSON.parse(readFileSync(currentPath, 'utf8')),
|
|
723
|
-
currentBillingEvidence: billing,
|
|
724
|
-
evaluatedAt,
|
|
725
|
-
expectedBaselineBillingEvidenceDigest: expectedBaselineBillingDigest,
|
|
726
|
-
expectedBaselineRelease: JSON.parse(
|
|
727
|
-
readFileSync(baselineReleasePath, 'utf8'),
|
|
728
|
-
),
|
|
729
|
-
expectedCurrentBillingEvidenceDigest: expectedBillingDigest,
|
|
730
|
-
expectedCurrentRelease: JSON.parse(readFileSync(releasePath, 'utf8')),
|
|
731
|
-
policy,
|
|
732
|
-
});
|
|
733
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
734
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
735
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
736
|
-
const evidencePath = new URL('performance-unit-cost.json', evidenceDirectory);
|
|
737
|
-
writeFileSync(evidencePath, JSON.stringify(result, null, 2) + '\\n', {
|
|
738
|
-
encoding: 'utf8',
|
|
739
|
-
mode: 0o600,
|
|
740
|
-
});
|
|
741
|
-
chmodSync(evidencePath, 0o600);
|
|
742
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
743
|
-
`,
|
|
744
|
-
'performance/aggregate-count-provider.ts': `export interface ProtectedAggregateCountRequest {
|
|
745
|
-
authority: Readonly<{
|
|
746
|
-
mode: 'dedicated-oidc-read-role';
|
|
747
|
-
permissionContract: 'adopter-owned-least-privilege-read-v1';
|
|
748
|
-
}>;
|
|
749
|
-
capabilities: readonly string[];
|
|
750
|
-
environment: Readonly<{
|
|
751
|
-
accountFingerprint: string;
|
|
752
|
-
region: string;
|
|
753
|
-
slice: string;
|
|
754
|
-
stage: 'development' | 'production' | 'staging';
|
|
755
|
-
workspace: string;
|
|
756
|
-
}>;
|
|
757
|
-
period: Readonly<{ end: string; start: string }>;
|
|
758
|
-
release: Readonly<{
|
|
759
|
-
candidateDigest: string;
|
|
760
|
-
releaseId: string;
|
|
761
|
-
releaseMaterialDigest: string;
|
|
762
|
-
sourceCommit: string;
|
|
763
|
-
}>;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
export interface ProtectedAggregateCountResult {
|
|
767
|
-
counts: readonly Readonly<{
|
|
768
|
-
aggregateId: string;
|
|
769
|
-
capabilityId: string;
|
|
770
|
-
count: number;
|
|
771
|
-
sourceRef: string;
|
|
772
|
-
}>[];
|
|
773
|
-
requestId: string;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
export async function collectAggregateCounts(
|
|
777
|
-
request: ProtectedAggregateCountRequest,
|
|
778
|
-
): Promise<ProtectedAggregateCountResult> {
|
|
779
|
-
void request;
|
|
780
|
-
throw new Error(
|
|
781
|
-
'Adopt performance/aggregate-count-provider.ts before protected aggregate collection.',
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
`,
|
|
785
|
-
'scripts/performance-aggregate-counts.mjs': `import {
|
|
786
|
-
chmodSync,
|
|
787
|
-
existsSync,
|
|
788
|
-
lstatSync,
|
|
789
|
-
mkdirSync,
|
|
790
|
-
readFileSync,
|
|
791
|
-
readdirSync,
|
|
792
|
-
realpathSync,
|
|
793
|
-
writeFileSync,
|
|
794
|
-
} from 'node:fs';
|
|
795
|
-
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
796
|
-
import { fileURLToPath } from 'node:url';
|
|
797
|
-
import {
|
|
798
|
-
awsAccountFingerprint,
|
|
799
|
-
createAggregateCountEvidence,
|
|
800
|
-
validateAggregateCountEvidence,
|
|
801
|
-
validateCostAllocationContract,
|
|
802
|
-
} from '@empire-builder-kit/nx/performance';
|
|
803
|
-
import { isBoundedSafeReference } from '@empire-builder-kit/runtime/safe-reference';
|
|
804
|
-
import { collectAggregateCounts } from '../performance/aggregate-count-provider.ts';
|
|
805
|
-
|
|
806
|
-
const sliceRoot = fileURLToPath(new URL('../', import.meta.url));
|
|
807
|
-
const workspaceRoot = resolve(sliceRoot, '../..');
|
|
808
|
-
const required = (name) => {
|
|
809
|
-
const value = process.env[name]?.trim();
|
|
810
|
-
if (!value) throw new Error(name + ' is required.');
|
|
811
|
-
return value;
|
|
812
|
-
};
|
|
813
|
-
const authorityOnly =
|
|
814
|
-
process.argv.length === 3 && process.argv[2] === '--validate-authority';
|
|
815
|
-
if (process.argv.length > (authorityOnly ? 3 : 2)) {
|
|
816
|
-
throw new Error('Aggregate-count wrapper received unsupported arguments.');
|
|
817
|
-
}
|
|
818
|
-
const exactKeys = (value, keys, label) => {
|
|
819
|
-
if (
|
|
820
|
-
!value ||
|
|
821
|
-
typeof value !== 'object' ||
|
|
822
|
-
Array.isArray(value) ||
|
|
823
|
-
Object.keys(value).sort().join(',') !== [...keys].sort().join(',')
|
|
824
|
-
) {
|
|
825
|
-
throw new Error(label + ' contains unsupported fields.');
|
|
826
|
-
}
|
|
827
|
-
return value;
|
|
828
|
-
};
|
|
829
|
-
const readBoundedJson = (path, label) => {
|
|
830
|
-
const metadata = lstatSync(path);
|
|
831
|
-
if (
|
|
832
|
-
!metadata.isFile() ||
|
|
833
|
-
metadata.isSymbolicLink() ||
|
|
834
|
-
metadata.size < 2 ||
|
|
835
|
-
metadata.size > 1024 * 1024
|
|
836
|
-
) {
|
|
837
|
-
throw new Error(label + ' must be one bounded regular file.');
|
|
838
|
-
}
|
|
839
|
-
return JSON.parse(readFileSync(path, 'utf8'));
|
|
840
|
-
};
|
|
841
|
-
const releaseArtifactRoot = resolve(
|
|
842
|
-
sliceRoot,
|
|
843
|
-
'.ebk/performance-aggregate-input/release-artifact',
|
|
844
|
-
);
|
|
845
|
-
const artifactRootMetadata = lstatSync(releaseArtifactRoot);
|
|
846
|
-
const artifactRootRelative = relative(
|
|
847
|
-
sliceRoot,
|
|
848
|
-
realpathSync(releaseArtifactRoot),
|
|
849
|
-
);
|
|
850
|
-
if (
|
|
851
|
-
!artifactRootMetadata.isDirectory() ||
|
|
852
|
-
artifactRootMetadata.isSymbolicLink() ||
|
|
853
|
-
artifactRootRelative === '..' ||
|
|
854
|
-
artifactRootRelative.startsWith('..' + sep) ||
|
|
855
|
-
isAbsolute(artifactRootRelative)
|
|
856
|
-
) {
|
|
857
|
-
throw new Error('Release artifact root is unsafe.');
|
|
858
|
-
}
|
|
859
|
-
const releaseFiles = [];
|
|
860
|
-
let releaseBytes = 0;
|
|
861
|
-
const visit = (directory) => {
|
|
862
|
-
if (releaseFiles.length > 4096 || releaseBytes > 64 * 1024 * 1024) {
|
|
863
|
-
throw new Error('Release artifact exceeds its traversal bound.');
|
|
864
|
-
}
|
|
865
|
-
for (const name of readdirSync(directory).sort()) {
|
|
866
|
-
const path = resolve(directory, name);
|
|
867
|
-
const metadata = lstatSync(path);
|
|
868
|
-
if (metadata.isSymbolicLink()) {
|
|
869
|
-
throw new Error('Release artifact contains a symbolic link.');
|
|
870
|
-
}
|
|
871
|
-
if (metadata.isDirectory()) visit(path);
|
|
872
|
-
else if (metadata.isFile()) {
|
|
873
|
-
releaseBytes += metadata.size;
|
|
874
|
-
releaseFiles.push(path);
|
|
875
|
-
if (
|
|
876
|
-
releaseFiles.length > 4096 ||
|
|
877
|
-
releaseBytes > 64 * 1024 * 1024
|
|
878
|
-
) {
|
|
879
|
-
throw new Error('Release artifact exceeds its traversal bound.');
|
|
880
|
-
}
|
|
881
|
-
} else {
|
|
882
|
-
throw new Error('Release artifact contains a special file.');
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
visit(releaseArtifactRoot);
|
|
887
|
-
const bindingSuffix =
|
|
888
|
-
'/packages/${name}/.ebk/evidence/active-protected-release.json';
|
|
889
|
-
const bindingMatches = releaseFiles.filter((path) =>
|
|
890
|
-
('/' + relative(releaseArtifactRoot, path).replaceAll('\\\\', '/')).endsWith(
|
|
891
|
-
bindingSuffix,
|
|
892
|
-
),
|
|
893
|
-
);
|
|
894
|
-
if (bindingMatches.length !== 1) {
|
|
895
|
-
throw new Error(
|
|
896
|
-
'Release artifact lacks one exact ${name} active protected release binding.',
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
const source = exactKeys(
|
|
900
|
-
readBoundedJson(bindingMatches[0], 'Active protected release binding'),
|
|
901
|
-
[
|
|
902
|
-
'candidateDigest',
|
|
903
|
-
'deploymentCommit',
|
|
904
|
-
'kind',
|
|
905
|
-
'manifestDigest',
|
|
906
|
-
'releaseId',
|
|
907
|
-
'releaseMaterialDigest',
|
|
908
|
-
'releaseSourceCommit',
|
|
909
|
-
'runAttempt',
|
|
910
|
-
'runId',
|
|
911
|
-
'schemaVersion',
|
|
912
|
-
'stage',
|
|
913
|
-
'workflow',
|
|
914
|
-
],
|
|
915
|
-
'Active protected release binding',
|
|
916
|
-
);
|
|
917
|
-
const digestPattern = /^[a-f0-9]{64}$/;
|
|
918
|
-
const commitPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
919
|
-
const stage = required('EBK_STAGE');
|
|
920
|
-
const sourceCommit = required('EBK_SOURCE_COMMIT');
|
|
921
|
-
if (
|
|
922
|
-
source.kind !== 'ebk-active-protected-release-binding' ||
|
|
923
|
-
source.schemaVersion !== 1 ||
|
|
924
|
-
source.stage !== stage ||
|
|
925
|
-
source.workflow !== 'Deploy' ||
|
|
926
|
-
String(source.runId) !== required('EBK_RELEASE_ARTIFACT_RUN_ID') ||
|
|
927
|
-
String(source.runAttempt) !== required('EBK_RELEASE_RUN_ATTEMPT') ||
|
|
928
|
-
source.deploymentCommit !== sourceCommit ||
|
|
929
|
-
!commitPattern.test(source.deploymentCommit ?? '') ||
|
|
930
|
-
!digestPattern.test(source.candidateDigest ?? '') ||
|
|
931
|
-
!digestPattern.test(source.manifestDigest ?? '') ||
|
|
932
|
-
!digestPattern.test(source.releaseMaterialDigest ?? '') ||
|
|
933
|
-
!commitPattern.test(source.releaseSourceCommit ?? '') ||
|
|
934
|
-
!isBoundedSafeReference(source.releaseId, 'performance-evidence')
|
|
935
|
-
) {
|
|
936
|
-
throw new Error(
|
|
937
|
-
'Active protected release binding does not match its exact Deploy authority.',
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
const release = {
|
|
941
|
-
candidateDigest: source.candidateDigest,
|
|
942
|
-
releaseId: source.releaseId,
|
|
943
|
-
releaseMaterialDigest: source.releaseMaterialDigest,
|
|
944
|
-
sourceCommit: source.deploymentCommit,
|
|
945
|
-
};
|
|
946
|
-
const workspaceManifest = readBoundedJson(
|
|
947
|
-
resolve(workspaceRoot, 'package.json'),
|
|
948
|
-
'Workspace manifest',
|
|
949
|
-
);
|
|
950
|
-
if (
|
|
951
|
-
!isBoundedSafeReference(
|
|
952
|
-
workspaceManifest.name,
|
|
953
|
-
'performance-evidence',
|
|
954
|
-
)
|
|
955
|
-
) {
|
|
956
|
-
throw new Error('Workspace manifest lacks one bounded name.');
|
|
957
|
-
}
|
|
958
|
-
const environment = {
|
|
959
|
-
accountFingerprint: awsAccountFingerprint(
|
|
960
|
-
required('AWS_EXPECTED_ACCOUNT_ID'),
|
|
961
|
-
),
|
|
962
|
-
region: required('AWS_REGION'),
|
|
963
|
-
slice: '${name}',
|
|
964
|
-
stage,
|
|
965
|
-
workspace: workspaceManifest.name,
|
|
966
|
-
};
|
|
967
|
-
const period = {
|
|
968
|
-
end: required('EBK_AGGREGATE_PERIOD_END'),
|
|
969
|
-
start: required('EBK_AGGREGATE_PERIOD_START'),
|
|
970
|
-
};
|
|
971
|
-
const collectionStartedAt = new Date();
|
|
972
|
-
const instantPattern = /^\\d{4}-\\d{2}-\\d{2}T00:00:00\\.000Z$/;
|
|
973
|
-
const durationDays =
|
|
974
|
-
(Date.parse(period.end) - Date.parse(period.start)) / 86_400_000;
|
|
975
|
-
if (
|
|
976
|
-
!instantPattern.test(period.start) ||
|
|
977
|
-
!instantPattern.test(period.end) ||
|
|
978
|
-
!Number.isSafeInteger(durationDays) ||
|
|
979
|
-
durationDays < 1 ||
|
|
980
|
-
durationDays > 370 ||
|
|
981
|
-
Date.parse(period.end) > collectionStartedAt.getTime() ||
|
|
982
|
-
!/^(?:af|ap|ca|cn|eu|il|me|mx|sa|us)(?:-gov|-iso|-isob)?-[a-z]+-\\d$/.test(
|
|
983
|
-
environment.region,
|
|
984
|
-
) ||
|
|
985
|
-
!${JSON.stringify(protectedPerformanceStages)}.includes(stage)
|
|
986
|
-
) {
|
|
987
|
-
throw new Error(
|
|
988
|
-
'Aggregate environment and closed billing period are invalid.',
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
const allocation = validateCostAllocationContract(
|
|
992
|
-
readBoundedJson(
|
|
993
|
-
resolve(sliceRoot, 'performance/cost-allocation.json'),
|
|
994
|
-
'Cost allocation authority',
|
|
995
|
-
),
|
|
996
|
-
{ requireAdopted: true },
|
|
997
|
-
);
|
|
998
|
-
if (allocation.slice !== '${name}') {
|
|
999
|
-
throw new Error('Cost allocation authority belongs to another Slice.');
|
|
1000
|
-
}
|
|
1001
|
-
const capabilities = allocation.allocations
|
|
1002
|
-
.map(({ capabilityId }) => capabilityId)
|
|
1003
|
-
.sort();
|
|
1004
|
-
if (authorityOnly) {
|
|
1005
|
-
process.stdout.write(
|
|
1006
|
-
JSON.stringify({
|
|
1007
|
-
kind: 'ebk-protected-aggregate-authority-result',
|
|
1008
|
-
outcome: 'passed',
|
|
1009
|
-
release,
|
|
1010
|
-
schemaVersion: 1,
|
|
1011
|
-
}) + '\\n',
|
|
1012
|
-
);
|
|
1013
|
-
process.exit(0);
|
|
1014
|
-
}
|
|
1015
|
-
if (
|
|
1016
|
-
required('EBK_AGGREGATE_ACTUAL_ACCOUNT_ID') !==
|
|
1017
|
-
required('AWS_EXPECTED_ACCOUNT_ID')
|
|
1018
|
-
) {
|
|
1019
|
-
throw new Error(
|
|
1020
|
-
'Aggregate-count provider lacks a verified protected account binding.',
|
|
1021
|
-
);
|
|
1022
|
-
}
|
|
1023
|
-
const provider = exactKeys(
|
|
1024
|
-
await collectAggregateCounts({
|
|
1025
|
-
authority: {
|
|
1026
|
-
mode: 'dedicated-oidc-read-role',
|
|
1027
|
-
permissionContract: 'adopter-owned-least-privilege-read-v1',
|
|
1028
|
-
},
|
|
1029
|
-
capabilities,
|
|
1030
|
-
environment,
|
|
1031
|
-
period,
|
|
1032
|
-
release,
|
|
1033
|
-
}),
|
|
1034
|
-
['counts', 'requestId'],
|
|
1035
|
-
'Aggregate-count provider result',
|
|
1036
|
-
);
|
|
1037
|
-
if (!Array.isArray(provider.counts)) {
|
|
1038
|
-
throw new Error('Aggregate-count provider counts must be an array.');
|
|
1039
|
-
}
|
|
1040
|
-
const providerCapabilities = provider.counts
|
|
1041
|
-
.map(({ capabilityId }) => capabilityId)
|
|
1042
|
-
.sort();
|
|
1043
|
-
if (JSON.stringify(providerCapabilities) !== JSON.stringify(capabilities)) {
|
|
1044
|
-
throw new Error(
|
|
1045
|
-
'Aggregate-count provider must return the exact adopted capability set.',
|
|
1046
|
-
);
|
|
1047
|
-
}
|
|
1048
|
-
const evidence = createAggregateCountEvidence({
|
|
1049
|
-
collectedAt: new Date().toISOString(),
|
|
1050
|
-
counts: provider.counts,
|
|
1051
|
-
environment,
|
|
1052
|
-
kind: 'ebk-aggregate-count-evidence',
|
|
1053
|
-
period,
|
|
1054
|
-
producer: {
|
|
1055
|
-
access: {
|
|
1056
|
-
mode: 'dedicated-oidc-read-role',
|
|
1057
|
-
permissionContract: 'adopter-owned-least-privilege-read-v1',
|
|
1058
|
-
},
|
|
1059
|
-
authority: 'adopter-protected-aggregate-v1',
|
|
1060
|
-
requestId: provider.requestId,
|
|
1061
|
-
},
|
|
1062
|
-
release,
|
|
1063
|
-
schemaVersion: 1,
|
|
1064
|
-
});
|
|
1065
|
-
const evidenceRoot = resolve(sliceRoot, '.ebk/evidence');
|
|
1066
|
-
for (const directory of [resolve(sliceRoot, '.ebk'), evidenceRoot]) {
|
|
1067
|
-
if (!existsSync(directory)) mkdirSync(directory, { mode: 0o700 });
|
|
1068
|
-
const metadata = lstatSync(directory);
|
|
1069
|
-
if (!metadata.isDirectory() || metadata.isSymbolicLink()) {
|
|
1070
|
-
throw new Error('Aggregate-count evidence directory is unsafe.');
|
|
1071
|
-
}
|
|
1072
|
-
chmodSync(directory, 0o700);
|
|
1073
|
-
}
|
|
1074
|
-
const evidenceRootRelative = relative(sliceRoot, realpathSync(evidenceRoot));
|
|
1075
|
-
if (
|
|
1076
|
-
evidenceRootRelative === '..' ||
|
|
1077
|
-
evidenceRootRelative.startsWith('..' + sep) ||
|
|
1078
|
-
isAbsolute(evidenceRootRelative)
|
|
1079
|
-
) {
|
|
1080
|
-
throw new Error('Aggregate-count evidence directory escaped its Slice.');
|
|
1081
|
-
}
|
|
1082
|
-
const evidencePath = resolve(evidenceRoot, 'aggregate-count-evidence.json');
|
|
1083
|
-
const evidenceBytes = Buffer.from(
|
|
1084
|
-
JSON.stringify(evidence, null, 2) + '\\n',
|
|
1085
|
-
'utf8',
|
|
1086
|
-
);
|
|
1087
|
-
if (evidenceBytes.length > 1024 * 1024) {
|
|
1088
|
-
throw new Error('Aggregate-count evidence exceeds its byte bound.');
|
|
1089
|
-
}
|
|
1090
|
-
writeFileSync(evidencePath, evidenceBytes, {
|
|
1091
|
-
flag: 'wx',
|
|
1092
|
-
mode: 0o600,
|
|
1093
|
-
});
|
|
1094
|
-
chmodSync(evidencePath, 0o600);
|
|
1095
|
-
const outputMetadata = lstatSync(evidencePath);
|
|
1096
|
-
if (
|
|
1097
|
-
!outputMetadata.isFile() ||
|
|
1098
|
-
outputMetadata.isSymbolicLink() ||
|
|
1099
|
-
outputMetadata.size !== evidenceBytes.length ||
|
|
1100
|
-
validateAggregateCountEvidence(
|
|
1101
|
-
JSON.parse(readFileSync(evidencePath, 'utf8')),
|
|
1102
|
-
).materialDigest !== evidence.materialDigest
|
|
1103
|
-
) {
|
|
1104
|
-
throw new Error('Aggregate-count evidence output did not remain canonical.');
|
|
1105
|
-
}
|
|
1106
|
-
process.stdout.write(
|
|
1107
|
-
JSON.stringify({
|
|
1108
|
-
kind: 'ebk-protected-aggregate-count-result',
|
|
1109
|
-
materialDigest: evidence.materialDigest,
|
|
1110
|
-
outcome: 'passed',
|
|
1111
|
-
schemaVersion: 1,
|
|
1112
|
-
}) + '\\n',
|
|
1113
|
-
);
|
|
1114
|
-
`,
|
|
1115
|
-
'scripts/performance-cost-collect.mjs': `import {
|
|
1116
|
-
CostExplorerClient,
|
|
1117
|
-
GetCostAndUsageCommand,
|
|
1118
|
-
ListCostAllocationTagsCommand,
|
|
1119
|
-
} from '@aws-sdk/client-cost-explorer';
|
|
1120
|
-
import {
|
|
1121
|
-
GetCallerIdentityCommand,
|
|
1122
|
-
STSClient,
|
|
1123
|
-
} from '@aws-sdk/client-sts';
|
|
1124
|
-
import { createHash } from 'node:crypto';
|
|
1125
|
-
import {
|
|
1126
|
-
chmodSync,
|
|
1127
|
-
lstatSync,
|
|
1128
|
-
mkdirSync,
|
|
1129
|
-
readFileSync,
|
|
1130
|
-
writeFileSync,
|
|
1131
|
-
} from 'node:fs';
|
|
1132
|
-
import {
|
|
1133
|
-
collectAwsBillingActualEvidence,
|
|
1134
|
-
validateAggregateCountEvidence,
|
|
1135
|
-
validateCostAllocationContract,
|
|
1136
|
-
} from '@empire-builder-kit/nx/performance';
|
|
1137
|
-
|
|
1138
|
-
const required = (name) => {
|
|
1139
|
-
const value = process.env[name]?.trim();
|
|
1140
|
-
if (!value) throw new Error(name + ' is required.');
|
|
1141
|
-
return value;
|
|
1142
|
-
};
|
|
1143
|
-
const digest = (bytes) =>
|
|
1144
|
-
createHash('sha256').update(bytes).digest('hex');
|
|
1145
|
-
const readBoundedJson = (path, expectedDigest, label) => {
|
|
1146
|
-
const metadata = lstatSync(path);
|
|
1147
|
-
if (
|
|
1148
|
-
!metadata.isFile() ||
|
|
1149
|
-
metadata.isSymbolicLink() ||
|
|
1150
|
-
metadata.size <= 0 ||
|
|
1151
|
-
metadata.size > 1024 * 1024
|
|
1152
|
-
) {
|
|
1153
|
-
throw new Error(label + ' must be one bounded regular file.');
|
|
1154
|
-
}
|
|
1155
|
-
const bytes = readFileSync(path);
|
|
1156
|
-
if (!/^[a-f0-9]{64}$/.test(expectedDigest) || digest(bytes) !== expectedDigest) {
|
|
1157
|
-
throw new Error(label + ' does not match its independently expected digest.');
|
|
1158
|
-
}
|
|
1159
|
-
return JSON.parse(bytes.toString('utf8'));
|
|
1160
|
-
};
|
|
1161
|
-
const aggregate = validateAggregateCountEvidence(
|
|
1162
|
-
readBoundedJson(
|
|
1163
|
-
required('EBK_AGGREGATE_COUNT_EVIDENCE_PATH'),
|
|
1164
|
-
required('EBK_EXPECTED_AGGREGATE_COUNT_EVIDENCE_DIGEST'),
|
|
1165
|
-
'Aggregate-count evidence',
|
|
1166
|
-
),
|
|
1167
|
-
);
|
|
1168
|
-
const release = readBoundedJson(
|
|
1169
|
-
required('EBK_RELEASE_BINDING_PATH'),
|
|
1170
|
-
required('EBK_EXPECTED_RELEASE_BINDING_DIGEST'),
|
|
1171
|
-
'Release binding',
|
|
1172
|
-
);
|
|
1173
|
-
if (JSON.stringify(release) !== JSON.stringify(aggregate.release)) {
|
|
1174
|
-
throw new Error('Aggregate counts and reviewed release binding differ.');
|
|
1175
|
-
}
|
|
1176
|
-
const environment = aggregate.environment;
|
|
1177
|
-
if (
|
|
1178
|
-
environment.slice !== '${name}' ||
|
|
1179
|
-
environment.stage !== required('EBK_STAGE') ||
|
|
1180
|
-
environment.region !== required('AWS_REGION') ||
|
|
1181
|
-
environment.workspace !== required('EBK_WORKSPACE') ||
|
|
1182
|
-
environment.accountFingerprint !== required('EBK_ACCOUNT_FINGERPRINT') ||
|
|
1183
|
-
release.sourceCommit !== required('EBK_SOURCE_COMMIT') ||
|
|
1184
|
-
aggregate.period.start !==
|
|
1185
|
-
required('EBK_EXPECTED_BILLING_PERIOD_START') ||
|
|
1186
|
-
aggregate.period.end !== required('EBK_EXPECTED_BILLING_PERIOD_END')
|
|
1187
|
-
) {
|
|
1188
|
-
throw new Error('Cost collection escaped its exact reviewed cohort.');
|
|
1189
|
-
}
|
|
1190
|
-
const allocation = validateCostAllocationContract(
|
|
1191
|
-
JSON.parse(
|
|
1192
|
-
readFileSync(
|
|
1193
|
-
new URL('../performance/cost-allocation.json', import.meta.url),
|
|
1194
|
-
'utf8',
|
|
1195
|
-
),
|
|
1196
|
-
),
|
|
1197
|
-
{ requireAdopted: true },
|
|
1198
|
-
);
|
|
1199
|
-
if (allocation.slice !== '${name}') {
|
|
1200
|
-
throw new Error('Cost allocation authority belongs to another Slice.');
|
|
1201
|
-
}
|
|
1202
|
-
const allocations = allocation.allocations.map(
|
|
1203
|
-
({ capabilityId, id }) => ({ allocationId: id, capabilityId }),
|
|
1204
|
-
);
|
|
1205
|
-
const sts = new STSClient({ region: environment.region });
|
|
1206
|
-
const costExplorer = new CostExplorerClient({ region: 'us-east-1' });
|
|
1207
|
-
const requiredCostAllocationTags = [
|
|
1208
|
-
'ebk:cost-allocation',
|
|
1209
|
-
'ebk:cost-scope',
|
|
1210
|
-
'ebk:slice',
|
|
1211
|
-
'ebk:stage',
|
|
1212
|
-
'ebk:workspace',
|
|
1213
|
-
];
|
|
1214
|
-
const costAllocationTagResponse = await costExplorer.send(
|
|
1215
|
-
new ListCostAllocationTagsCommand({
|
|
1216
|
-
MaxResults: 100,
|
|
1217
|
-
Status: 'Active',
|
|
1218
|
-
TagKeys: requiredCostAllocationTags,
|
|
1219
|
-
Type: 'UserDefined',
|
|
1220
|
-
}),
|
|
1221
|
-
);
|
|
1222
|
-
const activeCostAllocationTags = (costAllocationTagResponse.CostAllocationTags ?? [])
|
|
1223
|
-
.map(({ Status, TagKey, Type }) => ({ Status, TagKey, Type }))
|
|
1224
|
-
.sort((left, right) =>
|
|
1225
|
-
(left.TagKey ?? '') < (right.TagKey ?? '')
|
|
1226
|
-
? -1
|
|
1227
|
-
: (left.TagKey ?? '') > (right.TagKey ?? '')
|
|
1228
|
-
? 1
|
|
1229
|
-
: 0,
|
|
1230
|
-
);
|
|
1231
|
-
if (
|
|
1232
|
-
costAllocationTagResponse.NextToken ||
|
|
1233
|
-
!costAllocationTagResponse.$metadata.requestId ||
|
|
1234
|
-
JSON.stringify(activeCostAllocationTags) !==
|
|
1235
|
-
JSON.stringify(
|
|
1236
|
-
requiredCostAllocationTags.map((TagKey) => ({
|
|
1237
|
-
Status: 'Active',
|
|
1238
|
-
TagKey,
|
|
1239
|
-
Type: 'UserDefined',
|
|
1240
|
-
})),
|
|
1241
|
-
)
|
|
1242
|
-
) {
|
|
1243
|
-
throw new Error(
|
|
1244
|
-
'Required Product cost-allocation tags are not all ACTIVE in AWS.',
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
const client = {
|
|
1248
|
-
async getCallerIdentity() {
|
|
1249
|
-
const response = await sts.send(new GetCallerIdentityCommand({}));
|
|
1250
|
-
if (!response.Account || !response.$metadata.requestId) {
|
|
1251
|
-
throw new Error('AWS STS identity response is incomplete.');
|
|
1252
|
-
}
|
|
1253
|
-
return {
|
|
1254
|
-
accountId: response.Account,
|
|
1255
|
-
requestId: response.$metadata.requestId,
|
|
1256
|
-
};
|
|
1257
|
-
},
|
|
1258
|
-
async getCostAndUsage(request) {
|
|
1259
|
-
const filter = {
|
|
1260
|
-
And: request.filter.tags.map(({ key, value }) => ({
|
|
1261
|
-
Tags: {
|
|
1262
|
-
Key: key,
|
|
1263
|
-
MatchOptions: ['EQUALS'],
|
|
1264
|
-
Values: [value],
|
|
1265
|
-
},
|
|
1266
|
-
})),
|
|
1267
|
-
};
|
|
1268
|
-
const response = await costExplorer.send(
|
|
1269
|
-
new GetCostAndUsageCommand({
|
|
1270
|
-
Filter: filter,
|
|
1271
|
-
Granularity: request.granularity,
|
|
1272
|
-
GroupBy: request.groupBy
|
|
1273
|
-
? [{ Key: request.groupBy.key, Type: request.groupBy.type }]
|
|
1274
|
-
: undefined,
|
|
1275
|
-
Metrics: [request.metric],
|
|
1276
|
-
TimePeriod: {
|
|
1277
|
-
End: request.timePeriod.end,
|
|
1278
|
-
Start: request.timePeriod.start,
|
|
1279
|
-
},
|
|
1280
|
-
}),
|
|
1281
|
-
);
|
|
1282
|
-
if (response.NextPageToken || !response.$metadata.requestId) {
|
|
1283
|
-
throw new Error('AWS Cost Explorer result exceeded its exact page bound.');
|
|
1284
|
-
}
|
|
1285
|
-
return {
|
|
1286
|
-
requestId: response.$metadata.requestId,
|
|
1287
|
-
results: (response.ResultsByTime ?? []).map((result) => ({
|
|
1288
|
-
end: result.TimePeriod?.End ?? '',
|
|
1289
|
-
estimated: result.Estimated ?? true,
|
|
1290
|
-
groups: (result.Groups ?? []).map((group) => {
|
|
1291
|
-
const key = group.Keys?.[0] ?? '';
|
|
1292
|
-
const prefix = 'ebk:cost-allocation$';
|
|
1293
|
-
const metric = group.Metrics?.UnblendedCost;
|
|
1294
|
-
if (
|
|
1295
|
-
group.Keys?.length !== 1 ||
|
|
1296
|
-
!key.startsWith(prefix) ||
|
|
1297
|
-
!metric?.Amount
|
|
1298
|
-
) {
|
|
1299
|
-
throw new Error('AWS allocation row is incomplete or unallocated.');
|
|
1300
|
-
}
|
|
1301
|
-
return {
|
|
1302
|
-
allocationId: key.slice(prefix.length),
|
|
1303
|
-
amountUsd: metric.Amount,
|
|
1304
|
-
currency: metric.Unit === 'USD' ? 'USD' : metric.Unit,
|
|
1305
|
-
};
|
|
1306
|
-
}),
|
|
1307
|
-
start: result.TimePeriod?.Start ?? '',
|
|
1308
|
-
total: request.groupBy
|
|
1309
|
-
? null
|
|
1310
|
-
: {
|
|
1311
|
-
amountUsd: result.Total?.UnblendedCost?.Amount ?? '',
|
|
1312
|
-
currency:
|
|
1313
|
-
result.Total?.UnblendedCost?.Unit === 'USD'
|
|
1314
|
-
? 'USD'
|
|
1315
|
-
: result.Total?.UnblendedCost?.Unit,
|
|
1316
|
-
},
|
|
1317
|
-
})),
|
|
1318
|
-
};
|
|
1319
|
-
},
|
|
1320
|
-
};
|
|
1321
|
-
const report = await collectAwsBillingActualEvidence({
|
|
1322
|
-
aggregateEvidence: aggregate,
|
|
1323
|
-
allocations,
|
|
1324
|
-
client,
|
|
1325
|
-
collectedAt: new Date().toISOString(),
|
|
1326
|
-
collection: {
|
|
1327
|
-
aggregateArtifact: {
|
|
1328
|
-
name: required('EBK_AGGREGATE_ARTIFACT_NAME'),
|
|
1329
|
-
runId: required('EBK_AGGREGATE_ARTIFACT_RUN_ID'),
|
|
1330
|
-
sha256: required('EBK_EXPECTED_AGGREGATE_COUNT_EVIDENCE_DIGEST'),
|
|
1331
|
-
},
|
|
1332
|
-
releaseArtifact: {
|
|
1333
|
-
name: required('EBK_RELEASE_ARTIFACT_NAME'),
|
|
1334
|
-
runId: required('EBK_RELEASE_ARTIFACT_RUN_ID'),
|
|
1335
|
-
sha256: required('EBK_EXPECTED_RELEASE_BINDING_DIGEST'),
|
|
1336
|
-
},
|
|
1337
|
-
repository: required('GITHUB_REPOSITORY'),
|
|
1338
|
-
runAttempt: required('GITHUB_RUN_ATTEMPT'),
|
|
1339
|
-
runId: required('GITHUB_RUN_ID'),
|
|
1340
|
-
sourceCommit: release.sourceCommit,
|
|
1341
|
-
workflow: '.github/workflows/performance-cost-actual.yml',
|
|
1342
|
-
},
|
|
1343
|
-
environment,
|
|
1344
|
-
period: aggregate.period,
|
|
1345
|
-
release,
|
|
1346
|
-
});
|
|
1347
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
1348
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
1349
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
1350
|
-
const evidencePath = new URL(
|
|
1351
|
-
'performance-cost-actual.json',
|
|
1352
|
-
evidenceDirectory,
|
|
1353
|
-
);
|
|
1354
|
-
writeFileSync(evidencePath, JSON.stringify(report, null, 2) + '\\n', {
|
|
1355
|
-
encoding: 'utf8',
|
|
1356
|
-
flag: 'wx',
|
|
1357
|
-
mode: 0o600,
|
|
1358
|
-
});
|
|
1359
|
-
chmodSync(evidencePath, 0o600);
|
|
1360
|
-
process.stdout.write(JSON.stringify(report) + '\\n');
|
|
1361
|
-
`,
|
|
1362
|
-
'scripts/performance-load-guard.mjs': `import {
|
|
1363
|
-
lstatSync,
|
|
1364
|
-
readFileSync,
|
|
1365
|
-
realpathSync,
|
|
1366
|
-
} from 'node:fs';
|
|
1367
|
-
import { fileURLToPath } from 'node:url';
|
|
1368
|
-
import { relative, resolve, sep } from 'node:path';
|
|
1369
|
-
import {
|
|
1370
|
-
validateProtectedLoadAuthorization,
|
|
1371
|
-
validatePerformancePolicy,
|
|
1372
|
-
} from '@empire-builder-kit/nx/performance';
|
|
1373
|
-
|
|
1374
|
-
const requestedPlanPath =
|
|
1375
|
-
process.env.EBK_PROTECTED_LOAD_PLAN_PATH?.trim();
|
|
1376
|
-
const requestedApprovalPath =
|
|
1377
|
-
process.env.EBK_PROTECTED_LOAD_APPROVAL_PATH?.trim();
|
|
1378
|
-
const currentSourceCommit = process.env.EBK_SOURCE_COMMIT?.trim();
|
|
1379
|
-
const expectedAccountFingerprint =
|
|
1380
|
-
process.env.EBK_ACCOUNT_FINGERPRINT?.trim();
|
|
1381
|
-
const expectedEndpoint = process.env.EBK_LOAD_ENDPOINT?.trim();
|
|
1382
|
-
const expectedRegion = process.env.AWS_REGION?.trim();
|
|
1383
|
-
const now = process.env.EBK_EVIDENCE_NOW?.trim();
|
|
1384
|
-
if (
|
|
1385
|
-
!requestedPlanPath ||
|
|
1386
|
-
!requestedApprovalPath ||
|
|
1387
|
-
!currentSourceCommit ||
|
|
1388
|
-
!expectedAccountFingerprint ||
|
|
1389
|
-
!expectedEndpoint ||
|
|
1390
|
-
!expectedRegion ||
|
|
1391
|
-
!now
|
|
1392
|
-
) {
|
|
1393
|
-
throw new Error(
|
|
1394
|
-
'Protected load guard requires exact plan, approval, source, target, Region, and time inputs.',
|
|
1395
|
-
);
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
const sliceRoot = realpathSync(
|
|
1399
|
-
fileURLToPath(new URL('../', import.meta.url)),
|
|
1400
|
-
);
|
|
1401
|
-
|
|
1402
|
-
function managedInput(requestedPath, directory, label) {
|
|
1403
|
-
const root = resolve(sliceRoot, '.ebk/performance-load', directory);
|
|
1404
|
-
const rootChild = relative(sliceRoot, root);
|
|
1405
|
-
let cursor = sliceRoot;
|
|
1406
|
-
for (const component of rootChild.split(sep).filter(Boolean)) {
|
|
1407
|
-
cursor = resolve(cursor, component);
|
|
1408
|
-
const metadata = lstatSync(cursor);
|
|
1409
|
-
if (!metadata.isDirectory() || metadata.isSymbolicLink()) {
|
|
1410
|
-
throw new Error(label + ' managed directory contains a symbolic link.');
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
const candidate = resolve(process.cwd(), requestedPath);
|
|
1414
|
-
const child = relative(root, candidate);
|
|
1415
|
-
if (
|
|
1416
|
-
!/^[a-z0-9][a-z0-9._-]*\\.json$/.test(child) ||
|
|
1417
|
-
child.includes(sep) ||
|
|
1418
|
-
child === '..' ||
|
|
1419
|
-
child.startsWith('..' + sep)
|
|
1420
|
-
) {
|
|
1421
|
-
throw new Error(label + ' must be one exact managed JSON file.');
|
|
1422
|
-
}
|
|
1423
|
-
const metadata = lstatSync(candidate);
|
|
1424
|
-
if (
|
|
1425
|
-
!metadata.isFile() ||
|
|
1426
|
-
metadata.isSymbolicLink() ||
|
|
1427
|
-
(process.platform !== 'win32' && (metadata.mode & 0o077) !== 0) ||
|
|
1428
|
-
(typeof process.getuid === 'function' &&
|
|
1429
|
-
metadata.uid !== process.getuid()) ||
|
|
1430
|
-
metadata.size <= 0 ||
|
|
1431
|
-
metadata.size > 1024 * 1024
|
|
1432
|
-
) {
|
|
1433
|
-
throw new Error(label + ' must be a regular bounded non-symlink file.');
|
|
1434
|
-
}
|
|
1435
|
-
const realRoot = realpathSync(root);
|
|
1436
|
-
const realCandidate = realpathSync(candidate);
|
|
1437
|
-
if (relative(realRoot, realCandidate) !== child) {
|
|
1438
|
-
throw new Error(label + ' resolves outside its managed directory.');
|
|
1439
|
-
}
|
|
1440
|
-
return realCandidate;
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
const planPath = managedInput(requestedPlanPath, 'plans', 'Protected plan');
|
|
1444
|
-
const approvalPath = managedInput(
|
|
1445
|
-
requestedApprovalPath,
|
|
1446
|
-
'approvals',
|
|
1447
|
-
'Protected approval',
|
|
1448
|
-
);
|
|
1449
|
-
const policy = validatePerformancePolicy(
|
|
1450
|
-
JSON.parse(
|
|
1451
|
-
readFileSync(
|
|
1452
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
1453
|
-
'utf8',
|
|
1454
|
-
),
|
|
1455
|
-
),
|
|
1456
|
-
);
|
|
1457
|
-
const result = validateProtectedLoadAuthorization({
|
|
1458
|
-
approval: JSON.parse(readFileSync(approvalPath, 'utf8')),
|
|
1459
|
-
currentSourceCommit,
|
|
1460
|
-
expectedAccountFingerprint,
|
|
1461
|
-
expectedEndpoint,
|
|
1462
|
-
expectedRegion,
|
|
1463
|
-
now,
|
|
1464
|
-
plan: JSON.parse(readFileSync(planPath, 'utf8')),
|
|
1465
|
-
policy,
|
|
1466
|
-
});
|
|
1467
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
1468
|
-
`,
|
|
1469
|
-
'scripts/performance-load-runner.mjs': `import {
|
|
1470
|
-
appendFileSync,
|
|
1471
|
-
chmodSync,
|
|
1472
|
-
closeSync,
|
|
1473
|
-
constants,
|
|
1474
|
-
existsSync,
|
|
1475
|
-
lstatSync,
|
|
1476
|
-
mkdirSync,
|
|
1477
|
-
openSync,
|
|
1478
|
-
readFileSync,
|
|
1479
|
-
writeFileSync,
|
|
1480
|
-
} from 'node:fs';
|
|
1481
|
-
import {
|
|
1482
|
-
createProtectedLoadPlan,
|
|
1483
|
-
createProtectedLoadScenarioDriver,
|
|
1484
|
-
runBoundedProtectedLoad,
|
|
1485
|
-
validatePerformancePolicy,
|
|
1486
|
-
} from '@empire-builder-kit/nx/performance';
|
|
1487
|
-
import { assertWorkspaceStageOwnershipForWorkspace } from '@empire-builder-kit/nx/workspace-deployment';
|
|
1488
|
-
import { resolve } from 'node:path';
|
|
1489
|
-
|
|
1490
|
-
const stage = process.env.EBK_STAGE?.trim();
|
|
1491
|
-
if (!['development', 'staging', 'production'].includes(stage)) {
|
|
1492
|
-
throw new Error('Protected load runner requires one canonical EBK stage.');
|
|
1493
|
-
}
|
|
1494
|
-
const ownership = await assertWorkspaceStageOwnershipForWorkspace(
|
|
1495
|
-
resolve(import.meta.dirname, '../../..'),
|
|
1496
|
-
stage,
|
|
1497
|
-
{
|
|
1498
|
-
...(process.env.AWS_PROFILE ? { profile: process.env.AWS_PROFILE } : {}),
|
|
1499
|
-
...(process.env.AWS_CONFIG_FILE ? { configFilepath: process.env.AWS_CONFIG_FILE } : {}),
|
|
1500
|
-
...(process.env.AWS_SHARED_CREDENTIALS_FILE
|
|
1501
|
-
? { credentialsFilepath: process.env.AWS_SHARED_CREDENTIALS_FILE }
|
|
1502
|
-
: {}),
|
|
1503
|
-
},
|
|
1504
|
-
);
|
|
1505
|
-
if (process.env.AWS_REGION?.trim() !== ownership.region) {
|
|
1506
|
-
throw new Error('Protected load runner Region differs from its exact workspace owner tuple.');
|
|
1507
|
-
}
|
|
1508
|
-
for (const name of [
|
|
1509
|
-
'AWS_ACCESS_KEY_ID',
|
|
1510
|
-
'AWS_SECRET_ACCESS_KEY',
|
|
1511
|
-
'AWS_SESSION_TOKEN',
|
|
1512
|
-
'AWS_SECURITY_TOKEN',
|
|
1513
|
-
]) delete process.env[name];
|
|
1514
|
-
|
|
1515
|
-
const planPath = process.env.EBK_PROTECTED_LOAD_PLAN_PATH?.trim();
|
|
1516
|
-
const authorizationPath =
|
|
1517
|
-
process.env.EBK_PROTECTED_LOAD_AUTHORIZATION_PATH?.trim();
|
|
1518
|
-
const hmacKeyPath =
|
|
1519
|
-
process.env.EBK_PERFORMANCE_LOAD_HMAC_KEY_PATH?.trim();
|
|
1520
|
-
const emergencyStopPath = process.env.EBK_EMERGENCY_STOP_PATH?.trim();
|
|
1521
|
-
if (!planPath || !authorizationPath || !hmacKeyPath || !emergencyStopPath) {
|
|
1522
|
-
throw new Error(
|
|
1523
|
-
'Protected load runner requires exact plan, authorization, job-scoped HMAC-key, and emergency-stop paths.',
|
|
1524
|
-
);
|
|
1525
|
-
}
|
|
1526
|
-
const readHmacKey = (path) => {
|
|
1527
|
-
const metadata = lstatSync(path);
|
|
1528
|
-
if (
|
|
1529
|
-
!metadata.isFile() ||
|
|
1530
|
-
metadata.isSymbolicLink() ||
|
|
1531
|
-
(process.platform !== 'win32' && (metadata.mode & 0o077) !== 0) ||
|
|
1532
|
-
(typeof process.getuid === 'function' &&
|
|
1533
|
-
metadata.uid !== process.getuid()) ||
|
|
1534
|
-
metadata.size <= 0 ||
|
|
1535
|
-
metadata.size > 2_048
|
|
1536
|
-
) {
|
|
1537
|
-
throw new Error('Protected load HMAC key must be one bounded regular file.');
|
|
1538
|
-
}
|
|
1539
|
-
const value = JSON.parse(readFileSync(path, 'utf8'));
|
|
1540
|
-
const secret =
|
|
1541
|
-
value && typeof value.secret === 'string' ? value.secret : '';
|
|
1542
|
-
const decoded = /^[A-Za-z0-9_-]{43}$/.test(secret)
|
|
1543
|
-
? Buffer.from(secret, 'base64url')
|
|
1544
|
-
: Buffer.alloc(0);
|
|
1545
|
-
if (
|
|
1546
|
-
!value ||
|
|
1547
|
-
typeof value !== 'object' ||
|
|
1548
|
-
Array.isArray(value) ||
|
|
1549
|
-
Object.keys(value).sort().join() !== 'id,secret' ||
|
|
1550
|
-
typeof value.id !== 'string' ||
|
|
1551
|
-
!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(value.id) ||
|
|
1552
|
-
decoded.length !== 32 ||
|
|
1553
|
-
decoded.toString('base64url') !== secret
|
|
1554
|
-
) {
|
|
1555
|
-
throw new Error('Protected load HMAC key material is invalid.');
|
|
1556
|
-
}
|
|
1557
|
-
return Object.freeze({ id: value.id, secret: value.secret });
|
|
1558
|
-
};
|
|
1559
|
-
const hmacKey = readHmacKey(hmacKeyPath);
|
|
1560
|
-
const policy = validatePerformancePolicy(
|
|
1561
|
-
JSON.parse(
|
|
1562
|
-
readFileSync(
|
|
1563
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
1564
|
-
'utf8',
|
|
1565
|
-
),
|
|
1566
|
-
),
|
|
1567
|
-
);
|
|
1568
|
-
if (
|
|
1569
|
-
policy.authority.operationsAuthorityPath !==
|
|
1570
|
-
'operations/reliability.json'
|
|
1571
|
-
) {
|
|
1572
|
-
throw new Error(
|
|
1573
|
-
'Protected load requires the exact generated reliability operations authority.',
|
|
1574
|
-
);
|
|
1575
|
-
}
|
|
1576
|
-
const operationsAuthority = JSON.parse(
|
|
1577
|
-
readFileSync(
|
|
1578
|
-
new URL('../operations/reliability.json', import.meta.url),
|
|
1579
|
-
'utf8',
|
|
1580
|
-
),
|
|
1581
|
-
);
|
|
1582
|
-
const providedPlan = JSON.parse(readFileSync(planPath, 'utf8'));
|
|
1583
|
-
const plan = createProtectedLoadPlan(policy, providedPlan);
|
|
1584
|
-
if (plan.materialDigest !== providedPlan.materialDigest) {
|
|
1585
|
-
throw new Error('Protected load plan material changed after authorization.');
|
|
1586
|
-
}
|
|
1587
|
-
if (plan.evidencePath !== '.ebk/evidence/performance-load-report.json') {
|
|
1588
|
-
throw new Error('Protected load evidence path is not the managed path.');
|
|
1589
|
-
}
|
|
1590
|
-
const catalog = JSON.parse(
|
|
1591
|
-
readFileSync(
|
|
1592
|
-
new URL('../performance/load-scenarios.json', import.meta.url),
|
|
1593
|
-
'utf8',
|
|
1594
|
-
),
|
|
1595
|
-
);
|
|
1596
|
-
const authorization = JSON.parse(readFileSync(authorizationPath, 'utf8'));
|
|
1597
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
1598
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
1599
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
1600
|
-
const effectsPath = new URL('performance-load-effects.jsonl', evidenceDirectory);
|
|
1601
|
-
const maximumEffectLineBytes = 2_048;
|
|
1602
|
-
const maximumEffectLedgerBytes = Math.min(
|
|
1603
|
-
64 * 1024 * 1024,
|
|
1604
|
-
plan.maximumRequests * maximumEffectLineBytes,
|
|
1605
|
-
);
|
|
1606
|
-
const effects = new Map();
|
|
1607
|
-
let effectLedgerBytes = 0;
|
|
1608
|
-
if (existsSync(effectsPath)) {
|
|
1609
|
-
const metadata = lstatSync(effectsPath);
|
|
1610
|
-
if (
|
|
1611
|
-
!metadata.isFile() ||
|
|
1612
|
-
metadata.isSymbolicLink() ||
|
|
1613
|
-
metadata.size > maximumEffectLedgerBytes
|
|
1614
|
-
) {
|
|
1615
|
-
throw new Error('Protected load effect ledger must be a bounded regular file.');
|
|
1616
|
-
}
|
|
1617
|
-
const bytes = readFileSync(effectsPath, 'utf8');
|
|
1618
|
-
effectLedgerBytes = Buffer.byteLength(bytes);
|
|
1619
|
-
if (bytes && !bytes.endsWith('\\n')) {
|
|
1620
|
-
throw new Error('Protected load effect ledger has an incomplete record.');
|
|
1621
|
-
}
|
|
1622
|
-
const lines = bytes ? bytes.slice(0, -1).split('\\n') : [];
|
|
1623
|
-
if (lines.length > plan.maximumRequests) {
|
|
1624
|
-
throw new Error('Protected load effect ledger exceeds the request budget.');
|
|
1625
|
-
}
|
|
1626
|
-
for (const line of lines) {
|
|
1627
|
-
if (Buffer.byteLength(line) > maximumEffectLineBytes) {
|
|
1628
|
-
throw new Error('Protected load effect ledger record is oversized.');
|
|
1629
|
-
}
|
|
1630
|
-
const effect = JSON.parse(line);
|
|
1631
|
-
if (
|
|
1632
|
-
!effect ||
|
|
1633
|
-
typeof effect !== 'object' ||
|
|
1634
|
-
typeof effect.effectId !== 'string' ||
|
|
1635
|
-
effects.has(effect.effectId)
|
|
1636
|
-
) {
|
|
1637
|
-
throw new Error('Protected load effect ledger identity is invalid.');
|
|
1638
|
-
}
|
|
1639
|
-
effects.set(effect.effectId, effect);
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
const effectLedger = openSync(
|
|
1643
|
-
effectsPath,
|
|
1644
|
-
constants.O_APPEND |
|
|
1645
|
-
constants.O_CREAT |
|
|
1646
|
-
constants.O_WRONLY |
|
|
1647
|
-
constants.O_NOFOLLOW,
|
|
1648
|
-
0o600,
|
|
1649
|
-
);
|
|
1650
|
-
chmodSync(effectsPath, 0o600);
|
|
1651
|
-
const recordEffect = async (effect) => {
|
|
1652
|
-
const prior = effects.get(effect.effectId);
|
|
1653
|
-
if (prior) {
|
|
1654
|
-
if (JSON.stringify(prior) !== JSON.stringify(effect)) {
|
|
1655
|
-
throw new Error('Protected load effect identity contains other material.');
|
|
1656
|
-
}
|
|
1657
|
-
return;
|
|
1658
|
-
}
|
|
1659
|
-
const line = JSON.stringify(effect) + '\\n';
|
|
1660
|
-
const lineBytes = Buffer.byteLength(line);
|
|
1661
|
-
if (
|
|
1662
|
-
lineBytes > maximumEffectLineBytes ||
|
|
1663
|
-
effects.size >= plan.maximumRequests ||
|
|
1664
|
-
effectLedgerBytes + lineBytes > maximumEffectLedgerBytes
|
|
1665
|
-
) {
|
|
1666
|
-
throw new Error('Protected load effect ledger exceeded its hard bounds.');
|
|
1667
|
-
}
|
|
1668
|
-
appendFileSync(effectLedger, line, 'utf8');
|
|
1669
|
-
effectLedgerBytes += lineBytes;
|
|
1670
|
-
effects.set(effect.effectId, effect);
|
|
1671
|
-
};
|
|
1672
|
-
const { allowedDriver, driver } = createProtectedLoadScenarioDriver({
|
|
1673
|
-
catalog,
|
|
1674
|
-
hmacKey,
|
|
1675
|
-
operationsAuthority,
|
|
1676
|
-
plan,
|
|
1677
|
-
policy,
|
|
1678
|
-
recordEffect,
|
|
1679
|
-
});
|
|
1680
|
-
const report = await runBoundedProtectedLoad({
|
|
1681
|
-
abortRequested: () => existsSync(emergencyStopPath),
|
|
1682
|
-
allowedDrivers: [allowedDriver],
|
|
1683
|
-
authorization,
|
|
1684
|
-
driver,
|
|
1685
|
-
plan,
|
|
1686
|
-
});
|
|
1687
|
-
closeSync(effectLedger);
|
|
1688
|
-
const output = new URL('performance-load-report.json', evidenceDirectory);
|
|
1689
|
-
const bytes = JSON.stringify(report, null, 2) + '\\n';
|
|
1690
|
-
try {
|
|
1691
|
-
writeFileSync(output, bytes, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
1692
|
-
} catch {
|
|
1693
|
-
if (readFileSync(output, 'utf8') !== bytes) {
|
|
1694
|
-
throw new Error('Protected load evidence path already contains other bytes.');
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
chmodSync(output, 0o600);
|
|
1698
|
-
process.stdout.write(JSON.stringify(report) + '\\n');
|
|
1699
|
-
`,
|
|
1700
|
-
'scripts/performance-load-cleanup.mjs': `import {
|
|
1701
|
-
chmodSync,
|
|
1702
|
-
existsSync,
|
|
1703
|
-
lstatSync,
|
|
1704
|
-
mkdirSync,
|
|
1705
|
-
readFileSync,
|
|
1706
|
-
writeFileSync,
|
|
1707
|
-
} from 'node:fs';
|
|
1708
|
-
import {
|
|
1709
|
-
cleanupProtectedLoadScenarioEffects,
|
|
1710
|
-
createProtectedLoadPlan,
|
|
1711
|
-
validatePerformancePolicy,
|
|
1712
|
-
} from '@empire-builder-kit/nx/performance';
|
|
1713
|
-
import { assertWorkspaceStageOwnershipForWorkspace } from '@empire-builder-kit/nx/workspace-deployment';
|
|
1714
|
-
import { resolve } from 'node:path';
|
|
1715
|
-
|
|
1716
|
-
const stage = process.env.EBK_STAGE?.trim();
|
|
1717
|
-
if (!['development', 'staging', 'production'].includes(stage)) {
|
|
1718
|
-
throw new Error('Protected load cleanup requires one canonical EBK stage.');
|
|
1719
|
-
}
|
|
1720
|
-
const ownership = await assertWorkspaceStageOwnershipForWorkspace(
|
|
1721
|
-
resolve(import.meta.dirname, '../../..'),
|
|
1722
|
-
stage,
|
|
1723
|
-
{
|
|
1724
|
-
...(process.env.AWS_PROFILE ? { profile: process.env.AWS_PROFILE } : {}),
|
|
1725
|
-
...(process.env.AWS_CONFIG_FILE ? { configFilepath: process.env.AWS_CONFIG_FILE } : {}),
|
|
1726
|
-
...(process.env.AWS_SHARED_CREDENTIALS_FILE
|
|
1727
|
-
? { credentialsFilepath: process.env.AWS_SHARED_CREDENTIALS_FILE }
|
|
1728
|
-
: {}),
|
|
1729
|
-
},
|
|
1730
|
-
);
|
|
1731
|
-
if (process.env.AWS_REGION?.trim() !== ownership.region) {
|
|
1732
|
-
throw new Error('Protected load cleanup Region differs from its exact workspace owner tuple.');
|
|
1733
|
-
}
|
|
1734
|
-
for (const name of [
|
|
1735
|
-
'AWS_ACCESS_KEY_ID',
|
|
1736
|
-
'AWS_SECRET_ACCESS_KEY',
|
|
1737
|
-
'AWS_SESSION_TOKEN',
|
|
1738
|
-
'AWS_SECURITY_TOKEN',
|
|
1739
|
-
]) delete process.env[name];
|
|
1740
|
-
|
|
1741
|
-
const planPath = process.env.EBK_PROTECTED_LOAD_PLAN_PATH?.trim();
|
|
1742
|
-
const hmacKeyPath =
|
|
1743
|
-
process.env.EBK_PERFORMANCE_LOAD_HMAC_KEY_PATH?.trim();
|
|
1744
|
-
if (!planPath || !hmacKeyPath) {
|
|
1745
|
-
throw new Error(
|
|
1746
|
-
'Protected load cleanup requires one exact plan path and job-scoped HMAC key.',
|
|
1747
|
-
);
|
|
1748
|
-
}
|
|
1749
|
-
const metadata = lstatSync(hmacKeyPath);
|
|
1750
|
-
if (
|
|
1751
|
-
!metadata.isFile() ||
|
|
1752
|
-
metadata.isSymbolicLink() ||
|
|
1753
|
-
(process.platform !== 'win32' && (metadata.mode & 0o077) !== 0) ||
|
|
1754
|
-
(typeof process.getuid === 'function' &&
|
|
1755
|
-
metadata.uid !== process.getuid()) ||
|
|
1756
|
-
metadata.size <= 0 ||
|
|
1757
|
-
metadata.size > 2_048
|
|
1758
|
-
) {
|
|
1759
|
-
throw new Error('Protected load HMAC key must be one bounded regular file.');
|
|
1760
|
-
}
|
|
1761
|
-
const hmacKey = JSON.parse(readFileSync(hmacKeyPath, 'utf8'));
|
|
1762
|
-
const hmacSecret =
|
|
1763
|
-
hmacKey && typeof hmacKey.secret === 'string' ? hmacKey.secret : '';
|
|
1764
|
-
const decodedHmacSecret = /^[A-Za-z0-9_-]{43}$/.test(hmacSecret)
|
|
1765
|
-
? Buffer.from(hmacSecret, 'base64url')
|
|
1766
|
-
: Buffer.alloc(0);
|
|
1767
|
-
if (
|
|
1768
|
-
!hmacKey ||
|
|
1769
|
-
typeof hmacKey !== 'object' ||
|
|
1770
|
-
Array.isArray(hmacKey) ||
|
|
1771
|
-
Object.keys(hmacKey).sort().join() !== 'id,secret' ||
|
|
1772
|
-
typeof hmacKey.id !== 'string' ||
|
|
1773
|
-
!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(hmacKey.id) ||
|
|
1774
|
-
decodedHmacSecret.length !== 32 ||
|
|
1775
|
-
decodedHmacSecret.toString('base64url') !== hmacSecret
|
|
1776
|
-
) {
|
|
1777
|
-
throw new Error('Protected load HMAC key material is invalid.');
|
|
1778
|
-
}
|
|
1779
|
-
const policy = validatePerformancePolicy(
|
|
1780
|
-
JSON.parse(
|
|
1781
|
-
readFileSync(
|
|
1782
|
-
new URL('../performance/policy.json', import.meta.url),
|
|
1783
|
-
'utf8',
|
|
1784
|
-
),
|
|
1785
|
-
),
|
|
1786
|
-
);
|
|
1787
|
-
if (
|
|
1788
|
-
policy.authority.operationsAuthorityPath !==
|
|
1789
|
-
'operations/reliability.json'
|
|
1790
|
-
) {
|
|
1791
|
-
throw new Error(
|
|
1792
|
-
'Protected load cleanup requires the exact generated reliability operations authority.',
|
|
1793
|
-
);
|
|
1794
|
-
}
|
|
1795
|
-
const operationsAuthority = JSON.parse(
|
|
1796
|
-
readFileSync(
|
|
1797
|
-
new URL('../operations/reliability.json', import.meta.url),
|
|
1798
|
-
'utf8',
|
|
1799
|
-
),
|
|
1800
|
-
);
|
|
1801
|
-
const providedPlan = JSON.parse(readFileSync(planPath, 'utf8'));
|
|
1802
|
-
const plan = createProtectedLoadPlan(policy, providedPlan);
|
|
1803
|
-
if (plan.materialDigest !== providedPlan.materialDigest) {
|
|
1804
|
-
throw new Error('Protected load cleanup plan material is inconsistent.');
|
|
1805
|
-
}
|
|
1806
|
-
const catalog = JSON.parse(
|
|
1807
|
-
readFileSync(
|
|
1808
|
-
new URL('../performance/load-scenarios.json', import.meta.url),
|
|
1809
|
-
'utf8',
|
|
1810
|
-
),
|
|
1811
|
-
);
|
|
1812
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
1813
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
1814
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
1815
|
-
const effectsPath = new URL('performance-load-effects.jsonl', evidenceDirectory);
|
|
1816
|
-
const maximumEffectLineBytes = 2_048;
|
|
1817
|
-
const maximumEffectLedgerBytes = Math.min(
|
|
1818
|
-
64 * 1024 * 1024,
|
|
1819
|
-
plan.maximumRequests * maximumEffectLineBytes,
|
|
1820
|
-
);
|
|
1821
|
-
let effects = [];
|
|
1822
|
-
if (existsSync(effectsPath)) {
|
|
1823
|
-
const metadata = lstatSync(effectsPath);
|
|
1824
|
-
if (
|
|
1825
|
-
!metadata.isFile() ||
|
|
1826
|
-
metadata.isSymbolicLink() ||
|
|
1827
|
-
metadata.size > maximumEffectLedgerBytes
|
|
1828
|
-
) {
|
|
1829
|
-
throw new Error('Protected load effect ledger must be a bounded regular file.');
|
|
1830
|
-
}
|
|
1831
|
-
const bytes = readFileSync(effectsPath, 'utf8');
|
|
1832
|
-
if (bytes && !bytes.endsWith('\\n')) {
|
|
1833
|
-
throw new Error('Protected load effect ledger has an incomplete record.');
|
|
1834
|
-
}
|
|
1835
|
-
const lines = bytes ? bytes.slice(0, -1).split('\\n') : [];
|
|
1836
|
-
if (
|
|
1837
|
-
lines.length > plan.maximumRequests ||
|
|
1838
|
-
lines.some((line) => Buffer.byteLength(line) > maximumEffectLineBytes)
|
|
1839
|
-
) {
|
|
1840
|
-
throw new Error('Protected load effect ledger exceeds its hard bounds.');
|
|
1841
|
-
}
|
|
1842
|
-
effects = lines.map((line) => JSON.parse(line));
|
|
1843
|
-
}
|
|
1844
|
-
const report = await cleanupProtectedLoadScenarioEffects({
|
|
1845
|
-
catalog,
|
|
1846
|
-
effects,
|
|
1847
|
-
hmacKey,
|
|
1848
|
-
operationsAuthority,
|
|
1849
|
-
plan,
|
|
1850
|
-
policy,
|
|
1851
|
-
});
|
|
1852
|
-
const output = new URL('performance-load-cleanup.json', evidenceDirectory);
|
|
1853
|
-
const bytes = JSON.stringify(report, null, 2) + '\\n';
|
|
1854
|
-
try {
|
|
1855
|
-
writeFileSync(output, bytes, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
1856
|
-
} catch {
|
|
1857
|
-
if (readFileSync(output, 'utf8') !== bytes) {
|
|
1858
|
-
throw new Error('Protected cleanup evidence path contains other bytes.');
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
chmodSync(output, 0o600);
|
|
1862
|
-
process.stdout.write(JSON.stringify(report) + '\\n');
|
|
1863
|
-
`,
|
|
1864
|
-
'scripts/performance-tag-coverage.mjs': `import { chmodSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
1865
|
-
import {
|
|
1866
|
-
deriveExpectedResourceTagInventory,
|
|
1867
|
-
evaluateResourceTagCoverage,
|
|
1868
|
-
} from '@empire-builder-kit/nx/performance';
|
|
1869
|
-
|
|
1870
|
-
const deploymentPath =
|
|
1871
|
-
process.env.EBK_DEPLOYMENT_RESOURCE_TAG_INVENTORY_PATH?.trim();
|
|
1872
|
-
const observedPath =
|
|
1873
|
-
process.env.EBK_OBSERVED_RESOURCE_TAG_INVENTORY_PATH?.trim();
|
|
1874
|
-
if (!deploymentPath || !observedPath) {
|
|
1875
|
-
throw new Error(
|
|
1876
|
-
'Exact deployment resource inventory and observed tag inventory paths are required.',
|
|
1877
|
-
);
|
|
1878
|
-
}
|
|
1879
|
-
const expected = deriveExpectedResourceTagInventory(
|
|
1880
|
-
JSON.parse(readFileSync(deploymentPath, 'utf8')),
|
|
1881
|
-
);
|
|
1882
|
-
const result = evaluateResourceTagCoverage({
|
|
1883
|
-
expected,
|
|
1884
|
-
observed: JSON.parse(readFileSync(observedPath, 'utf8')),
|
|
1885
|
-
});
|
|
1886
|
-
const evidenceDirectory = new URL('../.ebk/evidence/', import.meta.url);
|
|
1887
|
-
mkdirSync(evidenceDirectory, { recursive: true, mode: 0o700 });
|
|
1888
|
-
chmodSync(evidenceDirectory, 0o700);
|
|
1889
|
-
const evidencePath = new URL(
|
|
1890
|
-
'performance-tag-coverage.json',
|
|
1891
|
-
evidenceDirectory,
|
|
1892
|
-
);
|
|
1893
|
-
writeFileSync(evidencePath, JSON.stringify(result, null, 2) + '\\n', {
|
|
1894
|
-
encoding: 'utf8',
|
|
1895
|
-
mode: 0o600,
|
|
1896
|
-
});
|
|
1897
|
-
chmodSync(evidencePath, 0o600);
|
|
1898
|
-
process.stdout.write(JSON.stringify(result) + '\\n');
|
|
1899
|
-
if (result.status !== 'complete') process.exitCode = 2;
|
|
1900
|
-
`,
|
|
1901
|
-
'web/src/app/%5F%5Febk/performance/handler.ts': `import 'server-only';
|
|
1902
|
-
import {
|
|
1903
|
-
handleProtectedLoadCleanupEndpoint,
|
|
1904
|
-
handleProtectedLoadScenarioEndpoint,
|
|
1905
|
-
type ProtectedLoadEndpointBindingV1,
|
|
1906
|
-
type ProtectedLoadRequestAuthorizationV1,
|
|
1907
|
-
${' DYNAMODB_PROTECTED_REQUEST_BUDGET_MS,\n'}\
|
|
1908
|
-
} from '@empire-builder-kit/runtime/performance';
|
|
1909
|
-
${`import { dataStore } from '../../../../../data/key-value';
|
|
1910
|
-
import { createPerformancePersistence } from '../../../../../performance/persistence';`}
|
|
1911
|
-
import { Secrets } from '../../../../../secrets/declarations';
|
|
1912
|
-
import { createStandardSliceSecretRuntime } from '../../../../../secrets/runtime';
|
|
1913
|
-
|
|
1914
|
-
type ManagedAdapterId = 'ebk-api-lambda-v1' | '${asyncAdapter}' | '${databaseAdapter}';
|
|
1915
|
-
|
|
1916
|
-
function required(name: string): string {
|
|
1917
|
-
const value = process.env[name]?.trim();
|
|
1918
|
-
if (!value) throw new Error('protected-performance-endpoint-disabled');
|
|
1919
|
-
return value;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
type EndpointSecretRuntime = ReturnType<
|
|
1923
|
-
typeof createStandardSliceSecretRuntime
|
|
1924
|
-
>;
|
|
1925
|
-
const protectedPerformanceStages = ${JSON.stringify(protectedPerformanceStages)} as const;
|
|
1926
|
-
type ProtectedPerformanceStage = (typeof protectedPerformanceStages)[number];
|
|
1927
|
-
|
|
1928
|
-
function isProtectedPerformanceStage(
|
|
1929
|
-
value: string | undefined,
|
|
1930
|
-
): value is ProtectedPerformanceStage {
|
|
1931
|
-
return value !== undefined &&
|
|
1932
|
-
(protectedPerformanceStages as readonly string[]).includes(value);
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
let endpointSecretRuntime: EndpointSecretRuntime | undefined;
|
|
1936
|
-
let endpointSecretRuntimeStage: ProtectedPerformanceStage | undefined;
|
|
1937
|
-
|
|
1938
|
-
function performanceSecretRuntime(
|
|
1939
|
-
stage: ProtectedPerformanceStage,
|
|
1940
|
-
): EndpointSecretRuntime {
|
|
1941
|
-
if (
|
|
1942
|
-
endpointSecretRuntimeStage !== undefined &&
|
|
1943
|
-
endpointSecretRuntimeStage !== stage
|
|
1944
|
-
) {
|
|
1945
|
-
throw new Error('protected-performance-endpoint-disabled');
|
|
1946
|
-
}
|
|
1947
|
-
endpointSecretRuntimeStage = stage;
|
|
1948
|
-
endpointSecretRuntime ??= createStandardSliceSecretRuntime({
|
|
1949
|
-
stage,
|
|
1950
|
-
workload: '${name}.web-server',
|
|
1951
|
-
});
|
|
1952
|
-
return endpointSecretRuntime;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
async function withEndpointBinding<Result>(
|
|
1956
|
-
adapterId: ManagedAdapterId,
|
|
1957
|
-
operation: (binding: ProtectedLoadEndpointBindingV1) => Promise<Result>,
|
|
1958
|
-
): Promise<Result> {
|
|
1959
|
-
const stage = process.env.EBK_STAGE;
|
|
1960
|
-
if (
|
|
1961
|
-
process.env.EBK_PERFORMANCE_LOAD_ENABLED !== 'true' ||
|
|
1962
|
-
!isProtectedPerformanceStage(stage)
|
|
1963
|
-
) {
|
|
1964
|
-
throw new Error('protected-performance-endpoint-disabled');
|
|
1965
|
-
}
|
|
1966
|
-
return performanceSecretRuntime(stage).runWithSecret({
|
|
1967
|
-
declaration: Secrets.GeneratedPerformanceLoadHmacKeys,
|
|
1968
|
-
isAuthenticationFailure: () => false,
|
|
1969
|
-
operation: (hmacKeys) =>
|
|
1970
|
-
operation({
|
|
1971
|
-
adapterId,
|
|
1972
|
-
deployedCandidateDigest: required(
|
|
1973
|
-
'EBK_PERFORMANCE_CANDIDATE_DIGEST',
|
|
1974
|
-
),
|
|
1975
|
-
deployedReleaseId: required('EBK_PERFORMANCE_RELEASE_ID'),
|
|
1976
|
-
deployedReleaseMaterialDigest: required(
|
|
1977
|
-
'EBK_PERFORMANCE_RELEASE_MATERIAL_DIGEST',
|
|
1978
|
-
),
|
|
1979
|
-
deployedSourceCommit: required('EBK_SOURCE_COMMIT'),
|
|
1980
|
-
hmacKeys,
|
|
1981
|
-
stage,
|
|
1982
|
-
target: {
|
|
1983
|
-
accountFingerprint: required(
|
|
1984
|
-
'EBK_PERFORMANCE_ACCOUNT_FINGERPRINT',
|
|
1985
|
-
),
|
|
1986
|
-
origin: required('EBK_PERFORMANCE_ORIGIN'),
|
|
1987
|
-
region: required('EBK_PERFORMANCE_REGION'),
|
|
1988
|
-
slice: required('EBK_PERFORMANCE_SLICE'),
|
|
1989
|
-
},
|
|
1990
|
-
}),
|
|
1991
|
-
});
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
function requestMaterial(request: Request, body?: unknown) {
|
|
1995
|
-
return {
|
|
1996
|
-
...(body === undefined ? {} : { body }),
|
|
1997
|
-
headers: Object.fromEntries(request.headers.entries()),
|
|
1998
|
-
method: request.method as 'GET' | 'POST',
|
|
1999
|
-
url: request.url,
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
async function boundedRequestBody(request: Request): Promise<unknown> {
|
|
2004
|
-
const maximumBytes = 32 * 1024;
|
|
2005
|
-
const declaredLength = request.headers.get('content-length');
|
|
2006
|
-
if (
|
|
2007
|
-
declaredLength !== null &&
|
|
2008
|
-
(!/^\\d+$/.test(declaredLength) ||
|
|
2009
|
-
Number(declaredLength) <= 0 ||
|
|
2010
|
-
Number(declaredLength) > maximumBytes)
|
|
2011
|
-
) {
|
|
2012
|
-
throw new Error('protected-performance-request-body-invalid');
|
|
2013
|
-
}
|
|
2014
|
-
if (!request.body) {
|
|
2015
|
-
throw new Error('protected-performance-request-body-invalid');
|
|
2016
|
-
}
|
|
2017
|
-
const reader = request.body.getReader();
|
|
2018
|
-
const chunks: Uint8Array[] = [];
|
|
2019
|
-
let size = 0;
|
|
2020
|
-
try {
|
|
2021
|
-
for (;;) {
|
|
2022
|
-
const { done, value } = await reader.read();
|
|
2023
|
-
if (done) break;
|
|
2024
|
-
size += value.byteLength;
|
|
2025
|
-
if (size > maximumBytes) {
|
|
2026
|
-
await reader.cancel();
|
|
2027
|
-
throw new Error('protected-performance-request-body-invalid');
|
|
2028
|
-
}
|
|
2029
|
-
chunks.push(value);
|
|
2030
|
-
}
|
|
2031
|
-
} finally {
|
|
2032
|
-
reader.releaseLock();
|
|
2033
|
-
}
|
|
2034
|
-
if (size === 0) {
|
|
2035
|
-
throw new Error('protected-performance-request-body-invalid');
|
|
2036
|
-
}
|
|
2037
|
-
const bytes = new Uint8Array(size);
|
|
2038
|
-
let offset = 0;
|
|
2039
|
-
for (const chunk of chunks) {
|
|
2040
|
-
bytes.set(chunk, offset);
|
|
2041
|
-
offset += chunk.byteLength;
|
|
2042
|
-
}
|
|
2043
|
-
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
function memorySaturation(): number {
|
|
2047
|
-
const memory = process.memoryUsage();
|
|
2048
|
-
if (memory.heapTotal <= 0) return 0;
|
|
2049
|
-
return Math.min(100, (memory.heapUsed / memory.heapTotal) * 100);
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
${(0, built_in_plan_key_value_performance_js_1.renderKeyValuePerformanceEndpointFunctions)()}
|
|
2053
|
-
function refused() {
|
|
2054
|
-
return Response.json(
|
|
2055
|
-
{
|
|
2056
|
-
kind: 'ebk-protected-load-endpoint-refusal',
|
|
2057
|
-
status: 'not-found',
|
|
2058
|
-
},
|
|
2059
|
-
{ status: 404 },
|
|
2060
|
-
);
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
export async function runPerformanceScenarioEndpoint(
|
|
2064
|
-
adapterId: ManagedAdapterId,
|
|
2065
|
-
request: Request,
|
|
2066
|
-
) {
|
|
2067
|
-
try {
|
|
2068
|
-
const body =
|
|
2069
|
-
request.method === 'POST'
|
|
2070
|
-
? await boundedRequestBody(request)
|
|
2071
|
-
: undefined;
|
|
2072
|
-
const result = await withEndpointBinding(adapterId, (binding) =>
|
|
2073
|
-
handleProtectedLoadScenarioEndpoint({
|
|
2074
|
-
binding,
|
|
2075
|
-
execute: async ({ authorization, effectId }) => {
|
|
2076
|
-
if (
|
|
2077
|
-
adapterId === '${asyncAdapter}' ||
|
|
2078
|
-
adapterId === '${databaseAdapter}'
|
|
2079
|
-
) {
|
|
2080
|
-
if (!effectId) throw new Error('protected-effect-required');
|
|
2081
|
-
return databaseExecution(adapterId, effectId, authorization);
|
|
2082
|
-
}
|
|
2083
|
-
return { saturationPercent: memorySaturation() };
|
|
2084
|
-
},
|
|
2085
|
-
request: requestMaterial(request, body),
|
|
2086
|
-
reserve: reserveRequest,
|
|
2087
|
-
}),
|
|
2088
|
-
);
|
|
2089
|
-
return Response.json(result.body, { status: result.status });
|
|
2090
|
-
} catch {
|
|
2091
|
-
return refused();
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
export async function runPerformanceCleanupEndpoint(
|
|
2096
|
-
adapterId: '${asyncAdapter}' | '${databaseAdapter}',
|
|
2097
|
-
request: Request,
|
|
2098
|
-
) {
|
|
2099
|
-
try {
|
|
2100
|
-
const body = await boundedRequestBody(request);
|
|
2101
|
-
const result = await withEndpointBinding(adapterId, (binding) =>
|
|
2102
|
-
handleProtectedLoadCleanupEndpoint({
|
|
2103
|
-
binding,
|
|
2104
|
-
cleanup: (authorization) => cleanupRun(adapterId, authorization),
|
|
2105
|
-
request: requestMaterial(request, body),
|
|
2106
|
-
}),
|
|
2107
|
-
);
|
|
2108
|
-
return Response.json(result.body, { status: result.status });
|
|
2109
|
-
} catch {
|
|
2110
|
-
return refused();
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
`,
|
|
2114
|
-
'web/src/app/%5F%5Febk/performance/handler.spec.ts': `import {
|
|
2115
|
-
beforeAll,
|
|
2116
|
-
describe,
|
|
2117
|
-
expect,
|
|
2118
|
-
it,
|
|
2119
|
-
vi,
|
|
2120
|
-
} from 'vitest';
|
|
2121
|
-
|
|
2122
|
-
const mocks = vi.hoisted(() => {
|
|
2123
|
-
const runWithSecret = vi.fn(async ({ operation }) =>
|
|
2124
|
-
operation({
|
|
2125
|
-
current: {
|
|
2126
|
-
id: 'performance-current-v1',
|
|
2127
|
-
secret: 'current-performance-secret-material-0001',
|
|
2128
|
-
},
|
|
2129
|
-
}),
|
|
2130
|
-
);
|
|
2131
|
-
return {
|
|
2132
|
-
createSecretRuntime: vi.fn(() => ({ runWithSecret })),
|
|
2133
|
-
runWithSecret,
|
|
2134
|
-
};
|
|
2135
|
-
});
|
|
2136
|
-
|
|
2137
|
-
vi.mock('server-only', () => ({}));
|
|
2138
|
-
vi.mock('@empire-builder-kit/runtime/performance', () => ({
|
|
2139
|
-
handleProtectedLoadCleanupEndpoint: vi.fn(),
|
|
2140
|
-
handleProtectedLoadScenarioEndpoint: vi.fn(async ({ binding }) => ({
|
|
2141
|
-
body: {
|
|
2142
|
-
candidateDigest: binding.deployedCandidateDigest,
|
|
2143
|
-
kind: 'ebk-protected-load-endpoint-telemetry',
|
|
2144
|
-
status: 'accepted',
|
|
2145
|
-
},
|
|
2146
|
-
status: 200,
|
|
2147
|
-
})),
|
|
2148
|
-
}));
|
|
2149
|
-
${`vi.mock('../../../../../performance/persistence', () => ({
|
|
2150
|
-
createPerformancePersistence: vi.fn(),
|
|
2151
|
-
}));`}
|
|
2152
|
-
vi.mock('../../../../../secrets/declarations', () => ({
|
|
2153
|
-
Secrets: { GeneratedPerformanceLoadHmacKeys: {} },
|
|
2154
|
-
}));
|
|
2155
|
-
vi.mock('../../../../../secrets/runtime', () => ({
|
|
2156
|
-
createStandardSliceSecretRuntime: mocks.createSecretRuntime,
|
|
2157
|
-
}));
|
|
2158
|
-
|
|
2159
|
-
import { runPerformanceScenarioEndpoint } from './handler';
|
|
2160
|
-
|
|
2161
|
-
describe('${name} protected performance secret cache lifetime', () => {
|
|
2162
|
-
beforeAll(() => {
|
|
2163
|
-
process.env.EBK_PERFORMANCE_ACCOUNT_FINGERPRINT =
|
|
2164
|
-
'sha256:' + 'a'.repeat(64);
|
|
2165
|
-
process.env.EBK_PERFORMANCE_CANDIDATE_DIGEST = 'b'.repeat(64);
|
|
2166
|
-
process.env.EBK_PERFORMANCE_LOAD_ENABLED = 'true';
|
|
2167
|
-
process.env.EBK_PERFORMANCE_ORIGIN =
|
|
2168
|
-
'https://performance.example.test';
|
|
2169
|
-
process.env.EBK_PERFORMANCE_REGION = 'us-east-1';
|
|
2170
|
-
process.env.EBK_PERFORMANCE_RELEASE_ID = 'release-handler-test';
|
|
2171
|
-
process.env.EBK_PERFORMANCE_RELEASE_MATERIAL_DIGEST = 'd'.repeat(64);
|
|
2172
|
-
process.env.EBK_PERFORMANCE_SLICE = '${name}';
|
|
2173
|
-
process.env.EBK_SOURCE_COMMIT = 'c'.repeat(40);
|
|
2174
|
-
process.env.EBK_STAGE = '${rehearsalStage}';
|
|
2175
|
-
});
|
|
2176
|
-
|
|
2177
|
-
it('reuses one resolver across requests so declaration TTL is effective', async () => {
|
|
2178
|
-
const endpoint =
|
|
2179
|
-
'https://performance.example.test/${name}/__ebk/performance/api-lambda';
|
|
2180
|
-
await expect(
|
|
2181
|
-
runPerformanceScenarioEndpoint(
|
|
2182
|
-
'ebk-api-lambda-v1',
|
|
2183
|
-
new Request(endpoint),
|
|
2184
|
-
),
|
|
2185
|
-
).resolves.toMatchObject({ status: 200 });
|
|
2186
|
-
await expect(
|
|
2187
|
-
runPerformanceScenarioEndpoint(
|
|
2188
|
-
'ebk-api-lambda-v1',
|
|
2189
|
-
new Request(endpoint),
|
|
2190
|
-
),
|
|
2191
|
-
).resolves.toMatchObject({ status: 200 });
|
|
2192
|
-
expect(mocks.createSecretRuntime).toHaveBeenCalledTimes(1);
|
|
2193
|
-
expect(mocks.runWithSecret).toHaveBeenCalledTimes(2);
|
|
2194
|
-
});
|
|
2195
|
-
});
|
|
2196
|
-
`,
|
|
2197
|
-
...{},
|
|
2198
|
-
'web/src/app/%5F%5Febk/performance/api-lambda/route.ts': `import 'server-only';
|
|
2199
|
-
import { runPerformanceScenarioEndpoint } from '../handler';
|
|
2200
|
-
|
|
2201
|
-
export function GET(request: Request) {
|
|
2202
|
-
return runPerformanceScenarioEndpoint('ebk-api-lambda-v1', request);
|
|
2203
|
-
}
|
|
2204
|
-
`,
|
|
2205
|
-
'web/src/app/%5F%5Febk/performance/async-worker/route.ts': `import 'server-only';
|
|
2206
|
-
import { runPerformanceScenarioEndpoint } from '../handler';
|
|
2207
|
-
|
|
2208
|
-
export function POST(request: Request) {
|
|
2209
|
-
return runPerformanceScenarioEndpoint('${asyncAdapter}', request);
|
|
2210
|
-
}
|
|
2211
|
-
`,
|
|
2212
|
-
'web/src/app/%5F%5Febk/performance/async-worker/cleanup/route.ts': `import 'server-only';
|
|
2213
|
-
import { runPerformanceCleanupEndpoint } from '../../handler';
|
|
2214
|
-
|
|
2215
|
-
export function POST(request: Request) {
|
|
2216
|
-
return runPerformanceCleanupEndpoint('${asyncAdapter}', request);
|
|
2217
|
-
}
|
|
2218
|
-
`,
|
|
2219
|
-
'web/src/app/%5F%5Febk/performance/database/route.ts': `import 'server-only';
|
|
2220
|
-
import { runPerformanceScenarioEndpoint } from '../handler';
|
|
2221
|
-
|
|
2222
|
-
export function POST(request: Request) {
|
|
2223
|
-
return runPerformanceScenarioEndpoint('${databaseAdapter}', request);
|
|
2224
|
-
}
|
|
2225
|
-
`,
|
|
2226
|
-
'web/src/app/%5F%5Febk/performance/database/cleanup/route.ts': `import 'server-only';
|
|
2227
|
-
import { runPerformanceCleanupEndpoint } from '../../handler';
|
|
2228
|
-
|
|
2229
|
-
export function POST(request: Request) {
|
|
2230
|
-
return runPerformanceCleanupEndpoint('${databaseAdapter}', request);
|
|
2231
|
-
}
|
|
2232
|
-
`,
|
|
2233
|
-
'docs/runbooks/performance-capacity-cost.md': `# Performance, capacity, and cost
|
|
2234
|
-
|
|
2235
|
-
${`The default database scenarios use DynamoDB, not PostgreSQL. The database
|
|
2236
|
-
request signal measures the complete protected write/consistent-read operation
|
|
2237
|
-
against a one-second budget; it is a latency proxy, not connection count or
|
|
2238
|
-
measured DynamoDB service saturation. The async signal measures this run's
|
|
2239
|
-
unprocessed synthetic effects against its configured maximum. Expired but
|
|
2240
|
-
uncleaned effects remain counted until cleanup, so the signal is conservative.
|
|
2241
|
-
The backlog observation is a run-bound sample shared for at most one second
|
|
2242
|
-
inside each warm worker process. Concurrent requests reuse that sample instead
|
|
2243
|
-
of rescanning the pending collection per request; separate processes may sample
|
|
2244
|
-
independently. This is a bounded operational signal, never authorization or a
|
|
2245
|
-
global account-wide counter. Cleanup and async processing invalidate the local
|
|
2246
|
-
sample; exact per-request identity and effect checks are never cached.
|
|
2247
|
-
Neither signal claims account-wide capacity. Cold Aurora resume and idle cost
|
|
2248
|
-
apply only after SQL is explicitly declared; default key-value tests do not
|
|
2249
|
-
prove that relational acceptance. The signed-request, release, target, quota,
|
|
2250
|
-
and exact run-cleanup requirements are unchanged.
|
|
2251
|
-
|
|
2252
|
-
Explicit run cleanup closes the exact run before removing effects in bounded
|
|
2253
|
-
chunks. A progress response is not acceptance: the harness follows signed
|
|
2254
|
-
continuations within its existing deadline and accepts only \`run-absent\` with
|
|
2255
|
-
zero remaining effects. If interrupted or timed out, retain the run identity
|
|
2256
|
-
and retry its protected cleanup; never reopen the closed run or fabricate an
|
|
2257
|
-
absence receipt. Expiry maintenance remains the bounded recovery path.
|
|
2258
|
-
|
|
2259
|
-
Native expiry cleanup drains bounded exact pages within a shared four-minute
|
|
2260
|
-
invocation budget. It inspects at most 10,000 provider receipts and 5,000
|
|
2261
|
-
performance records per invocation; limits and time exhaustion retain cursors
|
|
2262
|
-
and report continuation. Provider receipts are removed after thirty days only
|
|
2263
|
-
when terminal; uncertain effects stay retained for reconciliation. Performance
|
|
2264
|
-
effects expire after twenty-four hours, with request/run audit history retained
|
|
2265
|
-
for thirty days after run expiry. Logical request expiry, not physical deletion
|
|
2266
|
-
or DynamoDB TTL timing, prevents replay.
|
|
2267
|
-
|
|
2268
|
-
Overdue effect deletion and its deadline report commit atomically. Reports stay
|
|
2269
|
-
durable until metric emission and acknowledgement succeed; a lost acknowledgement
|
|
2270
|
-
may repeat the breach metric. A partial scan does not emit a fabricated zero
|
|
2271
|
-
backlog. Each run reports \`PerformanceLoadCleanupContinuationRequired\` (1 when
|
|
2272
|
-
its inventory was incomplete); \`performance-load-cleanup-backlog\` alarms when
|
|
2273
|
-
every run in three consecutive hours reported 1. One interrupted run can need
|
|
2274
|
-
several runs to converge, because a resumed scan rescans from the start; a
|
|
2275
|
-
cadence slower than hourly can leave the alarm unable to fire. Require
|
|
2276
|
-
complete-scan evidence and no continuation or pending deadline
|
|
2277
|
-
reports before retiring an old signing key. Explicit maintenance pauses retain
|
|
2278
|
-
their existing behavior and can delay cleanup; selecting a capacity profile
|
|
2279
|
-
does not resume this worker.
|
|
2280
|
-
|
|
2281
|
-
`}\
|
|
2282
|
-
The generated policy is deliberately an unadopted seed. Replace example budgets,
|
|
2283
|
-
unknown capacity values, owner, review date, and allocation drivers from actual
|
|
2284
|
-
product requirements before protected promotion. Reliability remains authority
|
|
2285
|
-
for journey/SLO, alarm, and routing semantics; release and repository policy
|
|
2286
|
-
remain authority for candidate and production-profile identity. The performance
|
|
2287
|
-
contract consumes those files through explicit hooks and does not duplicate
|
|
2288
|
-
their schemas.
|
|
2289
|
-
|
|
2290
|
-
Keep warm/cold and cache hit/miss populations separate. Record p50, p95, and p99
|
|
2291
|
-
where meaningful, achieved throughput, the first exhausted dependency, quota
|
|
2292
|
-
headroom, and the scenario/tool/network limits. Estimates, test measurements,
|
|
2293
|
-
and delayed actual billing are different provenance classes. Never label a
|
|
2294
|
-
forecast or rehearsal-stage measurement as production actual.
|
|
2295
|
-
|
|
2296
|
-
Generated Product Slices relay the transactional outbox every minute in
|
|
2297
|
-
production. Nonproduction stages use a fifteen-minute relay cadence so an
|
|
2298
|
-
idle Aurora Serverless v2 database can pass its five-minute auto-pause window.
|
|
2299
|
-
That cost-aware nonproduction default intentionally permits up to fifteen
|
|
2300
|
-
minutes of event-delivery latency; use an explicit protected design change if a
|
|
2301
|
-
nonproduction product requires production-like latency.
|
|
2302
|
-
|
|
2303
|
-
Local commands can validate policy, budgets, capacity, and tag coverage. They
|
|
2304
|
-
cannot run protected load. The protected workflow must call
|
|
2305
|
-
\`performance-load-guard.mjs\` immediately before an allowlisted runner and
|
|
2306
|
-
must bind the exact candidate, target account, Region, endpoint, maximum
|
|
2307
|
-
concurrency/rate/requests/duration/cost, stop conditions, cleanup, and emergency
|
|
2308
|
-
termination. Production load is exceptional and requires explicit human
|
|
2309
|
-
evidence; prefer the rehearsal stage, synthetics, canaries, and production observation.
|
|
2310
|
-
The dedicated protected performance role must allow \`ssm:GetParameter\` on
|
|
2311
|
-
the one exact retained \`/ebk/<stage>/workspace-owner\` parameter and must not
|
|
2312
|
-
allow owner-record mutation. Both the runner and cleanup recheck that record
|
|
2313
|
-
before their first remote application-data mutation, bind \`AWS_REGION\` to the
|
|
2314
|
-
claimed tuple, and then remove raw AWS session credentials from their own
|
|
2315
|
-
process environment before issuing HTTP load or cleanup requests.
|
|
2316
|
-
The three base-Slice managed adapters use fixed API/Lambda, async-worker, and database
|
|
2317
|
-
request/cleanup paths. They remain disabled unless the deployed ${rehearsalStage}
|
|
2318
|
-
environment binds the exact plan, run, release, source commit, scenario, signal,
|
|
2319
|
-
adapter, exact Slice URL, and deployment-bound HMAC key ID. The workflow obtains
|
|
2320
|
-
only the current per-Slice signer from the exact AWSCURRENT Secrets Manager
|
|
2321
|
-
generation after OIDC target verification. Each response must return an
|
|
2322
|
-
exact-release JSON telemetry envelope for its reviewed saturation signal.
|
|
2323
|
-
Adding a generated Service promotes its reserved scenario to the managed
|
|
2324
|
-
Service runtime endpoint, exact per-task admission signal, and cleanup ledger;
|
|
2325
|
-
before that generator runs, Service load remains explicitly blocked.
|
|
2326
|
-
Next/Lambda heap data is never relabeled as Service evidence. The runner
|
|
2327
|
-
computes estimated test cost from the reviewed per-request
|
|
2328
|
-
scenario value; target headers are never cost authority. Async and database
|
|
2329
|
-
adapters persist a deterministic cleanup identity before each request and
|
|
2330
|
-
cleanup must prove every identity absent, including after a runner crash.
|
|
2331
|
-
The plan target is the exact fixed adapter request URL—not merely an origin or
|
|
2332
|
-
base path—so target approval and the URL actually exercised remain identical.
|
|
2333
|
-
The scenario signal must resolve exactly one capacity resource in the
|
|
2334
|
-
plan-bound policy; the report binds the adapter and complete scenario-contract
|
|
2335
|
-
digest so changed cost, signal, or adoption material cannot reuse evidence.
|
|
2336
|
-
|
|
2337
|
-
## Performance load HMAC rotation
|
|
2338
|
-
|
|
2339
|
-
The HMAC secret is scoped to one Slice and contains exact \`current\` and
|
|
2340
|
-
optional \`previous\` records. The endpoint keeps one resolver for the deployed
|
|
2341
|
-
web workload, caches a successful AWSCURRENT read for at most one second, and
|
|
2342
|
-
has no stale fallback. Execution accepts only \`current\`; cleanup accepts
|
|
2343
|
-
\`current\` or the immediately previous generation so an interrupted old run
|
|
2344
|
-
can remove its effects. This control-plane read rate and the corresponding
|
|
2345
|
-
Secrets Manager request cost belong in the load cost model.
|
|
2346
|
-
|
|
2347
|
-
Each \`secret\` is the canonical unpadded base64url encoding of exactly 32
|
|
2348
|
-
cryptographically random bytes (43 characters). Generate a new value with a
|
|
2349
|
-
reviewed cryptographic random-byte source; a long passphrase, repeated text, or
|
|
2350
|
-
arbitrary 32-character string is rejected.
|
|
2351
|
-
|
|
2352
|
-
For routine rotation, disable new performance runs, publish
|
|
2353
|
-
\`{ current: new, previous: old }\`, deploy, and prove every endpoint observes
|
|
2354
|
-
the new key within the one-second cache bound. Then switch the protected signer
|
|
2355
|
-
to the new current key and re-enable new runs. Retain previous until all jobs
|
|
2356
|
-
signed by it are terminal, cleanup and expiry backlogs are zero, and both the
|
|
2357
|
-
24-hour authorization window and subsequent 24-hour cleanup window have
|
|
2358
|
-
elapsed. Do not start another rotation or retire previous during that overlap.
|
|
2359
|
-
The hourly worker measures residue at least 24 hours past its
|
|
2360
|
-
eligible expiry, emits \`PerformanceLoadCleanupDeadlineBreaches\`, and fails the
|
|
2361
|
-
invocation so the dedicated alarm cannot silently clear. This is an executable
|
|
2362
|
-
deadline-violation signal, not a claim that deletion succeeds through an AWS or
|
|
2363
|
-
database outage. Previous-key retirement remains a protected operator action;
|
|
2364
|
-
operators must not retire it while either cleanup metric is nonzero.
|
|
2365
|
-
For suspected compromise, disable the workflow and endpoint first, rotate,
|
|
2366
|
-
redeploy, and investigate before restoring access.
|
|
2367
|
-
|
|
2368
|
-
Evidence retains only the bounded HMAC key ID. Never log, hash, upload, or place
|
|
2369
|
-
the secret in GitHub environment output. Live rotation evidence must show
|
|
2370
|
-
current execution succeeds, previous execution fails, previous cleanup
|
|
2371
|
-
succeeds, retired cleanup fails, cross-Slice substitution fails, and no secret
|
|
2372
|
-
sentinel appears in logs or retained artifacts.
|
|
2373
|
-
|
|
2374
|
-
## AWS cost controls
|
|
2375
|
-
|
|
2376
|
-
Protected deployments fail until the seeded cost policy names a real owner, a
|
|
2377
|
-
future review instant, and declares the account, pilot, anomaly, notification,
|
|
2378
|
-
and per-test values adopted. Stable v1 provisions these controls only in the
|
|
2379
|
-
commercial \`aws\` partition, where the workload account is also the billing
|
|
2380
|
-
authority. GovCloud, China, and isolated partitions fail before resource
|
|
2381
|
-
construction; a separately modeled commercial billing-account provider is
|
|
2382
|
-
required before those partitions can adopt this path. The protected Foundation
|
|
2383
|
-
stack is the sole owner of the account monthly actual/forecast Budget. It
|
|
2384
|
-
publishes the exact policy digest and monthly maximum through Foundation
|
|
2385
|
-
discovery. Production Foundation also owns the account's one AWS Services
|
|
2386
|
-
dimensional Cost Anomaly monitor and immediate SNS subscription; this
|
|
2387
|
-
AWS-managed monitor is supported by both Organizations management and member
|
|
2388
|
-
accounts. Its absolute-impact threshold is five percent of the reviewed
|
|
2389
|
-
monthly account maximum, rounded up to the nearest cent. Every protected
|
|
2390
|
-
Product plan must bind the Foundation cost authority and adopt the same maximum
|
|
2391
|
-
before creating a cost resource. Product stacks create no account anomaly
|
|
2392
|
-
resources, avoiding unsupported custom monitors, duplicate global alerts, and
|
|
2393
|
-
the one-per-account AWS Services monitor quota. The ${rehearsalStageTitle} Product stack creates
|
|
2394
|
-
the lower pilot monthly Budget filtered to the exact
|
|
2395
|
-
\`ebk:slice\` and \`ebk:stage=${rehearsalStage}\` allocation tags. Other stages
|
|
2396
|
-
outside the profile's rehearsal and production stages create none of
|
|
2397
|
-
these global billing resources.
|
|
2398
|
-
|
|
2399
|
-
Both Budgets and the anomaly subscription route only to the Foundation alert
|
|
2400
|
-
topic and retain the policy digest, semantic route, and named owner in resource
|
|
2401
|
-
tags. The Foundation topic policy must allow only \`sns:Publish\` from
|
|
2402
|
-
\`budgets.amazonaws.com\`, \`costalerts.amazonaws.com\`, and its existing RDS
|
|
2403
|
-
events publisher. These controls notify; generated infrastructure contains no
|
|
2404
|
-
BudgetAction, auto-adjustment, stop, throttle, IAM-policy change, or other
|
|
2405
|
-
automatic spend-changing response. Investigate through the named owner and
|
|
2406
|
-
runbook, then use a separately approved owning tool for any intervention.
|
|
2407
|
-
|
|
2408
|
-
Every supported resource must carry the bounded workspace/Slice/stage/owner/
|
|
2409
|
-
cost-allocation/managed-by/framework tags supplied by the provider baseline.
|
|
2410
|
-
Repository and production-profile tags are supplementary identity on generated
|
|
2411
|
-
resources that explicitly use \`createStandardResourceTags\`; coverage does not
|
|
2412
|
-
claim that SST-owned resources receive them.
|
|
2413
|
-
Unsupported resources remain visible with a reason and shared-cost allocation
|
|
2414
|
-
reference. Never use feature, user, tenant, request, work-item, payload, or raw
|
|
2415
|
-
error identifiers as resource tags or metric dimensions.
|
|
2416
|
-
Tag coverage compares observations with a nonempty exact resource inventory
|
|
2417
|
-
derived from deployment plan/state and bound to the same release; an empty,
|
|
2418
|
-
omitted, extra, or cross-release inventory fails. The external cost collection
|
|
2419
|
-
contract names its adopter-owned read-only collector and requires canonical
|
|
2420
|
-
closed-window AWS Cost Explorer allocation and total queries. Evidence binds
|
|
2421
|
-
the STS-derived account fingerprint, Region, stage, workspace, Slice, period,
|
|
2422
|
-
release/source, request identities, response digests, reconciled allocation
|
|
2423
|
-
rows, and independently sourced aggregate-count evidence. Generation does not
|
|
2424
|
-
manufacture live cost values.
|
|
2425
|
-
The managed PR budget derives its observation directly from the completed
|
|
2426
|
-
Next.js client artifact and does not consume caller-authored measurements.
|
|
2427
|
-
Adopter performance budgets remain a separate readiness and exact-release
|
|
2428
|
-
evaluation. Unit-cost evaluation validates baseline and current billing
|
|
2429
|
-
evidence before it accepts observations. Each of the two capability
|
|
2430
|
-
observations must name the exact allocation and aggregate identifiers, amounts,
|
|
2431
|
-
counts, evidence digests, account, Region, stage, workspace, Slice, period, and
|
|
2432
|
-
release from that validated evidence; clean generation reports the missing live
|
|
2433
|
-
evidence as incomplete.
|
|
2434
|
-
|
|
2435
|
-
The generated scenarios cover API/Lambda, async worker, and DynamoDB-backed
|
|
2436
|
-
database operations. Cold Aurora resume and idle cost are separate acceptance
|
|
2437
|
-
cases only when SQL is declared. A Service extension becomes managed when its
|
|
2438
|
-
Service is generated. Scenarios are disabled until deliberately adopted. A
|
|
2439
|
-
clean generated Slice therefore reports incomplete rather than claiming
|
|
2440
|
-
capacity, cost, or live load evidence.
|
|
2441
|
-
`,
|
|
2442
|
-
};
|
|
2443
|
-
}
|
|
2444
|
-
//# sourceMappingURL=built-in-plan-performance-files.js.map
|