Skip to content

feat(aws): BucketDeployment composite (#1139) - #1921

Merged
lex00 merged 1 commit into
mainfrom
feat/1139-bucket-deployment
Aug 25, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/1139-bucket-deployment

Conversation

@lex00

@lex00 lex00 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the bucket-deployment composite gap from #1139 (the epic stays open — this closes one of seven listed composite gaps, not the epic): s3deploy.BucketDeployment is the aws-bench corpus's most-used CDK pattern, 37 instantiations across 8 real apps, with no chant equivalent before this.

  • lexicons/aws/src/composites/bucket-deployment.ts — BucketDeployment: an AWS::S3::Bucket encrypted and public-access-blocked by default (matching LambdaS3's existing bucket shape), with an opt-in website shape (opens the access block, sets WebsiteConfiguration, attaches a scoped AWS::S3::BucketPolicy for s3:GetObject), optional versioned, and a removalPolicy ("retain" | "destroy", mapped to DeletionPolicy) for the epic's "cleanup" half. defaults.bucket / defaults.bucketPolicy escape hatches follow the standing convention.

Design choice, per the task's own steer: deploy-time content upload — the actual thing CDK's BucketDeployment does at deploy time via a Lambda-backed custom resource — has no CloudFormation resource shape, so it does not belong in a Composite() that only emits fixed CFN resources. chant already ships the mechanism for this: the s3-sync capability (lexicons/aws/src/components/apply.ts's createS3SyncCapability, real aws s3 sync/cp via CloudExecutor, typed step-builder s3Sync in ../components/builders.ts) — it shipped in #566 but had no composite pairing it with a bucket to sync into until this one. This composite is that pairing point; a component composes BucketDeployment({...}) with an s3Sync({ from, to: Sub\s3://${bucket.Ref}` })deploy step. No CFN custom-resource / Lambda-backed provisioner exists anywhere in chant (verified), and inventing one to reproduce aPutObjectloop would be new plumbing for an already-solved problem — the epic's own note thatAwsCustomResource` maps to chant Ops, not composites, points the same direction. This is documented in the composite's file-header docstring.

Floci gap found while verifying: deploying the exact CFN shape this composite produces (bucket with encryption/public-access-block/website/tags + a sibling BucketPolicy) against floci/floci:1.5.34 reaches CREATE_COMPLETE, but only BucketEncryption is actually applied — WebsiteConfiguration, PublicAccessBlockConfiguration and Tags are silently dropped, and the BucketPolicy resource applies nothing at all (PutBucketPolicy never called). All four round-trip correctly through the plain S3 API when set directly. Logged as entry 11 in test/floci-gaps.md — this is emulator behavior, not a composite bug (chant graph on the composite emits every property correctly).

Test plan

  • npx vitest run lexicons/aws/src/composites/bucket-deployment.test.ts — 8 new tests (default private+retain shape, bucketName/versioning, removalPolicy: destroy → DeletionPolicy: Delete, website shape opens the access block + attaches the scoped policy, website without errorDocument, tags pass-through, defaults.bucket/defaults.bucketPolicy escape hatches)
  • npx vitest run lexicons/aws/src/composites/barrel.test.ts — confirms BucketDeployment reaches the package root, not just composites/index
  • npx tsc --noEmit -p lexicons/aws/tsconfig.build.json — clean
  • just check-lexicons — clean
  • npx vitest run lexicons/aws — 122 files, 1596 passed / 2 skipped (pre-existing skips, unrelated)
  • Live Floci verification (floci/floci:1.5.34 via Docker) of the exact CFN shape this composite emits — CREATE_COMPLETE, gap found and logged rather than hidden

🤖 Generated with Claude Code

https://claude.ai/code/session_013GoZx3iYpaQxKNCNxguYvT

@lex00
lex00 force-pushed the feat/1139-bucket-deployment branch from 4a5094e to 0ac28f4 Compare August 25, 2026 05:32
… content (#1139)

Adds lexicons/aws/src/composites/bucket-deployment.ts: encrypted,
access-blocked-by-default S3 bucket with a website/public-read shape and a
removalPolicy (DeletionPolicy) escape hatch. The most-used aws-bench CDK
pattern (37 instantiations, chant#1139) had no chant equivalent.

Content upload — the deploy-time half of CDK's BucketDeployment — has no
CloudFormation resource shape, so it stays out of the composite; it pairs
with the existing s3-sync capability (lexicons/aws/src/components/apply.ts,
shipped in #566, unpaired with any composite until now) rather than
inventing custom-resource machinery chant doesn't have.

Building it against Floci turned up a real emulator gap, logged as entry 11
in test/floci-gaps.md: the S3 CloudFormation provider applies
BucketEncryption but silently drops WebsiteConfiguration,
PublicAccessBlockConfiguration and Tags, and AWS::S3::BucketPolicy reports
CREATE_COMPLETE while calling PutBucketPolicy never. All four round-trip
fine through the plain S3 API.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GoZx3iYpaQxKNCNxguYvT
@lex00
lex00 force-pushed the feat/1139-bucket-deployment branch from 92b0b4d to 0688290 Compare August 25, 2026 06:28
@lex00
lex00 merged commit 9401305 into main Aug 25, 2026
5 checks passed
@lex00
lex00 deleted the feat/1139-bucket-deployment branch August 25, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant