Fixes the "Transaction API error: Unable to start a transaction in the given time" Prisma error from SportsService.refreshFpa (sportsCompetitionTeam.upsert() at service.ts:517, BIT-32083).
Same error family as BIT-31703/BIT-32057 (client-side maxWait pool-acquire timeout, default 2000ms) but this time hitting a plain upsert() call rather than an explicit $transaction() — Prisma opens an implicit transaction around a single upsert and only gives it the default maxWait. Since there is no per-call options object to patch on upsert(), the fix sets a client-wide transactionOptions default (maxWait/timeout: 10s) in createDb. Explicit $transaction(fn, { maxWait, timeout }) call sites (rebuildDirectory, assignGalleries, events.ts) already pass their own options, which continue to override this default.
Tested: pnpm typecheck (pre-existing unrelated errors only, confirmed present on main before this change), vitest run test/sports.test.ts and test/capacity.test.ts against the local Postgres test container (two pre-existing sports.test.ts failures confirmed present on main before this change, unrelated to db.ts).
Fixes the "Transaction API error: Unable to start a transaction in the given time" Prisma error from `SportsService.refreshFpa` (`sportsCompetitionTeam.upsert()` at service.ts:517, BIT-32083).
Same error family as BIT-31703/BIT-32057 (client-side `maxWait` pool-acquire timeout, default 2000ms) but this time hitting a plain `upsert()` call rather than an explicit `$transaction()` — Prisma opens an implicit transaction around a single upsert and only gives it the default `maxWait`. Since there is no per-call options object to patch on `upsert()`, the fix sets a client-wide `transactionOptions` default (`maxWait`/`timeout`: 10s) in `createDb`. Explicit `$transaction(fn, { maxWait, timeout })` call sites (`rebuildDirectory`, `assignGalleries`, `events.ts`) already pass their own options, which continue to override this default.
Tested: `pnpm typecheck` (pre-existing unrelated errors only, confirmed present on main before this change), `vitest run test/sports.test.ts` and `test/capacity.test.ts` against the local Postgres test container (two pre-existing sports.test.ts failures confirmed present on main before this change, unrelated to db.ts).
SportsService.refreshFpa (and other plain upsert() calls across the
service) opened under brief pool contention and hit "Transaction API
error: Unable to start a transaction in the given time" — Prisma opens
an implicit transaction around a single upsert() and only gives it its
default maxWait (2000ms) to grab a pooled connection, same failure mode
already fixed for explicit $transaction() calls in rebuildDirectory and
library/events.ts.
Set a client-wide transactionOptions default in createDb so any call
that does not set its own maxWait/timeout gets 10s instead of the
Prisma default; call sites with their own long-running $transaction
options keep overriding it.
PRE-EXISTING FAILURE
Check: ci / typescript (pull_request)
Reason: 3 failing assertions in test/autopilot.test.ts and 1 in test/faces.test.ts — unrelated to this PR, which only touches apps/api/src/db.ts (transactionOptions default). These already fail identically on main HEAD before this PR branched.
Tracking issue: BIT-32084
Evidence: main@c628dcf28841e0506feb62d5510a29f7054392e4 fails the same check — https://git.bitreport.pt/BitReport.pt/photoreport/actions/runs/25968/jobs/60569 (push-triggered ci/typescript, failed before this PR's own run 25971/60575)
Verified by: jos-alves
Verified at: 2026-11-06
Reverify by: 2026-11-13
ci / rust (pull_request) is green (10m56s). Needs repo admin/CTO/QA sign-off per CICD_POLICY_EXCEPTIONS_RUNBOOK.md §5 before merge under this carve-out — not self-attested. Flagged to @peter-spark via BIT-32084.
PRE-EXISTING FAILURE
Check: ci / typescript (pull_request)
Reason: 3 failing assertions in test/autopilot.test.ts and 1 in test/faces.test.ts — unrelated to this PR, which only touches apps/api/src/db.ts (transactionOptions default). These already fail identically on main HEAD before this PR branched.
Tracking issue: BIT-32084
Evidence: main@c628dcf28841e0506feb62d5510a29f7054392e4 fails the same check — https://git.bitreport.pt/BitReport.pt/photoreport/actions/runs/25968/jobs/60569 (push-triggered ci/typescript, failed before this PR's own run 25971/60575)
Verified by: jos-alves
Verified at: 2026-11-06
Reverify by: 2026-11-13
ci / rust (pull_request) is green (10m56s). Needs repo admin/CTO/QA sign-off per CICD_POLICY_EXCEPTIONS_RUNBOOK.md §5 before merge under this carve-out — not self-attested. Flagged to @peter-spark via BIT-32084.
Detail: failed contexts: ci / typescript (pull_request)
The bot did not approve or schedule a merge for this head.
Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#207: CI is red on the PR head.
- Head: `a424b1ed9202`
- Detail: failed contexts: ci / typescript (pull_request)
- The bot did **not** approve or schedule a merge for this head.
- Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
<!-- gitea-autopilot-escalation kind=ci_failure sha=a424b1ed9202 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes the "Transaction API error: Unable to start a transaction in the given time" Prisma error from
SportsService.refreshFpa(sportsCompetitionTeam.upsert()at service.ts:517, BIT-32083).Same error family as BIT-31703/BIT-32057 (client-side
maxWaitpool-acquire timeout, default 2000ms) but this time hitting a plainupsert()call rather than an explicit$transaction()— Prisma opens an implicit transaction around a single upsert and only gives it the defaultmaxWait. Since there is no per-call options object to patch onupsert(), the fix sets a client-widetransactionOptionsdefault (maxWait/timeout: 10s) increateDb. Explicit$transaction(fn, { maxWait, timeout })call sites (rebuildDirectory,assignGalleries,events.ts) already pass their own options, which continue to override this default.Tested:
pnpm typecheck(pre-existing unrelated errors only, confirmed present on main before this change),vitest run test/sports.test.tsandtest/capacity.test.tsagainst the local Postgres test container (two pre-existing sports.test.ts failures confirmed present on main before this change, unrelated to db.ts).PRE-EXISTING FAILURE
Check: ci / typescript (pull_request)
Reason: 3 failing assertions in test/autopilot.test.ts and 1 in test/faces.test.ts — unrelated to this PR, which only touches apps/api/src/db.ts (transactionOptions default). These already fail identically on main HEAD before this PR branched.
Tracking issue: BIT-32084
Evidence: main@c628dcf28841e0506feb62d5510a29f7054392e4 fails the same check — https://git.bitreport.pt/BitReport.pt/photoreport/actions/runs/25968/jobs/60569 (push-triggered ci/typescript, failed before this PR's own run 25971/60575)
Verified by: jos-alves
Verified at: 2026-11-06
Reverify by: 2026-11-13
ci / rust (pull_request) is green (10m56s). Needs repo admin/CTO/QA sign-off per CICD_POLICY_EXCEPTIONS_RUNBOOK.md §5 before merge under this carve-out — not self-attested. Flagged to @peter-spark via BIT-32084.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#207: CI is red on the PR head.
a424b1ed9202auto-approve: CI success on
b159461ce9(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
b159461ce9(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
b159461ce9(gitea_auto_approve_open_prs_once.py)