Skip to content

fix(typing): restore full-tree mypy for semantic-layer testing kit and mapper tests - #46359

Merged
sadpandajoe merged 1 commit into
masterfrom
ultraset-semantic-layers-full-tree-mypy-errors
Nov 20, 2026
Merged

sadpandajoe merged 1 commit into
masterfrom
ultraset-semantic-layers-full-tree-mypy-errors

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

The scheduled full-tree pre-commit run fails mypy (main) with 17 errors in two files. Per-PR runs only check changed files, where superset_core.* (follow_imports = "skip") resolves to Any, so neither PR caught them.

  • superset-core/src/superset_core/semantic_layers/testing.py, introduced by test(semantic-layer): validate provider-declared default time dimensions #45893: the Dimension | None annotation on a min(..., default=None) result made mypy infer the element type as Dimension | None, which no longer matched the Dimension-typed key function. The annotation is dropped; mypy infers Dimension | None on its own.
  • tests/unit_tests/semantic_layers/mapper_test.py, introduced by fix(semantic-layer): ignore inapplicable time grains #46339: three new assertions read .column.id / .value from SemanticQuery.filters (set[Filter | OrFilter] | None) without narrowing. They now narrow it to non-None and to Filter leaves, and still assert that exactly two Filter leaves exist, so the checks are as strict as before.

Test-only typing changes; no product code is touched.

TESTING INSTRUCTIONS

  1. pre-commit run mypy --all-files: no errors are reported in testing.py or mapper_test.py (17 before this change).
  2. pytest tests/unit_tests/semantic_layers/ superset-core/tests/semantic_layers/: all pass.

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

…d mapper tests

The scheduled full-tree mypy run reports 17 errors that per-PR runs miss,
because superset_core.* is follow_imports=skip and resolves to Any when
only changed files are checked.

- testing.py (#45893): the `Dimension | None` annotation on the min(...,
  default=None) result made mypy infer the element type as
  `Dimension | None`, so the `Dimension`-typed key function no longer
  matched. Let mypy infer the result type instead.
- mapper_test.py (#46339): narrow `SemanticQuery.filters` and each
  member to `Filter` (and its column to non-None) before reading
  `.column.id` / `.value`, keeping the same assertions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sadpandajoe sadpandajoe added the ai:fix-master generated by AI to fix master branch label Nov 19, 2026
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 26ae2123897a

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.58%. Comparing base (3565acb) to head (26ae212).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #46359   +/-   ##
=======================================
  Coverage   85.58%   85.58%           
=======================================
  Files        3106     3106           
  Lines      214408   214408           
  Branches    50662    50662           
=======================================
  Hits       183507   183507           
  Misses      27481    27481           
  Partials     3420     3420           
Flag Coverage Δ
hive 33.99% <ø> (ø)
mysql 51.65% <ø> (ø)
postgres 51.68% <ø> (ø)
presto 35.68% <ø> (ø)
python 88.25% <ø> (ø)
sqlite 51.36% <ø> (ø)
unit 83.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Narrowing keeps each mapper assertion as strict as before, and the dropped annotation leaves the inferred type unchanged.

@sadpandajoe
sadpandajoe merged commit d16c79c into master Nov 20, 2026
86 of 87 checks passed
@sadpandajoe
sadpandajoe deleted the ultraset-semantic-layers-full-tree-mypy-errors branch November 20, 2026 00:51
hainenber pushed a commit that referenced this pull request Nov 21, 2026
…d mapper tests (#46359)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:fix-master generated by AI to fix master branch size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduled pre-commit fails: full-tree mypy errors in semantic-layer testing kit and mapper_test

2 participants