Skip to content

fix: make teardown resilient to already-deleted Neon branches#1289

Merged
Kitenite merged 1 commit into
mainfrom
kitenite/teardown-branch-already-deleted
Feb 8, 2026
Merged

fix: make teardown resilient to already-deleted Neon branches#1289
Kitenite merged 1 commit into
mainfrom
kitenite/teardown-branch-already-deleted

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 8, 2026

Summary

  • Teardown script previously failed hard when the Neon branch was already deleted or didn't exist
  • Now gracefully skips branch deletion when NEON_BRANCH_ID is missing or the branch is gone

Changes

  • Missing NEON_BRANCH_ID: changed from error + exit to warning + skip
  • neonctl branches delete failure: capture stderr and check for "not found" / "does not exist" / "already deleted" / "404" — treat as skip instead of failure
  • Genuine deletion errors still fail with the command output included

Test Plan

  • Delete a workspace whose Neon branch was already manually deleted — teardown should succeed
  • Delete a workspace with no NEON_BRANCH_ID in .env — teardown should skip gracefully
  • Delete a workspace with a valid Neon branch — teardown should delete it as before

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup operations with enhanced error handling that gracefully manages missing branch identifiers and expected deletion failures. The process now continues with warnings instead of stopping prematurely, ensuring cleanup sequences complete successfully in more scenarios while providing better visibility into non-fatal issues.

Skip gracefully instead of failing when NEON_BRANCH_ID is missing or
when the Neon branch has already been deleted / doesn't exist.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 8, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The teardown script now gracefully handles missing Neon branch IDs and certain branch deletion failures by treating them as non-fatal warnings rather than stopping execution, allowing the teardown process to complete successfully even when the branch is already absent.

Changes

Cohort / File(s) Summary
Neon Branch Deletion Error Handling
.superset/teardown.sh
Modified error handling to capture deletion command output and conditionally treat "not found," "does not exist," or "404" error messages as non-fatal warnings instead of failures. When NEON_BRANCH_ID is missing, now emits warning and returns success rather than error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A branch that's gone? No fuss or fluster!
Teardown hops on without disaster
Warnings whisper where errors once barked
The script now shrugs—mission embarked! 🌙

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/teardown-branch-already-deleted

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.

@Kitenite Kitenite merged commit b55e2c4 into main Feb 8, 2026
12 of 13 checks passed
@Kitenite Kitenite deleted the kitenite/teardown-branch-already-deleted branch February 8, 2026 04:35
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 8, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

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