You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/10/22 07:46:47 UTC
[PR] fix(mypy): type-check dataset export in full-tree mypy [superset]
sadpandajoe opened a new pull request, #45616:
URL: https://github.com/apache/superset/pull/45616
### SUMMARY
The nightly `pre-commit checks` run on master fails `mypy (main)` with three errors in two files, both added by #44347 (77ebc0e5, "fix(chart): keep dataset_uuid in exports when the dataset is deleted"):
superset/commands/export/assets.py:157: error: Argument 1 to "set" has incompatible type "list[int | str]"; expected "Iterable[int | None]" [arg-type]
tests/unit_tests/commands/chart/export_test.py:403: error: Item "UUID" of "UUID | None" has no attribute "in_" [union-attr]
tests/unit_tests/commands/chart/export_test.py:403: error: Item "None" of "UUID | None" has no attribute "in_" [union-attr]
These only show up when mypy checks the whole tree. With `--all-files`, superset-core's sources are part of the run, so `SqlaTable` picks up `CoreDataset`'s plain `id: int` and `uuid: UUID | None` annotations. In the per-PR run, which only checks changed files, superset_core is not resolved and both attributes are `Any`, so #44347 passed its own checks. Nothing is wrong at runtime: `dataset_ids` holds the integer ids from `find_all()`, and `SqlaTable.uuid` is a column.
The fix:
- `assets.py`: `referenced - set(dataset_ids)` becomes `referenced.difference(dataset_ids)`. Same result, and `set.difference()` accepts any iterable, so it type-checks in both modes.
- `export_test.py`: `SqlaTable.uuid.in_(...)` gets `# type: ignore[union-attr]`, the same as the existing `SqlaTable.uuid.in_()` / `Slice.uuid.in_()` sites.
- `pyproject.toml`: adds the test module to the existing `warn_unused_ignores = false` override for this case. Without it, a per-PR run that touches only this file reports the ignore as unused.
### TESTING INSTRUCTIONS
1. On master, run `prek run mypy --all-files` (or `pre-commit run mypy --all-files`) and see the three errors above.
2. On this branch, run the same command: `mypy (main)` passes.
3. Run `prek run mypy --files pyproject.toml superset/commands/export/assets.py tests/unit_tests/commands/chart/export_test.py` to check that the per-PR, changed-files-only run also passes.
4. Optionally, export all assets from Settings > Import/Export with a chart whose dataset is in the trash, and check the bundle still includes that dataset. This change does not alter that behaviour.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #45615
- [ ] 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
Notes:
- An inline `# type: ignore[union-attr,unused-ignore]` on `export_test.py:403` would avoid the pyproject override (the repo does this in `superset/daos/chart.py:80` and `superset/daos/dataset.py:104`). This PR follows the existing pyproject convention for `SqlaTable.uuid.in_()` instead.
🤖 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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mypy): type-check dataset export in full-tree mypy [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #45616:
URL: https://github.com/apache/superset/pull/45616
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mypy): type-check dataset export in full-tree mypy [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45616:
URL: https://github.com/apache/superset/pull/45616#issuecomment-6335670080
## CodeAnt PR Risk: Low Risk
- The PR appears safe to merge; no actionable issues were identified in the review.
**Assessed commit:** `b851bfff7ee1`
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mypy): type-check dataset export in full-tree mypy [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45616:
URL: https://github.com/apache/superset/pull/45616#issuecomment-6335913960
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45616?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 65.28%. Comparing base ([`b3471a1`](https://app.codecov.io/gh/apache/superset/commit/b3471a1369cf5a0527571b643839374854732dec?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b851bff`](https://app.codecov.io/gh/apache/superset/commit/b851bfff7ee1071cb7fb3b80bb939901f0830881?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45616?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/commands/export/assets.py](https://app.codecov.io/gh/apache/superset/pull/45616?src=pr&el=tree&filepath=superset%2Fcommands%2Fexport%2Fassets.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvZXhwb3J0L2Fzc2V0cy5weQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45616?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (b3471a1) and HEAD (b851bff). Click for more details.
>
> <details><summary>HEAD has 4 uploads less than BASE</summary>
>
>| Flag | BASE (b3471a1) | HEAD (b851bff) |
>|------|------|------|
>|python|7|3|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #45616 +/- ##
===========================================
- Coverage 84.10% 65.28% -18.83%
===========================================
Files 3056 3056
Lines 201287 201287
Branches 47066 47066
===========================================
- Hits 169296 131406 -37890
- Misses 28752 66924 +38172
+ Partials 3239 2957 -282
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.89% <0.00%> (ø)` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.62% <0.00%> (ø)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.73% <0.00%> (-34.62%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.62% <0.00%> (ø)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/45616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45616?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org