sadpandajoe commented on code in PR #44817:
URL: https://github.com/apache/superset/pull/44817#discussion_r4211949932


##########
.pre-commit-config.yaml:
##########
@@ -46,6 +49,35 @@ repos:
         name: mypy (superset-extensions-cli)
         args: [--check-untyped-defs]
         files: ^superset-extensions-cli/
+      - id: mypy
+        alias: mypy-sole-input-fixtures
+        name: mypy (sole-input fixtures)
+        # Regression guards that only mean something when mypy checks the
+        # fixture as its ONLY input: a type that resolves one way with the
+        # whole tree loaded and another way in a scoped per-PR run (e.g.
+        # UUIDMixin.uuid, see tests/mypy_fixtures/uuid_mixin_nullable.py).
+        # Manual stage, so neither a local `pre-commit run --all-files` nor
+        # the per-PR / nightly runs of the main hook pick it up; CI invokes
+        # it explicitly, one fixture at a time, in
+        # .github/workflows/pre-commit.yml. --no-incremental keeps it from
+        # reusing full-tree types the main hook may already have cached.
+        args: [--check-untyped-defs, --no-incremental]
+        files: ^tests/mypy_fixtures/
+        exclude: ^tests/mypy_fixtures/__init__\.py$
+        stages: [manual]
+        # Keep in sync with "mypy (main)" above.
+        additional_dependencies: [

Review Comment:
   This hook runs in prek's isolated mypy environment, and the dependency list 
below has no SQLAlchemy. With `ignore_missing_imports = true`, `Mapped` and 
`declared_attr` resolve to `Any`, so `assert_type(..., Optional[UUID])` can't 
pass whether or not the `@declared_attr` fix is in place. The `mypy sole-input 
fixtures` step on this head fails with `uuid_mixin_nullable.py:43/44: 
Expression is of type "Any", not "UUID | None"`, which means the guard is red 
on the fixed code and can't tell a revert apart from the fix. Should the hook 
get SQLAlchemy (and whatever else `superset.models.dashboard` imports) in its 
environment, or run as a `language: system` hook against the CI-installed 
backend?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to