Skip to content

Conversation

@jankuca
Copy link
Contributor

@jankuca jankuca commented Oct 16, 2025

Screenshot 2025-10-17 at 15 34 28 Screenshot 2025-10-17 at 15 30 50 Screenshot 2025-10-17 at 15 31 04 Screenshot 2025-10-17 at 15 31 12

Summary by CodeRabbit

  • New Features

    • SQL cells show a left-aligned status indicator with integration name and Manage Integrations action.
    • Integration UI can open with an optional pre-selected integration.
  • Improvements

    • Storage now emits change notifications, adds get/clear APIs and supports disposal.
    • Detection/UI will fetch and surface a selected integration if not initially detected.
    • Webview and forms now receive localization payloads; UI strings and default integration names are localized.
  • Tests

    • Added unit tests validating SQL cell status indicator behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

📝 Walkthrough

Walkthrough

Command ManageIntegrations now accepts variadic args and extracts an optional integrationId passed to showIntegrationsUI(selectedIntegrationId?). showIntegrationsUI and IntegrationWebview.show accept an optional selectedIntegrationId and will fetch and insert a fallback integration entry from storage if the selected ID is not found among detected integrations. IntegrationStorage implements IIntegrationStorage/IDisposable, exposes onDidChangeIntegrations, adds getIntegrationConfig and clear(), fires change events after save/delete/clear, and supports disposal. Webview now sends loc_init localization payloads; many webview React components use the new locReactSide. A new SqlCellStatusBarProvider displays per-cell integration status and registers as an activation service.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Cell as NotebookCell
    participant StatusBar as SqlCellStatusBarProvider
    participant Mgr as IntegrationManager
    participant Storage as IntegrationStorage
    participant Webview as IntegrationWebview
    participant UI as Webview UI

    User->>Cell: focus/click SQL cell
    Cell->>StatusBar: read cell.metadata.sql_integration_id
    alt valid integrationId & not internal
        StatusBar->>Storage: getIntegrationConfig(projectId, integrationId)
        Storage-->>StatusBar: IntegrationConfig? 
        StatusBar->>User: render status item (ManageIntegrations, args:[integrationId])
    else no projectId or invalid
        StatusBar-->>User: no status item
    end

    User->>StatusBar: invoke ManageIntegrations (integrationId)
    StatusBar->>Mgr: ManageIntegrations handler (args...)
    Mgr->>Storage: detect/list integrations
    Storage-->>Mgr: integrations map
    alt selectedIntegrationId not in map
        Mgr->>Storage: getIntegrationConfig(projectId, selectedIntegrationId)
        Storage-->>Mgr: config or undefined
        Mgr->>Mgr: insert fallback entry (Connected/Disconnected)
    end
    Mgr->>Webview: show(integrationsMap, selectedIntegrationId)
    Webview->>UI: post loc_init (if new) and update (includes selectedIntegrationId)
    UI->>Storage: save/delete integration actions
    Storage->>Storage: persist, fire onDidChangeIntegrations
    Storage-->>StatusBar: onDidChangeIntegrations event
    StatusBar->>StatusBar: refresh items
Loading

Possibly related PRs

Suggested reviewers

  • andyjakubowski
  • Artmann
  • saltenasl
  • jamesbhobbs

Pre-merge checks

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Buttons to open SQL block integration config + fix localization" directly summarizes the two main changes in the pull request. It clearly references the primary features: adding UI controls (buttons/status bar items) for SQL cells to open integration configuration, and addressing localization across integration management views. The title is concise, specific, and accurately reflects the scope of the changeset.
Linked Issues Check ✅ Passed The code changes comprehensively address both linked issues. For GRN-4960, the PR introduces SqlCellStatusBarProvider to create status bar items for SQL cells, updates integrationManager to accept selectedIntegrationId parameters, and extends integrationWebview to display configuration forms when a specific integration is selected. For GRN-4966, the PR adds a complete localization infrastructure including new message keys in messageTypes.ts and localize.ts, replaces all hardcoded strings with getLocString calls across webview components, and implements localization message delivery via LocInitMessage. All coding-related requirements are met.
Out of Scope Changes Check ✅ Passed All changes remain within scope of the two linked issues. Core additions like SqlCellStatusBarProvider and localization updates directly address GRN-4960 and GRN-4966. Supporting changes such as integrationStorage enhancements (event emissions, getIntegrationConfig method), type definitions, and service registry registrations are necessary infrastructure for the stated objectives. No refactoring, unrelated bug fixes, or stylistic changes to unrelated code are present.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

@jankuca jankuca force-pushed the jk/feat/sql-block-open-credentials branch from cb75865 to a179762 Compare October 16, 2025 14:58
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 93.12977% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 71%. Comparing base (146cda4) to head (ed65018).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/notebooks/deepnote/sqlCellStatusBarProvider.ts 81% 5 Missing and 2 partials ⚠️
src/platform/webviews/webviewHost.ts 0% 1 Missing ⚠️
...webviews/webview-side/react-common/locReactSide.ts 50% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main     #73    +/-   ##
======================================
  Coverage     71%     71%            
======================================
  Files        520     523     +3     
  Lines      38865   39001   +136     
  Branches    4895    4905    +10     
======================================
+ Hits       27705   27834   +129     
- Misses      9537    9542     +5     
- Partials    1623    1625     +2     
Files with missing lines Coverage Δ
src/messageTypes.ts 100% <ø> (ø)
src/notebooks/deepnote/integrations/types.ts 100% <ø> (ø)
...oks/deepnote/sqlCellStatusBarProvider.unit.test.ts 100% <100%> (ø)
src/platform/common/utils/localize.ts 87% <100%> (+1%) ⬆️
src/platform/webviews/webviewHost.ts 48% <0%> (ø)
...webviews/webview-side/react-common/locReactSide.ts 37% <50%> (ø)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts 81% <81%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jankuca jankuca force-pushed the jk/feat/sql-block-open-credentials branch from a179762 to 6bf4689 Compare October 16, 2025 15:05
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/notebooks/deepnote/integrations/integrationStorage.ts (1)

110-124: Fire change event after clear().

clear() updates storage/cache but doesn’t emit onDidChangeIntegrations. UIs depending on the event won’t refresh.

Apply this diff:

     async clear(): Promise<void> {
         await this.ensureCacheLoaded();

         // Delete all integrations from encrypted storage
         const integrationIds = Array.from(this.cache.keys());
         for (const id of integrationIds) {
             await this.encryptedStorage.store(INTEGRATION_SERVICE_NAME, id, undefined);
         }

         // Clear the index
         await this.encryptedStorage.store(INTEGRATION_SERVICE_NAME, 'index', undefined);

         // Clear cache
         this.cache.clear();
+
+        // Notify listeners
+        this._onDidChangeIntegrations.fire();
     }
src/notebooks/deepnote/integrations/integrationWebview.ts (1)

49-59: Invalid Webview option and missing localization.

  • enableForms is not a valid option; this likely fails type-check or is ignored.
  • Localize the panel title.

Apply this diff:

