Skip to content

[api] Add idempotent early-exit to setupSandboxHandler#260

Open
sweetmantech wants to merge 1 commit intotestfrom
sweetmantech/myc-4417-api-add-idempotent-early-exit-to-setupsandboxhandler
Open

[api] Add idempotent early-exit to setupSandboxHandler#260
sweetmantech wants to merge 1 commit intotestfrom
sweetmantech/myc-4417-api-add-idempotent-early-exit-to-setupsandboxhandler

Conversation

@sweetmantech
Copy link
Contributor

Summary

Make POST /api/sandboxes/setup idempotent by checking if the account already has a valid sandbox before triggering the background task.

Changes

  • New: lib/sandbox/isSandboxProvisioned.ts — checks snapshot_id + github_repo + expires_at > now()
  • Edit: lib/sandbox/setupSandboxHandler.ts — early-exit when already provisioned
  • New: lib/sandbox/__tests__/isSandboxProvisioned.test.ts (5 tests)
  • Edit: lib/sandbox/__tests__/setupSandboxHandler.test.ts (4 tests, +1 new)

Linear

MYC-4417

🤖 Generated with Claude Code

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>
@vercel
Copy link
Contributor

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Mar 5, 2026 4:55pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b157130b-7373-49e6-aeca-e6245ca23c99

📥 Commits

Reviewing files that changed from the base of the PR and between 687f410 and 16cbb8d.

⛔ Files ignored due to path filters (2)
  • lib/sandbox/__tests__/isSandboxProvisioned.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/sandbox/__tests__/setupSandboxHandler.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (2)
  • lib/sandbox/isSandboxProvisioned.ts
  • lib/sandbox/setupSandboxHandler.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-4417-api-add-idempotent-early-exit-to-setupsandboxhandler

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.

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