<?xml version="1.0" encoding="UTF-8"?>
<adr xmlns="urn:xenon:adr"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     id="ADR-001" status="accepted" decided="2025-01-14">

  <decision-log xlink:type="simple"
                xlink:href="../linkbase/decision-log.xml"
                xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"
                xlink:actuate="onLoad"/>

  <title>Event-source the billing ledger</title>

  <context>
    <p>Invoice corrections currently mutate rows in place, so there is no reliable
    way to answer "what did this account owe on 31 March". Finance reconstructs
    history by hand from backups. Audit has asked for a defensible answer.</p>
  </context>

  <decision>
    <clause id="ledger-model">The billing ledger is an append-only event log.
    Balances and invoices are projections derived from that log; no process
    mutates a ledger row after it is written.</clause>
    <clause id="correction-model">Corrections are expressed as compensating
    events, never as edits or deletes.</clause>
    <clause id="retention">Ledger events are retained for seven years.</clause>
  </decision>

  <consequences>
    <p>Any balance is reproducible as of any instant. Storage grows monotonically,
    and every read path needs a projection. Teams must learn to think in
    compensations rather than updates.</p>
  </consequences>
</adr>
