sadpandajoe opened a new pull request, #45315:
URL: https://github.com/apache/superset/pull/45315

   ### SUMMARY
   The nightly full-repo `mypy (main)` pre-commit run on master fails on two 
test-only type errors that changed-file CI can't see.
   
   1. `tests/unit_tests/semantic_layers/query_errors_test.py` (lines 191, 269, 
476) builds `SemanticQuery(dimensions=set(), metrics=set())`, but 
`SemanticQuery.dimensions` and `.metrics` are declared `list[Dimension]` and 
`list[Metric]` (`superset-core/src/superset_core/semantic_layers/types.py`, 
unchanged since cb53745d43). The test file was added in #45110 (1fced034d3) 
with `set()`. The `superset_core.*` override in `pyproject.toml` sets 
`follow_imports = "skip"`, so the class is `Any` in changed-file runs and the 
mismatch is invisible. The nightly passes `superset-core/**` on the command 
line, so the real types apply and mypy reports 6 `arg-type` errors 
(`set[Never]` vs `list[Dimension]`/`list[Metric]`). The dataclass does no 
runtime validation, so the tests pass either way.
   2. `tests/unit_tests/models/helpers_test.py:3085` carries `# type: 
ignore[list-item]` on `"val": [33, 29.02, None]`. #45133 (f5404f7eae) widened 
`FilterValues` in `superset/superset_typing.py` to accept `None` list elements, 
so the literal now type-checks and the ignore is reported as `unused-ignore`. 
#45133 didn't touch the test file, so changed-file CI never ran mypy on it.
   
   The fix passes empty lists at the three call sites and removes the stale 
ignore. No behavior changes. The two ignores added by #44986 at lines 3149 and 
3200 are still needed and are left alone. The remaining nightly errors in 
`cache_policy_test.py` and `metric_filter_test.py` are handled in #45268 and 
#45239.
   
   ### TESTING INSTRUCTIONS
   Run mypy the way the nightly does, with `superset-core` on the command line:
   
       mypy --ignore-missing-imports --scripts-are-modules --check-untyped-defs 
\
         tests/unit_tests/models/helpers_test.py \
         tests/unit_tests/semantic_layers/query_errors_test.py \
         $(git ls-files 'superset-core/*.py')
   
   Before the change this reports 7 errors in 2 files; after it, `Success: no 
issues found`. For the full-repo run, pass every tracked `.py`/`.pyi` file 
outside `superset-extensions-cli/`; only the errors in the two PRs above should 
remain.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #45314
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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