Problem
tests/unit_tests/versioning/test_runtime_capture.py and tests/unit_tests/versioning/test_capture_gap_restore.py fail nightly full-repo mypy on master. First failing run: https://github.com/apache/superset/actions/runs/36530938046/job/109284247292 ("pre-commit (next)", commit ca3d356).
Root cause
UUIDMixin.uuid (superset/models/helpers.py:740-742) is a nullable column, so mypy infers SqlaTable.uuid / Dashboard.uuid as UUID | None. BaseRestoreVersionCommand.__init__ (superset/commands/version_restore.py:78) requires a non-optional UUID. PR #44514 added the two test files and passed .uuid straight into RestoreDatasetVersionCommand/RestoreDashboardVersionCommand without narrowing (e.g. test_runtime_capture.py:229, test_capture_gap_restore.py:186,236,257,306,311,416,488,608,609,720,753,786), and test_runtime_capture.py:253 assigns the nullable value into a : UUID-annotated variable, which fails at the assignment itself.
Steps to reproduce
pre-commit run mypy --files tests/unit_tests/versioning/test_runtime_capture.py tests/unit_tests/versioning/test_capture_gap_restore.py
run against a commit on master before the fix, or open the mypy step output in the job log linked above.
(Found via automated investigation — Agor.)
Problem
tests/unit_tests/versioning/test_runtime_capture.pyandtests/unit_tests/versioning/test_capture_gap_restore.pyfail nightly full-repo mypy on master. First failing run: https://github.com/apache/superset/actions/runs/36530938046/job/109284247292 ("pre-commit (next)", commit ca3d356).Root cause
UUIDMixin.uuid(superset/models/helpers.py:740-742) is a nullable column, so mypy infersSqlaTable.uuid/Dashboard.uuidasUUID | None.BaseRestoreVersionCommand.__init__(superset/commands/version_restore.py:78) requires a non-optionalUUID. PR #44514 added the two test files and passed.uuidstraight intoRestoreDatasetVersionCommand/RestoreDashboardVersionCommandwithout narrowing (e.g.test_runtime_capture.py:229,test_capture_gap_restore.py:186,236,257,306,311,416,488,608,609,720,753,786), andtest_runtime_capture.py:253assigns the nullable value into a: UUID-annotated variable, which fails at the assignment itself.Steps to reproduce
run against a commit on master before the fix, or open the mypy step output in the job log linked above.
(Found via automated investigation — Agor.)