-
Notifications
You must be signed in to change notification settings - Fork 4
feat: SQL metadata output renderer #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdds a Deepnote SQL metadata notebook renderer: a memoized React component that displays SQL metadata (status, optional cache timestamp, size), a VS Code renderer activation module that mounts/unmounts the component for outputs with MIME Sequence Diagram(s)sequenceDiagram
autonumber
participant Notebook
participant Renderer as "VSCode Renderer (activate)"
participant ReactDOM
participant Component as "SqlMetadataRenderer"
Notebook->>Renderer: NotebookCellOutputItem (mime: application/vnd.deepnote.sql-output-metadata+json)
activate Renderer
Renderer->>Renderer: outputItem.json() -> data
Renderer->>ReactDOM: create root element & render(<SqlMetadataRenderer data={data} />)
activate ReactDOM
ReactDOM->>Component: mount with data
activate Component
Component->>Component: compute statusInfo, format cache_created_at & size_in_bytes
Component-->>ReactDOM: rendered DOM
deactivate Component
ReactDOM-->>Renderer: render complete
deactivate ReactDOM
Renderer->>Notebook: rendered output displayed
deactivate Renderer
Possibly related PRs
Suggested reviewers
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
build/esbuild/build.ts(1 hunks)package.json(1 hunks)src/notebooks/deepnote/deepnoteDataConverter.ts(2 hunks)src/notebooks/deepnote/deepnoteDataConverter.unit.test.ts(2 hunks)src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx(1 hunks)src/webviews/webview-side/sql-metadata-renderer/index.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Usel10n.t()for user-facing strings
Use typed error classes fromsrc/platform/errors/when throwing or handling errors
Use theILoggerservice instead ofconsole.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 withCancellationToken
**/*.{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/sql-metadata-renderer/SqlMetadataRenderer.tsxsrc/webviews/webview-side/sql-metadata-renderer/index.tsbuild/esbuild/build.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/notebooks/deepnote/deepnoteDataConverter.unit.test.ts
**/!(*.node|*.web).ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place shared cross-platform logic in common
.tsfiles (not suffixed with.nodeor.web)
Files:
src/webviews/webview-side/sql-metadata-renderer/index.tsbuild/esbuild/build.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/notebooks/deepnote/deepnoteDataConverter.unit.test.ts
src/notebooks/deepnote/**
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration code resides under src/notebooks/deepnote/
Files:
src/notebooks/deepnote/deepnoteDataConverter.tssrc/notebooks/deepnote/deepnoteDataConverter.unit.test.ts
src/notebooks/deepnote/deepnoteDataConverter.ts
📄 CodeRabbit inference engine (CLAUDE.md)
deepnoteDataConverter.ts performs Deepnote data transformations
Files:
src/notebooks/deepnote/deepnoteDataConverter.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/deepnoteDataConverter.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
thenproperty to avoid hanging tests
Files:
src/notebooks/deepnote/deepnoteDataConverter.unit.test.ts
🧠 Learnings (2)
📚 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 src/notebooks/deepnote/deepnoteDataConverter.ts : deepnoteDataConverter.ts performs Deepnote data transformations
Applied to files:
src/notebooks/deepnote/deepnoteDataConverter.tssrc/notebooks/deepnote/deepnoteDataConverter.unit.test.ts
📚 Learning: 2025-09-03T12:59:14.489Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/notebooks.instructions.md:0-0
Timestamp: 2025-09-03T12:59:14.489Z
Learning: Applies to src/notebooks/export/**/*.ts : Update FileConverter to handle the new export format
Applied to files:
src/notebooks/deepnote/deepnoteDataConverter.ts
🧬 Code graph analysis (2)
src/webviews/webview-side/sql-metadata-renderer/index.ts (1)
src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx (1)
SqlMetadataRenderer(14-96)
src/notebooks/deepnote/deepnoteDataConverter.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
NotebookCellOutputItem(16-69)
🔇 Additional comments (6)
build/esbuild/build.ts (1)
339-350: LGTM - Follows established pattern.The build configuration mirrors the existing renderer setup (vega-renderer) correctly.
src/notebooks/deepnote/deepnoteDataConverter.ts (2)
223-227: LGTM - Consistent with existing MIME type handling.The SQL metadata MIME type handling follows the same pattern as dataframe and vega outputs.
312-319: LGTM - Symmetric conversion.The reverse transformation correctly reconstructs the SQL metadata output item.
src/notebooks/deepnote/deepnoteDataConverter.unit.test.ts (2)
435-475: LGTM - Thorough test coverage.The test validates MIME type registration and JSON payload preservation correctly.
513-558: LGTM - Round-trip validation.Confirms SQL metadata survives blocks→cells→blocks conversion without data loss.
package.json (1)
1860-1868: LGTM - Renderer registration correct.Configuration matches existing renderer pattern and aligns with build output path.
src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx
Outdated
Show resolved
Hide resolved
e1e2d82 to
85cfd9e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
=====================================
Coverage 71% 71%
=====================================
Files 527 527
Lines 39474 39500 +26
Branches 4933 4935 +2
=====================================
+ Hits 28277 28312 +35
+ Misses 9563 9547 -16
- Partials 1634 1641 +7
🚀 New features to boost your workflow:
|
There was a problem hiding this 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/sql-metadata-renderer/index.ts (1)
26-26: Replace console.error with ILogger.Coding guidelines require using the ILogger service instead of console methods.
As per coding guidelines
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx(1 hunks)src/webviews/webview-side/sql-metadata-renderer/index.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Usel10n.t()for user-facing strings
Use typed error classes fromsrc/platform/errors/when throwing or handling errors
Use theILoggerservice instead ofconsole.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 withCancellationToken
**/*.{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/sql-metadata-renderer/SqlMetadataRenderer.tsxsrc/webviews/webview-side/sql-metadata-renderer/index.ts
**/!(*.node|*.web).ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place shared cross-platform logic in common
.tsfiles (not suffixed with.nodeor.web)
Files:
src/webviews/webview-side/sql-metadata-renderer/index.ts
🧠 Learnings (1)
📚 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 the `ILogger` service instead of `console.log`
Applied to files:
src/webviews/webview-side/sql-metadata-renderer/index.ts
🧬 Code graph analysis (1)
src/webviews/webview-side/sql-metadata-renderer/index.ts (1)
src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx (1)
SqlMetadataRenderer(56-96)
⏰ 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 & Package Extension
- GitHub Check: Lint & Format
🔇 Additional comments (3)
src/webviews/webview-side/sql-metadata-renderer/index.ts (1)
13-13: LGTM: Proper cleanup implemented.The roots Map and disposeOutputItem implementation correctly prevent memory leaks by unmounting React components.
Also applies to: 22-22, 35-43
src/webviews/webview-side/sql-metadata-renderer/SqlMetadataRenderer.tsx (2)
14-41: LGTM: Helper functions properly extracted.Moving getStatusMessage outside the component avoids recreation on each render.
83-86: Date formatting is locale-aware.Using toLocaleString() correctly respects user locale preferences, which aligns with VS Code UX expectations.
Resolves GRN-4964
Before:
After:
Even though SQL caching is not available locally (we cannot upload to S3), we can still renderer these outputs. Some imported
.deepnotefiles may contain them, and the SQL blocks do generate them.Summary by CodeRabbit