Skip to content

feat(integrations): add Cloud SQL integration support#432

Merged
tkislan merged 5 commits into
mainfrom
tk/bump-database-integrations
Jun 30, 2026
Merged

feat(integrations): add Cloud SQL integration support#432
tkislan merged 5 commits into
mainfrom
tk/bump-database-integrations

Conversation

@tkislan

@tkislan tkislan commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Bumps @deepnote/database-integrations from ^1.4.3 to ^1.5.0, which adds the new cloud-sql database integration type, and wires cloud-sql through the extension following the convention used by the other integrations.

Changes

Dependency

  • @deepnote/database-integrations 1.4.31.5.0

Required to keep tsc passing (the exhaustive Record<ConfigurableDatabaseIntegrationType, …> maps that broke):

  • integrationUtils.ts — added cloud-sql to integrationTypeLabels (Google Cloud SQL) and integrationTypeIcons (+ logo import)
  • sqlCellStatusBarProvider.ts — added cloud-sql to its integrationTypeLabels

Following the integration convention (closest model: Spanner, since cloud-sql metadata is { service_account: string }):

  • icons/cloud-sql.svg — new GCP-style database icon
  • CloudSqlForm.tsx — new form (name + Service Account JSON, matching the schema)
  • ConfigurationForm.tsx — import + case 'cloud-sql'
  • IntegrationItem.tsxcase 'cloud-sql' in the type-label switch
  • IntegrationTypeSelector.tsx — Cloud SQL added to the Databases section, grouped with the other GCP databases
  • Localization chain: keys in messageTypes.ts, strings in localize.ts, wiring in integrationWebview.ts

Other touchpoints (integrationDetector.ts, sqlLspConnectionUtils.ts, env-var/startup providers) already handle types generically via the package's databaseIntegrationTypes or a default branch, so no changes were needed there.

Notes

In 1.5.0 the package's getSqlAlchemyInput returns null for cloud-sql (query execution isn't wired up in the package yet) and the metadata schema is just service_account. The form therefore intentionally only collects the service-account JSON, faithful to the current schema. If the package later expands the cloud-sql metadata (e.g. instance/database), the form will need corresponding fields.

Verification

  • tsc -p ./ --noEmit ✅ (the 3 original errors are gone)
  • compile-tsc ✅, format-fix ✅, ESLint on all changed files ✅
  • 123 integration unit tests passing
image

🤖 Generated with Claude Code

https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW

Summary by CodeRabbit

  • New Features
    • Added support for Google Cloud SQL integrations, including a dedicated configuration form and a new database option with icon.
    • Introduced localized Cloud SQL fields (name and service account JSON) with required validation.
  • Bug Fixes
    • Improved service-account JSON validation using a shared helper (better required/invalid behavior and clearer errors).
    • Updated existing integration forms (e.g., BigQuery/Spanner) to use the unified validation flow.
  • Documentation
    • Updated integration credentials documentation to include Cloud SQL configuration and form requirements.
  • Tests
    • Added unit tests for service-account JSON validation.
  • Chores
    • Updated a dependency version.

Bump @deepnote/database-integrations from 1.4.3 to 1.5.0, which adds the
`cloud-sql` database integration type, and wire it through the extension
following the convention used by the other integrations:

- Add Cloud SQL to the type-label and icon maps (incl. new cloud-sql.svg)
- Add CloudSqlForm (name + service account JSON, matching the
  `{ service_account }` metadata schema) and route to it from
  ConfigurationForm
- Surface Cloud SQL in the integration type selector and item label
- Add the corresponding localization keys, strings and webview wiring

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Google Cloud SQL as a supported database integration. The dependency on @deepnote/database-integrations is bumped to ^1.5.0. New Cloud SQL localization strings are added to localize.ts, LocalizedMessages, and the integrations webview payload. A new CloudSqlForm handles configuration and JSON validation, and ConfigurationForm, IntegrationTypeSelector, IntegrationItem, integrationUtils, and the status bar provider are updated to recognize cloud-sql. The integration credentials spec is updated with Cloud SQL examples and counts.

Sequence Diagram(s)

