mikebridge opened a new pull request, #45033: URL: https://github.com/apache/superset/pull/45033
### SUMMARY When an application savepoint rolls back, versioning now restores its bookkeeping to the state at savepoint entry, so a later versioned write in the same outer transaction records correct history. Before this change, SQLAlchemy-Continuum kept a cached shadow row and an auxiliary savepoint that the rollback had already removed. The next versioned write in the same transaction then failed: a stale `*_version` UPDATE, then "no such savepoint". On PostgreSQL and MySQL a post-rollback shadow could also point at a rolled-back `version_transaction` row. - Savepoint entry checkpoints the unit of work (shadow identities, current transaction, retained pre-change state and action metadata). Rollback restores it; release discards it; the outer commit or rollback clears it. - Auxiliary sessions share the application's transaction boundaries. Transactions without savepoints behave exactly as before. - No schema or API change. One production path that reaches this: the v1 importer opens a savepoint per tag (`superset/commands/importers/v1/utils.py`) inside import transactions that also write versioned objects. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A (backend). ### TESTING INSTRUCTIONS `pytest tests/unit_tests/versioning` (414 pass). New service-free cases with real capture listeners cover: - explicit flush and query autoflush after a nested rollback; - surviving outer edits, deletes and associations; - a nested commit followed by a parent rollback; - capture denied, action intent, and an unrelated flush after the savepoint ends. The regression cases fail on master and pass here. PostgreSQL and MySQL behaviour was reasoned from the SQLAlchemy and Continuum source, not run. ### ADDITIONAL INFORMATION - [ ] Has associated issue - [ ] Required feature flags - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API Interaction with #44928: both change the before/after-flush hooks in `superset/versioning/unit_of_work.py` and append to the same test module, so whichever merges second needs a small textual merge. #44928's two strict xfails cover this bug; once both are in, they should become normal passing tests. Before this leaves draft: a regression guard for re-applying a rolled-back value, and a few small test and comment follow-ups from review. 🤖 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]
