Repository navigation
feat(etl): Add integration with new validation endpoint - #41731
Conversation
WalkthroughAdds destination and pipeline validation (API types, client mutations, and UI flow), a helper to build validation payloads, UI to surface aggregated validation failures, simplifies publications selection and list filtering, and minor layout/text adjustments across the replication DestinationPanel. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Form as DestinationForm (index.tsx)
participant Builder as buildDestinationConfigForValidation
participant ValidateDest as useValidateDestinationMutation
participant ValidatePipe as useValidatePipelineMutation
participant API as Validation API
participant UI as ValidationFailuresSection
User->>Form: Submit (create new destination)
Form->>Builder: buildDestinationConfigForValidation(formData)
par Parallel validation
Form->>ValidateDest: mutate(destination config)
Form->>ValidatePipe: mutate(pipeline config)
ValidateDest->>API: POST /platform/replication/{ref}/destinations/validate
ValidatePipe->>API: POST /platform/replication/{ref}/pipelines/validate
end
API-->>ValidateDest: validation_failures[]
API-->>ValidatePipe: validation_failures[]
ValidateDest-->>Form: result
ValidatePipe-->>Form: result
Form->>Form: aggregate & partition failures (critical vs warnings)
alt critical failures exist
Form->>UI: render ValidationFailuresSection(critical + warnings)
UI-->>User: show critical failures (block submission)
else only warnings or none
Form-->>User: proceed to disclaimer / create
end
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
⛔ Snyk checks have failed. 1 issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| namespace: validationNamespace, | ||
| catalogToken: data.catalogToken ?? '', | ||
| s3AccessKeyId: s3Keys.accessKey, | ||
| s3SecretAccessKey: s3Keys.secretKey, |
There was a problem hiding this comment.
Hardcoded Non-Cryptographic Secret
Avoid hardcoding values that are meant to be secret. Found a hardcoded string used in here.
Line 284 | CWE-547 | Priority score 900
Data flow: 2 steps
Step 1
Step 2
There was a problem hiding this comment.
these are red herrings afaict
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (1)
1-143: Fix Prettier formatting issues before merge.The pipeline is reporting code style issues. Please run
prettier --writeon this file to resolve the formatting problems.#!/bin/bash # Description: Run prettier to fix code style issues in the file prettier --write apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
🧹 Nitpick comments (6)
packages/api-types/types/api.d.ts (1)
4636-4639: Consistent deprecation docs onhealthy; consider clarifying “status” referenceMarking both
V1ServiceHealthResponse.healthybooleans as deprecated in favor ofstatusis consistent and non-breaking; this will help nudge clients toward the enum. One optional tweak: for the nestedinfovariant, you might say “Use the top‑levelstatusinstead” to make it explicit whichstatusfield is meant in that context.Also applies to: 4651-4654
apps/studio/data/replication/validate-destination-mutation.ts (2)
33-37: Consolidate duplicatedValidationFailuretype.The
ValidationFailuretype is defined identically in bothvalidate-destination-mutation.tsandvalidate-pipeline-mutation.ts. Consider extracting this to a shared types file to avoid duplication and ensure consistency.Suggested approach
Create a shared types file:
// data/replication/types.ts export type ValidationFailure = { name: string reason: string failure_type: 'critical' | 'warning' }Then import from both mutation files.
97-101: Type assertion could be replaced with runtime validation.Per coding guidelines, prefer runtime validation using zod schemas over type casting. The
as ValidateDestinationResponsecast assumes the API response matches the expected shape without verification.Optional: Add zod validation
+import * as z from 'zod' + +const ValidateDestinationResponseSchema = z.object({ + validation_failures: z.array(z.object({ + name: z.string(), + reason: z.string(), + failure_type: z.enum(['critical', 'warning']), + })), +}) + // In validateDestination function: if (error) { handleError(error) } - return data as ValidateDestinationResponse + return ValidateDestinationResponseSchema.parse(data)apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (1)
3-3: Remove unused import.The
cnutility is imported but not used in this component.-import { cn } from 'ui'apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (2)
90-98: Consider grouping related validation state.Per coding guidelines, related state should be grouped. These validation-related states are updated together and could be consolidated.
Optional: Group validation state
interface ValidationState { hasRun: boolean destinationFailures: ValidationFailure[] pipelineFailures: ValidationFailure[] } const [validationState, setValidationState] = useState<ValidationState>({ hasRun: false, destinationFailures: [], pipelineFailures: [], })
370-373: Acknowledged complexity - consider extraction in future.The existing comment acknowledges this function's complexity. With the addition of validation logic, consider extracting common patterns into custom hooks (e.g.,
useValidationWorkflow,useDestinationSubmission) in a follow-up PR.Would you like me to help sketch out how to extract the validation workflow into a custom hook?
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/data/replication/publications-query.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/data/replication/validate-pipeline-mutation.tspackages/api-types/types/api.d.tspackages/api-types/types/platform.d.ts
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/data/replication/validate-pipeline-mutation.tsapps/studio/data/replication/publications-query.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧠 Learnings (15)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/data/replication/validate-pipeline-mutation.tsapps/studio/data/replication/publications-query.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/data/replication/validate-pipeline-mutation.tsapps/studio/data/replication/publications-query.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxpackages/api-types/types/api.d.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxpackages/api-types/types/platform.d.ts
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.tsx : Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Input_Shadcn_ with type='number' and onChange handler for number input form fields
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Input_Shadcn_ with placeholder for text input form fields
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use useFieldArray from react-hook-form for dynamic add/remove form fields
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.tsx : Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Always wrap form inputs with FormControl_Shadcn_ to ensure proper form integration
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Select_Shadcn_ with SelectTrigger_Shadcn_, SelectContent_Shadcn_, and SelectItem_Shadcn_ for select form fields
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use MultiSelector component from ui-patterns/multi-select for multi-select form fields
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/**/*.{ts,tsx} : Use _Shadcn_ suffixed components (e.g., Input_Shadcn_, Button_Shadcn_) from the ui package where possible
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
📚 Learning: 2025-12-12T11:27:51.417Z
Learnt from: ignaciodob
Repo: supabase/supabase PR: 41291
File: packages/api-types/types/platform.d.ts:7128-7128
Timestamp: 2025-12-12T11:27:51.417Z
Learning: For changes tied to entitlements (e.g., adding a new entitlement like 'security.questionnaire'), do not merge until backend entitlements are confirmed live. Apply a do-not-merge label on such PRs and ensure UI changes that rely on new entitlements are not merged in isolation. In reviews, verify entitlement availability in backend before approving and, if needed, hold UI-only changes until entitlement is active.
Applied to files:
packages/api-types/types/api.d.tspackages/api-types/types/platform.d.ts
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Place submit/cancel buttons in SheetFooter for forms in sheets
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧬 Code graph analysis (4)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.ts (1)
DestinationType(1-1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (2)
apps/studio/data/replication/validate-destination-mutation.ts (1)
ValidationFailure(33-37)apps/studio/data/replication/validate-pipeline-mutation.ts (1)
ValidationFailure(13-17)
apps/studio/data/replication/validate-destination-mutation.ts (1)
apps/studio/data/replication/validate-pipeline-mutation.ts (1)
ValidationFailure(13-17)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (1)
PublicationsComboBox(27-144)packages/ui-patterns/src/admonition.tsx (1)
Admonition(83-180)
🪛 GitHub Actions: Check Code with Prettier
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
[warning] 1-1: Code style issues found in file. Run 'prettier --write' to fix code style issues.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
[warning] 1-1: Code style issues found in file. Run 'prettier --write' to fix code style issues.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
[warning] 1-1: Code style issues found in file. Run 'prettier --write' to fix code style issues.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (27)
apps/studio/data/replication/publications-query.ts (1)
32-40: LGTM! Clean filtering and sorting logic.The filtering of internal publications and empty publications aligns well with the PR's goal of reducing configuration issues. The alphabetical sorting improves UX, and the comments clearly document the reasoning.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx (1)
38-67: LGTM! Excellent simplification of the component.The removal of client-side primary key validation logic in favor of backend validation endpoints significantly simplifies this component. The single warning case for missing publications is clear and sufficient. The updated description accurately reflects the component's purpose.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (2)
83-87: Helpful informational text improves UX.The added note "Publications with no tables are hidden" clearly explains the filtering behavior to users, aligning well with the backend filtering logic in
publications-query.ts. The placement at the top of the dropdown ensures visibility.
20-25: Verify the UX impact of removing the loading state from the trigger button.The
isLoadingCheckprop has been removed, and the trigger button now always shows the staticChevronsUpDownicon instead of a loading indicator. While this simplifies the component and aligns with moving validation to the backend, users no longer receive visual feedback during validation checks on the button itself.Confirm this is the intended UX, especially if validation operations can take noticeable time.
Also applies to: 27-32, 66-68
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx (1)
60-60: The placeholder defaults are correctly implemented and match the backend behavior. No changes needed.
- maxFillMs default (10000ms / 10 seconds): Verified in form initialization (index.tsx:176) and backend schema
- maxStalenessMins default (none): Correctly represents no staleness limit when field is empty, verified in form initialization (index.tsx:181)
The text improvements appropriately communicate actual defaults to users instead of arbitrary examples.
apps/studio/data/replication/validate-destination-mutation.ts (1)
43-102: LGTM!The
validateDestinationfunction is well-structured with proper parameter validation, discriminated union handling for config types, and abort signal support. The error handling correctly uses the sharedhandleErrorutility.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (4)
51-62: LGTM!The
useEffectcorrectly manages the interval lifecycle: resetting the index when hidden, setting up the interval when visible, and cleaning up on unmount or dependency changes.
66-119: LGTM!The overlay UI is well-implemented with smooth animations using
framer-motion. The loading dots with staggered animation provide good visual feedback during validation.
1-1: Run Prettier to fix formatting issues.The pipeline indicates code style issues. Run
prettier --writeon this file.⛔ Skipped due to learnings
Learnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-best-practices.mdc:0-0 Timestamp: 2025-12-11T16:46:18.701Z Learning: Applies to apps/studio/**/*.tsx : Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized childrenLearnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-best-practices.mdc:0-0 Timestamp: 2025-12-11T16:46:18.701Z Learning: Applies to apps/studio/**/*.tsx : Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function referencesLearnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-best-practices.mdc:0-0 Timestamp: 2025-12-11T16:46:18.701Z Learning: Only optimize with useMemo/useCallback after measuring a performance problem; avoid premature optimizationLearnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-best-practices.mdc:0-0 Timestamp: 2025-12-11T16:46:18.701Z Learning: Applies to apps/studio/**/*.tsx : Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
44-49: No changes needed. TheValidationOverlaycomponent is only rendered whenselectedTypeis NOT'Read Replica'(see parentDestinationPanel.tsxline 71). The binary condition correctly handles the only two possible destination types that can reach this component:'BigQuery'and'Analytics Bucket'.Likely an incorrect or invalid review comment.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (2)
11-42: LGTM!The component follows the recommended loading/empty/success rendering pattern with early returns. Boolean variables use proper
hasprefix naming convention per coding guidelines.
44-97: LGTM!The failure and warning sections are well-structured with appropriate visual differentiation. The conditional messaging adapts based on the presence of critical failures, providing clear guidance to users.
apps/studio/data/replication/validate-pipeline-mutation.ts (2)
23-47: LGTM!The
validatePipelinefunction correctly validates required parameters and constructs the API payload with optional batch configuration. The pattern matches the destination validation implementation.
51-61: LGTM!The mutation hook follows the established pattern and is properly typed.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (5)
308-368: LGTM!The
validateConfigurationfunction properly orchestrates parallel validation usingPromise.allSettled, which ensures both validations complete even if one fails. The distinction between request errors and validation failures is handled correctly.
571-600: LGTM!The
onSubmitflow correctly handles the validation-first workflow for new destinations. The explicit re-check for critical failures after state updates (lines 585-591) provides a safety net given React's asynchronous state updates.
625-633: LGTM!Properly resets validation state when the panel opens, ensuring users don't see stale validation results from previous sessions.
681-693: LGTM!The validation section is correctly rendered only for new destinations after validation has run. The separation between
ValidationOverlay(for loading state) andValidationFailuresSection(for results) provides clear UX feedback.
1-1: Run Prettier to fix formatting issues.The pipeline indicates code style issues. Run
prettier --writeon this file.⛔ Skipped due to learnings
Learnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-ui.mdc:0-0 Timestamp: 2025-12-11T17:04:40.037Z Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validationLearnt from: CR Repo: supabase/supabase PR: 0 File: .cursor/rules/studio-best-practices.mdc:0-0 Timestamp: 2025-12-11T16:46:18.701Z Learning: Applies to apps/studio/**/*.tsx : Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hookspackages/api-types/types/platform.d.ts (8)
3454-3473: LGTM!The new
/destinations/validateendpoint is well-defined with clear documentation describing its purpose and requirements.
3671-3690: LGTM!The new
/pipelines/validateendpoint follows the same well-structured pattern as the destination validation endpoint.
7008-7009: Verify that thereplication.etlentitlement is live in the backend.Based on learnings, UI/type changes that rely on new entitlements should not be merged until the backend entitlement is confirmed active. Please verify that
replication.etlis available in the backend before merging this PR.
10573-10614: LGTM!The validation response schemas are well-structured with consistent failure types (
critical|warning) and clear documentation. The identical structure betweenValidateDestinationResponseandValidatePipelineResponseis acceptable for generated API types.
10615-10713: LGTM!The request body schemas for destination and pipeline validation are comprehensive with proper JSDoc descriptions and examples. The discriminated union for BigQuery and Iceberg configurations is correctly typed.
22874-22928: LGTM!The operation definition is complete with appropriate error responses for authentication, authorization, and rate limiting scenarios.
23624-23678: LGTM!The pipeline validation operation follows the same consistent pattern as destination validation, with appropriate error handling responses.
7950-7957: ProfileResponse nullable fields are properly handled by consumers.The fields
first_name,last_name,mobile, andfree_project_limitare correctly typed as nullable. Verified that consumers likeProfileInformation.tsxhandle these fields appropriately using optional chaining and nullish coalescing (e.g.,profile?.first_name ?? ''), preventing runtime errors.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (1)
41-46: Consider handling allDestinationTypevalues explicitly.The ternary assumes only 'BigQuery' vs 'Analytics Bucket', but
DestinationTypealso includes 'Read Replica'. If validation is ever enabled for Read Replicas, this would incorrectly show Analytics Bucket messages.Suggested improvement
const validationMessages = useMemo(() => { - const destinationSpecificMessages = - destinationType === 'BigQuery' ? bigQueryMessages : analyticsBucketMessages + const destinationSpecificMessages = + destinationType === 'BigQuery' + ? bigQueryMessages + : destinationType === 'Analytics Bucket' + ? analyticsBucketMessages + : [] // Read Replica or future types return [...sharedPipelineMessages, ...destinationSpecificMessages, ...finalMessages] }, [destinationType])apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (2)
90-98: Consider grouping validation-related state.Per coding guidelines, related state should be grouped. These three validation states could be combined into a single object or reducer for cleaner state management.
Optional: Group validation state
interface ValidationState { hasRun: boolean destinationFailures: ValidationFailure[] pipelineFailures: ValidationFailure[] } const [validationState, setValidationState] = useState<ValidationState>({ hasRun: false, destinationFailures: [], pipelineFailures: [], })
569-598: Redundant critical failures check.Lines 583-589 re-check for critical failures immediately after
validateConfigurationalready returnsfalsewhen critical failures exist. IfvalidateConfigurationreturnstrue, there are no critical failures, making this check unreachable except in edge timing scenarios.Simplify by removing redundant check
const onSubmit = async (data: z.infer<typeof FormSchema>) => { if (!editMode) { // For new pipelines, validate configuration first if not already validated // OR if user has critical failures and clicks "Validate again" if (!hasRunValidation || isValidating || hasCriticalValidationFailures) { const isValid = await validateConfiguration(data) if (!isValid) { // Validation failed with critical errors, show inline and stop return } // Validation passed or only has warnings, continue to disclaimer } - // Check if there are critical failures before proceeding - const allFailures = [...destinationValidationFailures, ...pipelineValidationFailures] - const hasCriticalFailures = allFailures.some((f) => f.failure_type === 'critical') - - if (hasCriticalFailures) { - // Don't proceed if there are critical failures - return - } - // Validation passed or only warnings, proceed to disclaimer setPendingFormValues(data) setShowDisclaimerDialog(true) return } await submitPipeline(data) }
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
🧠 Learnings (7)
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Show loading states on submit buttons using the loading prop
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.tsx : Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Place submit/cancel buttons in SheetFooter for forms in sheets
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.ts (1)
DestinationType(1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test
- GitHub Check: typecheck
- GitHub Check: test (1)
🔇 Additional comments (10)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (2)
48-59: LGTM!The effect correctly resets the message index when hidden and properly cleans up the interval. The dependencies are accurate.
63-114: LGTM!Clean component structure with proper animation handling via framer-motion. The loading dots animation with staggered delays is a nice UX touch.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (2)
10-41: LGTM!Clean implementation following the loading/error/success pattern with early returns. Boolean variables use proper
hasprefix conventions, and the filtering logic is straightforward.
43-97: LGTM!Well-structured conditional rendering with clear separation between critical failures and warnings panels. The messaging adapts appropriately based on whether critical failures exist alongside warnings.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (4)
269-275: Placeholder values are intentional for validation bypass.The
'placeholder'strings are used whenCREATE_NEW_KEYis selected because S3 key validation is skipped in this case—the actual keys are created later insubmitPipeline. This is documented in the comments and is not a security concern since these values are never persisted or transmitted as real credentials.
308-368: LGTM on the validation flow.Good use of
Promise.allSettledto run validations in parallel while handling individual failures gracefully. The scroll-to-section behavior improves UX when failures occur.
623-631: LGTM!Properly resets all validation-related state when the panel reopens, ensuring a clean slate for new validation runs.
678-691: LGTM!Clean conditional rendering of the validation results section only for create flows after validation has run. The ref attachment enables smooth scrolling to failures.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (2)
81-85: Excellent UX improvement!The informational text clearly explains the filtering behavior and helps users understand why certain publications may not appear in the list. The positioning and styling are appropriate.
66-66: Validation feedback is adequately provided through new UI components.The removal of the loading state from the trigger button is appropriate. Users now receive validation feedback through the
ValidationOverlaycomponent (displayed while validation is in progress) and theValidationFailuresSectioncomponent (shown after validation completes), which provides more comprehensive feedback than a button loading state would offer.
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › database.spec.ts › Database › Schema Visualizer › actions works as expected Skipped testsFeatures › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (2)
42-47: Consider simplifying the nested ternary for better readability.While this nested ternary works correctly, it could be more maintainable using an if-else chain or a lookup object, aligning with the coding guidelines about avoiding nested ternaries and using descriptive variables.
🔎 Alternative approaches
Option 1: If-else chain
- const destinationSpecificMessages = - destinationType === 'BigQuery' - ? bigQueryMessages - : destinationType === 'Analytics Bucket' - ? analyticsBucketMessages - : [] // Read Replica or future types + let destinationSpecificMessages: string[] = [] + if (destinationType === 'BigQuery') { + destinationSpecificMessages = bigQueryMessages + } else if (destinationType === 'Analytics Bucket') { + destinationSpecificMessages = analyticsBucketMessages + }Option 2: Lookup object (most maintainable for future additions)
- const destinationSpecificMessages = - destinationType === 'BigQuery' - ? bigQueryMessages - : destinationType === 'Analytics Bucket' - ? analyticsBucketMessages - : [] // Read Replica or future types + const destinationMessagesMap: Record<string, string[]> = { + 'BigQuery': bigQueryMessages, + 'Analytics Bucket': analyticsBucketMessages, + } + const destinationSpecificMessages = destinationMessagesMap[destinationType] ?? []
67-118: Add accessibility attributes for screen reader support.The overlay lacks ARIA attributes to communicate its purpose and state changes to assistive technologies. Screen reader users won't be informed that validation is in progress or about the cycling status messages.
🔎 Suggested accessibility improvements
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.2 }} - className="fixed inset-0 z-[100] flex items-center justify-center bg-background/95 backdrop-blur-sm" + className="fixed inset-0 z-[100] flex items-center justify-center bg-background/95 backdrop-blur-sm" + role="status" + aria-live="polite" + aria-label="Running validation checks" > <div className="flex flex-col items-center gap-2 px-8 max-w-xl w-full"> {/* Title */} - <h3 className="text-lg font-medium text-foreground">Running pre-flight checks</h3> + <h3 className="text-lg font-medium text-foreground" aria-live="off"> + Running pre-flight checks + </h3> {/* Cycling Messages */} - <div className="relative h-12 w-full"> + <div className="relative h-12 w-full" aria-live="polite"> <AnimatePresence mode="wait">This ensures:
- The overlay is announced as a status region
- Message updates are communicated to screen readers
- The title doesn't redundantly announce on every render
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.ts (1)
DestinationType(1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test (1)
- GitHub Check: typecheck
- GitHub Check: test
🔇 Additional comments (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (2)
1-31: LGTM! Well-organized message constants.The imports and static message arrays are clean and well-structured. The messages provide clear feedback for each validation step, enhancing the user experience.
52-63: LGTM! Proper effect cleanup and state management.The interval management is well-implemented with proper cleanup, early returns, and boundary handling using modulo arithmetic. The dependencies are correct, and the reset logic when the overlay is hidden prevents stale state.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx (1)
128-136: Loading states are correct, but consider disabling the confirm button.The conditional rendering for loading states is implemented correctly. However, the modal's confirm button remains enabled while
isLoadingVersionis true. If a user clicks "Update and restart" before version data loads, the action silently fails (due to the guard on line 63:if (!versionId) return) with no feedback.🔎 Consider disabling the button during version data load
While this is likely a rare edge case (version data usually loads quickly), you could improve UX by passing the loading state to the
ConfirmationModal:<ConfirmationModal size="small" visible={visible} title="Update pipeline image" className="!p-0" confirmLabel={confirmLabel ?? (isStopped ? 'Update image' : 'Update and restart')} confirmLabelLoading={confirmLabelLoading} + loading={isLoadingVersion} onCancel={onClose} onConfirm={onConfirmUpdate} >This would disable the button and provide visual feedback while version data is being fetched.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Show loading states on submit buttons using the loading prop
Applied to files:
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx (1)
apps/studio/data/replication/pipeline-version-query.ts (1)
useReplicationPipelineVersionQuery(30-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: typecheck
- GitHub Check: test
- GitHub Check: test (1)
🔇 Additional comments (1)
apps/studio/components/interfaces/Database/Replication/UpdateVersionModal.tsx (1)
50-50: LGTM! Good extraction and naming.The
isPendingextraction asisLoadingVersionfollows the naming convention guideline (using theisprefix for state) and makes the loading state explicit and readable.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (7)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.ts (1)
29-32: Potential undefined namespace when creating new namespace.When
data.namespace === CREATE_NEW_NAMESPACEbutdata.newNamespaceNameis falsy (empty string or undefined),validationNamespacewill be an empty/falsy value. This could cause validation to behave unexpectedly. Consider adding a guard or using a fallback.🔎 Suggested improvement
const validationNamespace = - data.namespace === CREATE_NEW_NAMESPACE ? data.newNamespaceName : data.namespace + data.namespace === CREATE_NEW_NAMESPACE + ? (data.newNamespaceName || '') + : (data.namespace ?? '')apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx (2)
468-473: Absolute positioning for toggle button may cause alignment issues.The eye/eye-off button uses absolute positioning (
absolute right-6 top-[4px]) which could break on different screen sizes or when the label text wraps. Consider using a flex container or the Input component'sactionsprop pattern (as used for the Catalog Token field on lines 346-357) for more robust positioning.
105-481: Consider extracting AnalyticsBucketFields into smaller sub-components.The AnalyticsBucketFields component handles multiple concerns (bucket selection, namespace selection, S3 credentials, catalog token) and is quite long. Per coding guidelines, components should ideally be under 200-300 lines. Consider extracting logical groupings (e.g., S3CredentialsFields, NamespaceSelectionField) for improved maintainability.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (1)
23-27: Minor:warningsarray is unused after filtering.The
warningsarray is computed but never used - onlyhasWarnings(derived from its length) is used. Consider simplifying to avoid unnecessary array allocation.🔎 Suggested simplification
const criticalFailures = validationIssues.filter((f) => f.failure_type === 'critical') - const warnings = validationIssues.filter((f) => f.failure_type === 'warning') const hasCriticalFailures = criticalFailures.length > 0 - const hasWarnings = warnings.length > 0 + const hasWarnings = validationIssues.some((f) => f.failure_type === 'warning')apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (2)
90-96: Consider grouping related validation state.Per coding guidelines, related state should be grouped using objects or reducers instead of multiple useState calls. The three validation-related state variables could be consolidated.
🔎 Suggested grouping
const [validationState, setValidationState] = useState<{ hasRun: boolean destinationFailures: ValidationFailure[] pipelineFailures: ValidationFailure[] }>({ hasRun: false, destinationFailures: [], pipelineFailures: [], })
321-325: Redundant status checks after hasRequestError guard.After the
hasRequestErrorcheck returns early (line 314-318), both results are guaranteed to be fulfilled. The ternary operators checkingstatus === 'fulfilled'are defensive but technically redundant.🔎 Simplified extraction
// Both requests succeeded, extract validation failures - const destValidationResult = - destResult.status === 'fulfilled' ? destResult.value : { validation_failures: [] } - const pipelineValidationResult = - pipelineResult.status === 'fulfilled' ? pipelineResult.value : { validation_failures: [] } + // Safe to cast - we've already verified both requests succeeded above + const destValidationResult = (destResult as PromiseFulfilledResult<typeof destResult extends PromiseFulfilledResult<infer T> ? T : never>).value + const pipelineValidationResult = (pipelineResult as PromiseFulfilledResult<typeof pipelineResult extends PromiseFulfilledResult<infer T> ? T : never>).valueOr keep the current defensive approach if you prefer explicit safety over conciseness.
apps/studio/data/replication/validate-pipeline-mutation.ts (1)
2-2: Minor: Consider using type-only import for consistency.The
componentsimport is only used for type derivation. For consistency withvalidate-destination-mutation.ts(which usestype { components }), consider using a type-only import.🔎 Suggested change
-import { components } from 'api-types' +import type { components } from 'api-types'
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/data/replication/validate-destination-mutation.tsapps/studio/data/replication/validate-pipeline-mutation.ts
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/data/replication/validate-pipeline-mutation.ts
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧠 Learnings (13)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/data/replication/validate-pipeline-mutation.ts
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.tsapps/studio/data/replication/validate-destination-mutation.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsxapps/studio/data/replication/validate-pipeline-mutation.ts
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use FormItemLayout with layout='horizontal' for side panel forms in wide panels (size='lg')
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use FormItemLayout with layout='flex-row-reverse' for horizontal alignment in page layouts, wrapped in a Card with each field in CardContent and CardFooter for actions
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Always wrap form inputs with FormControl_Shadcn_ to ensure proper form integration
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use FormItemLayout without form control for action fields with buttons for navigation or performable actions, wrapping buttons in a div with justify-end
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Always use FormItemLayout instead of manually composing FormItem, FormLabel, FormMessage, and FormDescription
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use FormItemLayout with layout='vertical' for side panel forms in narrow panels (size='sm' or below)
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Show loading states on submit buttons using the loading prop
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.tsx : Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Place submit/cancel buttons in SheetFooter for forms in sheets
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
🧬 Code graph analysis (2)
apps/studio/data/replication/validate-destination-mutation.ts (2)
apps/studio/data/replication/create-destination-pipeline-mutation.ts (1)
DestinationConfig(9-15)apps/studio/data/fetchers.ts (1)
handleError(146-184)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (2)
apps/studio/data/replication/validate-destination-mutation.ts (1)
ValidationFailure(14-14)packages/ui-patterns/src/admonition.tsx (1)
Admonition(83-180)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test
- GitHub Check: test (1)
- GitHub Check: typecheck
🔇 Additional comments (8)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.ts (1)
7-56: LGTM - Well-structured validation config builder.The utility function cleanly handles both BigQuery and Analytics Bucket destination types with appropriate conditional logic and clear inline documentation. The use of zod type inference from the schema ensures type safety.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx (1)
33-94: LGTM - BigQueryFields component is well-structured.The component properly uses FormItemLayout with horizontal layout for the side panel form, follows consistent loading/error patterns, and correctly wraps inputs with FormControl_Shadcn_ as per coding guidelines.
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx (1)
17-68: LGTM - Clean validation failures display component.The component follows good patterns: early return for empty state, clear boolean variable naming (hasCriticalFailures, hasWarnings), and appropriate use of Accordion for collapsible failure details. The dynamic Admonition type based on criticality is a nice UX touch.
apps/studio/data/replication/validate-destination-mutation.ts (2)
70-71: Type assertion after error handling.The
as ValidateDestinationResponsecast is used here. Per coding guidelines, type casting should be avoided in favor of runtime validation. However, given thathandleErrorthrows on error and the API response schema is well-defined viacomponents['schemas'], this is acceptable. Consider adding a brief comment explaining why the assertion is safe.
16-72: LGTM - Well-structured validation mutation.The mutation properly handles both BigQuery and Iceberg destination configs with clear transformation to API schema format. Good use of TypeScript's discriminated union pattern (
'bigQuery' in destinationConfig) for type narrowing.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx (2)
508-528: Validation flow logic is sound.The onSubmit logic correctly handles the validation flow:
- For new pipelines, validation runs first (or re-runs if there are critical failures)
- Only proceeds to disclaimer dialog if no critical failures
- Edit mode skips validation and submits directly
The condition
!hasRunValidation || isValidating || hasValidationFailuresappropriately allows re-validation after fixing issues.
624-653: LGTM - Footer with loading state and validation feedback.Good use of AnimatePresence for smooth loading state transitions. The contextual loading message distinguishes between validation and creation states, providing clear user feedback.
apps/studio/data/replication/validate-pipeline-mutation.ts (1)
15-50: LGTM - Pipeline validation mutation follows established patterns.The mutation mirrors the destination validation mutation structure, maintaining consistency across the codebase. Good use of optional batch config spreading and proper type definitions.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (1)
23-28: Consider using a typed form schema with zod.The
anytype inControllerRenderProps<any, 'publicationName'>reduces type safety. Per the coding guidelines and learnings, forms should be built with react-hook-form and zod for validation, which would provide proper typing:import { z } from 'zod' const formSchema = z.object({ publicationName: z.string(), // ... other fields }) type FormValues = z.infer<typeof formSchema> interface PublicationsComboBoxProps { publications: ReplicationPublication[] isLoadingPublications: boolean onNewPublicationClick: () => void field: ControllerRenderProps<FormValues, 'publicationName'> }This would enable full type checking and validation across the form.
Based on coding guidelines:
Avoid type casting (e.g.,
as any,as Type); instead validate values at runtime using zod schemasBased on learnings:
Build forms with react-hook-form and zod for validation
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g.,as any,as Type); instead validate values at runtime using zod schemas
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
apps/studio/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: useonprefix for prop callbacks andhandleprefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers
Files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (2)
apps/studio/data/replication/publications-query.ts (1)
ReplicationPublication(10-11)packages/ui/src/components/shadcn/ui/badge.tsx (1)
Badge(43-43)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (5)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx (5)
1-21: LGTM: Imports align with new functionality.The addition of the
Badgeimport and the type change toReplicationPublicationproperly support the enhanced publication display with table counts.
36-48: LGTM: State management and event handlers are well-structured.The component properly manages local state for the dropdown and selection, with appropriate synchronization to the form field. The handler naming follows conventions consistently.
61-75: LGTM: Simplified trigger button with consistent icon.The removal of the conditional loader from the trigger button simplifies the UI while still providing loading feedback within the dropdown content (lines 91-95). This creates a more consistent user experience with a stable button appearance.
84-88: Excellent UX improvement: Clear filtering explanation.The informational text clearly communicates that publications without tables are filtered out, helping users understand why certain publications might not appear in the list. This transparency improves the user experience and reduces potential confusion.
108-132: Publication list implementation is well-designed with proper type safety.The enhanced publication rendering with table count badges and selection indicators is a significant UX improvement. The implementation correctly uses
pub.nameas the key and for selection logic.The
tablesproperty access at line 125 is completely safe. The upstreamfetchReplicationPublications()function inapps/studio/data/replication/publications-query.tsexplicitly filters out publications with no tables (pub.tables.length > 0), guaranteeing that only publications with at least one table reach this component. The inline pluralization logic is appropriate for this single use case.
joshenlim
left a comment
There was a problem hiding this comment.
Verified chnages on local and staging!
Braintrust eval report
|
This PR adds the integration with the new validation endpoints which allow to validate things before a pipeline is started. This is done to reduce many of the problems that customers have when configuring pipelines.
In addition, it removes the primary key alert since it's now handled by the validation endpoint and improves the copy around publications.
Screenshots
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.