sequenceDiagram
  participant localize as localize.ts
  participant integrationWebview as integrationWebview.ts
  participant CloudSqlForm as CloudSqlForm.tsx
  participant validateServiceAccountJson as validateServiceAccountJson
  localize->>integrationWebview: provide Cloud SQL strings
  integrationWebview->>CloudSqlForm: send localized form text
  CloudSqlForm->>validateServiceAccountJson: validate service_account JSON
  validateServiceAccountJson-->>CloudSqlForm: required or invalid-json result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • m1so
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Cloud SQL integration support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Updates Docs ✅ Passed PASS: specs/INTEGRATIONS_CREDENTIALS.md now covers Cloud SQL; I couldn’t verify the private landing-page roadmap, so please update that too.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0%. Comparing base (aef728e) to head (1161a0f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #432   +/-   ##
===========================
===========================
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/webviews/webview-side/integrations/CloudSqlForm.tsx`:
- Around line 42-48: The CloudSqlForm state reset in the React.useEffect that
updates pendingConfig should also clear serviceAccountError when existingConfig,
integrationId, or defaultName changes. Update the same effect in CloudSqlForm so
switching integrations or reloading a valid config resets the validation state
and does not leave a stale error blocking Save.
- Around line 73-88: The Cloud SQL submit path in handleSubmit currently only
trims for JSON parsing, so whitespace-only service_account values can still
reach onSave as if they were valid. Update CloudSqlForm.tsx to treat
pendingConfig.metadata.service_account as missing when trim() is empty, set the
same service account validation error, and return before calling onSave. Make
the same check anywhere else in this flow that relies on service_account being
required so the form cannot persist an effectively blank credential.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b63e8317-921f-49ef-9372-0ca68aaf1596

📥 Commits

Reviewing files that changed from the base of the PR and between aef728e and a040c3f.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • src/webviews/webview-side/integrations/icons/cloud-sql.svg is excluded by !**/*.svg
📒 Files selected for processing (10)
  • package.json
  • src/messageTypes.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/platform/common/utils/localize.ts
  • src/webviews/webview-side/integrations/CloudSqlForm.tsx
  • src/webviews/webview-side/integrations/ConfigurationForm.tsx
  • src/webviews/webview-side/integrations/IntegrationItem.tsx
  • src/webviews/webview-side/integrations/IntegrationTypeSelector.tsx
  • src/webviews/webview-side/integrations/integrationUtils.ts

Comment thread src/webviews/webview-side/integrations/CloudSqlForm.tsx
Comment thread src/webviews/webview-side/integrations/CloudSqlForm.tsx
tkislan and others added 2 commits June 29, 2026 16:34
…anner forms

Addresses CodeRabbit review on the Cloud SQL form, and applies the same fixes
to the Spanner form which shared both issues (BigQueryForm already handled them
correctly):

- Reject whitespace-only service-account JSON on submit. The `required`
  attribute on a <textarea> does not trim, so "   " passed the browser check
  and reached onSave with an effectively blank credential. Submit now treats a
  trim-empty value as missing and surfaces a dedicated "required" error.
- Clear the validation error in the reset effect, so switching integrations or
  reloading a valid config no longer leaves a stale error that blocks Save.

Adds the corresponding `...ServiceAccountRequired` localization strings + wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW
Add Cloud SQL to specs/INTEGRATIONS_CREDENTIALS.md (supported-types list,
config interface example and the Google Cloud forms section) and bump the
integration count 18 -> 19. Addresses the CodeRabbit "Updates Docs" check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW

@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.

🧹 Nitpick comments (1)
src/webviews/webview-side/integrations/SpannerForm.tsx (1)

45-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the shared service-account validation path.

This reset + trim/required/JSON-validation flow now exists in both SpannerForm and CloudSqlForm, so the next change will likely update one and miss the other. Please move it into a shared helper (or shared field component) and reuse it from both forms. As per coding guidelines, "Extract duplicate logic into helper methods to prevent drift following DRY principle".

Also applies to: 95-110

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/webviews/webview-side/integrations/SpannerForm.tsx` around lines 45 - 52,
The service-account reset, trim/required check, and JSON validation logic is
duplicated in SpannerForm and CloudSqlForm, so extract it into a shared helper
or reusable field component and call it from both forms. Move the common
validation flow out of the SpannerForm effect/handler and the matching
CloudSqlForm path, keeping the unique integration-specific state updates
separate. Reuse the shared logic via the existing SpannerForm and CloudSqlForm
service-account handling symbols so future changes only need one update.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/webviews/webview-side/integrations/SpannerForm.tsx`:
- Around line 45-52: The service-account reset, trim/required check, and JSON
validation logic is duplicated in SpannerForm and CloudSqlForm, so extract it
into a shared helper or reusable field component and call it from both forms.
Move the common validation flow out of the SpannerForm effect/handler and the
matching CloudSqlForm path, keeping the unique integration-specific state
updates separate. Reuse the shared logic via the existing SpannerForm and
CloudSqlForm service-account handling symbols so future changes only need one
update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f29da3d5-eba5-4e11-b085-4aa171e5aacb

📥 Commits

Reviewing files that changed from the base of the PR and between a040c3f and 4bd3ff3.

📒 Files selected for processing (6)
  • specs/INTEGRATIONS_CREDENTIALS.md
  • src/messageTypes.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/platform/common/utils/localize.ts
  • src/webviews/webview-side/integrations/CloudSqlForm.tsx
  • src/webviews/webview-side/integrations/SpannerForm.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/messageTypes.ts
  • src/webviews/webview-side/integrations/CloudSqlForm.tsx
  • src/platform/common/utils/localize.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 29, 2026
The "required + valid-JSON" check for service-account credentials was
duplicated across the Cloud SQL, Spanner and BigQuery forms. Extract it into a
pure, dependency-free `validateServiceAccountJson()` helper and reuse it in all
three forms (both the change and submit handlers). BigQuery keeps its detailed
"Invalid JSON: <detail>" message via the helper's `detail` field, so behavior is
unchanged everywhere.

The helper has no React/localization dependencies, so it is unit-tested in
isolation. Addresses finding #1 from the TypeScript code review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/webviews/webview-side/integrations/serviceAccountValidation.ts`:
- Around line 23-29: The validation in serviceAccountValidation should not treat
every successful JSON.parse as valid; it currently returns null for values like
null, arrays, strings, and numbers. Update the logic in the helper used by
CloudSqlForm and BigQueryForm so that after JSON.parse(trimmed) succeeds, it
verifies the parsed value is a non-null plain object before returning success,
and otherwise returns an invalid-json-style result. Keep the existing invalid
JSON error handling, but add the non-object rejection in the same validation
path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee6a4b46-5489-44dd-b588-66bbb8b368e4

📥 Commits

Reviewing files that changed from the base of the PR and between 4bd3ff3 and 72d41a0.

📒 Files selected for processing (5)
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/webviews/webview-side/integrations/CloudSqlForm.tsx
  • src/webviews/webview-side/integrations/SpannerForm.tsx
  • src/webviews/webview-side/integrations/serviceAccountValidation.ts
  • src/webviews/webview-side/integrations/serviceAccountValidation.unit.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/webviews/webview-side/integrations/SpannerForm.tsx
  • src/webviews/webview-side/integrations/CloudSqlForm.tsx

Comment thread src/webviews/webview-side/integrations/serviceAccountValidation.ts
…ject

`validateServiceAccountJson` only checked that `JSON.parse` succeeded, so
`JSON.parse`-valid but non-object payloads (`123`, `"foo"`, `null`, `[]`) passed
validation and could be saved as service accounts, failing only later. Reject
anything that is not a non-null, non-array object. Covers the Cloud SQL, Spanner
and BigQuery forms via the shared helper. Addresses CodeRabbit review feedback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuoSZXF8YHsN81Lra45JW
@tkislan
tkislan marked this pull request as ready for review June 30, 2026 07:46
@tkislan
tkislan requested a review from a team as a code owner June 30, 2026 07:46
@tkislan
tkislan merged commit 8eddb48 into main Jun 30, 2026
13 checks passed
@tkislan
tkislan deleted the tk/bump-database-integrations branch June 30, 2026 11:47
tkislan added a commit that referenced this pull request Jun 30, 2026
Brings in #432 (Cloud SQL integration support). Resolved the package.json and
package-lock.json conflicts by keeping this branch's newer @deepnote/* versions
(blocks 4.6.0, convert 4.0.0, runtime-core 0.4.0); @deepnote/database-integrations
is 1.5.0 on both sides, and the Cloud SQL source from #432 merged cleanly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P2CLu8UmD8ceGNyv8u96pQ
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.

2 participants