Skip to content

feat(schema): make contentHash prefix optional#209

Merged
saltenasl merged 1 commit intomainfrom
ls/more-permissive-content-hash
Jan 13, 2026
Merged

feat(schema): make contentHash prefix optional#209
saltenasl merged 1 commit intomainfrom
ls/more-permissive-content-hash

Conversation

@saltenasl
Copy link
Contributor

@saltenasl saltenasl commented Jan 13, 2026

Summary

  • Updated the contentHash regex from /^(md5|sha256):[a-f0-9]+$/i to /^([a-z0-9]+:)?[a-f0-9]+$/i to make the prefix optional
  • Added comprehensive tests for contentHash validation covering prefixed hashes, plain hex strings, and invalid inputs

Test plan

  • Existing tests pass (backward compatibility with md5: and sha256: prefixes)
  • New tests verify plain hex strings without prefix are accepted
  • New tests verify other prefixes (e.g., blake2:) are accepted
  • New tests verify invalid formats are rejected

Summary by CodeRabbit

  • Improvements

    • Enhanced file hash validation to support additional hash algorithm formats beyond previously supported types.
  • Chores

    • Version bump to 3.0.1.

✏️ Tip: You can customize this high-level summary in your review settings.

@saltenasl saltenasl requested a review from a team as a code owner January 13, 2026 03:53
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The pull request updates the blocks package with three changes: a patch version bump from 3.0.0 to 3.0.1, a relaxation of the contentHash validation regex in the deepnote file schema to accept hashes with optional algorithm prefixes (e.g., md5:, sha256:, or custom prefixes) or no prefix at all, and new test coverage validating the updated contentHash validation rules across various hash format scenarios.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title directly matches the main change: making contentHash prefix optional by updating the validation regex pattern.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 36b6377 and 825fe01.

📒 Files selected for processing (3)
  • packages/blocks/package.json
  • packages/blocks/src/deserialize-file/deepnote-file-schema.ts
  • packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Place test files next to source files with .test.ts or .test.tsx extension
Use strict type checking in TypeScript files
Prefer type safety over convenience in TypeScript
Use const for immutable values
Avoid any types - use proper type definitions
Follow Biome's rules (configured in biome.json)
Use literal keys instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)
Keep code clean and readable following Biome standards

Files:

  • packages/blocks/src/deserialize-file/deepnote-file-schema.ts
  • packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts
packages/blocks/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/blocks/src/**/*.{ts,tsx}: Use escapePythonString() for safely embedding strings in Python code in the blocks package
Use ts-dedent for clean multiline template strings in code generation
Always include DataFrame config when generating code for code/SQL blocks

Files:

  • packages/blocks/src/deserialize-file/deepnote-file-schema.ts
  • packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.test.{ts,tsx}: Use Vitest as the testing framework
Follow existing test patterns in the codebase (see packages/blocks/src/blocks/*.test.ts)
Test edge cases, error handling, and special characters

Files:

  • packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts
packages/blocks/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

For functions that generate code, test the exact output format

Files:

  • packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts
🔇 Additional comments (4)
packages/blocks/package.json (1)

3-3: LGTM!

Patch bump aligns with the backward-compatible schema relaxation.

packages/blocks/src/deserialize-file/deepnote-file-schema.ts (1)

66-69: LGTM!

Regex correctly makes prefix optional while requiring at least one hex digit. Case-insensitive flag covers both parts.

packages/blocks/src/deserialize-file/deserialize-deepnote-file.test.ts (2)

2-2: LGTM!

Import addition for deepnoteBlockSchema needed for new tests.


268-326: Solid test coverage.

Covers prefixed, plain hex, undefined, and invalid cases. Edge cases for empty string and prefix-only handled well.


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

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.52%. Comparing base (36b6377) to head (825fe01).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #209   +/-   ##
=======================================
  Coverage   91.52%   91.52%           
=======================================
  Files          40       40           
  Lines        2029     2029           
  Branches      645      645           
=======================================
  Hits         1857     1857           
  Misses        172      172           

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

@saltenasl saltenasl merged commit e1df576 into main Jan 13, 2026
20 checks passed
@saltenasl saltenasl deleted the ls/more-permissive-content-hash branch January 13, 2026 03:57
@tkislan
Copy link
Contributor

tkislan commented Jan 13, 2026

Approve after merge 👍

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