Skip to content

fix(web): stabilize preview deployments#951

Merged
willwashburn merged 1 commit into
mainfrom
codex/fix-preview-cache-policy
May 22, 2026
Merged

fix(web): stabilize preview deployments#951
willwashburn merged 1 commit into
mainfrom
codex/fix-preview-cache-policy

Conversation

@willwashburn
Copy link
Copy Markdown
Member

@willwashburn willwashburn commented May 22, 2026

Summary:

  • Reuse AWS managed CachingDisabled for pr-* SST preview stages.
  • Skip per-PR Cloudflare DNS and ACM certificate provisioning; PR previews now use the generated SST/CloudFront URL.
  • Capture the SST deploy URL and post that actual URL in the PR comment.
  • Keep production and non-PR stages on their configured custom-domain path.
  • Add a changelog entry for the preview deploy fix.

Validation:

  • /Users/will/Projects/AgentWorkforce/relay/node_modules/.bin/prettier --check CHANGELOG.md web/sst.config.ts .github/workflows/preview-web.yml
  • /Users/will/Projects/AgentWorkforce/relay/node_modules/.bin/tsc --noEmit --skipLibCheck --target ES2022 --lib DOM,DOM.Iterable,ES2022 --module ESNext --moduleResolution Bundler --strict --esModuleInterop --types node --typeRoots /Users/will/Projects/AgentWorkforce/relay/node_modules/@types /Users/will/Projects/AgentWorkforce/relay/web/.sst/platform/config.d.ts /private/tmp/relay-preview-cache-policy/web/sst.config.ts
  • node -e "const fs=require('fs'); const yaml=require('/Users/will/Projects/AgentWorkforce/relay/node_modules/js-yaml'); yaml.load(fs.readFileSync('/private/tmp/relay-preview-cache-policy/.github/workflows/preview-web.yml','utf8')); console.log('preview-web.yml ok')"
  • git diff --check origin/main...HEAD
  • GitHub Preview Web (SST) run 26306705944 passed and updated the PR comment to https://d5lbjao1551j2.cloudfront.net

Notes:

  • The original failing run hit CloudFront TooManyCachePolicies while SST was creating WebServerCachePolicy per preview stage.
  • The first PR run got past that blocker, then failed in Cloudflare zone lookup for the per-PR custom domain. This update removes both per-preview quota/failure paths.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an AWS-managed CloudFront "caching disabled" policy constant, makes SST $config.run() async, detects preview stages to omit domain and apply the managed cache policy for previews, returns { url: web.url }, and updates CHANGELOG with the preview behavior.

Changes

PR preview infrastructure and changelog updates

Layer / File(s) Summary
Cache policy constant and preview detection
web/sst.config.ts
Introduces AWS_MANAGED_CACHING_DISABLED_CACHE_POLICY_ID as a CloudFront cache policy ID constant. Changes $config to make run() async and derives isProd and isPreview boolean flags from $app.stage.
Apply cache policy to Nextjs and expose URL
web/sst.config.ts
Conditionally applies the cachePolicy override to sst.aws.Nextjs for PR preview stages while avoiding the domain configuration for previews. Returns { url: web.url } from $config to expose the deployed Next.js URL.
Changelog entry for preview cache policy
CHANGELOG.md
Adds Unreleased Fixed bullet documenting that PR preview deployments reuse AWS-managed disabled cache policies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • AgentWorkforce/cloud#471: Addresses preview-stage CloudFront cache-policy behavior by switching previews to an AWS-managed caching-disabled policy rather than per-preview cache policies.

Possibly related PRs

  • AgentWorkforce/relay#901: Overlaps with prior edits to web/sst.config.ts around preview domain and cache policy handling.

Suggested reviewers

  • khaliqgant

Poem

🐰 Hops through the cloud with cache in hand,
No per-preview DNS to roam the land,
AWS tends the policy so light,
Preview URLs appear in sight,
A rabbit cheers: deploys take flight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description provides a comprehensive summary of changes and validation steps performed, but does not follow the required template structure with dedicated Test Plan and Screenshots sections. Restructure the description to match the template: add a Summary section, create a Test Plan section with checkboxes, and include a Screenshots section if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: stabilizing preview deployments by reusing AWS's managed cache policy instead of creating per-preview policies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-preview-cache-policy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@willwashburn willwashburn force-pushed the codex/fix-preview-cache-policy branch 3 times, most recently from fa950b5 to 1a0a19d Compare May 22, 2026 18:55
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Preview deployed!

Environment URL
Web https://d5lbjao1551j2.cloudfront.net

This preview will be cleaned up when the PR is merged or closed.

@willwashburn willwashburn force-pushed the codex/fix-preview-cache-policy branch from 1a0a19d to c992acd Compare May 22, 2026 19:04
@willwashburn willwashburn changed the title fix(web): reuse managed cache policy for previews fix(web): stabilize preview deployments May 22, 2026
@willwashburn willwashburn merged commit fa3f757 into main May 22, 2026
39 checks passed
@willwashburn willwashburn deleted the codex/fix-preview-cache-policy branch May 22, 2026 19:13
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