mikebridge opened a new pull request, #44253: URL: https://github.com/apache/superset/pull/44253
### SUMMARY `BaseRestoreVersionCommand.run()`'s transactional wrapper kept `on_error`'s default `catches=(SQLAlchemyError,)`, so a non-DB exception from the restore engine bypassed the `failed_exc` → 422 mapping and surfaced as a raw 500. The concrete latent case (sc-115326, found in the #42469 review): `restore_version()` raises `LookupError` for a model class missing from `_RESTORE_RELATIONS` — the fail-closed registry guard. All three shipped entities are registered, so it cannot fire today; whoever wires a fourth versioned entity without a registry entry now gets the intended fail-closed 422 instead of a confusing 500. `catches` widens to exactly `(SQLAlchemyError, LookupError)` — deliberately narrow, per the call-site comment: other non-SQLAlchemy exceptions must keep passing through the wrapper untouched so the endpoint can map specific types explicitly (e.g. #44251's fail-closed refusal). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — error mapping. Before: unregistered model → 500 with a raw traceback. After: 422 via the entity's `failed_exc`. ### TESTING INSTRUCTIONS `pytest tests/unit_tests/commands/test_base_restore_version_command.py` — parametrized over all three concrete commands, both directions: the registry `LookupError` maps to the subclass's `failed_exc` with the original chained as `__cause__` (fails pre-fix), and an arbitrary `RuntimeError` still propagates as itself (the tuple stays narrow). ### ADDITIONAL INFORMATION - [x] Has associated issue: sc-115326 - [ ] 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) https://claude.ai/code/session_01JRLEJS4mUqKBoPjSjviKUW -- 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]
