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

   ### SUMMARY
   The scheduled `pre-commit checks` run on master fails the `mypy (main)` hook 
with 6 errors in `tests/unit_tests/semantic_layers/mapper_test.py` (lines 1391, 
5445, 5446).
   
   Root cause: two tests added in f829175e94 (#45571, "fix(sunburst): keep the 
saved time grain in Explore") read `SemanticQuery.filters` without narrowing 
it. The field is typed `set[Filter | OrFilter] | None` in 
`superset-core/src/superset_core/semantic_layers/types.py`; `OrFilter` has no 
`column` or `operator`, and `Filter.column` is `Dimension | Metric | None`. 
mypy only resolves these types when superset-core's sources are on its command 
line, as in the nightly `pre-commit run --all-files`. In a scoped per-PR run 
`superset_core` falls back to `Any`, so the PR merged green.
   
   The fix is test-only. Each test first asserts that `filters` is not `None`, 
then asserts that every member is a leaf `Filter` (with a column, where the 
test reads one) before reading its attributes. The assertions stay as strict as 
before: an `OrFilter` in the result still fails the test rather than being 
skipped. No product code changes.
   
   ### TESTING INSTRUCTIONS
   1. In a virtualenv with `mypy==1.15.0` plus the hook's `types-*` stubs (no 
Superset dependencies installed, matching the isolated pre-commit hook), run:
      `mypy --check-untyped-defs 
tests/unit_tests/semantic_layers/mapper_test.py $(git ls-files 
'superset-core/*.py')`
      On master this reports 6 errors; on this branch it reports no issues.
   2. `pytest tests/unit_tests/semantic_layers/mapper_test.py` passes (401 
tests).
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] 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