Skip to content

test broken#41775

Closed
annyzhu713 wants to merge 1 commit into
apache:masterfrom
annyzhu713:test-demo
Closed

test broken#41775
annyzhu713 wants to merge 1 commit into
apache:masterfrom
annyzhu713:test-demo

Conversation

@annyzhu713

Copy link
Copy Markdown

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0f42a3

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

Review Details
  • Files reviewed - 1 · Commit Range: 4a5e857..4a5e857
    • superset/utils/core.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b32a37f
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a49b3a033de6800088017ea
😎 Deploy Preview https://deploy-preview-41775--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread superset/utils/core.py


def cast_to_num(value: float | int | str | None) -> float | int | None:
def cast_to_num(value: float | int | str) -> float | int | None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: This signature change drops None from the accepted input type, but the function’s documented/tested contract still includes None and the body calls value.isdigit() without a null guard. Passing None now will raise an exception instead of returning None, so restore None in the accepted type and keep an explicit None early return. [api mismatch]

Severity Level: Critical 🚨
- ❌ Integration test `test_cast_to_num` fails due to AttributeError.
- ⚠️ Numeric filter conversion in helpers.py uses cast_to_num.
- ⚠️ Function docs and doctests still include None input.
Steps of Reproduction ✅
1. Run the integration test suite, specifically `test_cast_to_num` in
`tests/integration_tests/utils_tests.py:404-410`, which imports `cast_to_num` from
`superset.utils.core` at lines 42-46.

2. The test calls `cast_to_num(None)` (see `tests/integration_tests/utils_tests.py:409`),
expecting the function to return `None` as asserted in the test and documented by the
doctest examples in `superset/utils/core.py:56-59`.

3. The call reaches `cast_to_num` defined in `superset/utils/core.py:41-72`, where the
signature is `def cast_to_num(value: float | int | str) -> float | int | None:` and the
implementation executes:

   - `if isinstance(value, (int, float)):` at line 65, which is false for `None`,

   - then `if value.isdigit():` at line 67.

4. Because `value` is `None`, `value.isdigit()` raises `AttributeError: 'NoneType' object
has no attribute 'isdigit'`, causing the test and any real caller passing `None` (such as
numeric filter handling in `superset/models/helpers.py:2658-2673` which delegates to
`utils.cast_to_num(value)`) to fail unexpectedly instead of returning `None` as per the
documented contract.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/utils/core.py
**Line:** 420:420
**Comment:**
	*Api Mismatch: This signature change drops `None` from the accepted input type, but the function’s documented/tested contract still includes `None` and the body calls `value.isdigit()` without a null guard. Passing `None` now will raise an exception instead of returning `None`, so restore `None` in the accepted type and keep an explicit `None` early return.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The removal of None from the type hint and the deletion of the if value is None check causes an AttributeError when None is passed, as value.isdigit() is called without a null guard. To resolve this, restore None to the type hint and re-add the early return for None values.

superset/utils/core.py

def cast_to_num(value: float | int | str | None) -> float | int | None:
    # ... (docstring)
    if value is None:
        return None
    if isinstance(value, (int, float)):
        return value
    if value.isdigit():

@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #70397a

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/utils/core.py - 1
Review Details
  • Files reviewed - 1 · Commit Range: b32a37f..b32a37f
    • superset/utils/core.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant