The handleRename function was being called with the raw storage.Storage
interface inside upsertIssuesTx, which runs within a transaction. When
handleRename called store.DeleteIssue() or store.CreateIssue(), these
methods attempted to start new transactions via withTx/BEGIN IMMEDIATE,
causing a deadlock since SQLite cannot nest BEGIN IMMEDIATE transactions.
This fix:
- Adds handleRenameTx that accepts storage.Transaction and uses tx methods
- Updates the call site in upsertIssuesTx to use handleRenameTx(ctx, tx, ...)
The non-transactional upsertIssues continues to use handleRename for
backends that don't support transactions.
Fixes nested transaction deadlock during bd sync when issue renames occur.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>