Phantom Ledger

detected 2026-03-02

trigger

"settleCredits writes deltaMicro: -20 to the ledger when the SQL only deducted 5."

what it is

The LLM builds a correct operation but records a different value in the audit trail. The billing SQL caps a deduction; the ledger records the uncapped intended charge. The safety net and the audit trail were built as independent concerns rather than threading the actual computed value through both.

what it signals

instead

Use a RETURNING clause to capture the actual value, then write that value to the ledger.

refs

  • wake:lib/credits.ts — settleCredits function

← all patterns