Skip to content

feat: derive DeepnoteBlock type from Zod schema, update createMarkdown - #29

Merged
andyjakubowski merged 2 commits into
mainfrom
andy/grn-4902-derive-deepnoteblock-type-from-zod-schema-update
Oct 7, 2025
Merged

andyjakubowski merged 2 commits into
mainfrom
andy/grn-4902-derive-deepnoteblock-type-from-zod-schema-update

Conversation

@andyjakubowski

@andyjakubowski andyjakubowski commented Oct 7, 2025 •

Copy link
Copy Markdown
Contributor

Removes hand coded DeepnoteBlock interface and uses a Zod schema derived type instead.

Signed-off-by: Andy Jakubowski hello@andyjakubowski.com

Summary by CodeRabbit

  • New Features

    • Exposed a block schema type in the blocks package exports.
  • Bug Fixes

    • Markdown handling improved: markdown blocks now return their content directly (handles empty content).
  • Refactor

    • Renamed and consolidated block schema exports for clarity.
    • Unified type imports across block modules to a single schema source (no runtime behavior changes).
  • Tests

    • Added tests covering markdown block content handling.

Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

  • Removed the exported DeepnoteBlock interface from packages/blocks/src/blocks.ts.
  • Introduced/renamed deepnoteBlockSchema and DeepnoteBlock in packages/blocks/src/deserialize-file/deepnote-file-schema.ts (was deepnoteFileBlockSchema / DeepnoteFileBlock) and updated deepnoteFileSchema to reference it.
  • Updated multiple block modules (big-number, button, code, image, input, sql, text, visualization) to import DeepnoteBlock from deserialize-file/deepnote-file-schema instead of ../blocks.
  • Updated packages/blocks/src/index.ts to export DeepnoteBlock alongside DeepnoteFile.
  • packages/blocks/src/markdown.ts: switched to a type-only import for DeepnoteBlock and added an early return for block.type === 'markdown' (returns block.content || "").
  • packages/blocks/src/python-code.ts: switched to a type-only DeepnoteBlock import; runtime logic unchanged.
  • Added tests in packages/blocks/src/markdown.test.ts for markdown block content handling.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Markdown as createMarkdown(block)
  participant Error as UnsupportedBlockTypeError

  Caller->>Markdown: call with DeepnoteBlock
  alt block.type == "markdown"
    Note right of Markdown #DDEBF7: New early return\nreturns block.content || ""
    Markdown-->>Caller: string (content or "")
  else block.type in {"text","separator","image"}
    Note right of Markdown #F7F3DD: existing rendering paths
    Markdown-->>Caller: rendered string
  else other type
    Note right of Error #FBE7E6: unsupported -> throw
    Markdown->>Error: throw UnsupportedBlockTypeError
  end
Loading

Possibly related PRs

Suggested reviewers

  • saltenasl
  • jamesbhobbs
  • Artmann

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately and concisely describes the primary change of deriving the DeepnoteBlock type from a Zod schema and updating createMarkdown behavior, making it clear to reviewers what the feature entails without extraneous details.
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.

@codecov

codecov Bot commented Oct 7, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.59%. Comparing base (47ece6c) to head (6eab8e0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   93.55%   93.59%   +0.03%     
==========================================
  Files          19       19              
  Lines         590      593       +3     
  Branches      117      120       +3     
==========================================
+ Hits          552      555       +3     
  Misses         38       38              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Artmann
Artmann previously approved these changes Oct 7, 2025

@Artmann Artmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 7, 2025
Signed-off-by: Andy Jakubowski <hello@andyjakubowski.com>
@linear

linear Bot commented Oct 7, 2025

Copy link
Copy Markdown

@andyjakubowski
andyjakubowski requested a review from Artmann October 7, 2025 14:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a891045 and 6eab8e0.

📒 Files selected for processing (1)
  • packages/blocks/src/markdown.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/blocks/src/markdown.test.ts (2)
packages/blocks/src/index.ts (1)
  • createMarkdown (3-3)
packages/blocks/src/markdown.ts (1)
  • createMarkdown (12-30)

Comment thread packages/blocks/src/markdown.test.ts Resolved
Comment thread packages/blocks/src/markdown.test.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants