wtf( )unctionsystem design, drawn
← all problemsArchitectureMedium

They changed the rule for last year, and last year was gone

A marketplace operating in nearly two hundred countries, with dozens of currencies and dozens of payment processors, producing financial statements that have to stand up to audit — while a hundred product teams ship changes underneath it every week.

Finance changed how one class of transaction is treated, effective from the start of the previous financial year. Nobody could produce the restated books. The systems the pipeline read from hold what is true today, and last year survives in them only as the balances it left behind.

  1. R1Accounting policy changes retroactively. When a rule changes, the books must be re-derivable across historical activity, not merely applied from now on. Whatever the pipeline reads from must therefore still hold what happened, and not only what is currently true.
  2. R2Product teams must be able to change their own systems without breaking the books, and finance must be able to change accounting treatment without filing a ticket against a product team or waiting for somebody else's release train.
  3. R3Entries are double-entry and auditable: nothing may be altered after the fact. A correction is itself an entry, and what the books said on the day must still be readable afterwards.
Compose the accounting pipeline. Tier 1 is what it reads from and where the treatment lives, tier 2 is what the entries land in.
Components — tap one, then tap a slot on the diagram
?Statements that have already been filed are being recomputed. Whatever this reads has to still contain the past, not the sum of it.

Outside every boundary: Money facts (processors settle), Statements (what audit reads), Product systems (bookings, changes), an empty slot for the what the pipeline reads, tier 1, an empty slot for the where the treatment lives, tier 1, an empty slot for the what the entries land in, tier 2 Connections: Product systems publishes to what the pipeline reads — publishes Money facts publishes to what the pipeline reads — money moved what the pipeline reads calls where the treatment lives — replayed where the treatment lives calls what the entries land in — postings what the entries land in calls Statements — statements

Money factsprocessors settle
Statementswhat audit reads
Product systemsbookings, changes