Coding tasks and graders · synthetic data

How often does a first-draft grader pass wrong code?

The tasks

  1. 01
    Payments API

    Make payment creation idempotent

    A payment endpoint must charge a card once per Idempotency-Key, no matter how the client retries.

    FastAPI · PostgreSQLhard
  2. 02
    Interest

    Accrue CAD interest at posting boundaries

    Accrue daily interest on a CAD balance and post it at month ends, using Actual/365 and banker's rounding.

    Python · Decimalmedium
  3. 03
    FX transfers

    Quote transfers with currency-specific minor units

    Quote a currency transfer with the fee taken in the source currency and each currency's own decimal places.

    Python · Decimalmedium
  4. 04
    Reconciliation

    Reconcile synthetic statements deterministically

    Match bank statement lines to ledger entries with exact, split, refund and duplicate rules, deterministically.

    Pythonhard
  5. 05
    Ledger

    Enforce an atomic double-entry journal

    Run a double-entry journal where every post balances per currency and is all-or-nothing.

    Python · PostgreSQLhard
  6. 06
    Card holds

    Track active authorization holds and available balance

    Compute available balance as posted funds minus active card holds, with capture, void and expiry.

    FastAPI · SQLitemedium
  7. 07
    Statements

    Select transactions by the account calendar month

    Select a month's transactions using midnight in the account's own time zone, converted to UTC.

    Python · zoneinfomedium
  8. 08
    Refunds

    Limit refunds to the captured amount

    Allow partial refunds up to the captured amount, which may be less than what was authorized.

    Python · SQLitemedium
  9. 09
    Fees

    Apply a non-marginal tiered fee schedule

    Price a payment at one tier selected by an inclusive upper bound, then round and clamp the fee.

    Pythonmedium
  10. 10
    Batch files

    Validate an entire SBF-80 payment batch

    Validate an invented 80-character fixed-width payment file and reject the whole batch on any error.

    Pythonmedium
  1. 1 TicketObservable rules and starter code.
  2. 2 SolutionsCorrect and plausible wrong code.
  3. 3 Naive graderFirst-draft tests.
  4. 4 Hardened graderTests for the missed bugs.

Task 01 · idempotent payments

Example: duplicate payment retries

Results

Independent check

The hardened graders reject 46 of 46 held-out wrong solutions and accept 6 of 6 correct ones.

Before the gaps were closed, the hardened graders rejected 6 of 44 of these.

What the first-draft graders missed