feat(infra): #353 enable CloudFront edge invalidation (wire distribution id) — DRAFT, gated on #502 cutover#828
Draft
paulalbert1 wants to merge 1 commit into
Draft
Conversation
…edge invalidation Activates the durable CloudFront-invalidation path shipped dormant in #823/#826. Wires envConfig.cloudFrontDistributionId into the app web task and the cdn-reconcile task environment, so the synchronous post-commit purge (lib/edit/revalidation.ts) and the outbox reconciler both run. Distribution id was deliberately omitted before to keep the path dormant. Per-env: staging -> E17NRWINXLP3B3, prod -> E28NKDFXC7K2ZL (config.ts). The web + cdn-reconcile task roles already carry the matching cloudfront:CreateInvalidation grant (distribution-scoped). The synth-time guard test flips from asserting absence to asserting the prod distribution id. DRAFT / gated: only merge + deploy at the #502 prod edge cutover (CloudFront stays as CDN). The env var needs an explicit cdk deploy Sps-App-<env> + Sps-Etl-<env> (the GitHub workflow only re-rolls the image). Deploy staging first as a canary, then prod. Refs #353
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.
Draft / pre-staged. Do not merge until the #502 prod edge cutover. This is the enable step for the durable CloudFront-invalidation path that shipped dormant in #823 (app outbox + worker) and #826 (CDK schedule/alarm + IAM grants).
What it does
Wires
SCHOLARS_CLOUDFRONT_DISTRIBUTION_ID(fromconfig.ts's already-populatedcloudFrontDistributionId) into theenvironmentof:lib/edit/revalidation.ts invalidateCloudFront)Both task roles already carry the matching
cloudfront:CreateInvalidationgrant (from #826), distribution-scoped. The synth-time guard test flips from asserting the env is absent (dormant) to asserting it equals the prod distribution id.Per-env distribution ids (verified against synth)
E17NRWINXLP3B3E28NKDFXC7K2ZL(Confirmed in the synthesized templates; staging and prod ids do not cross-contaminate.)
Why it's needed
#502 decided (2026-06-03) that CloudFront stays as the CDN (NetScaler inserted between CloudFront and the ALB). So the edge cache is real: without invalidation, a suppressed / edited / renamed page stays edge-cached up to 24h. This closes that gap.
How to land it (operator, at the cutover)
cdk deploy Sps-App-staging+Sps-Etl-stagingfrommaster— staging canary first (the GitHub workflow only re-rolls the image; the env var needs an explicitcdk deploy). Verify a real suppression purges the staging edge and thesps-cdn-reconcile-stagingrule + alarms are healthy.cdk deploy Sps-App-prod+Sps-Etl-prod. Verify the same in prod; close CloudFront-invalidation outbox — PR-2: wire cdk reconciler schedule + alarm (mirror #582) + operator enable (app side merged #823) #353.Verification (local)
tsc + eslint clean; cdk jest 451 passed (snapshots regenerated);
cdk synthexit 0 for all four stacks. Per-env distribution id confirmed in the synthesized app + cdn-reconcile containers.Refs #353. Tracked on the go-live tracker #506 (Gate A).