Skip to content

fix(versioning): narrow UUIDs in restore tests - #42654

Merged
hainenber merged 1 commit into
masterfrom
codex/ci-master-7d2b184-20260731
Aug 2, 2026
Merged

fix(versioning): narrow UUIDs in restore tests#42654
hainenber merged 1 commit into
masterfrom
codex/ci-master-7d2b184-20260731

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Narrow the nullable SQLAlchemy UUID attributes in the chart, dashboard, and
dataset version-restore integration tests before passing them to
derive_version_uuid.

The scheduled pre-commit workflow on master reported 14 MyPy arg-type errors
after #42469 introduced these tests. The model fields are typed as UUID | None,
while the helper correctly requires UUID. Explicit non-null assertions at the
test setup boundaries retain the runtime test behavior and satisfy the stricter
contract.

Observed failure: https://github.com/apache/superset/actions/runs/30611617987

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable; test-only typing fix.

TESTING INSTRUCTIONS

  • pre-commit run mypy --files tests/integration_tests/charts/version_restore_tests.py tests/integration_tests/dashboards/version_restore_tests.py tests/integration_tests/datasets/version_restore_tests.py
  • pre-commit run --files tests/integration_tests/charts/version_restore_tests.py tests/integration_tests/dashboards/version_restore_tests.py tests/integration_tests/datasets/version_restore_tests.py
  • pre-commit run --all-files was run. The affected MyPy hook passed; unrelated local baseline/environment failures remained in docs/frontend tooling and repository-wide linting.
  • The three pytest files were attempted, but the host environment failed before collection because its pytest-cov plugin imports coverage.results.display_covered, which is absent from the installed coverage package.

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

@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 705ae03
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a6ce165038613000731ccd0
😎 Deploy Preview https://deploy-preview-42654--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.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.44%. Comparing base (7d2b184) to head (ca87645).
⚠️ Report is 22 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42654   +/-   ##
=======================================
  Coverage   65.44%   65.44%           
=======================================
  Files        2810     2810           
  Lines      159362   159364    +2     
  Branches    36372    36372           
=======================================
+ Hits       104301   104303    +2     
  Misses      53019    53019           
  Partials     2042     2042           
Flag Coverage Δ
hive 38.08% <ø> (-0.01%) ⬇️
mysql 57.82% <ø> (-0.01%) ⬇️
postgres 57.87% <ø> (+<0.01%) ⬆️
presto 39.98% <ø> (-0.01%) ⬇️
python 59.25% <ø> (+<0.01%) ⬆️
sqlite 57.49% <ø> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sadpandajoe
sadpandajoe force-pushed the codex/ci-master-7d2b184-20260731 branch from 705ae03 to ca87645 Compare July 31, 2026 18:06
@sadpandajoe
sadpandajoe requested review from Copilot and rusackas July 31, 2026 19:38
@sadpandajoe
sadpandajoe marked this pull request as ready for review July 31, 2026 19:38

Copilot AI left a comment

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.

Pull request overview

This PR fixes MyPy arg-type errors in the version-restore integration tests by narrowing nullable SQLAlchemy UUID fields to non-null UUIDs before calling derive_version_uuid, aligning the tests with the helper’s strict UUID contract.

Changes:

  • Add explicit non-null assertions for entity UUIDs in chart, dashboard, and dataset version-restore tests.
  • Reuse the narrowed UUID variables when deriving deterministic version_uuid values.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/integration_tests/charts/version_restore_tests.py Assert chart UUID is non-null before passing to derive_version_uuid; reuse narrowed UUID variable.
tests/integration_tests/dashboards/version_restore_tests.py Assert dashboard UUID is non-null before passing to derive_version_uuid; reuse narrowed UUID variable in multiple tests.
tests/integration_tests/datasets/version_restore_tests.py Assert dataset UUID is non-null before passing to derive_version_uuid across restore/listing tests.
Suppressed comments (1)

tests/integration_tests/dashboards/version_restore_tests.py:298

  • target_tx comes from .scalar() and can be None if no version rows are found. Passing None into derive_version_uuid will compute a UUID for a non-existent version and fail later in a less obvious way. Add an explicit assert target_tx is not None before deriving to make failures clearer (and keep the call contract tight).
        )
        target_uuid = str(derive_version_uuid(entity_uuid, target_tx))

Comment on lines 238 to +239
)
target_uuid = str(derive_version_uuid(dashboard.uuid, target_tx))
target_uuid = str(derive_version_uuid(entity_uuid, target_tx))
Comment on lines 437 to +438
)
target_uuid = str(derive_version_uuid(chart.uuid, first_tx))
target_uuid = str(derive_version_uuid(entity_uuid, first_tx))
@bito-code-review

bito-code-review Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #ad41f5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: ca87645..ca87645
    • tests/integration_tests/charts/version_restore_tests.py
    • tests/integration_tests/dashboards/version_restore_tests.py
    • tests/integration_tests/datasets/version_restore_tests.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

@hainenber

Copy link
Copy Markdown
Contributor

Thanks @sadpandajoe, this should help unblocking the CI!

@hainenber
hainenber merged commit 120b442 into master Aug 2, 2026
95 checks passed
@hainenber
hainenber deleted the codex/ci-master-7d2b184-20260731 branch August 2, 2026 16:54
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.

3 participants