Skip to content

feat(etl): Add integration with new validation endpoint - #41731

Merged
joshenlim merged 9 commits into
masterfrom
add-etl-validation
Jan 6, 2026
Merged

joshenlim merged 9 commits into
masterfrom
add-etl-validation

Conversation

@iambriccardo

@iambriccardo iambriccardo commented Jan 6, 2026 •

Copy link
Copy Markdown
Contributor

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

image image image

Summary by CodeRabbit

  • New Features

    • Interactive validation for replication destinations and pipelines with inline failure reporting (warnings vs critical) before submission.
    • Inline validation results section listing specific failures.
  • Improvements

    • Publication selector hides empty publications, shows per-publication table counts, and sorts alphabetically.
    • Batch wait time and staleness fields now show unit labels and clearer default/placeholders (default batch wait 10s; staleness default: none).
    • Submit button text and flow reflect validation state; version fields show loading state.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 6, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds 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

Cohort / File(s) Summary
Validation API types
packages/api-types/types/platform.d.ts
New POST endpoints and request/response schemas for destination and pipeline validation; new Validate* schemas; entitlement keys expanded; several profile fields made nullable; minor doc fixes.
Client validation mutations
apps/studio/data/replication/validate-destination-mutation.ts, apps/studio/data/replication/validate-pipeline-mutation.ts
New validation functions and React-Query hooks (useValidateDestinationMutation, useValidatePipelineMutation) and related types.
Validation UI integration
apps/studio/components/.../DestinationForm/index.tsx
Runs parallel destination/pipeline validation on submit, aggregates failures, scrolls to results, gates submission on critical failures, and updates submit button text/state.
Validation helper
apps/studio/components/.../DestinationForm/DestinationForm.utils.ts
New buildDestinationConfigForValidation to synthesize minimal BigQuery/Iceberg configs for validation payloads.
Validation failures UI
apps/studio/components/.../DestinationForm/ValidationFailuresSection.tsx
New component that merges destination/pipeline failures, partitions critical vs warnings, and renders an Admonition + Accordion with badges and preserved reason text.
Publications UI & query
apps/studio/components/.../PublicationSelection.tsx, .../PublicationsComboBox.tsx, apps/studio/data/replication/publications-query.ts
Simplified publication selection: removed primary-key checks and loading-check prop; PublicationsComboBox now accepts ReplicationPublication[], shows table counts; query filters out supabase_realtime and publications with no tables and sorts by name.
Advanced settings UI
apps/studio/components/.../AdvancedSettings.tsx
Numeric inputs wrapped with PrePostTab to show units; updated labels/placeholders for batch wait time and max staleness to indicate defaults/opt-out.
Layout adjustments
apps/studio/components/.../DestinationPanelFields.tsx
Moved padding from inner items to outer container (px-5 → p-5), removing redundant horizontal padding on form items.
Version modal UX
apps/studio/components/.../UpdateVersionModal.tsx
Display of Current/New version names gated behind isLoadingVersion to show "Loading..." while pending.
API deprecation docs
packages/api-types/types/api.d.ts
Added JSDoc deprecation comments to V1ServiceHealthResponse.healthy fields (docs-only).

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
Loading

Possibly related PRs

Suggested reviewers

  • alaister

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description explains the purpose (validate before pipeline starts), key improvements (removes primary key alert, updates publication copy), and includes screenshots, but does not follow the template structure with explicit sections. Consider following the template structure more explicitly by including 'What kind of change', 'Current behavior', 'New behavior' sections, and confirming CONTRIBUTING.md review.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(etl): Add integration with new validation endpoint' clearly describes the main change - integrating validation endpoints into the ETL flow.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62c69b1 and 5e277b4.

📒 Files selected for processing (1)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
⏰ 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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel

vercel Bot commented Jan 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Jan 6, 2026 4:14pm
studio-staging Ready Ready Preview, Comment Jan 6, 2026 4:14pm
6 Skipped Deployments
Project Deployment Review Updated (UTC)
cms Ignored Ignored Jan 6, 2026 4:14pm
studio Ignored Ignored Jan 6, 2026 4:14pm
design-system Skipped Skipped Jan 6, 2026 4:14pm
docs Skipped Skipped Jan 6, 2026 4:14pm
ui-library Skipped Skipped Jan 6, 2026 4:14pm
zone-www-dot-com Skipped Skipped Jan 6, 2026 4:14pm

@supabase

supabase Bot commented Jan 6, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@snyk-io

snyk-io Bot commented Jan 6, 2026 •

Copy link
Copy Markdown

⛔ Snyk checks have failed. 1 issues have been found so far.

Status Scanner Critical High Medium Low Total (1)
⛔ Code Security 0 1 0 0 1 issues

💻 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  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

@joshenlim joshenlim Jan 6, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are red herrings afaict

@iambriccardo
iambriccardo marked this pull request as ready for review January 6, 2026 06:01
@iambriccardo
iambriccardo requested a review from a team as a code owner January 6, 2026 06:01
@coveralls

coveralls commented Jan 6, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 68.226%. remained the same
when pulling 62c69b1 on add-etl-validation
into c62cd07 on master.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --write on 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 on healthy; consider clarifying “status” reference

Marking both V1ServiceHealthResponse.healthy booleans as deprecated in favor of status is consistent and non-breaking; this will help nudge clients toward the enum. One optional tweak: for the nested info variant, you might say “Use the top‑level status instead” to make it explicit which status field is meant in that context.

Also applies to: 4651-4654

apps/studio/data/replication/validate-destination-mutation.ts (2)

33-37: Consolidate duplicated ValidationFailure type.

The ValidationFailure type is defined identically in both validate-destination-mutation.ts and validate-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 ValidateDestinationResponse cast 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 cn utility 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

📥 Commits

Reviewing files that changed from the base of the PR and between c62cd07 and 68c429b.

📒 Files selected for processing (11)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/studio/data/replication/publications-query.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/data/replication/validate-pipeline-mutation.ts
  • packages/api-types/types/api.d.ts
  • packages/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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/data/replication/validate-pipeline-mutation.ts
  • apps/studio/data/replication/publications-query.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • apps/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: use on prefix for prop callbacks and handle prefix 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
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • apps/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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • apps/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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/data/replication/validate-pipeline-mutation.ts
  • apps/studio/data/replication/publications-query.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • apps/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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/data/replication/validate-pipeline-mutation.ts
  • apps/studio/data/replication/publications-query.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/AdvancedSettings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationSelection.tsx
  • packages/api-types/types/api.d.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • packages/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.tsx
  • 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} : 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.ts
  • packages/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 isLoadingCheck prop has been removed, and the trigger button now always shows the static ChevronsUpDown icon 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 validateDestination function is well-structured with proper parameter validation, discriminated union handling for config types, and abort signal support. The error handling correctly uses the shared handleError utility.

apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (4)

51-62: LGTM!

The useEffect correctly 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 --write on 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 children
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 : Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
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: Only optimize with useMemo/useCallback after measuring a performance problem; avoid premature optimization
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

44-49: No changes needed. The ValidationOverlay component is only rendered when selectedType is NOT 'Read Replica' (see parent DestinationPanel.tsx line 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 has prefix 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 validatePipeline function 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 validateConfiguration function properly orchestrates parallel validation using Promise.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 onSubmit flow 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) and ValidationFailuresSection (for results) provides clear UX feedback.


1-1: Run Prettier to fix formatting issues.

The pipeline indicates code style issues. Run prettier --write on 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 validation
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 : 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
packages/api-types/types/platform.d.ts (8)

3454-3473: LGTM!

The new /destinations/validate endpoint is well-defined with clear documentation describing its purpose and requirements.


3671-3690: LGTM!

The new /pipelines/validate endpoint follows the same well-structured pattern as the destination validation endpoint.


7008-7009: Verify that the replication.etl entitlement 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.etl is 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 between ValidateDestinationResponse and ValidatePipelineResponse is 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, and free_project_limit are correctly typed as nullable. Verified that consumers like ProfileInformation.tsx handle these fields appropriately using optional chaining and nullish coalescing (e.g., profile?.first_name ?? ''), preventing runtime errors.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx (1)

41-46: Consider handling all DestinationType values explicitly.

The ternary assumes only 'BigQuery' vs 'Analytics Bucket', but DestinationType also 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 validateConfiguration already returns false when critical failures exist. If validateConfiguration returns true, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 68c429b and b29abb5.

📒 Files selected for processing (4)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
  • 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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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: use on prefix for prop callbacks and handle prefix 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
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/PublicationsComboBox.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • 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} : 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.tsx
  • apps/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 has prefix 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 when CREATE_NEW_KEY is selected because S3 key validation is skipped in this case—the actual keys are created later in submitPipeline. 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.allSettled to 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 ValidationOverlay component (displayed while validation is in progress) and the ValidationFailuresSection component (shown after validation completes), which provides more comprehensive feedback than a button loading state would offer.

@github-actions

github-actions Bot commented Jan 6, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  66 passed
flaky  1 flaky
skipped  4 skipped

Details

stats  71 tests across 12 suites
duration  7 minutes, 44 seconds
commit  5e277b4

Flaky tests

Features › database.spec.ts › Database › Schema Visualizer › actions works as expected

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b29abb5 and 3236829.

📒 Files selected for processing (2)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationOverlay.tsx
  • apps/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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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: use on prefix for prop callbacks and handle prefix 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isLoadingVersion is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2683ef0 and 1b3ccbf.

📒 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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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: use on prefix for prop callbacks and handle prefix 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 isPending extraction as isLoadingVersion follows the naming convention guideline (using the is prefix for state) and makes the loading state explicit and readable.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_NAMESPACE but data.newNamespaceName is falsy (empty string or undefined), validationNamespace will 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's actions prop 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: warnings array is unused after filtering.

The warnings array is computed but never used - only hasWarnings (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 hasRequestError check returns early (line 314-318), both results are guaranteed to be fulfilled. The ternary operators checking status === '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>).value

Or 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 components import is only used for type derivation. For consistency with validate-destination-mutation.ts (which uses type { 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3ccbf and e8376ae.

📒 Files selected for processing (6)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationForm.utils.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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: use on prefix for prop callbacks and handle prefix 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.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/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.ts
  • apps/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.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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.ts
  • apps/studio/data/replication/validate-destination-mutation.ts
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/ValidationFailuresSection.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.tsx
  • apps/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 ValidateDestinationResponse cast is used here. Per coding guidelines, type casting should be avoided in favor of runtime validation. However, given that handleError throws on error and the API response schema is well-defined via components['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:

  1. For new pipelines, validation runs first (or re-runs if there are critical failures)
  2. Only proceeds to disclaimer dialog if no critical failures
  3. Edit mode skips validation and submits directly

The condition !hasRunValidation || isValidating || hasValidationFailures appropriately 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 any type in ControllerRenderProps<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 schemas

Based on learnings:

Build forms with react-hook-form and zod for validation

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8376ae and fbf4aa8.

📒 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: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix 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: use on prefix for prop callbacks and handle prefix 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 Badge import and the type change to ReplicationPublication properly 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.name as the key and for selection logic.

The tables property access at line 125 is completely safe. The upstream fetchReplicationPublications() function in apps/studio/data/replication/publications-query.ts explicitly 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 joshenlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified chnages on local and staging!

@joshenlim
joshenlim merged commit d795240 into master Jan 6, 2026
@joshenlim
joshenlim deleted the add-etl-validation branch January 6, 2026 16:32
@github-actions

github-actions Bot commented Jan 6, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1767717284)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 0% (+0pp) - -
Goal Completion 80% (+0pp) - -
Tool Usage 40% (+0pp) - -
Time_to_first_token 0.28tok (-0.02tok) 3 🟢 2 🔴
Llm_calls 7.6 (+0) 2 🟢 1 🔴
Tool_calls 4.2 (+0.4) 2 🟢 -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 57238.4tok (+4496.4tok) 3 🟢 2 🔴
Prompt_cached_tokens 46182.4tok (+5120tok) 3 🟢 2 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 5596.4tok (+614.8tok) 2 🟢 3 🔴
Completion_reasoning_tokens 4224tok (+768tok) 1 🟢 4 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 62834.8tok (+5111.2tok) 2 🟢 3 🔴
Estimated_cost 0.02$ (+0$) 1 🟢 4 🔴
Duration 57.03s (+6.03s) 2 🟢 3 🔴
Llm_duration 113.4s (+11.86s) 2 🟢 3 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants