mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-16 13:20:39 +00:00
Add the high-level entry point that ties the cursor and transaction lifecycle together: `run_interaction(func, *args, **kwargs)` opens a cursor (starting a transaction), invokes `func(cursor, *args, **kwargs)`, then commits if the callback returns normally and rolls back if it raises, propagating the callback's return value back to Python. This mirrors Synapse's existing `run_interaction` API. A `CursorGuard` is held for the duration so that an unexpected unwind (panic) before `finish` still rolls the transaction back; a `finish` error takes precedence over the callback's result, since on such an error the transaction outcome is unknown and the connection is closed. This is the caller that `cursor`/`finish`/`CursorGuard` were waiting for, so their transitional `#[allow(dead_code)]` attributes are removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>