[api] Add idempotent early-exit to setupSandboxHandler#260
[api] Add idempotent early-exit to setupSandboxHandler#260sweetmantech wants to merge 1 commit intotestfrom
Conversation
Check if account already has a valid snapshot + GitHub repo before triggering the background task. Returns early with "already provisioned" to avoid unnecessary task triggers on every login. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
✨ 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 |
Summary
Make
POST /api/sandboxes/setupidempotent by checking if the account already has a valid sandbox before triggering the background task.Changes
lib/sandbox/isSandboxProvisioned.ts— checks snapshot_id + github_repo + expires_at > now()lib/sandbox/setupSandboxHandler.ts— early-exit when already provisionedlib/sandbox/__tests__/isSandboxProvisioned.test.ts(5 tests)lib/sandbox/__tests__/setupSandboxHandler.test.ts(4 tests, +1 new)Linear
MYC-4417
🤖 Generated with Claude Code