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

   Problem
   
   The nightly full-repo mypy sweep fails with two `[union-attr]` errors on 
`Slice.uuid.in_(dependency_chart_uuids)` in 
`superset/commands/chart/importers/v1/__init__.py:162`: `Item "UUID" of "UUID | 
None" has no attribute "in_"` and the `None` variant. First seen on the nightly 
'pre-commit checks' run at master HEAD 
ea79c63e8786e6dad7cc53b12c0cfd0c0fb6aa36: 
https://github.com/apache/superset/actions/runs/37102954690/job/111145935842 
(job "pre-commit (next)", hook `mypy (main)`). It doesn't surface on scoped 
per-PR runs since `superset_core.*` is normally `follow_imports = "skip"`.
   
   Root cause
   
   `Slice` (superset/models/slice.py:73-75) lists `CoreChart` 
(superset_core.common.models.Chart, which declares a plain instance-attribute 
annotation `uuid: UUID | None` at 
superset-core/src/superset_core/common/models.py:227) ahead of 
`ImportExportMixin(UUIDMixin)` (superset/models/helpers.py:741-743), which 
supplies the real `uuid = sa.Column(UUIDType(binary=True), ...)`. `Slice` never 
redeclares `uuid` itself, so mypy resolves the attribute via MRO order and 
lands on `Chart.uuid: UUID | None` instead of the Column descriptor. The 
`.in_()` call was added by #43232 ("feat(export/import): add annotation layer 
export/import support for charts and dashboards").
   
   Steps to reproduce
   
   With mypy 1.15.0 (pinned in .pre-commit-config.yaml):
   
   ```
   mypy --config-file pyproject.toml 
superset/commands/chart/importers/v1/__init__.py 
superset-core/src/superset_core/common/models.py
   ```
   
   Checking `superset/commands/chart/importers/v1/__init__.py` alone (scoped 
mode, matching per-PR CI) stays clean; only pulling 
`superset_core.common.models` into the type-checked graph reproduces the two 
errors.
   
   (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