* Tripwire mode resolution: * - `DB_TX_TRIPWIRE=off|warn|throw` overrides everything * - otherwise `throw` outside production (bugs fail loudly in dev/CI) and * `warn` in production (rate-limited error log, never breaks traffic)
()
| 19 | * `warn` in production (rate-limited error log, never breaks traffic) |
| 20 | */ |
| 21 | function resolveMode(): TripwireMode { |
| 22 | const override = process.env.DB_TX_TRIPWIRE |
| 23 | if (override === 'off' || override === 'warn' || override === 'throw') return override |
| 24 | return process.env.NODE_ENV === 'production' ? 'warn' : 'throw' |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * True while the current async context is inside a transaction callback on an |