Skip to content

fix: default input-select select_type to 'from-options'#407

Draft
sLightlyDev wants to merge 1 commit into
mainfrom
fix/input-select-default-select-type
Draft

fix: default input-select select_type to 'from-options'#407
sLightlyDev wants to merge 1 commit into
mainfrom
fix/input-select-default-select-type

Conversation

@sLightlyDev

@sLightlyDev sLightlyDev commented Jun 8, 2026

Copy link
Copy Markdown

Problem

New Input Select blocks were created with deepnote_variable_select_type set to null. The @deepnote/blocks serializer validates this field against a strict 'from-options' | 'from-variable' enum and rejects null, so freshly-added Input Select blocks could not be saved.

Fix

Default deepnote_variable_select_type to 'from-options' in DeepnoteSelectInputMetadataSchema so new blocks serialize cleanly.

Tests

Added regression tests in inputConverters.unit.test.ts:

  • New input-select metadata defaults select_type to a valid enum value (not null).
  • Block → cell → block → cell round-trip is idempotent — guards against repeated JSON.stringify escaping growing the cell value.

Full unit suite green (2333 passing).

CI note

The required Build & Test check is red, but the tests pass (2333 passing in the job log). The failure is in the later "Upload test results to Codecov" step:

gpg: Can't check signature: No public key
==> Could not verify signature. Please contact Codecov if problem continues

This is a Codecov CLI / infrastructure issue unrelated to this change — it currently fails the same step on other open PRs as well. No action needed in this PR to address it.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR fixes a serialization bug in select input metadata where null or undefined deepnote_variable_select_type values could not be saved and triggered content-reformat loops. The fix applies Zod schema validation to coerce null/undefined to the non-null default 'from-options'. Two regression tests validate the schema's default behavior and confirm round-trip conversion remains idempotent without runaway escaping of quoted cell values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: defaulting input-select select_type to 'from-options', which matches the core fix in DeepnoteSelectInputMetadataSchema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Updates Docs ✅ Passed Bug fix for internal schema validation, not a user-facing feature. Changes default null enum to 'from-options' to prevent serialization errors.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 8, 2026
New Input Select blocks were created with deepnote_variable_select_type
set to null. The @deepnote/blocks serializer validates this field against
a strict 'from-options' | 'from-variable' enum and rejects null, which made
freshly-added Input Select blocks impossible to save.

Default the field to 'from-options' so new blocks serialize cleanly, and add
regression tests covering the default value and idempotent round-tripping of
the cell value (guarding against repeated JSON escaping).
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.

1 participant