Repository navigation
feat: add .deepnote file schema and deserializer - #28
andyjakubowski merged 6 commits into
Conversation
Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
📝 WalkthroughWalkthroughAdded runtime deps Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Deserializer as deserializeDeepnoteFile
participant Parser as parseYaml
participant YAML as yaml.parse
participant Schema as deepnoteFileSchema (zod)
Caller->>Deserializer: deserializeDeepnoteFile(yamlContent)
Deserializer->>Parser: parseYaml(yamlContent)
Parser->>YAML: parse(yamlContent)
alt parse success
YAML-->>Parser: parsedObject
Parser-->>Deserializer: parsedObject
Deserializer->>Schema: safeParse(parsedObject)
alt validation succeeds
Schema-->>Deserializer: { success: true, data }
Deserializer-->>Caller: return DeepnoteFile
else validation fails
Schema-->>Deserializer: { success: false, error }
Deserializer-->>Caller: throw Error("Invalid Deepnote file: <path>: <message>")
end
else parse failure
YAML-->>Parser: throw Error
Parser-->>Deserializer: throw Error("Failed to parse Deepnote file: ...")
end
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (5 passed)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 92.67% 93.55% +0.88%
==========================================
Files 16 19 +3
Lines 505 590 +85
Branches 167 117 -50
==========================================
+ Hits 468 552 +84
- Misses 37 38 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| return parsed | ||
| } catch (_) { | ||
| throw new Error('Failed to parse Deepnote file.') |
There was a problem hiding this comment.
Do we want to include the parse error here, or does it not contain anything useful?
Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
There was a problem hiding this comment.
Actionable comments posted: 6
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
packages/blocks/package.json(1 hunks)packages/blocks/src/deserialize-file/deepnote-file-schema.ts(1 hunks)packages/blocks/src/deserialize-file/deserialize-deepnote-file.ts(1 hunks)packages/blocks/src/deserialize-file/parse-yaml.ts(1 hunks)packages/blocks/src/index.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-12T12:52:09.726Z
Learnt from: CR
PR: deepnote/vscode-deepnote#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-12T12:52:09.726Z
Learning: Applies to src/notebooks/deepnote/deepnoteTypes.ts : deepnoteTypes.ts should contain only type definitions
Applied to files:
packages/blocks/src/deserialize-file/deepnote-file-schema.ts
🧬 Code graph analysis (1)
packages/blocks/src/deserialize-file/deserialize-deepnote-file.ts (2)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts (2)
DeepnoteFile(65-65)deepnoteFileSchema(17-63)packages/blocks/src/deserialize-file/parse-yaml.ts (1)
parseYaml(3-11)
🔇 Additional comments (2)
packages/blocks/src/index.ts (1)
1-1: LGTM!Clean export addition following existing patterns.
packages/blocks/src/deserialize-file/deserialize-deepnote-file.ts (1)
7-25: Well-structured error handling.The function correctly uses
safeParse, extracts path information, and constructs clear error messages. The separation of YAML parsing and schema validation is clean.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts(1 hunks)packages/blocks/src/deserialize-file/parse-yaml.test.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/blocks/src/deserialize-file/parse-yaml.test.ts (1)
packages/blocks/src/deserialize-file/parse-yaml.ts (1)
parseYaml(3-12)
packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts (2)
packages/blocks/src/deserialize-file/parse-yaml.ts (1)
parseYaml(3-12)packages/blocks/src/deserialize-file/deepnote-file-schema.ts (1)
deepnoteFileSchema(17-63)
…to-deepnoteblocks-package
Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
Closes https://linear.app/deepnote/issue/OSS-137/add-deepnote-file-deserializer-to-deepnoteblocks-package
Summary by CodeRabbit
New Features
Chores
Tests