Skip to content

feat: return github_repo and snapshot_id in GET /api/sandboxes#206

Merged
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4143-api-get-apisandboxes-return-github_repo
Feb 4, 2026
Merged

feat: return github_repo and snapshot_id in GET /api/sandboxes#206
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4143-api-get-apisandboxes-return-github_repo

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Feb 4, 2026

Summary

  • Adds snapshot_id and github_repo fields to GET /api/sandboxes response
  • For personal API keys: fetches account's snapshot data from account_snapshots table
  • For org API keys: returns null (no single account to fetch snapshot for)
  • Updates database types to include new github_repo column

Test plan

  • Unit tests added for new functionality (5 new tests)
  • All 12 tests passing
  • Manual testing with personal API key
  • Manual testing with org API key

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Sandbox responses now include snapshot metadata such as snapshot ID and associated GitHub repository information when available, providing enhanced traceability and context for sandbox instances.

- Add snapshot_id and github_repo to response for personal API keys
- Fetch account snapshot data from account_snapshots table
- Return null for both fields when using org keys (no single account)
- Update database types to include github_repo column

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Feb 4, 2026

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

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Feb 4, 2026 6:02pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 34 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.

📝 Walkthrough

Walkthrough

The getSandboxesHandler.ts file is enhanced to include snapshot information in its response. The change adds logic to determine the appropriate account identifier (from either accountId or orgId), retrieves snapshot data using selectAccountSnapshots, and extends the response payload with snapshot_id and github_repo fields.

Changes

Cohort / File(s) Summary
Snapshot Enhancement in Sandbox Handler
lib/sandbox/getSandboxesHandler.ts, package.json
Imports selectAccountSnapshots and adds logic to fetch and include snapshot metadata (snapshot_id and github_repo) in the sandbox response payload. Determines snapshotAccountId from either accountId or orgId, retrieves snapshot data conditionally, and enriches the response structure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🎬 Snapshots now shadow the sandbox scene,
Each grain of context, digitally seen,
With github_repo whispers and IDs so bright,
Your handlers now capture the architectural light! ✨

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning Pull request duplicates snapshot extraction logic across multiple handlers, violating DRY principle and reducing maintainability. Extract snapshot extraction logic into a shared utility function and encapsulate account ID selection logic into a named helper for consistency.

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

✨ 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-4143-api-get-apisandboxes-return-github_repo

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.

Org is an account, so use orgId to fetch snapshot data for org API keys.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fetch sandbox records and snapshot info in parallel using Promise.all.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Generated via: npx supabase gen types typescript --project-id godremdqwajrwazhbrue

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit 81f5391 into test Feb 4, 2026
3 checks passed
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

Comments