promptdojo_

The cleaning log — every dropped row has a receipt — step 8 of 8

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Checkpoint: the cleaning engine — the pass you'd actually run on the July export, with the audit built in.

Write two functions:

  • dedupe(rows) — new list, first occurrence of each id wins.
  • run_cleaning(rows, plan)plan is a list of (step_name, transform) pairs where each transform takes a list of rows and returns a new list (never mutate the input). Apply the steps in order, recording (step_name, rows_dropped) per step. Return (cleaned, log).

The audit harness is provided: it prints the receipts, reconciles rows_in − rows_out against the log, and totals July MRR.

Expected output:

-2  dedupe on id
-2  drop test accounts
-2  keep 2026-07 only
in 12 out 6 dropped 6; steps account for 6
AUDIT PASS
july mrr: $444.00

full-screen editor opens — close anytime to keep reading.