feat: add self-hosted Supabase support#2885
feat: add self-hosted Supabase support#2885wwwillchen-bot wants to merge 4 commits intodyad-sh:mainfrom
Conversation
|
@BugBot run |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for self-hosted Supabase instances, enabling users to connect to their private Supabase deployments. It provides a new user interface for configuring the necessary API URL and secret key, ensures these credentials are encrypted for security, and modifies the underlying Supabase management client to correctly route API requests to the specified self-hosted endpoint. This enhancement significantly expands the flexibility and deployment options for users. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 Dyadbot Code Review SummaryVerdict: 🤔 NOT SURE - Potential issues Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard. Issues Summary
🟢 Low Priority Notes (4 items)
🚫 Dropped False Positives (4 items)
Generated by Dyadbot multi-agent code review |
Greptile SummaryThis PR adds first-class support for self-hosted Supabase instances. It introduces a Key changes:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[App has supabaseProjectId] --> B{supabaseMode?}
B -- cloud / null --> C{isSupabaseConnected?}
B -- self-hosted --> D{hasSelfHostedSupabaseConfig?}
C -- yes --> E[getSupabaseClient\nwith org credentials]
C -- no --> F[Skip Supabase operations]
D -- yes --> G[getSupabaseClient\nwith secretKey from settings]
D -- no --> F
G --> H[getSelfHostedConfig\nreads apiUrl + secretKey]
H --> I[SupabaseManagementAPI\nbaseUrl = selfHosted.apiUrl]
E --> J[Token refresh flow\nper-org credentials]
J --> K[SupabaseManagementAPI\nbaseUrl = api.supabase.com]
I --> L[Supabase Operations\nbranches / functions / SQL]
K --> L
style D fill:#f9a,stroke:#c00
style F fill:#fdd,stroke:#c00
|
Additional Comments (1)
When Reset the local state inside the success branch to keep the UI in sync: |
🤖 Claude Code Review SummaryPR Confidence: 3/5Core self-hosted auth bypass and stale-state bugs are fixed, but 4 pre-existing flaky E2E tests remain and no new tests were added for the self-hosted feature. Unresolved Threads
Resolved Threads
Product Principle SuggestionsThe following suggestions could improve rules/product-principles.md to help resolve ambiguous cases in the future:
🤖 Generated by Claude Code |
✅ Claude Code completed successfullySummary
DetailsReview Comments Fixed:
CI Checks:
|
Additional Comments (2)
This function calls
Suggested fix: Route through This ensures the token and base URL always come from the same configuration source.
This function takes a cloud OAuth Since this function's purpose is specifically to enumerate cloud organizations during the OAuth flow, it should always use the cloud URL regardless of self-hosted configuration: |
|
@BugBot run |
Additional Comments (2)
When both self-hosted Supabase and cloud organizations are configured simultaneously, this function calls The same pattern is present in These functions should use the cloud base URL explicitly (since they were called with an // Instead of resolving the cloud client and then calling getSupabaseApiBaseUrl(),
// derive the base URL from the client that was already resolved:
const client = await getSupabaseClientForOrganization(organizationSlug);
const accessToken = (client as any).options.accessToken;
const baseUrl = (client as any).options.baseUrl ?? DEFAULT_SUPABASE_API_URL;
Since this function operates exclusively with a cloud-supplied access token, it should always target the cloud API URL: |
🔍 Dyadbot Code Review SummaryVerdict: 🤔 NOT SURE - Potential issues Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard. Issues Summary
🟢 Low Priority Notes (4 items)
🚫 Dropped False Positives (5 items)
Generated by Dyadbot multi-agent code review |
Add configuration options for self-hosted Supabase instances: - Add selfHostedSupabaseApiUrl and selfHostedSupabaseSecretKey to settings schema - Add UI in SupabaseIntegration to configure self-hosted settings - Update settings encryption/decryption to handle new secret key - Update management client to use self-hosted API URL when configured Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add early self-hosted config check in getSupabaseClient to bypass cloud auth requirement - Remove getAuthorizationHeader global override to prevent token/URL misrouting - Preserve self-hosted settings when disconnecting from Supabase Cloud - Add useEffect to sync local state when settings change externally - Read fresh settings via IPC before saving to avoid stale state overwrites - Add loading/disabled state to Save button during async save Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
184b85e to
3f0cc8b
Compare
|
@BugBot run |
🔍 Dyadbot Code Review SummaryVerdict: 🤔 NOT SURE - Potential issues Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard. Issues Summary
🟢 Low Priority Notes (4 items)
🚫 Dropped False Positives (7 items)
Generated by Dyadbot multi-agent code review |
🎭 Playwright Test Results❌ Some tests failed
Summary: 256 passed, 2 failed, 9 flaky, 6 skipped Failed Tests🍎 macOS
📋 Re-run Failing Tests (macOS)Copy and paste to re-run all failing spec files locally: npm run e2e \
e2e-tests/mcp.spec.ts
|
- Fix guard condition in chat_stream_handlers to check mode-specific credentials - Add app?.supabaseMode to useEffect dependency array in PreviewPanel - Use JSON.stringify for self-hosted URL in generated client code - Remove duplicate disconnect button in self-hosted mode - Hide branch selector for self-hosted (branching not available) - Add field-level validation errors for paired self-hosted fields - Add parent Supabase heading when not connected to cloud - Show self-hosted UI when app is in self-hosted mode even if config is cleared - Replace hardcoded English strings with i18n translation keys - Add supabase CLI state files to .gitignore and remove from tracking - Simplify disconnect handler to avoid stale-read race condition Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@BugBot run |
✅ Claude Code completed successfullySummary
Review Comments Addressed
CI Failures
Files Changed
|
🤖 Claude Code Review SummaryPR Confidence: 3/5All review comments addressed, but the MCP E2E test failures (pre-existing, unrelated) and missing i18n translations in pt-BR/zh-CN locales warrant attention before merge. Unresolved ThreadsNo unresolved threads Resolved Threads
Product Principle SuggestionsNo suggestions - principles were clear enough for all decisions made. 🤖 Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c7de05470
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const supabaseClientCode = await getSupabaseClientCode({ | ||
| projectId: chat.app.supabaseProjectId, | ||
| organizationSlug: chat.app.supabaseOrganizationSlug ?? null, | ||
| mode: chat.app.supabaseMode, |
There was a problem hiding this comment.
Guard self-hosted token counting when config is missing
countTokens now passes chat.app.supabaseMode into the Supabase context helpers, but this path still runs for any chat with supabaseProjectId and does not check whether self-hosted settings are actually configured first. In the reachable case where an app is still linked in self-hosted mode after API URL/secret were cleared in Settings, getSupabaseClientCode throws (Self-hosted Supabase project URL is not configured), causing token counting to fail repeatedly while typing. Add the same mode-aware credential gate used in chat_stream_handlers before calling these helpers.
Useful? React with 👍 / 👎.
Summary
Test plan
🤖 Generated with Claude Code