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

   ### SUMMARY
   Master's post-merge pre-commit check started failing on `mypy` with:
   
   ```
   superset/commands/importers/v1/utils.py:202: error: Name "config" already 
defined on line 195  [no-redef]
   ```
   
   Root cause: [#43232](https://github.com/apache/superset/pull/43232) and 
[#44390](https://github.com/apache/superset/pull/44390) merged the same day, 
each independently binding `config` up front in `load_configs` for the same 
reason — so the `except ValidationError` diagnostic stays valid even when 
`load_yaml` raises before the assignment completes. Landing side by side (no 
textual conflict, since they touch different lines), they left two annotated 
bindings of the same name with different types: `config: dict[str, Any] | None 
= None` outside the `if schema:` block, then `config: Any = None` again just 
inside it, right before the `try`. The first binding alone already covers it; 
the second was always redundant.
   
   This wasn't visible in either PR's own CI — neither PR's diff gave its own 
`mypy` run a reason to type-check the *other* PR's untouched lines. It only 
surfaced once an unrelated, later commit's `mypy` invocation happened to pull 
`utils.py` into its type-checked graph for the first time since both landed.
   
   This PR removes the redundant second binding and folds its explanatory 
comment into the first (correct, more precisely-typed) one. No behavior change.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A — type-checking fix only, no UI change.
   
   ### TESTING INSTRUCTIONS
   1. `pre-commit run mypy --files superset/commands/importers/v1/utils.py` — 
passes (was failing on master).
   2. `pytest tests/unit_tests/commands/importers/v1/utils_test.py 
tests/unit_tests/charts/commands/importers/v1/utils_test.py 
tests/unit_tests/dashboards/commands/importers/v1/utils_test.py` — 50 passed, 
no behavior change.
   
   ### 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