sadpandajoe commented on code in PR #44817:
URL: https://github.com/apache/superset/pull/44817#discussion_r4243463843
##########
.pre-commit-config.yaml:
##########
@@ -46,6 +49,40 @@ 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.
+ # --follow-imports=silent reports errors only for the fixture itself,
+ # not for the superset/ modules it imports.
+ args: [--check-untyped-defs, --no-incremental, --follow-imports=silent]
+ files: ^tests/mypy_fixtures/
+ exclude: ^tests/mypy_fixtures/__init__\.py$
+ stages: [manual]
+ # Keep in sync with "mypy (main)" above, plus SQLAlchemy: without it
+ # `Mapped` / `declared_attr` resolve to `Any` in the isolated hook
+ # environment and the guard cannot tell the fix from a revert.
+ additional_dependencies: [
+ sqlalchemy==2.0.52,
Review Comment:
The new guard installs SQLAlchemy only in this sole-input hook, but `mypy
(main)` above still has no SQLAlchemy and `ignore_missing_imports = true`, so
there `Mapped` and `declared_attr` resolve to `Any`. In that environment
`UUIDMixin.uuid` stays `Any` after this change, so a per-PR run that passes an
unnarrowed `.uuid` to a callee requiring `UUID` is still accepted while this
fixture stays green. Does the per-PR check now flag the #44789-style call, and
if not, should SQLAlchemy be added to the main hook as well (or the fixture
check extended to exercise that call)?
--
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]