Original practice scenario: A hypothetical banking service debits one account and credits another. The client times out after submission and retries. Describe the transaction and idempotency design.
Read model answer +
Preserve a balanced ledger transaction under a stable request identity. A timeout means the client lacks an outcome, not that the transfer failed or should be posted again.
Work through it
Validate authorization, currency and amount, then bind an idempotency key to the request payload so conflicting reuse can be rejected.
Commit debit, credit and durable request outcome atomically within the declared ledger boundary, applying appropriate account-concurrency and balance rules.
Return the stored outcome for repeated identical requests and provide status lookup; reconcile any separately executed external transfer through explicit pending and compensation states.
Tradeoffs to discuss
A single transactional ledger simplifies balance invariants but may limit cross-system reach; external participants require a recoverable protocol.
Common pitfalls
Never treat an identical key with a different amount as a harmless retry.
Distinguish client response delivery from transaction commitment, and test failures on both sides of that boundary.
Original practice scenario: A hypothetical payments team can manually review only a fixed number of alerts. Confirmed outcomes arrive late and many unreviewed transactions have unknown status. Design evaluation.
Read model answer +
Match evaluation to the review budget and label-availability process. Overall accuracy can look excellent in a rare-event setting while giving a poor investigation queue.
Work through it
Define prediction time and a mature outcome window, retaining which cases were reviewed and why rather than treating unreviewed transactions as confirmed negatives.
Compare precision, recall and operational workload at realistic queue sizes using time-separated splits and transparent rule-based baselines.
Assess calibration and error patterns across relevant transaction segments, then monitor drift and analyst overrides during a bounded deployment with review authority retained.
Tradeoffs to discuss
A more sensitive queue may recover additional suspicious cases but increase investigator burden and disruption to legitimate activity.
Common pitfalls
Do not leak chargeback or investigation results into features recorded before the alert.
Selective review creates evaluation bias; document coverage and use justified sampling when obtaining additional labels.