Conversation
…visioning Two fidelity mismatches on the same block, both of which left a CFN-provisioned SPA distribution with no deep-link fallback. Translating the CFN block ran each rule through `serde_json::from_value` into the wire struct and dropped anything that failed. CloudFormation types `ResponseCode` as an Integer while the CloudFront API carries it as a string, so every rule failed to deserialize and the distribution came out with `Quantity: 0`. Map the fields explicitly instead, coercing the number and accepting the quoted form YAML templates and resolved intrinsics produce. A rule missing the required `ErrorCode` is skipped rather than defaulted to a code that would match nothing. `ErrorCachingMinTTL` then still failed to round-trip: `rename_all = "PascalCase"` renders it `ErrorCachingMinTtl`, so the field was mis-named on the wire and dropped on parse from real SDK requests. Pin the AWS spelling, as `WebACLId` in the same file already does.
This branch has not been deployed
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.
Two fidelity mismatches on the same block, both of which left a
CFN-provisioned SPA distribution with no deep-link fallback.
Translating the CFN block ran each rule through
serde_json::from_valueinto the wire struct and dropped anything that failed. CloudFormation
types
ResponseCodeas an Integer while the CloudFront API carries it asa string, so every rule failed to deserialize and the distribution came
out with
Quantity: 0. Map the fields explicitly instead, coercing thenumber and accepting the quoted form YAML templates and resolved
intrinsics produce. A rule missing the required
ErrorCodeis skippedrather than defaulted to a code that would match nothing.
ErrorCachingMinTTLthen still failed to round-trip:rename_all = "PascalCase"renders itErrorCachingMinTtl, so the field was mis-namedon the wire and dropped on parse from real SDK requests. Pin the AWS
spelling, as
WebACLIdin the same file already does.Test plan
Regression test:
cfn_provisions_spa_custom_error_responsesincrates/fakecloud-e2e/tests/cloudformation_cloudfront.rsVerification
On this exact head, rebased onto current
main:cargo fmt --all --check- clean.cargo clippy --workspace --all-targets -- -D warnings- clean.cargo test --workspaceexcludingfakecloud-e2e,fakecloud-conformance,fakecloud-tfaccandfakecloud-parity(the same set CI'stestjob runs),plus
cargo test -p fakecloud-conformance --lib- 9836 passed, 1 failed(
--no-fail-fast,--test-threads=4). The failure is infakecloud-ssm(
service::tests::send_command_completion_persists_success); an earlier runof the same command failed its sibling
rearm_in_flight_commands_settles_restored_pendinginstead. Both read thelast durable snapshot right after the in-memory status flips to
Successwhile the save is asynchronous, and they fail 4 of 11 runs on untouched
mainon this machine. This branch does not touch SSM.cargo test -p fakecloud-e2e --test cloudformation_cloudfront- theregression test above passes against a freshly built
target/debug/fakecloud.Found by deploying a CDK CloudFront + S3 SPA against fakecloud.
Summary by cubic
Fixes CloudFormation provisioning so CloudFront distributions keep their
CustomErrorResponses(the SPA deep-link fallback) instead of provisioning withQuantity: 0.Two mismatches caused the loss:
ResponseCodeas an Integer while the CloudFront API carries it as a string, so translating each rule throughserde_json::from_valueinto the wire struct failed and silently dropped every rule. Fields are now mapped explicitly, coercing the number and accepting quoted values from YAML templates and resolved intrinsics.ErrorCachingMinTTLwas emitted asErrorCachingMinTtlbyrename_all = "PascalCase"and dropped on parse; the AWS spelling is now pinned, asWebACLIdalready is.Rules missing the required
ErrorCodeare skipped rather than defaulted to a code that would match nothing. Adds a regression test.Written for commit a951ab7. Summary will update on new commits.