sadpandajoe opened a new issue, #45137:
URL: https://github.com/apache/superset/issues/45137

   ### Problem
   mypy fails with 4 `union-attr`/`assignment` errors once superset-core's own 
sources are part of the same mypy invocation (the full-tree run, not the per-PR 
changed-files run): `superset/daos/datasource.py:111`, 
`superset/commands/security/reset.py:82`, and 
`tests/unit_tests/commands/deletion_retention/test_purge_chart_detach.py:203`. 
First failing run: 
https://github.com/apache/superset/actions/runs/37893429639/job/113699254515 
(job "pre-commit (current)", mypy hook, workflow "pre-commit checks", master 
HEAD 4ca736d81c).
   
   ### Root cause
   `superset-core/src/superset_core/common/models.py` declares `Dataset.id: 
int`, `Chart.uuid: UUID | None`, and `KeyValue.uuid: UUID | None` as plain 
type-hint interface markers on abstract `CoreModel` classes. 
`SqlaTable(CoreDataset, ...)` (`superset/connectors/sqla/models.py:1566`), 
`Slice(CoreChart, ...)` (`superset/models/slice.py:75`), and 
`KeyValueEntry(CoreKeyValue, ...)` (`superset/key_value/models.py:29`) list 
these abstract classes first in their bases, so mypy's MRO resolves 
`.id`/`.uuid` to the plain hint instead of the real SQLAlchemy 
`Mapped`/`Column` descriptor, but only when superset-core's source files are 
included in the same mypy run (`prek run --all-files` / the nightly full-tree 
job). This is already documented at `pyproject.toml:407-411` and already worked 
around at three other call sites the same way: 
`superset/mcp_service/dataset_scope.py:131`, 
`superset/commands/chart/importers/v1/__init__.py:167`, 
`tests/unit_tests/mcp_service/dataset/tool/test_dataset_tool
 s.py:2727`.
   
   ### Steps to reproduce
   Build a venv with mypy 1.15.0 and an editable superset-core install, then 
run mypy in full-tree mode with superset-core's own sources included as roots:
   ```
   mypy superset-core/src superset/daos/datasource.py 
superset/commands/security/reset.py 
tests/unit_tests/commands/deletion_retention/test_purge_chart_detach.py
   ```
   This reproduces all 4 errors byte-for-byte against the CI output on master @ 
4ca736d81c.
   
   (Found via automated investigation — [Agor](https://agor.live/).)


-- 
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