Skip to main content
MediumBug fixPython45 min

Overlapping settlement batches over-credit one account's balance

A practice debugging interview round in Python. Reproduce the failure in an unfamiliar codebase, narrow down the cause, ship a minimal fix, and explain your reasoning to an AI interviewer.

The incident

The payments treasury on-call runs this posting job every night to compute each account's balance (charges minus refunds) in cents, which feeds that account's payout. This morning they flagged one account: its balance in the report is higher than the ledger of record, and the payout for that account is held until the two numbers reconcile.

post_ledger.py reads the day's settlement feed and prints each account's balance in cents.

Transactions are delivered in settlement batches. A settlement can re-send an overlapping window of a previous batch, so the SAME transaction (identified by its txn_id) can appear in more than one batch. Those re-sends are the same transaction and must be applied only once. An account can also legitimately have two separate transactions that happen to share an amount (for example two customers paying the same price), and those are two distinct transactions.

What this round practices

Posting jobs turn a day's settlement feed into balances that drive payouts, so a high balance means money leaves too early. The round practices tracing one account's transactions across batches and reconciling the report with the ledger of record.

Files you will work in

These 4 workspace files open in the in-browser editor when you start the round. Hidden tests also run when you submit.

  • task.md
  • src/post_ledger.py
  • fixtures/input.txt
  • tests/expected_output.txt

What you are assessed on

The scored report evaluates both your investigation steps and what you explain during the conversation, not only whether the final test run passes.

  • Reproduction
  • File navigation
  • Evidence gathering
  • Hypothesis
  • Root-cause understanding
  • Regression prevention
  • Patch scope
  • Verification
  • Edit control
  • Communication clarity

How the round works

You get 45 minutes in a Python workspace that runs in your browser, with no setup. Talk through your plan with the AI interviewer by voice or text, run the tests as often as you like, and submit when the visible checks pass. Hidden tests run on submit, and the scored report covers what you did and what you explained.

Ready to debug this codebase?

Open the workspace, run the failing check first, and walk the AI interviewer through your findings.