Conversation
📝 WalkthroughWalkthroughZod upgraded from 3.25.76 to 4.3.5 in packages/blocks, packages/database-integrations, and packages/reactivity (import path updated). deepnote-file-schema.ts tightens map types to string-keyed records, replaces many 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/blocks/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🔇 Additional comments (2)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #105 +/- ##
==========================================
- Coverage 91.52% 91.49% -0.03%
==========================================
Files 40 40
Lines 2029 2022 -7
Branches 623 638 +15
==========================================
- Hits 1857 1850 -7
Misses 172 172 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fe55215 to
731f4d7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
🔇 Additional comments (1)
packages/database-integrations/package.json (1)
35-35: No issues found — zod v4 is compatible with this package.The main user-facing breaking change is default handling with
.default().optional(), which this codebase doesn't use. Deprecated methods like.strict()remain available for backwards compatibility. The database-integrations package only contains schema definitions usingz.object(),z.string(),.optional(),.extend(),z.record(), and type inference—all fully supported in v4.
1817727 to
2d62ae2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
🔇 Additional comments (1)
packages/database-integrations/package.json (1)
35-35: Zod v4 appears compatible; confirm tests pass before merging.The package uses only stable zod APIs (z.object, z.string, z.literal, z.optional, z.discriminatedUnion, z.infer, z.ZodSchema) with no deprecated error patterns or .nonstrict() calls. However, run
npm testinpackages/database-integrations/to verify the 100+ .safeParse() calls in the test suite work with v4.1.12.
2d62ae2 to
fad71f5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/blocks/package.json(1 hunks)packages/database-integrations/package.json(1 hunks)
🔇 Additional comments (1)
packages/database-integrations/package.json (1)
35-35: No schema changes needed for zod v4 upgrade.Verification found no
z.record()calls in database-integrations. Schemas usez.object()andz.discriminatedUnion()exclusively, which have no breaking changes in zod v4. Safe to proceed.
546f302 to
41c52d2
Compare
b5da804 to
879e0e7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Fix all issues with AI Agents 🤖
In @packages/database-integrations/package.json:
- Line 35: Update the import in database-integration-config.ts to use Zod's
named export: replace the default import `import z from 'zod'` with `import { z
} from 'zod'` so Zod v4's named export is used; then rebuild/verify any usages
of `z` (e.g., schema declarations) still reference the same identifier and run
tests/typecheck to confirm compatibility.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (2)
packages/reactivity/package.json (1)
36-36: No action needed. Verified thatast-analyzer.tsuses the correct named import pattern (import { z } from 'zod') compatible with zod v4.3.5.packages/blocks/package.json (1)
37-37: No changes needed; z.record() usage is valid in Zod v4.The code's single-arg
z.record()calls (lines 14, 27, 65 in deepnote-file-schema.ts) are fully compatible with Zod v4. Both single-arg formz.record(schema)and two-arg formz.record(keySchema, valueSchema)are supported; the former defaults the key schema toz.string(). No breaking API changes are present.Version 4.3.5 in package.json is correct.
Likely an incorrect or invalid review comment.
9490a33 to
9a4a026
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Fix all issues with AI Agents 🤖
In @packages/blocks/package.json:
- Line 37: Replace the single-argument z.record(...) calls with the Zod v4
two-argument form by explicitly passing a key schema of z.string() and the
appropriate value schema: change the first occurrence to z.record(z.string(),
z.any()), the second to z.record(z.string(), z.string()), and the third to
z.record(z.string(), z.unknown()); ensure the file imports z from "zod" and
update each schema usage accordingly.
In @packages/database-integrations/package.json:
- Line 35: The import in database-integration-config.ts is using a default
import from Zod which no longer exists in v4; update the top-level import
statement from a default import to a named import so it reads with the named
symbol z (i.e., replace the current import of z with an import that uses { z }
from 'zod') to match Zod v4's exports and prevent runtime/compile errors.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (1)
packages/reactivity/package.json (1)
36-36: Zod v4.3.5 compatibility confirmed.Named imports are correctly used (
import { z } from 'zod'), no invalid default imports present, and allz.record()calls have proper argument counts. No compatibility issues detected.
9a4a026 to
607236c
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI Agents
In @packages/blocks/package.json:
- Line 37: The z.record() calls use the old single-argument v3 API and must be
updated for zod v4: replace the three occurrences accordingly—change the call
that uses z.record(z.any()) to z.record(z.string(), z.any()), change the call
using z.record(z.string()) to z.record(z.string(), z.string()), and change the
call using z.record(z.unknown()) to z.record(z.string(), z.unknown()); update
the specific functions/variables where these records are declared so the key
type (z.string()) is the first argument and the value schema is the second.
In @packages/database-integrations/package.json:
- Line 35: Change the invalid default import in database-integration-config.ts
to the named import required by zod v4: replace any occurrence of "import z from
'zod'" with the named import form "import { z } from 'zod'"; ensure this matches
usage in database-integration-metadata-schemas.ts and update any references in
functions or types that expect the named z symbol (e.g., where z.object,
z.string, etc. are used).
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (1)
packages/reactivity/package.json (1)
36-36: Version correct—Zod v4 API verified.Bump to 4.3.5 confirmed compatible. Named imports and 2-arg
z.record()usage verified in all source files.
607236c to
4b263fb
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/database-integrations/package.json:
- Line 35: database-integration-config.ts currently uses a default import
"import z from 'zod'", which is invalid for Zod v4; change the import to the
named export form "import { z } from 'zod'" (keep all existing uses of the z
identifier unchanged) so that the module loads correctly with the declared Zod
version.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (2)
packages/reactivity/package.json (1)
36-36: Version correct—matches PR objectives (4.3.5).packages/blocks/package.json (1)
37-37: Verify z.record() calls are v4-compatible.Zod v4.3.5 requires
z.record(keySchema, valueSchema)with two arguments. Ifdeepnote-file-schema.tsstill uses single-argz.record()calls from v3, they will fail at runtime.
0e8393c to
5f4851a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/blocks/package.json:
- Line 37: Zod v4 changed z.record() to require a key schema and a value schema;
update each z.record(...) call in the deepnote file schema so keys are explicit
strings: replace z.record(z.any()) with z.record(z.string(), z.any()),
z.record(z.string()) with z.record(z.string(), z.string()), and
z.record(z.unknown()) with z.record(z.string(), z.unknown()). Locate and update
the eight occurrences of z.record in deepnote-file-schema (the ones using
z.any(), z.string() single-arg, or z.unknown()) so the first argument is
z.string() and the second is the existing value schema.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (2)
packages/reactivity/package.json (1)
36-36: Fix inconsistent Zod imports—mixing v3 compatibility layer with v4 native API.
types.tsimportszod/v3(compatibility layer), whileast-analyzer.tsuses nativezod. Schemas are simple and won't hit the breaking changes mentioned, but imports should be consistent. Migrate all files to either the native v4 API or keep the v3 compatibility layer throughout.Likely an incorrect or invalid review comment.
packages/database-integrations/package.json (1)
35-35: No Zod v4 breaking changes detected in this package.The codebase only uses
.extend()for discriminated union schemas, which is compatible with Zod v4. No unsafe patterns (.refine(),.transform(),.pick(),.omit(),.record(), or.default()) were found.
5f4851a to
47e3b2d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/reactivity/package.json:
- Line 36: The project mixes Zod import paths: one file imports from "zod/v3"
and another from "zod", causing inconsistency; update the import in types.ts
(the import that currently uses "zod/v3") to use the top-level "zod" export to
match ast-analyzer.ts (or vice versa if you prefer v3 for all files), and ensure
all Zod usages (e.g., ZodSchema, z.object, z.string, z.array, z.optional,
z.infer) across files are imported from the same module path (types.ts and
ast-analyzer.ts) so the codebase uses a single standardized Zod import path.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/blocks/package.jsonpackages/database-integrations/package.jsonpackages/reactivity/package.json
🔇 Additional comments (2)
packages/blocks/package.json (1)
37-37: Verify Zod v4 compatibility.Breaking changes require validation: object masking methods stricter, record schemas need both arguments, number/UUID validation tighter.
packages/database-integrations/package.json (1)
35-35: No Zod v4 compatibility issues found.The codebase uses only patterns compatible with Zod v4.3.5:
.extend()for schema composition,.enum()with array literals, and standard modifiers like.nullable()and.optional(). No breaking patterns detected.
47e3b2d to
ab7fd50
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @packages/blocks/src/deserialize-file/deepnote-file-schema.test.ts:
- Around line 22-28: The test uses expect(oldResult.data).toBe(expected) which
fails for arrays because toBe uses Object.is; replace that assertion with
expect(oldResult.data).toStrictEqual(expected) and keep the subsequent
comparisons between oldResult and newResult as-is (they already use
toStrictEqual) so arrays are compared deeply; update the assertion in the test
block that references oldResult.data.
In @packages/blocks/src/deserialize-file/deepnote-file-schema.ts:
- Line 262: The pipeline is failing because the new Zod v4 method name
'prefault' is not in the code spellchecker dictionary; open the cspell.json (or
your project's spellchecker config) and add the token "prefault" to the words
array (ensure exact casing 'prefault'), then commit the updated cspell.json so
references like .prefault({}) in deepnote-file-schema.ts are accepted.
📜 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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
packages/blocks/package.jsonpackages/blocks/src/deserialize-file/deepnote-file-schema.test.tspackages/blocks/src/deserialize-file/deepnote-file-schema.tspackages/database-integrations/package.jsonpackages/database-integrations/src/database-integration-env-vars.test.tspackages/reactivity/package.json
🧰 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.tsor.test.tsxextension
Use strict type checking in TypeScript files
Prefer type safety over convenience in TypeScript
Useconstfor immutable values
Avoidanytypes - use proper type definitions
Follow Biome's rules (configured inbiome.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.test.tspackages/database-integrations/src/database-integration-env-vars.test.tspackages/blocks/src/deserialize-file/deepnote-file-schema.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 (seepackages/blocks/src/blocks/*.test.ts)
Test edge cases, error handling, and special characters
Files:
packages/blocks/src/deserialize-file/deepnote-file-schema.test.tspackages/database-integrations/src/database-integration-env-vars.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/deepnote-file-schema.test.ts
packages/blocks/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/blocks/src/**/*.{ts,tsx}: UseescapePythonString()for safely embedding strings in Python code in the blocks package
Usets-dedentfor 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.test.tspackages/blocks/src/deserialize-file/deepnote-file-schema.ts
🪛 GitHub Actions: CI
packages/blocks/src/deserialize-file/deepnote-file-schema.test.ts
[error] 26-26: AssertionError: expected [ 'abc', 'def' ] to be [ 'abc', 'def' ] // Object.is equality. Use toStrictEqual for deep equality in tests.
packages/blocks/src/deserialize-file/deepnote-file-schema.ts
[error] 262-262: CSpell: Unknown word 'prefault' detected.
[error] 279-279: CSpell: Unknown word 'prefault' detected.
[error] 292-292: CSpell: Unknown word 'prefault' detected.
[error] 306-306: CSpell: Unknown word 'prefault' detected.
[error] 325-325: CSpell: Unknown word 'prefault' detected.
🔇 Additional comments (7)
packages/database-integrations/package.json (1)
35-35: LGTM.Consistent zod v4 upgrade across packages.
packages/database-integrations/src/database-integration-env-vars.test.ts (1)
2953-2973: LGTM.Good edge-case coverage for unknown integration metadata propagation.
packages/blocks/package.json (1)
37-37: LGTM.Consistent zod v4 upgrade.
packages/blocks/src/deserialize-file/deepnote-file-schema.ts (3)
14-28: LGTM.Clean helper for null removal from
deepnote_variable_default_value. Type inference is correct.
54-57: Record type tightening.Good alignment with Zod v4's requirement for explicit key schemas in
z.record().
276-279: Clarify intent:.prefault({})bypasses the transform.When metadata is
undefined,.prefault({})provides a default that skips theremoveNullDeepnoteVariableDefaultValuetransform. When metadata is provided withdeepnote_variable_default_value: null, the transform runs and removes the key. Confirm this inconsistency is intentional or consider restructuring to ensure consistent behavior.packages/reactivity/package.json (1)
36-36: Zod v4 upgrade is safe for this package.The specified breaking change patterns (
.pick(),.omit(),.extend()on refinements;z.record()) are not used. Schemas rely only onz.object(),z.string(),z.array(),z.optional(), andz.union(), which are stable across v3 and v4. Thezod/v3import path intypes.tsis a supported compatibility mechanism in Zod v4—no changes required.
packages/blocks/src/deserialize-file/deepnote-file-schema.test.ts
Outdated
Show resolved
Hide resolved
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/blocks/src/deserialize-file/deepnote-file-schema.ts:
- Around line 14-28: The return type of removeNullDeepnoteVariableDefaultValue
is incorrect because when deepnote_variable_default_value is null the function
deletes that key at runtime but the signature still claims the key exists (with
null excluded); change the return type to reflect either the original T or T
with the key removed (e.g., T | Omit<T, 'deepnote_variable_default_value'> or a
conditional mapped type that yields Omit<T,'deepnote_variable_default_value'>
when the value is null), update the two return casts to use that
union/conditional type, and keep the runtime logic (destructuring removal) in
the function body.
📜 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.
📒 Files selected for processing (1)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Place test files next to source files with.test.tsor.test.tsxextension
Use strict type checking in TypeScript files
Prefer type safety over convenience in TypeScript
Useconstfor immutable values
Avoidanytypes - use proper type definitions
Follow Biome's rules (configured inbiome.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/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/blocks/src/**/*.{ts,tsx}: UseescapePythonString()for safely embedding strings in Python code in the blocks package
Usets-dedentfor 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
🔇 Additional comments (3)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts (3)
54-54: LGTM: Record types correctly updated for v4.Explicit string keys align with Zod v4 requirements and improve type safety.
Also applies to: 57-57, 212-213, 225-225, 228-228, 478-478, 516-516
276-279: Nullish + transform pattern is consistent.Normalizing null defaults across input blocks is sensible for v4 migration, assuming
prefaultis valid.Also applies to: 289-292, 302-306, 316-325, 335-341, 351-356, 366-369
262-262:.prefault()is a valid Zod v4 method. It sets a pre-parse default (applied before validation), which appropriately handles null/invalid inputs before the schema validates. No issues here.
| function removeNullDeepnoteVariableDefaultValue<TValue, T extends { deepnote_variable_default_value?: TValue }>( | ||
| value: T | ||
| ): { | ||
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | ||
| } { | ||
| if (value.deepnote_variable_default_value === null) { | ||
| const { deepnote_variable_default_value: _, ...rest } = value | ||
| return rest as { | ||
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | ||
| } | ||
| } | ||
| return value as { | ||
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | ||
| } | ||
| } |
There was a problem hiding this comment.
Return type doesn't reflect that the key is removed.
When deepnote_variable_default_value is null, the key is deleted (line 20), but the return type claims Exclude<T[K], null> for that key—implying it's still present. Runtime and type shape diverge.
♻️ Align the type with runtime behavior
-function removeNullDeepnoteVariableDefaultValue<TValue, T extends { deepnote_variable_default_value?: TValue }>(
- value: T
-): {
- [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K]
-} {
+function removeNullDeepnoteVariableDefaultValue<TValue, T extends { deepnote_variable_default_value?: TValue }>(
+ value: T
+): Omit<T, 'deepnote_variable_default_value'> & {
+ deepnote_variable_default_value?: Exclude<TValue, null>
+} {
if (value.deepnote_variable_default_value === null) {
const { deepnote_variable_default_value: _, ...rest } = value
- return rest as {
- [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K]
- }
+ return rest as any
}
- return value as {
- [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K]
- }
+ return value as any
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| function removeNullDeepnoteVariableDefaultValue<TValue, T extends { deepnote_variable_default_value?: TValue }>( | |
| value: T | |
| ): { | |
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | |
| } { | |
| if (value.deepnote_variable_default_value === null) { | |
| const { deepnote_variable_default_value: _, ...rest } = value | |
| return rest as { | |
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | |
| } | |
| } | |
| return value as { | |
| [K in keyof T]: K extends 'deepnote_variable_default_value' ? Exclude<T[K], null> : T[K] | |
| } | |
| } | |
| function removeNullDeepnoteVariableDefaultValue<TValue, T extends { deepnote_variable_default_value?: TValue }>( | |
| value: T | |
| ): Omit<T, 'deepnote_variable_default_value'> & { | |
| deepnote_variable_default_value?: Exclude<TValue, null> | |
| } { | |
| if (value.deepnote_variable_default_value === null) { | |
| const { deepnote_variable_default_value: _, ...rest } = value | |
| return rest as Omit<T, 'deepnote_variable_default_value'> & { | |
| deepnote_variable_default_value?: Exclude<TValue, null> | |
| } | |
| } | |
| return value as Omit<T, 'deepnote_variable_default_value'> & { | |
| deepnote_variable_default_value?: Exclude<TValue, null> | |
| } | |
| } |
🤖 Prompt for AI Agents
In @packages/blocks/src/deserialize-file/deepnote-file-schema.ts around lines 14
- 28, The return type of removeNullDeepnoteVariableDefaultValue is incorrect
because when deepnote_variable_default_value is null the function deletes that
key at runtime but the signature still claims the key exists (with null
excluded); change the return type to reflect either the original T or T with the
key removed (e.g., T | Omit<T, 'deepnote_variable_default_value'> or a
conditional mapped type that yields Omit<T,'deepnote_variable_default_value'>
when the value is null), update the two return casts to use that
union/conditional type, and keep the runtime logic (destructuring removal) in
the function body.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (11)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts (11)
26-43: Good Zod v4 record migration; considerz.unknown()overz.any()and sanity-check.extend()behavior.
Thez.record(z.string(), …)changes look right for v4. If these payloads are truly opaque,z.unknown()is usually safer thanz.any()(type-level). Also, please verify Zod v4 doesn’t object to.extend()on your.passthrough()objects in this file at runtime (some v4 changes tightened object operations).Proposed tweak (type-safety only)
- deepnote_table_state: z.record(z.string(), z.any()).optional(), + deepnote_table_state: z.record(z.string(), z.unknown()).optional(), ... - function_notebook_export_states: z.record(z.string(), z.any()).optional(), + function_notebook_export_states: z.record(z.string(), z.unknown()).optional(),
189-200: String-keyed records are correct here; sameanyvsunknownnote.
Looks consistent with Zod v4 record typing. Considerz.unknown()unless you truly wantanyinference.Proposed tweak (type-safety only)
- function_notebook_inputs: z.record(z.string(), z.any()).optional(), - function_notebook_export_mappings: z.record(z.string(), z.any()).optional(), + function_notebook_inputs: z.record(z.string(), z.unknown()).optional(), + function_notebook_export_mappings: z.record(z.string(), z.unknown()).optional(),
202-215: Same: Zod v4 record keys look right; considerunknown.
No functional concerns beyond theanytyping choice.Proposed tweak (type-safety only)
- deepnote_visualization_spec: z.record(z.string(), z.any()).optional(), + deepnote_visualization_spec: z.record(z.string(), z.unknown()).optional(), ... - deepnote_chart_filter: z.record(z.string(), z.any()).optional(), + deepnote_chart_filter: z.record(z.string(), z.unknown()).optional(),
231-247:.prefault({})likely fixes v4 default short-circuiting; avoid shared-object defaults.
If any consumer mutatesmetadata, prefer a factory to avoid sharing the same{}across parses.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
253-276: Input text metadata:.prefaultmakes sense; confirm downstream acceptsnulldefault values.
.nullish()meansdeepnote_variable_default_valuecan now benull(not just absent). That’s fine if intentional (commit msg hints it is), but downstream should treatnullconsistently. Also: consider a factory for.prefault.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
277-289: Input checkbox: same nullish + prefault semantics; double-check consumer expectations fornull.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
290-307: Input select: nullish defaults can benull(and array/string); verify downstream normalization.
If consumers previously relied on “missing/undefined only”, they now need to handlenull(and possiblynullvs[]semantics). Also: consider.prefault(() => ({})).Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
308-322: Input slider: same prefault + nullish notes.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
323-336: Input date: same prefault + nullish notes.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
337-348: Input date-range: nullish allowsnullfor both string/tuple variants; verify downstream handling.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
349-359: Input file: if.prefault({})stays, prefer a factory to avoid shared objects.Proposed tweak (avoid shared references)
- .prefault({}), + .prefault(() => ({})),
📜 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.
📒 Files selected for processing (1)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Place test files next to source files with.test.tsor.test.tsxextension
Use strict type checking in TypeScript files
Prefer type safety over convenience in TypeScript
Useconstfor immutable values
Avoidanytypes - use proper type definitions
Follow Biome's rules (configured inbiome.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/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/blocks/src/**/*.{ts,tsx}: UseescapePythonString()for safely embedding strings in Python code in the blocks package
Usets-dedentfor 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
🔇 Additional comments (2)
packages/blocks/src/deserialize-file/deepnote-file-schema.ts (2)
451-465:environmentSchema.packages: v4 record typing looks correct; verify callers don’t pass non-string values.
This will now reject values that aren’t strings (which is probably desired).
489-499:executionSchema.inputs: string-keyed record is good; consider whether values should beunknownvs a narrower schema.
As-is, this is an explicit “bag of inputs” and matches JSON realities.
This PR contains the following updates:
3.25.76→4.3.5Release Notes
colinhacks/zod (zod)
v4.3.5Compare Source
Commits:
21afffd[Docs] Update migration guide docs for deprecation of message (#5595)e36743eImprove mini treeshaking0cdc0b84.3.5v4.3.4Compare Source
Commits:
1a8bea3Add integration testse01cd02Support patternProperties for looserecord (#5592)089e5fbImprove looseRecord docsdecef9cFix lint9443aabDrop iso time in fromJSONSchema66bda74Remove .refine() from ZodMiniTypeb4ab94c4.3.4v4.3.3Compare Source
v4.3.2Compare Source
v4.3.1Compare Source
Commits:
0fe8840allow non-overwriting extends with refinements. 4.3.1v4.3.0Compare Source
This is Zod's biggest release since 4.0. It addresses several of Zod's longest-standing feature requests.
z.fromJSONSchema()Convert JSON Schema to Zod (#5534, #5586)
You can now convert JSON Schema definitions directly into Zod schemas. This function supports JSON Schema
"draft-2020-12","draft-7","draft-4", and OpenAPI 3.0.The API should be considered experimental. There are no guarantees of 1:1 "round-trip soundness":
MySchema>z.toJSONSchema()>z.fromJSONSchema(). There are several features of Zod that don't exist in JSON Schema and vice versa, which makes this virtually impossible.Features supported:
string,number,integer,boolean,null,object,array)email,uri,uuid,date-time,date,time,ipv4,ipv6, and more)anyOf,oneOf,allOf)additionalProperties,patternProperties,propertyNames)prefixItems,items,minItems,maxItems)$reffor local references and circular schemasz.xor()— exclusive union (#5534)A new exclusive union type that requires exactly one option to match. Unlike
z.union()which passes if any option matches,z.xor()fails if zero or more than one option matches.When converted to JSON Schema,
z.xor()producesoneOfinstead ofanyOf.z.looseRecord()— partial record validation (#5534)A new record variant that only validates keys matching the key schema, passing through non-matching keys unchanged. This is used to represent
patternPropertiesin JSON Schema..exactOptional()— strict optional properties (#5589)A new wrapper that makes a property key-optional (can be omitted) but does not accept
undefinedas an explicit value.This makes it possible to accurately represent the full spectrum of optionality expressible using
exactOptionalPropertyTypes..apply()A utility method for applying arbitrary transformations to a schema, enabling cleaner schema composition. (#5463)
.brand()cardinalityThe
.brand()method now accepts a second argument to control whether the brand applies to input, output, or both. Closes #4764, #4836.Type predicates on
.refine()(#5575)The
.refine()method now supports type predicates to narrow the output type:ZodMapmethods:min,max,nonempty,size(#5316)ZodMapnow has parity withZodSetandZodArray:.with()alias for.check()(359c0db)A new
.with()method has been added as a more readable alias for.check(). Over time, more APIs have been added that don't qualify as "checks". The new method provides a readable alternative that doesn't muddy semantics.z.slugify()transformTransform strings into URL-friendly slugs. Works great with
.with():z.meta()andz.describe()in Zod Mini (947b4eb)Zod Mini now exports
z.meta()andz.describe()as top-level functions for adding metadata to schemas:New locales
am) (#5531)uz) (#5519)Bug fixes
All of these changes fix soundness issues in Zod. As with any bug fix there's some chance of breakage if you were intentionally or unintentionally relying on this unsound behavior.
.pick()and.omit()disallowed on object schemas containing refinements (#5317)Using
.pick()or.omit()on object schemas with refinements now throws an error. Previously, this would silently drop the refinements, leading to unexpected behavior.Migration: The easiest way to migrate is to create a new schema using the
shapeof the old one..extend()disallowed on refined schemas (#5317)Similarly,
.extend()now throws on schemas with refinements. Use.safeExtend()if you need to extend refined schemas.Object masking methods (
.pick(),.omit()) now validate that the keys provided actually exist in the schema:Additional changes
z.iso.timewith minute precision (#5557)includesmethod params typing to acceptstring | $ZodCheckIncludesParams(#5556)implementAsyncinferred type to always be a promise (#5476)Dateinstances to numbers inminimum/maximumchecks (#5351)z.record()(#5585)~standardschema property (#5363)@__NO_SIDE_EFFECTS__for better tree-shaking (#5475)v4.2.1Compare Source
v4.2.0Compare Source
Features
Implement Standard JSON Schema
standard-schema/standard-schema#134
Implement
z.fromJSONSchema()Implement
z.xor()Implement
z.looseRecord()Commits:
af49c08Update docs for JSON Schema conversion ofz.undefined()(#5504)767f320Add.toJSONSchema()method (#5477)e17dcb6Addz.fromJSONSchema(),z.looseRecord(),z.xor()(#5534)v4.1.13Compare Source
v4.1.12Compare Source
Commits:
0b109c3docs(ecosystem): add bupkis to the ecosystem section (#5237)d22ec0ddocs(ecosystem): add upfetch (#5238)c56a4f6docs(ecosystem): addeslint-plugin-zod-x(#5261)a0abcc0docs(metadata.mdx): fix a mistake in an example output (#5248)62bf4e4fix(ZodError): prevent flatten() from crashing on 'toString' key (#5266)02a5840refac(errors): Unify code structure and improve types (#5278)4b1922adocs(content/v4/index): fix zod version (#5289)3fcb20fAdd frrm to ecosystem (#5292)fda4c7cMake docs work without tokenaf44738Fix lint77c3c9fExport bg.ts3b94610v4.1.12v4.1.11Compare Source
Commits:
2bed4b34.1.11v4.1.10Compare Source
Commits:
7ffedd0Fix shape caching (#5263)82cd717v4.1.10v4.1.9Compare Source
Commits:
a78716dUpdate zshy (#5249)923af80Publish zod@4.1.9v4.1.8Compare Source
Commits:
36c4ee3Switch back to weakmapa1726d54.1.8v4.1.7Compare Source
Commits:
0cca351Fix variable name inconsistency in coercion documentation (#5188)aa78c27Add copy/edit buttons76452d4Update button txt937f73cFix tsconfig issue in bench976b436v4.1.6 (#5222)4309c61Fix cidrv6 validation - cidrv6 should reject invalid strings with multiple slashes (#5196)ef95a73feat(locales): Add Lithuanian (lt) locale (#5210)3803f3fdocs: update wrong contents in codeblocks inapi.mdx(#5209)8a47d5cdocs: update coerce example inapi.mdx(#5207)e87db13feat(locales): Add Georgian (ka) locale (#5203)c54b123docs: adds@traversable/zodand@traversable/zod-testto v4 ecosystem (#5194)c27a294Fix two tiny grammatical errors in the docs. (#5193)23a2d66docs: fix broken links in async refinements and transforms references (#5190)845a230fix(locales): Add type name translations to Spanish locale (#5187)27f13d6Improve regex precision and eliminate duplicates in regexes.ts (#5181)a8a52b3fix(v4): fix Khmer and Ukrainian locales (#5177)887e37cUpdate slugse1f1948fix(v4): ensure array defaults are shallow-cloned (#5173)9f65038docs(ecosystem): add DRZL; fix Prisma Zod Generator placement (#5215)aa6f0f0More fixes (#5223)aab33564.1.7v4.1.6Compare Source
v4.1.5Compare Source
Commits:
530415fUpdate docsb7b081dUpdate z.function() type to support array input (#5170)780cf574.1.5v4.1.4Compare Source
Commits:
3291c61fix(v4): toJSONSchema - wrong tuple withnulloutput when targetingopenapi-3.0(#5156)23f41c7test(v4): toJSONSchema - usevalidateOpenAPI30Schemain all relevant scenarios (#5163)0a09fd2Update installation instructions4ea5fec4.1.4v4.1.3Compare Source
Commits:
98ff675Drop stringToBooleana410616Fix typo0cf4589fix(v4): toJSONSchema - add missing oneOf inside items in tuple conversion (#5146)8bf0c16fix(v4): toJSONSchema tuple path handling for draft-7 with metadata IDs (#5152)5c5fa90fix(v4): toJSONSchema - wrong record output when targetingopenapi-3.0(#5141)87b97ccdocs(codecs): update example to use payloadSchema (#5150)309f358fix(v4): toJSONSchema - output numbers with exclusive range correctly when targetingopenapi-3.0(#5139)1e71ca9docs: fix refine fn to encode works properly (#5148)a85ec3cfix(docs): correct example to useLooseDoginstead ofDog(#5136)3e982744.1.3v4.1.2Compare Source
Commits:
e45e61bImprove codec docs25a4c37fix(v4): toJSONSchema - wrong record tuple output when targetingopenapi-3.0(#5145)0fa4f46Use method form in codecs.mdx940383dUpdate JSON codec and docs3009fa84.1.2v4.1.1Compare Source
Commits:
648eb43Remove codecs from sidebare7e39a99Improve codec docse5085beAdd images028b289Add methods10cc9944.1.1v4.1.0Compare Source
The first minor version since the introduction of Zod 4 back in May. This version contains a number of features that barely missed the cut for the 4.0 release. With Zod 4 stable and widely adopted, there's more time to resume feature development.
Codecs
This is the flagship feature of this release. Codecs are a new API & schema type that encapsulates a bi-directional transformation. It's a huge missing piece in Zod that's finally filled, and it unlocks some totally new ways to use Zod.
New top-level functions are added for processing inputs in the forward direction ("decoding") and backward direction ("encoding").
.parse()vs.decode()Both
.parse()anddecode()process data in the "forward" direction. They behave identically at runtime.There is an important difference however. While
.parse()accepts any input,.decode()expects a strongly typed input. That is, it expects an input of typestring, whereas.parse()acceptsunknown.Encoding
You can use any Zod schema with
.encode(). The vast majority of Zod schemas are non-transforming (the input and output types are identical) so.decode()and.encode()behave identically. Only certain schema types change their behavior:B->Aand executes theencodetransform during encodingB->Ainstead ofA->BThe usual async and safe variants exist as well:
Example codecs
Below are some "worked examples" for some commonly-needed codecs. These examples are all tested internally for correctness. Just copy/paste them into your project as needed. There is a more comprehensive set available at zod.dev/codecs.
stringToBigIntConverts
bigintinto a serializable form.jsonParses/stringifies JSON data.
To further validate the data,
.pipe()the result of this codec into another schema.Further reading
For more examples and a technical breakdown of how encoding works, reads theannouncement blog post and new Codecs docs page. The docs page contains implementations for several other commonly-needed codecs:
stringToNumberstringToIntstringToBigIntnumberToBigIntisoDatetimeToDateepochSecondsToDateepochMillisToDatejsonCodecutf8ToBytesbytesToUtf8base64ToBytesbase64urlToByteshexToBytesstringToURLstringToHttpURLuriComponentstringToBoolean.safeExtend()The existing way to add additional fields to an object is to use
.extend().Unfortunately this is a bit of a misnomer, as it allows you to overwrite existing fields. This means the result of
.extend()may not literallyextendthe original type (in the TypeScript sense).To enforce true
extendslogic, Zod 4.1 introduces a new.safeExtend()method. This statically enforces that the newly added properties conform to the existing ones.Importantly, this new API allows you to safely extend objects containing refinements.
Previously (in Zod 4.x) any refinements attached to the base schema were dropped in the extended result. This was too unexpected. It now throws an error. (Zod 3 did not support extension of refined objects either.)
z.hash()A new top-level string format for validating hashes produced using various common algorithms & encodings.
The following hash algorithms and encodings are supported. Each cell provides information about the expected number of characters/padding.
"hex""base64""base64url""md5""sha1""sha256""sha384""sha512"z.hex()To validate hexadecimal strings of any length.
Additional changes
FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF) per the RFC$ZodFunctionis now a subtype of$ZodTypeCommits
edd4fea- Closes #51275d4a315- Closes #5116f3f0955- Closes #51080114d5b- #51223b077c3- #51211e06af8- #5113b01b6f3— #5052571ab0c— #5051d3ea111— #5049b8e3f87— #4865v4.0.17Compare Source
Commits:
1cebf33Add blog (#5074)fc1e556Fixes #5073cc63f95v4.0.17v4.0.16Compare Source
Commits:
d589186fix: ensure keyof returns enum (#5045)4975f3afeat: add discriminator generic (#5044)0a463e3Update speakeasy files12658afFix Edit page buttons47e6604fix:edit this pagebutton, now redirects to correct url using the new path (#5056)7207a2dUpdate Hey API link to Zod v3 plugin (#5060)6887ff3Update Hey API link to Zod plugin (#5059)ffff1aaClone POJO objects during defaulting/prefaultinga227cb3v4.0.16v4.0.15Compare Source
Commits:
7e7e346Clean up docsf2949a8[docs] Fix migration guide upgrade command (#5021)d43cf19Fix recursive object initialization errors with check() and other methods (#5018)3de2b63fix: remove redundant Required<> from input and output type definitions (#5033)93553bdAdd needs info03cfa8d4.0.15v4.0.14Compare Source
Commits:
99391a8Docs: Fix typo (#5005)e25303eDocs: fix typo (#5008)dbb05efAdd JSON Schema draft-04 output (#4811)b8257d7Improve tuple recursive inference.9bdbc2fAvoid infinite loops in defineLazy. Fixes #4994.af96ad44.0.14v4.0.13Compare Source
Commits:
362eb33Fix optional + pipe handling. Closes #5002. v4.0.13v4.0.12Compare Source
Commits:
ff83fc9Add eslint-plugin-import-zod (#4848)7c9ce38Update docs for z.property check (#4863)c432577docs: add jwt schema docs (#4867)35e6a6fAdd llms.txt (#4915)3ac7bf0Clean up Edit this Page60a9372Implementllms-full.txt(#5004)73a19704.0.12v4.0.11Compare Source
Commits:
8e6a5f8Fix “Edit on Github” link (#4997)930a2f6Fix number of errors in doc (#4993)c762dbbfeat(locale): Add Yoruba (yo) locale (#4996)9a34a3aZod 4.0.11 (#4981)v4.0.10Compare Source
Commits:
291c1caAdd should-build scripte32d99bMove should-build scriptd4faf71Add v3 docs (#4972)dfae371Update Jazz img on v3 docsd6cd30dfix #4973 (#4974)1850496Fix typo invalype(#4960)4ec2f87Add Zod Playground to zod 4 ecosystem (#4975)2b571a2Update docs z.enum with object literal example (#4967)813451dv4.0.10 (#4978)v4.0.9Compare Source
Commits:
4e7a3efv4.0.9 (#4970)v4.0.8Compare Source
Commits:
3048d14Fix #4961v4.0.7Compare Source
Commits:
7ab1b3cDo not continue parsing in ZodPipe if issues exists. Closes #4926.34b400a4.0.7v4.0.6Compare Source
Commits:
a3e4391Unwiden catch input type (#4870)499df78Add RFC 9562 mentions. Closes #4872d0493f3Doc tweak - spread vs destructuring (#4919)8dad394feat: Icelandic translation (#4920)2ffdae1Bulgarian (bg) translation (#4928)0973135docs: add valype to xToZodConverts (#4930)d257340Remove moduleResolution callout (#4932)075970ddocs: add coercion note to fix compile errors (#4940)b9e8a60Add@hey-api/openapi-tsto Zod 3 ecosystem (#4949)ad7b0ffAdd@hey-api/openapi-tsto Zod 3 ecosystem (#4942)4619109feat(locales): add Danish translations (#4953)cb84a57Point to zod-v3-to-v4 codemod in Zod 4 migration guide (#4954)28a5091Update api.mdx (#4955)7f3cf94Fix URL sup example (#4959)17e7f3bAdd@hey-api/openapi-tsto Zod 4 ecosystem (#4950)f75d852fix: escapes decimal place inz.literal(#4895)7dd7484v4.0.6 (#4941)v4.0.5Compare Source
Commits:
f91a73eSupport pipes in discriminated unions. Closes #4856 (#4861)45afab04.0.5v4.0.4Compare Source
Commits:
9335f05AddsZodFirstPartyTypeKindstub to fix module resolution failure insidezod-to-json-schemav4.0.3[Compare Source](https://redirect.github.com/colinhacks/zod/compare/44a936cb77961e57a0988d8a3c63d9c71fce69ac...v4
Configuration
📅 Schedule: Branch creation - "before 9am on Monday" in timezone UTC, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.
Summary by CodeRabbit
Bug Fixes
Refactor
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.