Skip to content

Conversation

@tkislan
Copy link
Contributor

@tkislan tkislan commented Jan 14, 2026

  • Updated the function name from _model_validate_compat to model_validate_compat for consistency and clarity.
  • Adjusted imports in loader.py and sql_execution.py to reflect the new function name.
  • Ensured all references to the function are updated accordingly in the codebase.

Summary by CodeRabbit

  • Refactor

    • Unified the internal data-validation compatibility layer for consistent handling across configuration and authentication paths.
  • Bug Fixes

    • Broadened error handling in authentication and federated integration flows to more gracefully handle unexpected validation and runtime issues.

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

- Updated the function name from `_model_validate_compat` to `model_validate_compat` for consistency and clarity.
- Adjusted imports in `loader.py` and `sql_execution.py` to reflect the new function name.
- Ensured all references to the function are updated accordingly in the codebase.
@tkislan tkislan requested a review from a team as a code owner January 14, 2026 12:53
@tkislan tkislan requested a review from FilipPyrek January 14, 2026 12:53
@linear
Copy link

linear bot commented Jan 14, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

The private Pydantic compatibility helper _model_validate_compat was renamed to the public model_validate_compat in deepnote_core/pydantic_compat_helpers.py. Call sites in deepnote_core/config/loader.py were updated to import and use the new name. deepnote_toolkit/sql/sql_execution.py now uses model_validate_compat to parse federated auth models instead of direct .model_validate() calls and replaces ValidationError handling with a broader Exception catch.

🚥 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 The title accurately describes the main change: renaming _model_validate_compat to model_validate_compat and updating all references to use the compatibility helper function across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ 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 151f94f and 0944850.

📒 Files selected for processing (1)
  • deepnote_toolkit/sql/sql_execution.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (.cursorrules)

**/*.py: Write clean, readable Python code following PEP 8 style guide
Use type hints with Optional[T] for parameters that can be None (not T = None)
Use explicit type hints for function parameters and return values
Maximum line length: 88 characters (Black default)
Use f-strings instead of .format() for string formatting
Use pathlib.Path for file path operations instead of os.path
Use black for code formatting
Use isort for import sorting (black profile)
Use flake8 for linting
Use early returns to reduce nesting and extract common checks into variables for readability
Use snake_case for variable and function names
Use PascalCase for class names
Use snake_case for file names
Support Python versions 3.9, 3.10, 3.11, 3.12, and 3.13

**/*.py: Follow PEP 8 with Black formatting (line length: 88)
Use isort with Black profile for import sorting
Use type hints consistently
Use docstrings for all functions/classes
Use f-strings instead of .format() for string formatting
Use pathlib.Path for file path operations instead of os.path
Always use Optional[T] for parameters that can be None (not T = None)
Use explicit type hints for function parameters and return values
Use snake_case for files, functions, and variables
Use PascalCase for classes
Use appropriate exception types with context logging for error handling
Handle Jupyter/IPython specific exceptions properly
Use early returns to reduce nesting and extract common checks into variables for readability
Use dictionary unpacking for headers (e.g., headers = {"Content-Type": "application/json", **auth_headers})
Use space-separated format for CLI arguments (e.g., --port 8080)

Files:

  • deepnote_toolkit/sql/sql_execution.py
deepnote_toolkit/**/*.py

📄 CodeRabbit inference engine (.cursorrules)

deepnote_toolkit/**/*.py: Use dictionary unpacking for headers: headers = {"Content-Type": "application/json", **auth_headers}
Use appropriate exception types, log errors with context, and handle Jupyter/IPython specific exceptions properly
Document functions and classes with docstrings

Files:

  • deepnote_toolkit/sql/sql_execution.py
🧬 Code graph analysis (1)
deepnote_toolkit/sql/sql_execution.py (1)
deepnote_core/pydantic_compat_helpers.py (1)
  • model_validate_compat (48-55)
⏰ 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). (8)
  • GitHub Check: Test - Python 3.11
  • GitHub Check: Test - Python 3.10
  • GitHub Check: Test - Python 3.9
  • GitHub Check: Build and push artifacts for Python 3.13
  • GitHub Check: Build and push artifacts for Python 3.11
  • GitHub Check: Build and push artifacts for Python 3.9
  • GitHub Check: Build and push artifacts for Python 3.12
  • GitHub Check: Build and push artifacts for Python 3.10
🔇 Additional comments (3)
deepnote_toolkit/sql/sql_execution.py (3)

19-23: Imports updated correctly.

Removed ValidationError and added model_validate_compat to support Pydantic v1/v2 compatibility.


285-287: Consider adding exception handling for validation failure.

Unlike _handle_federated_auth_params (lines 313-319), validation errors here propagate unhandled. If API response format changes unexpectedly, this will crash rather than log and degrade gracefully.


313-319: LGTM.

model_validate_compat correctly applied. except Exception properly scopes the catch (prior BaseException concern resolved).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@github-actions
Copy link

github-actions bot commented Jan 14, 2026

📦 Python package built successfully!

  • Version: 1.2.0.dev3+a796e00
  • Wheel: deepnote_toolkit-1.2.0.dev3+a796e00-py3-none-any.whl
  • Install:
    pip install "deepnote-toolkit @ https://deepnote-staging-runtime-artifactory.s3.amazonaws.com/deepnote-toolkit-packages/1.2.0.dev3%2Ba796e00/deepnote_toolkit-1.2.0.dev3%2Ba796e00-py3-none-any.whl"

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 (1)
deepnote_core/pydantic_compat_helpers.py (1)

48-55: Rename looks good.

Function promoted to public API correctly. The Any return type is acceptable here given dynamic model class input.

Consider: Other helpers (_model_dump_compat, _model_fields_compat, etc.) still use underscore prefix. If they're also used externally, align naming.

🤖 Fix all issues with AI agents
In `@deepnote_toolkit/sql/sql_execution.py`:
- Around line 313-319: The except clause currently catches BaseException which
is too broad; change the exception handler around the call to
model_validate_compat(IntegrationFederatedAuthParams,
sql_alchemy_dict["federatedAuthParams"]) to catch Exception instead of
BaseException and keep the existing logger.exception("Invalid federated auth
params, try updating toolkit version") and return behavior so normal
system-exiting signals (KeyboardInterrupt, SystemExit, GeneratorExit) are not
swallowed.
📜 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 dfeedd6 and 151f94f.

📒 Files selected for processing (3)
  • deepnote_core/config/loader.py
  • deepnote_core/pydantic_compat_helpers.py
  • deepnote_toolkit/sql/sql_execution.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (.cursorrules)

**/*.py: Write clean, readable Python code following PEP 8 style guide
Use type hints with Optional[T] for parameters that can be None (not T = None)
Use explicit type hints for function parameters and return values
Maximum line length: 88 characters (Black default)
Use f-strings instead of .format() for string formatting
Use pathlib.Path for file path operations instead of os.path
Use black for code formatting
Use isort for import sorting (black profile)
Use flake8 for linting
Use early returns to reduce nesting and extract common checks into variables for readability
Use snake_case for variable and function names
Use PascalCase for class names
Use snake_case for file names
Support Python versions 3.9, 3.10, 3.11, 3.12, and 3.13

**/*.py: Follow PEP 8 with Black formatting (line length: 88)
Use isort with Black profile for import sorting
Use type hints consistently
Use docstrings for all functions/classes
Use f-strings instead of .format() for string formatting
Use pathlib.Path for file path operations instead of os.path
Always use Optional[T] for parameters that can be None (not T = None)
Use explicit type hints for function parameters and return values
Use snake_case for files, functions, and variables
Use PascalCase for classes
Use appropriate exception types with context logging for error handling
Handle Jupyter/IPython specific exceptions properly
Use early returns to reduce nesting and extract common checks into variables for readability
Use dictionary unpacking for headers (e.g., headers = {"Content-Type": "application/json", **auth_headers})
Use space-separated format for CLI arguments (e.g., --port 8080)

Files:

  • deepnote_toolkit/sql/sql_execution.py
  • deepnote_core/config/loader.py
  • deepnote_core/pydantic_compat_helpers.py
deepnote_toolkit/**/*.py

📄 CodeRabbit inference engine (.cursorrules)

deepnote_toolkit/**/*.py: Use dictionary unpacking for headers: headers = {"Content-Type": "application/json", **auth_headers}
Use appropriate exception types, log errors with context, and handle Jupyter/IPython specific exceptions properly
Document functions and classes with docstrings

Files:

  • deepnote_toolkit/sql/sql_execution.py
🧬 Code graph analysis (2)
deepnote_toolkit/sql/sql_execution.py (1)
deepnote_core/pydantic_compat_helpers.py (1)
  • model_validate_compat (48-55)
deepnote_core/config/loader.py (1)
deepnote_core/pydantic_compat_helpers.py (1)
  • model_validate_compat (48-55)
🪛 Ruff (0.14.11)
deepnote_core/pydantic_compat_helpers.py

48-48: Dynamically typed expressions (typing.Any) are disallowed in model_validate_compat

(ANN401)

⏰ 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). (14)
  • GitHub Check: Test - Python 3.12
  • GitHub Check: Test - Python 3.11
  • GitHub Check: Test - Python 3.10
  • GitHub Check: Test - Python 3.9
  • GitHub Check: Test - Python 3.13
  • GitHub Check: Typecheck - 3.10
  • GitHub Check: Typecheck - 3.12
  • GitHub Check: Typecheck - 3.9
  • GitHub Check: Typecheck - 3.13
  • GitHub Check: Build and push artifacts for Python 3.11
  • GitHub Check: Build and push artifacts for Python 3.12
  • GitHub Check: Build and push artifacts for Python 3.10
  • GitHub Check: Build and push artifacts for Python 3.13
  • GitHub Check: Build and push artifacts for Python 3.9
🔇 Additional comments (5)
deepnote_toolkit/sql/sql_execution.py (2)

19-23: Import changes correct.

Properly imports model_validate_compat and removes unused ValidationError.


285-287: Correct usage of compat helper.

deepnote_core/config/loader.py (3)

17-17: Import updated correctly.


111-111: Usage updated.


134-134: Usage updated.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.14%. Comparing base (dfeedd6) to head (0944850).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
deepnote_toolkit/sql/sql_execution.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage   73.13%   73.14%           
=======================================
  Files          93       93           
  Lines        5193     5194    +1     
  Branches      758      758           
=======================================
+ Hits         3798     3799    +1     
  Misses       1151     1151           
  Partials      244      244           
Flag Coverage Δ
combined 73.14% <88.88%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@deepnote-bot
Copy link

deepnote-bot commented Jan 14, 2026

🚀 Review App Deployment Started

📝 Description 🌐 Link / Info
🌍 Review application ra-51
🔑 Sign-in URL Click to sign-in
📊 Application logs View logs
🔄 Actions Click to redeploy
🚀 ArgoCD deployment View deployment
Last deployed 2026-01-14 13:12:54 (UTC)
📜 Deployed commit 6ca004524e3d1accb519be6b258ec665754f5d8a
🛠️ Toolkit version a796e00

m1so
m1so previously approved these changes Jan 14, 2026
@tkislan tkislan merged commit 10ab3d7 into main Jan 14, 2026
33 of 35 checks passed
@tkislan tkislan deleted the tomaskislan/blu-5441-toolkit-pydantic-v1-compatibility branch January 14, 2026 13:14
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.

4 participants