Skip to content

Conversation

@saltenasl
Copy link
Member

@saltenasl saltenasl commented Nov 3, 2025

Screenshot 2025-11-03 at 22 02 27

Summary by CodeRabbit

  • Bug Fixes

    • Date inputs now normalize ISO and timezone-aware dates to YYYY-MM-DD; existing YYYY-MM-DD, relative strings, and empty values are preserved.
    • Date range inputs now standardize both endpoints consistently and handle mixed formats correctly.
    • Improved consistency when saving or editing date fields to avoid unexpected format changes.
  • Tests

    • Expanded test coverage for single-date and date-range normalization, timezone handling, mixed-format ranges, relative strings, and empty values.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

📝 Walkthrough

Walkthrough

The base input block converter adds a protected helper updateBlockMetadata(block, updates) to centralize metadata updates and clear raw content keys. A top-level normalizeDateString(dateValue) helper normalizes date strings to YYYY-MM-DD. InputDateBlockConverter and InputDateRangeBlockConverter override applyChangesToBlock() to normalize deepnote_variable_value (single string or two-element array) using normalizeDateString(), with paths to clear updates. Unit tests were expanded to cover ISO, timezone-aware, already-normalized, relative, empty, and mixed-range cases.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI/Converter
    participant Base as BaseInputBlockConverter
    participant Normalize as normalizeDateString
    participant Block as DeepnoteBlock

    rect rgb(230,240,255)
    UI->>Base: applyChangesToBlock(block)
    end

    alt date block (single string)
        Base->>Normalize: deepnote_variable_value (string)
        Normalize-->>Base: normalized or unchanged string
        Base->>Base: updateBlockMetadata(block, { deepnote_variable_value })
    else date-range block (array of 2)
        Base->>Normalize: each element of deepnote_variable_value
        Normalize-->>Base: normalized or unchanged array
        Base->>Base: updateBlockMetadata(block, { deepnote_variable_value })
    end

    Base->>Block: persist metadata, clear raw content key if needed
    Note over Normalize,Base: Handles ISO, timezone-aware, relative, empty, mixed values
Loading

Possibly related PRs

Suggested reviewers

  • jankuca
  • jamesbhobbs
  • Artmann

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: normalizing dates to YYYY-MM-DD format for date-range blocks passed to Python execution. It matches the changeset focus.

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

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 85.07463% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 73%. Comparing base (333a169) to head (f85d2a5).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...c/notebooks/deepnote/converters/inputConverters.ts 60% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #167   +/-   ##
=====================================
  Coverage     73%     73%           
=====================================
  Files        574     574           
  Lines      46751   46813   +62     
  Branches    5513    5519    +6     
=====================================
+ Hits       34306   34358   +52     
- Misses     10628   10637    +9     
- Partials    1817    1818    +1     
Files with missing lines Coverage Δ
...s/deepnote/converters/inputConverters.unit.test.ts 100% <100%> (ø)
...c/notebooks/deepnote/converters/inputConverters.ts 81% <60%> (-5%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/notebooks/deepnote/converters/inputConverters.unit.test.ts (2)

703-785: Implementation bug causes timezone-dependent test failures; use UTC date methods.

The review correctly identifies a real issue: normalizeDateString uses getDate(), getMonth(), getFullYear() (local timezone methods) on UTC-parsed ISO strings. In non-UTC timezones (e.g., PST), "2025-09-30T00:00:00.000Z" extracts as "2025-09-29" instead of "2025-09-30".

Fix in src/notebooks/deepnote/converters/inputConverters.ts lines 36–38: replace getFullYear(), getMonth(), getDate() with getUTCFullYear(), getUTCMonth(), getUTCDate().


853-954: Fix normalizeDateString to use UTC methods.

The timezone bug is confirmed. getFullYear(), getMonth(), and getDate() return local time components, causing ISO UTC dates to be converted incorrectly. In non-UTC timezones, "2025-09-30T00:00:00.000Z" becomes "2025-09-29", breaking the test assertions at lines 871 and 914.

Use getUTCFullYear(), getUTCMonth(), getUTCDate() instead (inputConverters.ts line 36-38).

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

📥 Commits

Reviewing files that changed from the base of the PR and between ed71529 and b1ee698.

📒 Files selected for processing (2)
  • src/notebooks/deepnote/converters/inputConverters.ts (3 hunks)
  • src/notebooks/deepnote/converters/inputConverters.unit.test.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined then property to avoid hanging tests

Files:

  • src/notebooks/deepnote/converters/inputConverters.unit.test.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/converters/inputConverters.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • NotebookCellData (2546-2572)
src/notebooks/deepnote/converters/inputConverters.unit.test.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • NotebookCellData (2546-2572)
🔇 Additional comments (3)
src/notebooks/deepnote/converters/inputConverters.ts (3)

58-83: LGTM!

The centralized metadata update logic properly handles missing/invalid metadata while preserving existing valid values.


275-288: Logic is sound, but depends on timezone fix.

The normalization flow correctly handles string values and fallbacks. However, it relies on normalizeDateString which has a timezone bug (see comment on lines 21-43).


310-324: Logic is sound, but depends on timezone fix.

The normalization flow correctly handles array values, applies normalization to both elements, and falls back appropriately. However, it relies on normalizeDateString which has a timezone bug (see comment on lines 21-43).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.

📥 Commits

Reviewing files that changed from the base of the PR and between b1ee698 and 263a8f1.

📒 Files selected for processing (1)
  • src/notebooks/deepnote/converters/inputConverters.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/notebooks/deepnote/converters/inputConverters.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • NotebookCellData (2546-2572)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 263a8f1 and a37c8cf.

📒 Files selected for processing (1)
  • src/notebooks/deepnote/converters/inputConverters.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/notebooks/deepnote/converters/inputConverters.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
  • NotebookCellData (2546-2572)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Test

@saltenasl saltenasl marked this pull request as ready for review November 3, 2025 20:38
@saltenasl saltenasl requested a review from a team as a code owner November 3, 2025 20:38
@Artmann Artmann merged commit 7f741fe into main Nov 3, 2025
13 checks passed
@Artmann Artmann deleted the ls/fix-date-range branch November 3, 2025 22:16
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.

3 participants