Skip to content

feat(infra): #353 enable CloudFront edge invalidation (wire distribution id) — DRAFT, gated on #502 cutover#828

Draft
paulalbert1 wants to merge 1 commit into
masterfrom
feat/353-enable-cdn-invalidation
Draft

feat(infra): #353 enable CloudFront edge invalidation (wire distribution id) — DRAFT, gated on #502 cutover#828
paulalbert1 wants to merge 1 commit into
masterfrom
feat/353-enable-cdn-invalidation

Conversation

@paulalbert1

Copy link
Copy Markdown
Contributor

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 (from config.ts's already-populated cloudFrontDistributionId) into the environment of:

  • the app web task → activates the synchronous post-commit edge purge (lib/edit/revalidation.ts invalidateCloudFront)
  • the cdn-reconcile task → activates the outbox reconciler

Both task roles already carry the matching cloudfront:CreateInvalidation grant (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)

  • staging → E17NRWINXLP3B3
  • prod → E28NKDFXC7K2ZL

(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)

  1. Merge this PR.
  2. cdk deploy Sps-App-staging + Sps-Etl-staging from masterstaging canary first (the GitHub workflow only re-rolls the image; the env var needs an explicit cdk deploy). Verify a real suppression purges the staging edge and the sps-cdn-reconcile-staging rule + alarms are healthy.
  3. Then 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 synth exit 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).

…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
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.

CloudFront-invalidation outbox — PR-2: wire cdk reconciler schedule + alarm (mirror #582) + operator enable (app side merged #823)

1 participant