refactor: share tbank-sync claim and generation lock (WealthLedger/backend#166) #188

Merged
codex-bot merged 2 commits from refactor/166-tbank-sync-claim-protocol-v3 into develop 2026-11-04 20:47:51 +03:00
Showing only changes of commit bf502737f2 - Show all commits
+1 -5
View File
@@ -3,17 +3,13 @@ import type { TbankSyncAttempt } from './tbank-access.service';
const NO_UPDATED_ROWS = 0;
// Shared owners for the tbank-sync DB claim/lock protocol (backend#166).
// Shared owners for the tbank-sync DB claim/lock protocol.
// Both helpers are CAS fences: they run inside the caller's transaction and
// keep the exact where/data shapes they replaced. Callers keep deciding
// success from the claim count exactly as before.
// Claims the active TbankSyncWork row: only the still-running attempt of a
// valid connection may transition. `data` is the state transition to apply.
// `state` overrides the default 'running' fence (e.g. an initiator row also
// accepts 'complete'); `withoutConnectionFence` drops the
// `connection: { invalidToken: false }` guard for fences that must also fire
// on an invalidated connection.
export type ClaimOptions = {
// Overrides the default 'running' fence (e.g. an initiator row also
// accepts 'complete').