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

   ### SUMMARY
   Root cause: #45641 (a813fb906c) added `get_version(Dashboard, 
dashboard.uuid, ...)` and `get_version(Slice, chart.uuid, ...)` calls to 
`tests/unit_tests/versioning/test_runtime_capture.py`. `.uuid` is typed `UUID | 
None`, while `get_version` takes `entity_uuid: UUID`, so the full-repo mypy run 
(`pre-commit run mypy --all-files`, as in the scheduled `pre-commit checks` 
workflow) fails with two `[arg-type]` errors at lines 111 and 147.
   
   The per-PR run checks only changed files. In that mode `superset_core` isn't 
on mypy's command line, so the models' superset-core base classes resolve to 
`Any` and `.uuid` reads as `Any`. That is why the error got through on the 
original PR.
   
   This change narrows each uuid with a local variable and an `assert ... is 
not None` before the call, the same pattern #44789 used for the 
`RestoreVersionCommand` calls. Test behaviour is unchanged: both entities are 
committed before the assertion, so their uuid is always set.
   
   ### TESTING INSTRUCTIONS
   1. Check out this branch.
   2. Run `pre-commit run mypy --all-files` (or mypy 1.15.0 with 
`--check-untyped-defs` over the same file set as the `mypy (main)` hook).
   3. Confirm there are no 
`tests/unit_tests/versioning/test_runtime_capture.py` errors. On master the 
same command reports `test_runtime_capture.py:111` and `:147` `Argument 2 to 
"get_version" has incompatible type "UUID | None"; expected "UUID"`.
   4. Run `pytest tests/unit_tests/versioning/test_runtime_capture.py` and 
confirm all tests pass.
   
   ### 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