Skip to content

Run 2: Partition Resources

Creates the CDK constructs, stacks, unit tests, CI integration, and verification script for image storage and CDN delivery. Corresponds to Phase 1 and specification.md sections 1-3, 5.

#CriterionVerification CommandExpected Output
1Run 1 exit gate passed./run-1-dns-foundation/validate-exit.shALL CHECKS PASSED
2assetsHostedZone available in ImportingStackgrep assetsHostedZone src/main/cdk/apps/Al1x/util.tsImport code present
3assetsDomain() availablegrep assetsDomain src/main/cdk/platform/ari-configuration.tsFunction present
4Assets zone deployed to target infradig NS alpha002.assets.arda.cardsReturns NS records
5ACM cert issuedaws acm list-certificates --query "CertificateSummaryList[?DomainName=='*.alpha002.assets.arda.cards'].Status"ISSUED
6Worktree createdgit -C <worktree-path> branch --show-currentjmpicnic/image-upload-infrastructure/run-2
ArtifactPathFormatDescription
ImageAssetBucket constructsrc/main/cdk/constructs/storage/image-asset-bucket.tsTypeScriptS3 bucket + presigning role (spec 1.1)
ImageAssetCdn constructsrc/main/cdk/constructs/xgress/image-asset-cdn.tsTypeScriptCloudFront + OAC + DNS (spec 1.2)
CloudFrontSigningKeyGroup constructsrc/main/cdk/constructs/xgress/cloudfront-signing-key-group.tsTypeScriptRSA key pair + Secrets Manager (spec 1.3)
PartitionImageCdnStacksrc/main/cdk/stacks/purpose/partition-image-cdn.tsTypeScriptCDN stack with exports (spec 2.2)
BulkStoresStack modificationsrc/main/cdk/stacks/purpose/partition-bulk-stores.tsTypeScriptAdd ImageAssetBucket (spec 2.1)
Partition wiringsrc/main/cdk/apps/Al1x/partition.tsTypeScriptInstantiate new stack (spec 2.3)
Jest configjest.config.tsTypeScriptTest runner configuration
Construct tests (3 files)src/main/cdk/constructs/**/*.test.tsTypeScriptUnit tests per construct
Stack tests (2 files)src/main/cdk/stacks/purpose/*.test.tsTypeScriptSnapshot + export tests
CI update.github/workflows/ci.yamlYAMLAdd npm test to build job
Verification scripttools/verify-image-cdn.tsTypeScriptEnd-to-end verification
#TaskPersonaDepends OnStatusAcceptance Criteria
Test Infrastructure
2.1Create jest.config.ts with path aliasesdevops-engineerPendingJest runs with arda/* mapped to src/main/cdk/*
2.2Add test, test:ci scripts to package.json; add cdk-nag, @aws-sdk/client-s3, @aws-sdk/client-sts, @aws-sdk/client-secrets-manager, @aws-sdk/s3-presigned-post devDependenciesdevops-engineerPendingnpm test runs (may have 0 tests initially); all SDK deps available for verification script
2.3Add npm test step to .github/workflows/ci.yaml build jobdevops-engineer2.1, 2.2PendingCI build job includes test step after lint (V-113)
CDK Constructs
2.4Implement ImageAssetBucket constructdevops-engineerPendingVersioned, RETAIN, SSE-S3, no expiration, CORS POST, presigning role with conditions (spec 1.1)
2.5Implement CloudFrontSigningKeyGroup constructdevops-engineerPendingRSA key pair, public key in CF key group, private key in Secrets Manager, RETAIN (spec 1.3)
2.6Implement ImageAssetCdn constructdevops-engineer2.4, 2.5PendingOAC origin, HTTPS-only, GET/HEAD, CachingOptimized, PriceClass_100, trusted key groups, custom domain, Route53 A record (spec 1.2)
Stacks and Wiring
2.7Modify BulkStoresStack — add ImageAssetBucket + exportsdevops-engineer2.4PendingNew bucket in Built; 3 new -API- exports (spec 2.1)
2.8Create PartitionImageCdnStack with CDN + signing key group + exportsdevops-engineer2.5, 2.6Pending3 new -API- exports; publish() called (spec 2.2)
2.9Wire PartitionImageCdnStack into partition.tsdevops-engineer2.7, 2.8PendingStack instantiated after bulkStores; uses assetsHostedZone, assetsCertificateArn from ImportingStack (spec 2.3)
Unit Tests
2.10Write ImageAssetBucket unit testsdevops-engineer2.4PendingTests per spec section 5: naming, versioning, RETAIN, SSE, CORS, presigning role conditions, validation
2.11Write ImageAssetCdn unit testsdevops-engineer2.6PendingTests per spec section 5: OAC, HTTPS-only, GET/HEAD, cache policy, key groups, custom domain, validation
2.12Write CloudFrontSigningKeyGroup unit testsdevops-engineer2.5PendingTests per spec section 5: public key, key group, secret, RETAIN
2.13Write BulkStoresStack snapshot testdevops-engineer2.7PendingSnapshot captures new exports; baseline established
2.14Write PartitionImageCdnStack snapshot + export testsdevops-engineer2.8PendingSnapshot captures full stack; 3 exports verified
Verification
2.15Implement verify-image-cdn.ts scriptdevops-engineer2.9PendingSteps 1-11 per spec section 3; exits 0 on success
2.16Run npm run ci-check — all targets synthdevops-engineer2.9PendingZero errors across all infra + partition targets (V-101)
2.17Run npm test — all tests passdevops-engineer2.10-2.14PendingZero failures; cdk-nag passes (V-111, V-112)
Deployment
2.18Deploy to Alpha002/dev and run verify-image-cdn.tsdevops-engineer2.15-2.17Pendingamm.sh Alpha002 dev succeeds; verification script exits 0 (V-102-V-108)
2.19Deploy to Alpha002/stagedevops-engineer2.18Pendingamm.sh Alpha002 stage succeeds; partition has independent image infra (V-109)
2.20Deploy to Alpha001/demodevops-engineer2.18Pendingamm.sh Alpha001 demo succeeds (requires Phase 0 deployed to Alpha001 first)
2.21Deploy to Alpha001/proddevops-engineer2.20Pendingamm.sh Alpha001 prod succeeds; all production partitions operational
2.22Deploy to SandboxKyle002/kyledevops-engineer2.18Pendingamm.sh SandboxKyle002 kyle succeeds (requires Phase 0 deployed to SandboxKyle002 first)
Review
2.23Code review of all constructs and stacksquality-reviewer2.17PendingPatterns match design.md section 3; naming conventions followed; no regressions
2.1, 2.2 (test infra) ──→ 2.3 (CI)
└──→ 2.10-2.14 (unit tests)
2.4 (ImageAssetBucket) ──→ 2.6 (ImageAssetCdn) ──→ 2.8 (CdnStack) ──→ 2.9 (partition.ts)
└──→ 2.7 (BulkStores mod) └──→ 2.15 (verify script)
2.5 (SigningKeyGroup) ──→ 2.6, 2.8
2.4 → 2.10 (bucket tests)
2.5 → 2.12 (signing tests)
2.6 → 2.11 (cdn tests)
2.7 → 2.13 (bulk stores snapshot)
2.8 → 2.14 (cdn stack snapshot)
2.15-2.17 → 2.18 (deploy Alpha002/dev)
2.18 → 2.19 (Alpha002/stage)
2.18 → 2.20 (Alpha001/demo) → 2.21 (Alpha001/prod)
2.18 → 2.22 (SandboxKyle002/kyle)
2.17 → 2.23 (review) — can run in parallel with deployments

Parallelization: Tasks 2.1-2.2 (test infra), 2.4 (bucket), and 2.5 (signing key) can all start simultaneously. Task 2.6 (CDN) requires 2.4 and 2.5. Unit tests can be written alongside or immediately after each construct.

#CriterionVerification CommandExpected Output
1ci-check passesnpm run ci-checkAll targets synth without errors
2npm test passesnpm testZero failures
3Alpha002/dev deployed + verifiedamm.sh Alpha002 dev + verify-image-cdn.tsStacks complete; script exits 0
4Alpha002/stage deployedamm.sh Alpha002 stageAll stacks CREATE/UPDATE_COMPLETE
5Alpha001/demo deployedamm.sh Alpha001 demoAll stacks CREATE/UPDATE_COMPLETE
6Alpha001/prod deployedamm.sh Alpha001 prodAll stacks CREATE/UPDATE_COMPLETE
7SandboxKyle002/kyle deployedamm.sh SandboxKyle002 kyleAll stacks CREATE/UPDATE_COMPLETE
8CI gates PRsOpen test PR with deliberate failurebuild job fails, PR blocked
9Exports present in all partitionsCheck CloudFormation exports per partition6 ImageAsset exports per partition

devops-engineer — de-partition-resources

Section titled “devops-engineer — de-partition-resources”

Implement the CDK constructs, stacks, tests, and verification script for image storage and CDN delivery. Working directory: <worktree-path>.

Follow specification.md for construct interfaces, design.md section 3 for implementation patterns, and specification.md section 5 for testing strategy.

The existing UploadBucket in constructs/storage/public-upload-bucket.ts and ApiCloudFront in constructs/xgress/api-cloudfront.ts are the pattern models. Follow them for structure, naming, validation, and bucket policies. See the specification for specific differences.

Tasks: 2.1 through 2.17 in this plan. Start with test infrastructure (2.1-2.2), then constructs (2.4-2.6), then stacks (2.7-2.9), then tests (2.10-2.14), then verification (2.15-2.17).

Review the CDK constructs, stacks, and tests produced by the devops-engineer. Verify that:

ArtifactSource RunPath
assetsHostedZone importRun 1src/main/cdk/apps/Al1x/util.ts
assetsCertificateArn importRun 1src/main/cdk/apps/Al1x/util.ts
assetsDomain() functionRun 1src/main/cdk/platform/ari-configuration.ts
Deployed assets zone (in AWS)Run 1— (runtime)
Deployed ACM cert (in AWS)Run 1— (runtime)

Artifacts Produced (for subsequent phases)

Section titled “Artifacts Produced (for subsequent phases)”
ArtifactConsumerPath
6 cross-stack exports (3 bucket + 3 CDN)Phase 2 (operations CloudFormation)CloudFormation exports
Signing key in Secrets ManagerPhase 3b (BFF cookie signing)Secrets Manager ARN
CDN domainPhase 2a (CdnUrlResolver)CloudFormation export

Copyright: (c) Arda Systems 2025-2026, All rights reserved