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

   ### Summary
   Fixes the 23 mypy `UUID | None` errors the nightly pre-commit (next) sweep 
flagged in the four versioning test files (#44423). `UUIDMixin.uuid` 
(`superset/models/helpers.py:751`) is a nullable `sa.Column`, so mypy infers 
`UUID | None` for instance reads; the tests passed it (and 
`BaseDatasource.description`, `str | None`) unnarrowed into strictly-typed 
callees.
   
   Change is test-only: hoist the read into an annotated local and `assert 
<local> is not None` before the flagged call, matching the idiom from 
#44394/#42654. Where a narrowed local already existed (`chart_uuid`, 
`dataset_uuid`, `slc_uuid`), the assert lands right after its assignment and 
downstream call sites use the local; `restore_fails_closed_tests.py:375` 
narrows the `removesuffix` receiver with `(dataset.description or "")` since 
the target-version suffix is expected on a present description.
   
   ### Behavioral analysis
   No runtime behavior change intended; every touched entity 
(chart/slice/dashboard/dataset fixtures) mints its uuid via 
`default=uuid.uuid4` on insert and is committed before the asserted read, so 
the asserts are statically-load-bearing but unreachable in practice.
   
   ### Test plan
   - [x] `mypy --check-untyped-defs` (1.15.0, the pinned pre-commit rev) clean 
on the 4 files
   - [x] `python -c "import ast; ast.parse(...)"` on all 4 files
   - [ ] CI green on this PR
   
   ### Additional context
   Closes #44423. Same defect class as #44384/#44394; surfaced now because the 
`next` mypy leg only runs on push/schedule (first `--all-files` sweep since 
#44258/#44251/#44091 merged).
   


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