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

   ### Problem
   
   The nightly full-repo `pre-commit` run on `master` fails mypy with 3 errors 
in two semantic-layer test files: 
https://github.com/apache/superset/actions/runs/38521870062/job/115713188528 
(commit 7f1bfaba4b2968e0818d6e08e79d34ecae0bd3f1, 2026-10-14).
   
   ```
   tests/unit_tests/semantic_layers/cache_policy_test.py:78: error: Argument 
"filters" to "SemanticQuery" has incompatible type "set[Filter] | None"; 
expected "set[Filter | OrFilter] | None" [arg-type]
   tests/unit_tests/semantic_layers/metric_filter_test.py:248: error: Item 
"OrFilter" of "Filter | OrFilter | Any" has no attribute "column" [union-attr]
   tests/unit_tests/semantic_layers/metric_filter_test.py:248: error: Item 
"None" of "set[Filter | OrFilter] | None" has no attribute "__iter__" (not 
iterable) [union-attr]
   ```
   
   ### Root cause
   
   #45133 (`fix(semantic-layer): preserve NULL selections in chart filters`, 
f5404f7eae, merged 2026-10-13) widened `SemanticQuery.filters` to 
`set[FilterExpression] | None` where `FilterExpression = Filter | OrFilter` 
(`superset-core/src/superset_core/semantic_layers/types.py`), and updated 8 
sibling semantic-layer test files to match but missed these two. 
`cache_policy_test.py:71`'s `_candidate` helper still declares `query_filters` 
as the narrower `set[Filter] | None` (mypy sets are invariant). 
`metric_filter_test.py:248` iterates `query.filters` with no `None`-guard or 
`isinstance` narrowing before reading `.column`, which `OrFilter` lacks. 
Product code (`superset/semantic_layers/cache_policy.py:236`) already uses 
`isinstance(filter_, OrFilter)`; these two test files hadn't adopted it. Only 
visible when `superset-core` is on the mypy command line (`pyproject.toml` sets 
`follow_imports = "skip"` for `superset_core.*` normally), so only the nightly 
full-repo run surfaces it.
   
   ### Steps to reproduce
   
   With mypy 1.15.0 and `superset-core` installed editable:
   
   ```
   mypy --check-untyped-defs --config-file pyproject.toml 
tests/unit_tests/semantic_layers/cache_policy_test.py 
tests/unit_tests/semantic_layers/metric_filter_test.py 
superset-core/src/superset_core/semantic_layers/types.py
   ```
   
   (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