-        this.currentPanel = window.createWebviewPanel(
+        this.currentPanel = window.createWebviewPanel(
             'deepnoteIntegrations',
-            'Deepnote Integrations',
+            l10n.t('Deepnote Integrations'),
             column || ViewColumn.One,
             {
                 enableScripts: true,
                 retainContextWhenHidden: true,
                 localResourceRoots: [this.extensionContext.extensionUri],
-                enableForms: true
             }
         );

As per coding guidelines.

src/notebooks/deepnote/integrations/integrationManager.ts (1)

123-131: Localize user messages.

Use l10n.t for user-facing strings.

Apply this diff:

-            void window.showErrorMessage('No active Deepnote notebook');
+            void window.showErrorMessage(l10n.t('No active Deepnote notebook'));
             return;
-            void window.showErrorMessage('Cannot determine project ID');
+            void window.showErrorMessage(l10n.t('Cannot determine project ID'));
             return;

Add import if missing:

import { l10n } from 'vscode';

As per coding guidelines.

♻️ Duplicate comments (4)
src/webviews/webview-side/integrations/PostgresForm.tsx (1)

38-38: Same localization issue as IntegrationItem.tsx.

Hard-coded English strings violate the coding guideline requiring l10n.t() for user-facing text. See comment on IntegrationItem.tsx for suggested alternatives.

Based on coding guidelines.

Also applies to: 54-155

src/webviews/webview-side/integrations/IntegrationList.tsx (1)

13-13: Same localization issue.

Hard-coded English string. See IntegrationItem.tsx comment for suggested alternatives.

Based on coding guidelines.

src/webviews/webview-side/integrations/BigQueryForm.tsx (1)

30-30: Same localization issue.

Hard-coded English strings. See IntegrationItem.tsx comment for suggested alternatives.

Based on coding guidelines.

Also applies to: 40-40, 61-61, 73-129

src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)

135-135: Same localization issue.

Hard-coded English strings. See IntegrationItem.tsx comment for suggested alternatives.

Based on coding guidelines.

Also applies to: 154-167

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ac510e and 6bf4689.

📒 Files selected for processing (13)
  • src/notebooks/deepnote/integrations/integrationManager.ts (4 hunks)
  • src/notebooks/deepnote/integrations/integrationStorage.ts (5 hunks)
  • src/notebooks/deepnote/integrations/integrationWebview.ts (4 hunks)
  • src/notebooks/deepnote/integrations/types.ts (2 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1 hunks)
  • src/notebooks/serviceRegistry.node.ts (2 hunks)
  • src/notebooks/serviceRegistry.web.ts (2 hunks)
  • src/webviews/webview-side/integrations/BigQueryForm.tsx (7 hunks)
  • src/webviews/webview-side/integrations/IntegrationItem.tsx (2 hunks)
  • src/webviews/webview-side/integrations/IntegrationList.tsx (1 hunks)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (4 hunks)
  • src/webviews/webview-side/integrations/PostgresForm.tsx (8 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/webviews/webview-side/integrations/PostgresForm.tsx
  • src/webviews/webview-side/integrations/IntegrationList.tsx
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/serviceRegistry.node.ts
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/webviews/webview-side/integrations/IntegrationItem.tsx
  • src/notebooks/serviceRegistry.web.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
**/*.node.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use *.node.ts for Desktop-specific implementations that require full file system access and Python environments

Files:

  • src/notebooks/serviceRegistry.node.ts
**/*.web.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use *.web.ts for Web-specific implementations using browser-compatible APIs

Files:

  • src/notebooks/serviceRegistry.web.ts
🧬 Code graph analysis (6)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (5)
src/notebooks/deepnote/integrations/types.ts (2)
  • IIntegrationStorage (4-4)
  • IIntegrationStorage (5-23)
src/test/mocks/vsc/index.ts (2)
  • CancellationToken (100-112)
  • CancellationTokenSource (114-125)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationType (1-1)
src/test/datascience/mockDocument.ts (1)
  • languageId (102-104)
src/test/datascience/mockTextEditor.ts (1)
  • document (67-69)
src/notebooks/deepnote/integrations/integrationWebview.ts (3)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationWithStatus (63-67)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationWithStatus (29-33)
src/platform/logging/index.ts (1)
  • logger (35-48)
src/notebooks/deepnote/integrations/types.ts (2)
src/notebooks/deepnote/integrations/integrationTypes.ts (2)
  • IntegrationConfig (49-49)
  • IntegrationWithStatus (63-67)
src/webviews/webview-side/integrations/types.ts (2)
  • IntegrationConfig (27-27)
  • IntegrationWithStatus (29-33)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (2)
src/notebooks/deepnote/integrations/types.ts (2)
  • IIntegrationStorage (4-4)
  • IIntegrationStorage (5-23)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/notebooks/deepnote/integrations/integrationManager.ts (2)
src/platform/logging/index.ts (1)
  • logger (35-48)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationStatus (3-3)
src/notebooks/deepnote/integrations/integrationStorage.ts (3)
src/test/mocks/vsc/index.ts (1)
  • EventEmitter (65-89)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationConfig (49-49)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationConfig (27-27)
⏰ 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). (2)
  • GitHub Check: Build & Test
  • GitHub Check: Audit - Production
🔇 Additional comments (5)
src/notebooks/deepnote/integrations/types.ts (1)

1-46: LGTM! Clean API additions.

The new onDidChangeIntegrations event, getIntegrationConfig method, and optional selectedIntegrationId parameter follow VS Code API conventions. Documentation is clear and the changes are backwards compatible.

src/notebooks/serviceRegistry.web.ts (1)

51-51: LGTM! Service registration is correct.

SqlCellStatusBarProvider properly registered as an activation service in the web registry.

Also applies to: 110-113

src/notebooks/serviceRegistry.node.ts (1)

56-56: LGTM! Service registration is correct.

SqlCellStatusBarProvider properly registered as an activation service in the node registry, consistent with the web registry.

Also applies to: 146-149

src/webviews/webview-side/integrations/IntegrationItem.tsx (1)

12-13: Verify webview localization approach.
Webview React code can’t import l10n.t() directly. Please choose and implement one of:

  1. Pass localized strings from the extension host via postMessage
  2. Integrate a browser-friendly i18n library in the webview
  3. Document this limitation and track it with a TODO/issue
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1)

71-80: IntegrationType enum usage is correct. IntegrationType.Postgres is a string enum value ('postgres') and compiles as expected.

@jankuca jankuca force-pushed the jk/feat/sql-block-open-credentials branch 2 times, most recently from 77a90f1 to 0819fb0 Compare October 17, 2025 11:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (2)

19-20: Use cross‑env timer type.

NodeJS.Timeout is wrong in the browser/webview. Use ReturnType.

-    const messageTimerRef = React.useRef<NodeJS.Timeout | null>(null);
-    const confirmDeleteTimerRef = React.useRef<NodeJS.Timeout | null>(null);
+    const messageTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
+    const confirmDeleteTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);

80-87: Dead timer ref; either remove or implement auto‑dismiss.

You clear confirmDeleteTimerRef but never set it. Implement timeout or drop the ref.

Example auto‑dismiss:

 const handleDelete = (integrationId: string) => {
   // Clear any existing confirmDelete timer before creating a new one
   if (confirmDeleteTimerRef.current) {
     clearTimeout(confirmDeleteTimerRef.current);
   }
   setConfirmDelete(integrationId);
+  confirmDeleteTimerRef.current = setTimeout(() => {
+    setConfirmDelete(null);
+    confirmDeleteTimerRef.current = null;
+  }, 10000);
 };
src/notebooks/deepnote/integrations/integrationStorage.ts (1)

110-124: Fire change event on clear().

Listeners won’t refresh after a bulk clear.

     async clear(): Promise<void> {
         await this.ensureCacheLoaded();
@@
         // Clear cache
         this.cache.clear();
+        // Notify listeners
+        this._onDidChangeIntegrations.fire();
     }
src/notebooks/deepnote/integrations/integrationWebview.ts (1)

53-58: Invalid webview option.

enableForms isn’t a valid WebviewOptions flag; remove it.

-            {
-                enableScripts: true,
-                retainContextWhenHidden: true,
-                localResourceRoots: [this.extensionContext.extensionUri],
-                enableForms: true
-            }
+            {
+                enableScripts: true,
+                retainContextWhenHidden: true,
+                localResourceRoots: [this.extensionContext.extensionUri]
+            }
src/webviews/webview-side/integrations/PostgresForm.tsx (1)

54-156: Re-add l10n for all user-facing strings.

Hard-coded English strings violate the coding guidelines.

As per coding guidelines.

Apply this diff to restore localization:

+import { l10n } from 'vscode';
+
 export const PostgresForm: React.FC<IPostgresFormProps> = ({ integrationId, existingConfig, onSave, onCancel }) => {
     // ... state declarations ...
     
     const config: PostgresIntegrationConfig = {
         id: integrationId,
-        name: name || `Unnamed PostgreSQL Integration (${integrationId})`,
+        name: name || l10n.t('Unnamed PostgreSQL Integration ({0})', integrationId),
         type: 'postgres',
         // ...
     };
     
     return (
         <form onSubmit={handleSubmit}>
             <div className="form-group">
-                <label htmlFor="name">Name (optional)</label>
+                <label htmlFor="name">{l10n.t('Name (optional)')}</label>
                 <input
                     type="text"
                     id="name"
                     value={name}
                     onChange={(e) => setName(e.target.value)}
-                    placeholder="My PostgreSQL Database"
+                    placeholder={l10n.t('My PostgreSQL Database')}
                     autoComplete="off"
                 />
             </div>
             
             <div className="form-group">
                 <label htmlFor="host">
-                    Host <span className="required">*</span>
+                    {l10n.t('Host')} <span className="required">*</span>
                 </label>
                 {/* ... */}
             </div>
             
             {/* Apply l10n.t() to all remaining labels, placeholders, and button text */}
♻️ Duplicate comments (2)
src/webviews/webview-side/integrations/IntegrationItem.tsx (1)

28-28: Same localization issue.

Reset button uses hard-coded English (see comment on lines 12-13).

src/notebooks/deepnote/integrations/integrationManager.ts (1)

148-157: Deferred: Use getIntegrationConfig for project-aware lookup.

Already noted in past review and deferred.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf4689 and 7ed538e.

📒 Files selected for processing (13)
  • src/notebooks/deepnote/integrations/integrationManager.ts (5 hunks)
  • src/notebooks/deepnote/integrations/integrationStorage.ts (5 hunks)
  • src/notebooks/deepnote/integrations/integrationWebview.ts (4 hunks)
  • src/notebooks/deepnote/integrations/types.ts (2 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1 hunks)
  • src/notebooks/serviceRegistry.node.ts (2 hunks)
  • src/notebooks/serviceRegistry.web.ts (2 hunks)
  • src/webviews/webview-side/integrations/BigQueryForm.tsx (7 hunks)
  • src/webviews/webview-side/integrations/IntegrationItem.tsx (2 hunks)
  • src/webviews/webview-side/integrations/IntegrationList.tsx (1 hunks)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (2 hunks)
  • src/webviews/webview-side/integrations/PostgresForm.tsx (8 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.web.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use *.web.ts for Web-specific implementations using browser-compatible APIs

Files:

  • src/notebooks/serviceRegistry.web.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/serviceRegistry.web.ts
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/notebooks/serviceRegistry.node.ts
  • src/webviews/webview-side/integrations/IntegrationList.tsx
  • src/webviews/webview-side/integrations/PostgresForm.tsx
  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/webviews/webview-side/integrations/IntegrationItem.tsx
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
**/*.node.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use *.node.ts for Desktop-specific implementations that require full file system access and Python environments

Files:

  • src/notebooks/serviceRegistry.node.ts
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
🧬 Code graph analysis (4)
src/notebooks/deepnote/integrations/integrationWebview.ts (3)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationWithStatus (63-67)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationWithStatus (29-33)
src/platform/logging/index.ts (1)
  • logger (35-48)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (4)
src/test/mocks/vsc/index.ts (2)
  • CancellationToken (100-112)
  • CancellationTokenSource (114-125)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationType (1-1)
src/test/datascience/mockDocument.ts (1)
  • languageId (102-104)
src/notebooks/deepnote/integrations/types.ts (3)
types/slickgrid/index.d.ts (1)
  • Event (86-126)
src/notebooks/deepnote/integrations/integrationTypes.ts (2)
  • IntegrationConfig (49-49)
  • IntegrationWithStatus (63-67)
src/webviews/webview-side/integrations/types.ts (2)
  • IntegrationConfig (27-27)
  • IntegrationWithStatus (29-33)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
🔇 Additional comments (7)
src/notebooks/serviceRegistry.web.ts (1)

110-113: LGTM: provider registration looks correct.

SqlCellStatusBarProvider is bound as an activation service alongside others.

Please confirm the provider registers a NotebookCellStatusBarItemProvider with VS Code within its activate() and is disposed via the injected disposables.

src/notebooks/serviceRegistry.node.ts (1)

146-149: LGTM: native registry wiring is consistent with web.

Registration mirrors web path; no issues spotted.

Confirm the provider self‑registers with vscode.notebooks.registerNotebookCellStatusBarItemProvider and cleans up on dispose.

src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1)

101-108: Past review comment addressed correctly.

The implementation now uses NotebookCellStatusBarItem with proper alignment and l10n.

src/notebooks/deepnote/integrations/types.ts (2)

6-22: LGTM.

Interface extensions support the new integration pre-selection flow.


42-45: LGTM.

Optional parameter maintains backward compatibility.

src/notebooks/deepnote/integrations/integrationManager.ts (2)

33-49: LGTM.

Robust handling of VS Code's context injection with variadic args.


177-190: LGTM.

Type-safe metadata extraction with appropriate logging.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (3)

74-74: Use string literal for IntegrationType.

IntegrationType is a string union type, not an enum. Use 'postgres' directly.

Apply this diff:

-            type: IntegrationType.Postgres,
+            type: 'postgres',

86-86: Replace magic number with enum.

Use NotebookCellStatusBarAlignment.Left instead of 1.

Apply this diff:

-        assert.strictEqual((result as any).alignment, 1); // NotebookCellStatusBarAlignment.Left
+        assert.strictEqual((result as any).alignment, NotebookCellStatusBarAlignment.Left);

Add import:

 import {
     CancellationToken,
     CancellationTokenSource,
     NotebookCell,
+    NotebookCellStatusBarAlignment,
     NotebookCellKind,

89-89: Chai assert lacks deepStrictEqual.

Use assert.deepEqual or switch to Node's strict assert.

Apply this diff:

-        assert.deepStrictEqual((result as any).command.arguments, [integrationId]);
+        assert.deepEqual((result as any).command.arguments, [integrationId]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ed538e and 0819fb0.

📒 Files selected for processing (2)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
🧠 Learnings (3)
📚 Learning: 2025-09-03T12:54:35.368Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/interactiveWindow.instructions.md:0-0
Timestamp: 2025-09-03T12:54:35.368Z
Learning: Applies to src/interactive-window/**/*.ts : Add unit and integration tests for new features and modifications; include performance and cross-platform test coverage

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
📚 Learning: 2025-10-07T15:31:30.150Z
Learnt from: hc2p
PR: deepnote/deepnote-internal#18615
File: apps/webapp-client/src/api/integration-api.ts:204-204
Timestamp: 2025-10-07T15:31:30.150Z
Learning: In apps/webapp-client/src/api/integration-api.ts, when reviewing bug fixes authored by the PR creator (e.g., changing integration.state to integration.type), use informational tone rather than marking as critical issues, since the fix is already implemented.

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
📚 Learning: 2025-10-09T11:21:57.494Z
Learnt from: CR
PR: deepnote/vscode-deepnote#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-09T11:21:57.494Z
Learning: Applies to **/*.unit.test.ts : Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (3)
src/notebooks/deepnote/integrations/types.ts (2)
  • IIntegrationStorage (4-4)
  • IIntegrationStorage (5-23)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationType (1-1)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
🪛 GitHub Actions: CI
src/notebooks/deepnote/sqlCellStatusBarProvider.ts

[error] 1739-1739: SqlCellStatusBarProvider: NotebookCellStatusBarItem is not a constructor. TypeError occurred at createStatusBarItem.

@jankuca jankuca force-pushed the jk/feat/sql-block-open-credentials branch from 0819fb0 to 626028f Compare October 17, 2025 11:59
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/webviews/webview-side/integrations/BigQueryForm.tsx (2)

18-27: Reset fields when existingConfig becomes null.

Effect only updates when existingConfig is truthy; switching from a populated config to null leaves stale values. Add an else branch to clear fields.

   React.useEffect(() => {
-        if (existingConfig) {
+        if (existingConfig) {
             setName(existingConfig.name || '');
             setProjectId(existingConfig.projectId || '');
             setCredentials(existingConfig.credentials || '');
             setCredentialsError(null);
-        }
+        } else {
+            setName('');
+            setProjectId('');
+            setCredentials('');
+            setCredentialsError(null);
+        }
   }, [existingConfig]);

Based on learnings.


55-76: Trim inputs before save.

Prevent accidental whitespace in ids; no behavior change.

-        const config: BigQueryIntegrationConfig = {
+        const config: BigQueryIntegrationConfig = {
             id: integrationId,
-            name: name || unnamedIntegration,
+            name: (name || unnamedIntegration).trim(),
             type: 'bigquery',
-            projectId,
-            credentials
+            projectId: projectId.trim(),
+            credentials
         };

Based on learnings.

src/webviews/webview-side/integrations/PostgresForm.tsx (2)

34-55: Validate and clamp port; trim string fields.

parseInt can yield NaN despite input attributes. Add runtime validation and normalize fields before constructing config.

   const handleSubmit = (e: React.FormEvent) => {
     e.preventDefault();
 
-    const unnamedIntegration = getLocString(
+    const unnamedIntegration = getLocString(
       'integrationsPostgresUnnamedIntegration',
       'Unnamed PostgreSQL Integration ({0})'
     ).replace('{0}', integrationId);
 
-    const config: PostgresIntegrationConfig = {
-      id: integrationId,
-      name: name || unnamedIntegration,
-      type: 'postgres',
-      host,
-      port: parseInt(port, 10),
-      database,
-      username,
-      password,
-      ssl
-    };
+    const portNum = parseInt(port, 10);
+    if (!Number.isInteger(portNum) || portNum < 1 || portNum > 65535) {
+      // Rely on simple alert UX; form can later show inline error if desired.
+      return;
+    }
+    const config: PostgresIntegrationConfig = {
+      id: integrationId,
+      name: (name || unnamedIntegration).trim(),
+      type: 'postgres',
+      host: host.trim(),
+      port: portNum,
+      database: database.trim(),
+      username: username.trim(),
+      password,
+      ssl
+    };
 
     onSave(config);
   };

21-33: Also clear fields when existingConfig becomes null.

Mirror the BigQuery form to avoid stale state.

   React.useEffect(() => {
-    if (existingConfig) {
+    if (existingConfig) {
       setName(existingConfig.name || '');
       setHost(existingConfig.host || '');
       setPort(existingConfig.port?.toString() || '5432');
       setDatabase(existingConfig.database || '');
       setUsername(existingConfig.username || '');
       setPassword(existingConfig.password || '');
       setSsl(existingConfig.ssl || false);
-    }
+    } else {
+      setName('');
+      setHost('');
+      setPort('5432');
+      setDatabase('');
+      setUsername('');
+      setPassword('');
+      setSsl(false);
+    }
   }, [existingConfig]);
src/notebooks/deepnote/integrations/integrationStorage.ts (2)

117-131: Fire change event on clear().

Consumers rely on onDidChangeIntegrations; clearing should notify too.

     async clear(): Promise<void> {
         await this.ensureCacheLoaded();
@@
         // Clear cache
         this.cache.clear();
+        // Notify listeners
+        this._onDidChangeIntegrations.fire();
     }

16-18: Declare interface implementation for compile-time safety.

Have the class implement IIntegrationStorage (it already satisfies it).

-@injectable()
-export class IntegrationStorage {
+@injectable()
+export class IntegrationStorage implements IIntegrationStorage {

Add import if missing:

+import { IIntegrationStorage } from './types';
♻️ Duplicate comments (2)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1)

89-90: Use a supported deep equality assert.

Chai’s assert doesn’t expose deepStrictEqual. Either switch to Node’s strict assert or use Chai’s deepEqual.

Option A (Node assert strict):

-import { assert } from 'chai';
+import { strict as assert } from 'assert';
...
-        assert.deepStrictEqual((result as any).command.arguments, [integrationId]);
+        assert.deepStrictEqual((result as any).command.arguments, [integrationId]);

Option B (stay on Chai):

-        assert.deepStrictEqual((result as any).command.arguments, [integrationId]);
+        assert.deepEqual((result as any).command.arguments, [integrationId]);
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1)

100-109: Use the enum instead of magic number for alignment.

Prefer NotebookCellStatusBarAlignment.Left for clarity/typing.

Apply:

@@
-        return {
-            text: `$(database) ${displayName}`,
-            alignment: 1, // NotebookCellStatusBarAlignment.Left
+        return {
+            text: `$(database) ${displayName}`,
+            alignment: NotebookCellStatusBarAlignment.Left,
             tooltip: l10n.t('SQL Integration: {0}\nClick to configure', displayName),
             command: {
                 title: l10n.t('Configure Integration'),
                 command: Commands.ManageIntegrations,
                 arguments: [integrationId]
             }
         };

Add import:

 import {
     CancellationToken,
     EventEmitter,
     NotebookCell,
+    NotebookCellStatusBarAlignment,
     NotebookCellStatusBarItem,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0819fb0 and 626028f.

📒 Files selected for processing (16)
  • src/messageTypes.ts (1 hunks)
  • src/notebooks/deepnote/integrations/integrationManager.ts (5 hunks)
  • src/notebooks/deepnote/integrations/integrationStorage.ts (6 hunks)
  • src/notebooks/deepnote/integrations/integrationWebview.ts (5 hunks)
  • src/notebooks/deepnote/integrations/types.ts (2 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (1 hunks)
  • src/platform/common/utils/localize.ts (1 hunks)
  • src/platform/webviews/webviewHost.ts (1 hunks)
  • src/webviews/webview-side/integrations/BigQueryForm.tsx (6 hunks)
  • src/webviews/webview-side/integrations/ConfigurationForm.tsx (2 hunks)
  • src/webviews/webview-side/integrations/IntegrationItem.tsx (3 hunks)
  • src/webviews/webview-side/integrations/IntegrationList.tsx (2 hunks)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (4 hunks)
  • src/webviews/webview-side/integrations/PostgresForm.tsx (5 hunks)
  • src/webviews/webview-side/integrations/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/platform/webviews/webviewHost.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/messageTypes.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/webviews/webview-side/integrations/types.ts
  • src/platform/common/utils/localize.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/platform/webviews/webviewHost.ts
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/webviews/webview-side/integrations/PostgresForm.tsx
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/notebooks/deepnote/integrations/types.ts
  • src/webviews/webview-side/integrations/IntegrationItem.tsx
  • src/messageTypes.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/webviews/webview-side/integrations/types.ts
  • src/platform/common/utils/localize.ts
  • src/webviews/webview-side/integrations/IntegrationList.tsx
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/webviews/webview-side/integrations/ConfigurationForm.tsx
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/integrations/integrationManager.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/notebooks/deepnote/integrations/types.ts
  • src/notebooks/deepnote/integrations/integrationStorage.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
src/platform/**/*.ts

📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)

src/platform/**/*.ts: Use Inversify decorators for DI: annotate classes with @Injectable() and inject dependencies with @Inject(Token)
Use the centralized logger (import { logger } from '../platform/logging') instead of console.log for application logging

Files:

  • src/platform/webviews/webviewHost.ts
  • src/platform/common/utils/localize.ts
**/*.unit.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place unit tests in files matching *.unit.test.ts

**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
🧠 Learnings (8)
📚 Learning: 2025-09-03T12:53:28.421Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-03T12:53:28.421Z
Learning: Applies to **/*.{ts,tsx} : Use `l10n.t()` for user-facing strings

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/webviews/webview-side/integrations/IntegrationList.tsx
📚 Learning: 2025-10-17T11:36:40.042Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/BigQueryForm.tsx:0-0
Timestamp: 2025-10-17T11:36:40.042Z
Learning: The vscode API (including l10n) is not available in webview React components located in src/webviews/webview-side/. User-facing strings in these components cannot use l10n.t() for localization.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/webviews/webview-side/integrations/IntegrationItem.tsx
  • src/webviews/webview-side/integrations/IntegrationList.tsx
📚 Learning: 2025-09-03T12:54:35.368Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/interactiveWindow.instructions.md:0-0
Timestamp: 2025-09-03T12:54:35.368Z
Learning: Applies to src/interactive-window/**/*.ts : Add unit and integration tests for new features and modifications; include performance and cross-platform test coverage

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
📚 Learning: 2025-10-07T15:31:30.150Z
Learnt from: hc2p
PR: deepnote/deepnote-internal#18615
File: apps/webapp-client/src/api/integration-api.ts:204-204
Timestamp: 2025-10-07T15:31:30.150Z
Learning: In apps/webapp-client/src/api/integration-api.ts, when reviewing bug fixes authored by the PR creator (e.g., changing integration.state to integration.type), use informational tone rather than marking as critical issues, since the fix is already implemented.

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
  • src/webviews/webview-side/integrations/PostgresForm.tsx
📚 Learning: 2025-10-09T11:21:57.494Z
Learnt from: CR
PR: deepnote/vscode-deepnote#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-09T11:21:57.494Z
Learning: Applies to **/*.unit.test.ts : Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts
📚 Learning: 2025-09-03T12:54:35.368Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/interactiveWindow.instructions.md:0-0
Timestamp: 2025-09-03T12:54:35.368Z
Learning: Applies to src/interactive-window/**/*.ts : Use EventEmitter for event-driven updates and ensure proper disposal/cleanup of listeners to prevent leaks

Applied to files:

  • src/notebooks/deepnote/integrations/integrationStorage.ts
📚 Learning: 2025-10-09T11:21:57.494Z
Learnt from: CR
PR: deepnote/vscode-deepnote#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-09T11:21:57.494Z
Learning: Use dependency injection with inversify

Applied to files:

  • src/notebooks/deepnote/integrations/integrationStorage.ts
📚 Learning: 2025-09-03T13:01:10.017Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/standalone.instructions.md:0-0
Timestamp: 2025-09-03T13:01:10.017Z
Learning: Applies to src/standalone/chat/extension.node.ts : Register chat tools in chat/extension.node.ts via vscode.lm.registerTool(...) and add the disposables to context.subscriptions

Applied to files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
🧬 Code graph analysis (12)
src/notebooks/deepnote/integrations/integrationManager.ts (2)
src/platform/logging/index.ts (1)
  • logger (35-48)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationStatus (3-3)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (2)
  • storeLocStrings (19-21)
  • getLocString (11-17)
src/notebooks/deepnote/sqlCellStatusBarProvider.unit.test.ts (4)
src/notebooks/deepnote/integrations/types.ts (2)
  • IIntegrationStorage (5-5)
  • IIntegrationStorage (6-24)
src/test/mocks/vsc/index.ts (2)
  • CancellationToken (100-112)
  • CancellationTokenSource (114-125)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationType (1-1)
src/webviews/webview-side/integrations/PostgresForm.tsx (2)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
src/webviews/webview-side/integrations/types.ts (1)
  • PostgresIntegrationConfig (11-19)
src/webviews/webview-side/integrations/BigQueryForm.tsx (3)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
src/webviews/webview-side/integrations/types.ts (1)
  • BigQueryIntegrationConfig (21-25)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • BigQueryIntegrationConfig (40-44)
src/notebooks/deepnote/integrations/types.ts (4)
src/platform/common/types.ts (1)
  • IDisposable (211-213)
types/slickgrid/index.d.ts (1)
  • Event (86-126)
src/webviews/webview-side/integrations/types.ts (2)
  • IntegrationConfig (27-27)
  • IntegrationWithStatus (29-33)
src/notebooks/deepnote/integrations/integrationTypes.ts (2)
  • IntegrationConfig (49-49)
  • IntegrationWithStatus (63-67)
src/webviews/webview-side/integrations/IntegrationItem.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
src/notebooks/deepnote/integrations/integrationStorage.ts (3)
src/test/mocks/vsc/index.ts (1)
  • EventEmitter (65-89)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationConfig (27-27)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationConfig (49-49)
src/webviews/webview-side/integrations/IntegrationList.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (3)
src/notebooks/deepnote/integrations/integrationStorage.ts (1)
  • injectable (16-185)
src/notebooks/deepnote/integrations/integrationManager.ts (1)
  • injectable (14-198)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/notebooks/deepnote/integrations/integrationWebview.ts (3)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationWithStatus (29-33)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationWithStatus (63-67)
src/messageTypes.ts (1)
  • LocalizedMessages (123-210)
src/webviews/webview-side/integrations/ConfigurationForm.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
⏰ 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: Build & Test
🔇 Additional comments (13)
src/platform/webviews/webviewHost.ts (1)

268-308: LGTM—integration keys properly scaffolded.

Empty strings are appropriate placeholders since this webview host doesn't render integration UI. The integration webview uses its own localization flow via LocInit messages.

src/webviews/webview-side/integrations/IntegrationItem.tsx (1)

13-19: Localization properly implemented.

Correctly uses getLocString() with appropriate fallback strings. Past review concerns resolved.

src/platform/common/utils/localize.ts (1)

817-860: LGTM—comprehensive integration localization.

Namespace properly structured with general UI strings and form-specific keys. Functional keys correctly use l10n.t() with parameters.

src/notebooks/deepnote/integrations/integrationManager.ts (2)

33-49: Command arg extraction reasonable.

Variadic pattern handles VS Code's context object injection. Loop to find first string argument is straightforward.


177-197: Cell scanning logic is sound.

Safe metadata extraction with proper type checks. Correctly builds integration list for utility function.

src/webviews/webview-side/integrations/IntegrationList.tsx (1)

14-18: Localization correctly applied.

src/webviews/webview-side/integrations/ConfigurationForm.tsx (1)

38-41: Title localization correct.

Placeholder replacement properly implemented with replace('{0}', integrationId).

src/webviews/webview-side/integrations/types.ts (1)

57-62: Message type properly extended.

LocInitMessage correctly added to union for localization initialization flow.

src/webviews/webview-side/integrations/IntegrationPanel.tsx (2)

43-48: loc_init handler functional.

Type guard on line 44 is redundant (switch already matched), but harmless.


140-180: All UI text properly localized.

Comprehensive migration to getLocString() throughout the panel. Past review concerns addressed.

src/notebooks/deepnote/integrations/integrationWebview.ts (1)

165-171: Good: sanitized logging.

Only logging counts now, avoiding secret leakage.

src/notebooks/deepnote/integrations/types.ts (1)

6-24: Interface extensions look good.

Events and clear()/getIntegrationConfig() additions align with usage.

src/messageTypes.ts (1)

168-210: All integration keys properly used and populated.*

Verification confirms:

  • All 38 keys defined in messageTypes.ts are used in webviews (caught earlier misses: integrationsConfirmResetMessage, integrationsConfirmResetDetails, integrationsOptionalField used via multiline getLocString calls)
  • All keys initialized in webviewHost.ts (lines 269–307) as placeholder empty strings
  • All keys populated in integrationWebview.ts (lines 112–119+) from localize.Integrations namespace
  • LocInit mechanism properly wired: messageTypes.ts → handleLocInit → redux → webviews

No orphan or missing keys. No host/webview mismatch.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/platform/webviews/webviewHost.ts (2)

232-238: Wrong localization keys mapped.

  • filterRowsTooltip points to sliceMismatchedAxesError.
  • clearFilters points to refreshDataViewer.

Fix to the correct keys.

-            filterRowsTooltip: localize.WebViews.sliceMismatchedAxesError,
+            filterRowsTooltip: localize.WebViews.filterRowsTooltip,
@@
-            clearFilters: localize.WebViews.refreshDataViewer,
+            clearFilters: localize.WebViews.clearFilters,

186-188: LocInit sent twice.

sendLocStrings runs in loadWebview and again on Started. Consider sending once or de-duping to reduce traffic.

Also applies to: 328-331

src/webviews/webview-side/integrations/BigQueryForm.tsx (1)

18-27: Reset fields when existingConfig becomes null.

Current effect ignores null and leaves stale values.

 React.useEffect(() => {
-    if (existingConfig) {
+    if (existingConfig) {
         setName(existingConfig.name || '');
         setProjectId(existingConfig.projectId || '');
         setCredentials(existingConfig.credentials || '');
         setCredentialsError(null);
-    }
+    } else {
+        setName('');
+        setProjectId('');
+        setCredentials('');
+        setCredentialsError(null);
+    }
 }, [existingConfig]);
src/webviews/webview-side/integrations/PostgresForm.tsx (1)

21-33: Reset fields when existingConfig becomes null.

Avoid stale form state.

 React.useEffect(() => {
-    if (existingConfig) {
+    if (existingConfig) {
         setName(existingConfig.name || '');
         setHost(existingConfig.host || '');
         setPort(existingConfig.port?.toString() || '5432');
         setDatabase(existingConfig.database || '');
         setUsername(existingConfig.username || '');
         setPassword(existingConfig.password || '');
         setSsl(existingConfig.ssl || false);
-    }
+    } else {
+        setName('');
+        setHost('');
+        setPort('5432');
+        setDatabase('');
+        setUsername('');
+        setPassword('');
+        setSsl(false);
+    }
 }, [existingConfig]);
src/notebooks/deepnote/integrations/integrationWebview.ts (2)

55-61: Invalid Webview options: remove enableForms.

WebviewOptions/WebviewPanelOptions don’t include enableForms.

             {
                 enableScripts: true,
                 retainContextWhenHidden: true,
                 localResourceRoots: [this.extensionContext.extensionUri],
-                enableForms: true
             }

51-54: Localize the panel/window title.

Use l10n.t for user-facing strings.

-        this.currentPanel = window.createWebviewPanel(
+        this.currentPanel = window.createWebviewPanel(
             'deepnoteIntegrations',
-            'Deepnote Integrations',
+            l10n.t('Deepnote Integrations'),
             column || ViewColumn.One,
             {
-    <title>Deepnote Integrations</title>
+    <title>${l10n.t('Deepnote Integrations')}</title>

As per coding guidelines.

Also applies to: 321-330

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 626028f and e09a06c.

📒 Files selected for processing (6)
  • src/messageTypes.ts (1 hunks)
  • src/notebooks/deepnote/integrations/integrationWebview.ts (5 hunks)
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts (1 hunks)
  • src/platform/webviews/webviewHost.ts (1 hunks)
  • src/webviews/webview-side/integrations/BigQueryForm.tsx (6 hunks)
  • src/webviews/webview-side/integrations/PostgresForm.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/webviews/webview-side/integrations/BigQueryForm.tsx
  • src/platform/webviews/webviewHost.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/messageTypes.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
  • src/webviews/webview-side/integrations/PostgresForm.tsx
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/platform/webviews/webviewHost.ts
  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/messageTypes.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
src/platform/**/*.ts

📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)

src/platform/**/*.ts: Use Inversify decorators for DI: annotate classes with @Injectable() and inject dependencies with @Inject(Token)
Use the centralized logger (import { logger } from '../platform/logging') instead of console.log for application logging

Files:

  • src/platform/webviews/webviewHost.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
🧠 Learnings (5)
📚 Learning: 2025-09-03T12:53:28.421Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-03T12:53:28.421Z
Learning: Applies to **/*.{ts,tsx} : Use `l10n.t()` for user-facing strings

Applied to files:

  • src/webviews/webview-side/integrations/BigQueryForm.tsx
📚 Learning: 2025-10-17T11:36:40.042Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/BigQueryForm.tsx:0-0
Timestamp: 2025-10-17T11:36:40.042Z
Learning: The vscode API (including l10n) is not available in webview React components located in src/webviews/webview-side/. User-facing strings in these components cannot use l10n.t() for localization.

Applied to files:

  • src/webviews/webview-side/integrations/BigQueryForm.tsx
📚 Learning: 2025-09-03T13:01:10.017Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/standalone.instructions.md:0-0
Timestamp: 2025-09-03T13:01:10.017Z
Learning: Applies to src/standalone/chat/extension.node.ts : Register chat tools in chat/extension.node.ts via vscode.lm.registerTool(...) and add the disposables to context.subscriptions

Applied to files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
📚 Learning: 2025-09-03T12:54:35.368Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/interactiveWindow.instructions.md:0-0
Timestamp: 2025-09-03T12:54:35.368Z
Learning: Applies to src/interactive-window/**/*.ts : Use EventEmitter for event-driven updates and ensure proper disposal/cleanup of listeners to prevent leaks

Applied to files:

  • src/notebooks/deepnote/sqlCellStatusBarProvider.ts
📚 Learning: 2025-10-07T15:31:30.150Z
Learnt from: hc2p
PR: deepnote/deepnote-internal#18615
File: apps/webapp-client/src/api/integration-api.ts:204-204
Timestamp: 2025-10-07T15:31:30.150Z
Learning: In apps/webapp-client/src/api/integration-api.ts, when reviewing bug fixes authored by the PR creator (e.g., changing integration.state to integration.type), use informational tone rather than marking as critical issues, since the fix is already implemented.

Applied to files:

  • src/webviews/webview-side/integrations/PostgresForm.tsx
🧬 Code graph analysis (3)
src/webviews/webview-side/integrations/BigQueryForm.tsx (3)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
src/webviews/webview-side/integrations/types.ts (1)
  • BigQueryIntegrationConfig (21-25)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • BigQueryIntegrationConfig (40-44)
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (2)
src/notebooks/deepnote/integrations/types.ts (2)
  • IIntegrationStorage (5-5)
  • IIntegrationStorage (6-24)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • DATAFRAME_SQL_INTEGRATION_ID (5-5)
src/webviews/webview-side/integrations/PostgresForm.tsx (3)
src/webviews/webview-side/integrations/types.ts (1)
  • PostgresIntegrationConfig (11-19)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • PostgresIntegrationConfig (27-35)
src/webviews/webview-side/react-common/locReactSide.ts (1)
  • getLocString (11-17)
⏰ 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: Build & Test
🔇 Additional comments (7)
src/notebooks/deepnote/integrations/integrationWebview.ts (2)

142-146: No issues found. Payload shape matches webview listener.

Verification confirms the integration webview sends { type: 'loc_init', locStrings: string } which matches the LocInitMessage interface and the listener's expectations in IntegrationPanel.tsx.


63-74: Proposed solution is incomplete and would hang indefinitely.

The race condition is real—IntegrationPanel.tsx attaches its message listener in useEffect (line 77), which runs asynchronously after React renders. Meanwhile, integrationWebview.ts sends messages immediately (lines 87–93), before the webview's listener is attached.

However, the diff is broken: it expects the webview to emit a SharedMessages.Started or 'ready' message, but IntegrationPanel.tsx sends only 'configure', 'delete', and 'save' message types. Waiting for webviewReady.promise will hang indefinitely because that signal is never sent.

To fix this properly, either:

  1. Modify IntegrationPanel.tsx to post a SharedMessages.Started message when the listener attaches, or
  2. Use a different synchronization mechanism (e.g., listen for the first valid message type instead of waiting for a nonexistent signal).
src/notebooks/deepnote/sqlCellStatusBarProvider.ts (5)

1-18: Imports look good.

All necessary dependencies imported and properly ordered per guidelines.


34-47: LGTM! EventEmitter disposal properly handled.

Past review concern about EventEmitter leaks is now addressed (line 46).


49-74: LGTM! Proper filtering and cancellation handling.

Logic correctly filters SQL cells, excludes internal integrations, and checks cancellation.


76-87: LGTM! Safe metadata access with proper type guards.

Implementation matches the pattern used elsewhere in the codebase.


89-113: LGTM! Past review issues resolved.

Returns plain object (not constructor), uses l10n.t() for localization, and includes appropriate fallback logic. Alignment value documented inline.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 768aa72 and a6dd774.

📒 Files selected for processing (5)
  • src/notebooks/deepnote/integrations/integrationWebview.ts (5 hunks)
  • src/platform/webviews/webviewHost.ts (1 hunks)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (4 hunks)
  • src/webviews/webview-side/integrations/types.ts (1 hunks)
  • src/webviews/webview-side/react-common/locReactSide.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/!(*.node|*.web).ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Place shared cross-platform logic in common .ts files (not suffixed with .node or .web)

Files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/webviews/webview-side/react-common/locReactSide.ts
  • src/platform/webviews/webviewHost.ts
  • src/webviews/webview-side/integrations/types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/webviews/webview-side/react-common/locReactSide.ts
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/platform/webviews/webviewHost.ts
  • src/webviews/webview-side/integrations/types.ts
src/notebooks/deepnote/**

📄 CodeRabbit inference engine (CLAUDE.md)

Deepnote integration code resides under src/notebooks/deepnote/

Files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
src/platform/**/*.ts

📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)

src/platform/**/*.ts: Use Inversify decorators for DI: annotate classes with @Injectable() and inject dependencies with @Inject(Token)
Use the centralized logger (import { logger } from '../platform/logging') instead of console.log for application logging

Files:

  • src/platform/webviews/webviewHost.ts
🧠 Learnings (4)
📚 Learning: 2025-10-17T12:29:11.814Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/PostgresForm.tsx:45-51
Timestamp: 2025-10-17T12:29:11.814Z
Learning: In webview-side React components (src/webviews/webview-side/), use the format() function with hardcoded template strings for dynamic localization with placeholders, not getLocString(). The LocalizedMessages type only supports string properties, not functions, so templates like format('Unnamed PostgreSQL Integration ({0})', id) are the correct pattern.

Applied to files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
  • src/webviews/webview-side/react-common/locReactSide.ts
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
  • src/platform/webviews/webviewHost.ts
📚 Learning: 2025-09-03T13:01:10.017Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/standalone.instructions.md:0-0
Timestamp: 2025-09-03T13:01:10.017Z
Learning: Applies to src/standalone/chat/extension.node.ts : Register chat tools in chat/extension.node.ts via vscode.lm.registerTool(...) and add the disposables to context.subscriptions

Applied to files:

  • src/notebooks/deepnote/integrations/integrationWebview.ts
📚 Learning: 2025-09-03T12:53:28.421Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-03T12:53:28.421Z
Learning: Applies to **/*.{ts,tsx} : Use `l10n.t()` for user-facing strings

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
📚 Learning: 2025-10-17T11:36:40.042Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/BigQueryForm.tsx:0-0
Timestamp: 2025-10-17T11:36:40.042Z
Learning: The vscode API (including l10n) is not available in webview React components located in src/webviews/webview-side/. User-facing strings in these components cannot use l10n.t() for localization.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
🧬 Code graph analysis (4)
src/notebooks/deepnote/integrations/integrationWebview.ts (4)
src/webviews/webview-side/integrations/types.ts (1)
  • IntegrationWithStatus (29-33)
src/notebooks/deepnote/integrations/integrationTypes.ts (1)
  • IntegrationWithStatus (63-67)
src/messageTypes.ts (1)
  • LocalizedMessages (123-207)
src/platform/logging/index.ts (1)
  • logger (35-48)
src/webviews/webview-side/react-common/locReactSide.ts (1)
src/messageTypes.ts (1)
  • LocalizedMessages (123-207)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (2)
  • storeLocStrings (19-21)
  • getLocString (11-17)
src/platform/webviews/webviewHost.ts (1)
src/messageTypes.ts (1)
  • LocalizedMessages (123-207)
⏰ 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). (2)
  • GitHub Check: Lint & Format
  • GitHub Check: Build & Test
🔇 Additional comments (7)
src/platform/webviews/webviewHost.ts (1)

224-269: LGTM — Partial localization pattern applied correctly.

The type relaxation to Partial<LocalizedMessages> allows sending only the keys this webview actually uses, preventing empty-string overrides in the webview-side fallback logic.

src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)

140-180: LGTM — getLocString usage is correct.

All user-facing strings properly use getLocString with fallback defaults, following the webview-side localization pattern.

Based on learnings

src/webviews/webview-side/react-common/locReactSide.ts (1)

9-21: LGTM — Partial localization support implemented correctly.

The type relaxation to Partial<LocalizedMessages> with ?? defValue fallback (line 13) properly handles optional keys, ensuring getLocString returns the default when a key is omitted from the payload.

src/webviews/webview-side/integrations/types.ts (1)

57-62: LGTM — LocInitMessage type definitions correct.

The interface properly types the loc_init payload with Partial<LocalizedMessages>, coordinating with the webview host and receiver implementations.

src/notebooks/deepnote/integrations/integrationWebview.ts (3)

32-94: LGTM — selectedIntegrationId parameter integrated correctly.

The optional parameter enables pre-selection of an integration for immediate configuration. Both code paths (panel reuse at lines 43-46 and new panel creation at lines 90-93) consistently handle the conditional form display.


96-146: LGTM — sendLocStrings implementation is correct.

Localization strings are sent as an object (line 144), not stringified, which aligns with the Partial<LocalizedMessages> type in LocInitMessage and avoids unnecessary serialization round-trips. The method pulls from the localize.Integrations namespace and correctly uses Partial<LocalizedMessages> to send only integration-related keys.


151-162: LGTM — Debug logging is safe.

Logs only count metadata (line 162), avoiding exposure of credentials or config details from integration objects.

@linear
Copy link

linear bot commented Oct 17, 2025

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 17, 2025
@jankuca jankuca changed the title feat: Buttons to open SQL block integration config feat: Buttons to open SQL block integration config, fix localization Oct 17, 2025
@jankuca jankuca changed the title feat: Buttons to open SQL block integration config, fix localization feat: Buttons to open SQL block integration config + fix localization Oct 17, 2025
@jankuca jankuca marked this pull request as ready for review October 17, 2025 13:30
@jankuca jankuca marked this pull request as draft October 17, 2025 13:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6dd774 and 1faed39.

📒 Files selected for processing (1)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
🧠 Learnings (3)
📚 Learning: 2025-10-17T12:29:11.814Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/PostgresForm.tsx:45-51
Timestamp: 2025-10-17T12:29:11.814Z
Learning: In webview-side React components (src/webviews/webview-side/), use the format() function with hardcoded template strings for dynamic localization with placeholders, not getLocString(). The LocalizedMessages type only supports string properties, not functions, so templates like format('Unnamed PostgreSQL Integration ({0})', id) are the correct pattern.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
📚 Learning: 2025-09-03T12:53:28.421Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-03T12:53:28.421Z
Learning: Applies to **/*.{ts,tsx} : Use `l10n.t()` for user-facing strings

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
📚 Learning: 2025-10-17T11:36:40.042Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/BigQueryForm.tsx:0-0
Timestamp: 2025-10-17T11:36:40.042Z
Learning: The vscode API (including l10n) is not available in webview React components located in src/webviews/webview-side/. User-facing strings in these components cannot use l10n.t() for localization.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
🧬 Code graph analysis (1)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (2)
  • storeLocStrings (19-21)
  • getLocString (11-17)
🪛 Biome (2.1.2)
src/webviews/webview-side/integrations/IntegrationPanel.tsx

[error] 44-44: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Safe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (2)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (2)

3-3: LGTM: Correct localization imports.

Properly imports webview-side localization utilities.


138-178: LGTM: Localization correctly implemented.

All user-facing strings use getLocString() with appropriate keys and fallback values per webview-side requirements.

Based on learnings.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)

43-45: Eliminate intermediate variable or wrap in braces.

The const locStrings declaration can leak to other cases. Either pass msg.locStrings directly to storeLocStrings() or wrap the case body in braces.

Apply this diff:

 case 'loc_init':
-    const locStrings = msg.locStrings;
-    storeLocStrings(locStrings);
+    storeLocStrings(msg.locStrings);
     break;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94843c9 and ed65018.

📒 Files selected for processing (1)
  • src/webviews/webview-side/integrations/IntegrationPanel.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports

Files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
🧠 Learnings (3)
📚 Learning: 2025-10-17T12:29:11.814Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/PostgresForm.tsx:45-51
Timestamp: 2025-10-17T12:29:11.814Z
Learning: In webview-side React components (src/webviews/webview-side/), use the format() function with hardcoded template strings for dynamic localization with placeholders, not getLocString(). The LocalizedMessages type only supports string properties, not functions, so templates like format('Unnamed PostgreSQL Integration ({0})', id) are the correct pattern.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
📚 Learning: 2025-09-03T12:53:28.421Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-03T12:53:28.421Z
Learning: Applies to **/*.{ts,tsx} : Use `l10n.t()` for user-facing strings

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
📚 Learning: 2025-10-17T11:36:40.042Z
Learnt from: jankuca
PR: deepnote/vscode-deepnote#73
File: src/webviews/webview-side/integrations/BigQueryForm.tsx:0-0
Timestamp: 2025-10-17T11:36:40.042Z
Learning: The vscode API (including l10n) is not available in webview React components located in src/webviews/webview-side/. User-facing strings in these components cannot use l10n.t() for localization.

Applied to files:

  • src/webviews/webview-side/integrations/IntegrationPanel.tsx
🧬 Code graph analysis (1)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)
src/webviews/webview-side/react-common/locReactSide.ts (2)
  • storeLocStrings (19-21)
  • getLocString (11-17)
⏰ 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: Build & Test
🔇 Additional comments (1)
src/webviews/webview-side/integrations/IntegrationPanel.tsx (1)

137-137: LGTM: Localization implementation.

All user-facing strings correctly use getLocString with appropriate fallbacks. Pattern aligns with webview-side localization approach.

Also applies to: 156-177

@jankuca jankuca marked this pull request as ready for review October 17, 2025 13:52
Copy link
Member

@Artmann Artmann left a comment

Choose a reason for hiding this comment

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

Really cool stuff! 🚀

@jankuca jankuca merged commit 953a32a into main Oct 17, 2025
10 checks passed
@jankuca jankuca deleted the jk/feat/sql-block-open-credentials branch October 17, 2025 13:56
@deepnote deepnote deleted a comment from linear bot Oct 23, 2025
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