fix: migrate PR preview builds from D1 to PlanetScale#300
fix: migrate PR preview builds from D1 to PlanetScale#300zacjones93 wants to merge 2 commits intomainfrom
Conversation
WalkthroughThe PR removes PR-specific database seeding (scripts and package script), removes the Seed PR Database CI step, adds PlanetScale secrets to deploy/destroy steps, and changes the PlanetScale branch fallback for PR stages from "dev" to "demo". Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/wodsmith-start/alchemy.run.ts (1)
225-241:⚠️ Potential issue | 🟡 MinorUpdate branch hierarchy comment to match PR → demo behavior.
Line 229 still says PR stages use the "dev" branch, but Line 240 now routes PR stages to "demo". This will confuse future edits.
📝 Suggested doc fix
/** * PlanetScale branch hierarchy: * - prod → "main" (production branch, no Branch resource needed) * - dev → branches off main * - demo → branches off main (parallel to dev) - * - pr-N → uses "dev" branch directly (no per-PR branch creation) + * - pr-N → uses "demo" branch directly (no per-PR branch creation) */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/wodsmith-start/alchemy.run.ts` around lines 225 - 241, Update the top comment describing PlanetScale branch hierarchy to match the implemented logic: change the line that currently says "pr-N → uses 'dev' branch directly (no per-PR branch creation)" to indicate PR stages route to the "demo" branch (or otherwise reflect that psBranchName computes pr-* to use "demo") so the documentation matches the code paths involving branchConfig, isPrStage, psBranchName and stage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/wodsmith-start/alchemy.run.ts`:
- Around line 225-241: Update the top comment describing PlanetScale branch
hierarchy to match the implemented logic: change the line that currently says
"pr-N → uses 'dev' branch directly (no per-PR branch creation)" to indicate PR
stages route to the "demo" branch (or otherwise reflect that psBranchName
computes pr-* to use "demo") so the documentation matches the code paths
involving branchConfig, isPrStage, psBranchName and stage.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/deploy.ymlapps/wodsmith-start/alchemy.run.tsapps/wodsmith-start/package.jsonapps/wodsmith-start/scripts/seed-pr.sqlapps/wodsmith-start/scripts/seed-pr.ts
💤 Files with no reviewable changes (3)
- apps/wodsmith-start/scripts/seed-pr.sql
- apps/wodsmith-start/package.json
- apps/wodsmith-start/scripts/seed-pr.ts
- Point PR stages at 'demo' PlanetScale branch instead of 'dev' - Remove dead D1 seed step from deploy workflow - Add PlanetScale secrets to cleanup job for proper teardown - Delete unused seed-pr.ts and seed-pr.sql files - Remove db:seed:pr script from package.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR #295 (Sentry) was based on a commit before the D1 removal and reintroduced the D1Database("db") resource when merged to main. This caused all PR preview builds to fail with 401 trying to create a D1 database that's no longer needed post-PlanetScale migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7ed9568 to
14997e5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/wodsmith-start/alchemy.run.ts (1)
225-230: Update the branch-hierarchy comment to match the new PR fallback.
psBranchNamenow routes PR stages to"demo"(Line 240), but the comment still says PR uses"dev". Please sync this to prevent future confusion.✏️ Suggested fix
- * - pr-N → uses "dev" branch directly (no per-PR branch creation) + * - pr-N → uses "demo" branch directly (no per-PR branch creation)Also applies to: 237-240
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/wodsmith-start/alchemy.run.ts` around lines 225 - 230, Update the PlanetScale branch-hierarchy comment to reflect the new PR fallback: change the line that currently reads "pr-N → uses "dev" branch directly (no per-PR branch creation)" to indicate that PR stages now route to "demo" instead (e.g., "pr-N → routes to 'demo' (no per-PR branch creation)"); make the same update wherever that old description appears near the psBranchName logic (reference symbol: psBranchName) so the comment matches the runtime behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/wodsmith-start/alchemy.run.ts`:
- Around line 225-230: Update the PlanetScale branch-hierarchy comment to
reflect the new PR fallback: change the line that currently reads "pr-N → uses
"dev" branch directly (no per-PR branch creation)" to indicate that PR stages
now route to "demo" instead (e.g., "pr-N → routes to 'demo' (no per-PR branch
creation)"); make the same update wherever that old description appears near the
psBranchName logic (reference symbol: psBranchName) so the comment matches the
runtime behavior.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/deploy.ymlapps/wodsmith-start/alchemy.run.tsapps/wodsmith-start/package.jsonapps/wodsmith-start/scripts/seed-pr.sqlapps/wodsmith-start/scripts/seed-pr.ts
💤 Files with no reviewable changes (3)
- apps/wodsmith-start/scripts/seed-pr.sql
- apps/wodsmith-start/package.json
- apps/wodsmith-start/scripts/seed-pr.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/deploy.yml
Summary
demoPlanetScale branch (wasdev) so previews share demo data with no seeding neededseed-pr.ts,seed-pr.sql, anddb:seed:prscriptTest plan
demoPlanetScale branch🤖 Generated with Claude Code
Summary by cubic
Migrate PR preview builds from D1 to PlanetScale/Hyperdrive and fix a D1 resource regression that broke PR builds. Previews now use the PlanetScale demo branch, share demo data without seeding, and clean up resources on close.
Written for commit 14997e5. Summary will update on new commits.
Summary by CodeRabbit