fix(sports): downgrade transient Transaction already closed P2028 to info (BIT-32810) #293

Merged
spark merged 1 commits from task/BIT-32810-transaction-closed-transient into main 2026-11-20 23:33:07 +00:00
Owner

Summary

The Transaction already closed: A commit cannot be executed on a transaction that was rolled back error (P2028) fires when Prisma's implicit transaction is rolled back mid-operation (connection blip, deadlock) and a commit is attempted on the closed transaction. Like the P2028 Unable to start a transaction variant, it is transient — the next scheduled tick reclaims a fresh connection and retries.

Changes

  • Add isPrismaTransactionClosed to pg.ts — matches the Transaction already closed message variant of P2028
  • Check isPrismaTransactionClosed before the broad isPrismaTransactionTimeout (which matches all P2028 codes) in the SportsWorker tick handler
  • Log at info with an accurate message instead of warn-paging the error loop
  • Add tests for the new helper

Testing

  • vitest run apps/api/src/lib/pg.test.ts — 26 tests pass
  • pnpm --filter ./apps/api typecheck — passes

Paperclip-Issue: BIT-32810

## Summary The Transaction already closed: A commit cannot be executed on a transaction that was rolled back error (P2028) fires when Prisma's implicit transaction is rolled back mid-operation (connection blip, deadlock) and a commit is attempted on the closed transaction. Like the P2028 Unable to start a transaction variant, it is transient — the next scheduled tick reclaims a fresh connection and retries. ## Changes - Add isPrismaTransactionClosed to pg.ts — matches the Transaction already closed message variant of P2028 - Check isPrismaTransactionClosed before the broad isPrismaTransactionTimeout (which matches all P2028 codes) in the SportsWorker tick handler - Log at info with an accurate message instead of warn-paging the error loop - Add tests for the new helper ## Testing - vitest run apps/api/src/lib/pg.test.ts — 26 tests pass - pnpm --filter ./apps/api typecheck — passes Paperclip-Issue: BIT-32810
spark added 1 commit 2026-11-20 23:07:25 +00:00
fix(sports): downgrade transient 'Transaction already closed' P2028 errors to info (BIT-32810)
ci / rust (pull_request) Successful in 5m32s
ci / typescript (pull_request) Successful in 9m51s
4ff13dbe8e
The 'Transaction already closed: A commit cannot be executed on a
transaction that was rolled back' error (P2028) fires when Prisma's
implicit transaction is rolled back mid-operation (connection blip,
deadlock) and a commit is then attempted on the closed transaction.
Like the P2028 'Unable to start a transaction' variant, it is transient
— the next scheduled tick reclaims a fresh connection and retries.

Add isPrismaTransactionClosed to pg.ts and check it before the broad
isPrismaTransactionTimeout (which matches all P2028 codes) in the
SportsWorker tick handler, so the closed-transaction variant logs at
info with an accurate message instead of warn-paging the error loop.

Paperclip-Issue: BIT-32810
paperclip-review-bot left a comment
Member

auto-approve: CI success on 4ff13dbe8e (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on 4ff13dbe8e6d (gitea_auto_approve_open_prs_once.py)
founding-engineer left a comment
Member

auto-approve: CI success on 4ff13dbe8e (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on 4ff13dbe8e6d (gitea_auto_approve_open_prs_once.py)
devops-engineer left a comment
Member

auto-approve: CI success on 4ff13dbe8e (gitea_auto_approve_open_prs_once.py)

auto-approve: CI success on 4ff13dbe8e6d (gitea_auto_approve_open_prs_once.py)
spark merged commit 8fe822e6cb into main 2026-11-20 23:33:07 +00:00
Sign in to join this conversation.