feat(cloudfront): scaffold service + distributions, invalidations, tags#778
Merged
vieiralucas merged 5 commits intomainfrom Apr 26, 2026
Merged
Conversation
First batch of CloudFront control-plane support: 29 ops covering distribution CRUD with ETag/If-Match concurrency, invalidations, tags, alias and web ACL associations, and the read-only "by predicate" listings. The remaining 138 ops (OAC, cache/origin/response policies, Functions, key groups, OAIs, streaming distributions, field-level encryption, real-time logs, monitoring, VPC origins, anycast IP lists, trust stores, distribution tenants, connection groups/functions, resource policy) ship in subsequent batches. * `fakecloud-cloudfront` crate with REST-XML routing, typed `DistributionConfig` model that round-trips origins, cache behaviors, custom error responses, viewer certificates, geo restrictions, and tenant config via `quick-xml` * `cloudfront` registered on the `cloudfront` SigV4 endpoint, added to the REST-XML services list in `fakecloud-core` * Idempotent `CallerReference` enforcement returns `DistributionAlreadyExists` * `UpdateDistribution` and `DeleteDistribution` enforce `If-Match`; `DeleteDistribution` rejects enabled distributions * `CreateInvalidation` returns `Completed` immediately so tests don't need to poll, mirroring the deterministic shape used by ECS/RDS lifecycles * 15 unit tests, 6 SDK e2e tests (incl. complex `DistributionConfig` round-trip), 14 conformance tests pinned to AWS Smithy checksums * `aws-sdk-cloudfront` wired into `fakecloud-testkit` behind `sdk-clients` * Audit mapping + service-map + update script include `cloudfront` * README, services index, and per-service `cloudfront.md` page reflect the new service and call out which surfaces remain for follow-up batches
…front-distributions
There was a problem hiding this comment.
4 issues found across 25 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-cloudfront/src/service.rs">
<violation number="1" location="crates/fakecloud-cloudfront/src/service.rs:466">
P2: `CopyDistribution` skips caller-reference validation, so it can create distributions with an empty `CallerReference` that other distribution write paths reject.</violation>
<violation number="2" location="crates/fakecloud-cloudfront/src/service.rs:879">
P1: Response XML includes unescaped user-provided fields, which can produce malformed XML for valid inputs containing XML metacharacters.</violation>
</file>
<file name="crates/fakecloud-server/src/main.rs">
<violation number="1" location="crates/fakecloud-server/src/main.rs:1956">
P2: CloudFront state is registered but not wired into reset handling, so reset endpoints won’t clear CloudFront resources.</violation>
</file>
<file name="website/content/docs/services/cloudfront.md">
<violation number="1" location="website/content/docs/services/cloudfront.md:61">
P2: The smoke-test `create-invalidation` command passes both `--paths` and `--invalidation-batch`, but these options are mutually exclusive in AWS CLI.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- Escape XML metacharacters in user-supplied fields (Comment, WebACLId, WebACLArn, tag keys/values, distribution Id/ARN/Status/DomainName, invalidation Id/Status) when emitting hand-rolled XML response bodies. Quick-XML's serde-driven path already escapes correctly; the leak was in the manual `format!`-based responses for `Distribution`, `DistributionList`, `InvalidationList`, `Tags`, `Associate/DisassociateDistributionWebACLResult`. Add an `xml_escape` unit test that round-trips `&<>` in both Tags and the Comment field and asserts they never appear unescaped in either response shape. - Validate `CallerReference` in `CopyDistribution`. The other two write paths (Create / CreateWithTags) reject empty references; copy was taking whatever the caller sent and persisting an empty `CallerReference` on the new distribution. - Wire CloudFront state into `ResetState` so `/_fakecloud/reset` and the per-service / per-account reset endpoints clear distributions, invalidations, and tags alongside every other service. Required hoisting `cloudfront_state` ahead of `let reset_state = …`. - Drop the conflicting `--paths` flag from the smoke-test snippet in `cloudfront.md`; AWS CLI rejects `--paths` together with `--invalidation-batch`.
vieiralucas
added a commit
that referenced
this pull request
Apr 26, 2026
…ings Audit was already failing on PR #778 (16 missing tests across AssociateDistributionWebACL, CopyDistribution, CreateDistributionWithTags, DisassociateDistributionWebACL, and 12 ListDistributionsBy* variants). Pre-existing red CI surfaces here — not new with batch 2 — but per 'never merge red CI' policy, fix on the spot. - Add 16 conformance tests with Smithy checksums covering all the by-X listings + WebACL/Copy/WithTags ops. - Fix list_distributions_by response root mapping per AWS spec: cache/origin-request/response-headers/key-group/vpc-origin policy IDs return DistributionIdList; owned-resource returns DistributionIdOwnerList; trust-store/web-acl/anycast/connection-mode/ connection-function/realtime-log return DistributionList.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First batch of CloudFront control-plane support: 29 ops covering distribution CRUD with ETag/If-Match concurrency, invalidations, tags, alias and web ACL associations, and the read-only "by predicate" listings. Adds the
fakecloud-cloudfrontcrate, REST-XML routing, and a typedDistributionConfigmodel that round-trips origins, cache behaviors, custom error responses, viewer certificates, geo restrictions, and tenant config viaquick-xml.The remaining 138 CloudFront ops (OAC, cache/origin/response policies, Functions, key groups, OAIs, streaming distributions, field-level encryption, real-time logs, monitoring, VPC origins, anycast IP lists, trust stores, distribution tenants, connection groups/functions, resource policy) ship in subsequent batches.
Highlights
CallerReferenceenforcement returnsDistributionAlreadyExists(matches AWS).UpdateDistribution/DeleteDistributionenforceIf-Match;DeleteDistributionrejects enabled distributions withDistributionNotDisabled.CreateInvalidationreturnsCompletedimmediately so tests don't need to poll, consistent with how ECS/RDS lifecycles behave in fakecloud.cloudfrontregistered on its SigV4 service name and added to the REST-XML services list infakecloud-core.aws-sdk-cloudfrontwired intofakecloud-testkitbehindsdk-clients.cloudfront.mdpage are updated to reflect the new service and which surfaces remain for follow-up batches.Test plan
cargo test -p fakecloud-cloudfront— 15/15 unit testscargo test -p fakecloud-e2e --test cloudfront— 6/6 SDK e2e (incl. complexDistributionConfiground-trip)cargo test -p fakecloud-conformance --test cloudfront— 14/14 SDK conformance pinned to Smithy checksumscargo clippy --workspace --all-targets -- -D warningscargo fmt --checkSummary by cubic
Adds the first batch of CloudFront control-plane support (29 ops): distribution CRUD with ETag/If-Match, invalidations, tags, and alias/web ACL associations. Registers
cloudfrontas a REST-XML global service, addsfakecloud-cloudfront, updates tests/docs, and wires reset.New Features
CallerReference;If-Matchfor update/delete; delete blocked when enabled.CreateDistributionWithTags,ListTagsForResource,TagResource,UntagResource.CreateInvalidationreturnsCompletedimmediately.aws-sdk-cloudfront; 15 unit, 6 e2e, 14 conformance.websitepage.Bug Fixes
xml_escapeunit test.CallerReferencevalidation inCopyDistribution(reject empty)./_fakecloud/resetto clear per-service/per-account state; align with core response API viabody_stream.--pathsflag from the CloudFront CLI snippet in docs.Written for commit dcf71ea. Summary will update on new commits.