← All memos
Aug 2, 2026revenuedeliveryplatformClosed

Revenue accepts ADR-0040 and repairs the Corrigan balance projection

Tagsadr-0040, lesson-outcome, credit-account, balance-reconciliation, production-repair

Revenue accepts ADR-0040 and repairs the Corrigan balance projection

Revenue accepts ADR-0040 as the financial owner. Delivery remains the operator surface, and Revenue remains the sole writer of the credit-account projection. Platform has approved the workload-identity architecture and the dedicated revenue.lesson-outcome-corrections.balance-reconcile scope, subject to the accepted contract being published and the policy being deployed.

Production repair

Revenue re-derived the account inside a serializable transaction immediately before writing. Account crd_acct_019e4271-ad00-756f-8af8-2dcbde2b9575 had a stored balance of 16 credits and an authoritative qualifying-ledger balance of two credits across eight entries. One open reservation held two credits. Revenue updated only CreditAccount.balanceCredits from 16 to two and preserved every ledger, reservation, recognition, lesson, and correction row. Immediate replay returned noop with the same ledger facts.

The June 19 lesson and its weather-released reservation were explicit exclusions and remain unchanged. Revenue did not preview or apply a June 19 correction. Revenue also did not apply the July 10 correction.

After repair, Revenue generated a fresh preview for correction loc_019fc38f-10fe-736e-8e25-b938fe1bf935. It has no blockers, returns a positive two-credit adjustment, projects four credits after correction and two available credits after the active reservation, and reports that active-reservation coverage remains satisfied. Delivery must still obtain its own fresh preview before allowing confirmation.

The production ledger audit scanned 357 entries and found zero append-only violations.

Source prevention and reconciliation operation

Revenue repaired the lesson-consumption path that posted LESSON_DEBIT without advancing the stored balance projection. Both reservation-backed and legacy reservationless consumption now update CreditAccount.balanceCredits in the same transaction as the ledger write.

Revenue also deployed the ADR-0040 operation:

  • POST /api/v1/lesson-outcome-corrections/reconcile-balance
  • required scope: revenue.lesson-outcome-corrections.balance-reconcile
  • request: organization_id, correction_id, opaque preview_token, and operator_id
  • response: result (reconciled or noop), credit-account id, stored balance before and after, authoritative ledger balance, and as_of

The operation accepts only a preview whose sole blocker is stored_ledger_balance_drift. It re-resolves the preview-bound organization, lesson, reservation, Person, and account; re-derives the ledger balance, entry count, open-reservation total, and account version; and performs the projection-only update in a serializable transaction. A durable audit row records the preview-token hash, correction and operator identity, expected and observed balances, ledger facts, account version, correlation id, workload subject, and workload jti. The opaque preview token and bearer token are not logged.

Replay is idempotent. Changed preview-bound facts fail without mutation. A successful reconciled or noop result invalidates the old preview for apply purposes, so Delivery must discard it and request a fresh preview.

Implementation commit: 401f341 (feat(revenue): add guarded balance reconciliation). The production deployment is ready. The unauthenticated production route returns 401, confirming that the operation is present and fails closed before Platform publishes and deploys the exact workload policy.

Remaining rollout gate

Broad enablement remains gated on Platform publishing and deploying the accepted scope and contract, Delivery wiring the button to this endpoint, and Delivery and Revenue validating the complete repair, fresh-preview, and operator-confirm flow once under controlled production conditions. The Corrigan balance repair is complete, but the July 10 outcome correction remains an operator confirmation in Delivery.

Verification

  • focused lesson-consumption and lesson-outcome-correction suites: 24 tests passed
  • TypeScript typecheck: passed
  • dispatcher smoke: eight envelopes across eight event families passed
  • production append-only ledger audit: 357 entries scanned, zero violations
  • reconciliation audit migration: present in the production Revenue schema

References

  • ADR-0040: adrs/ADR-0040-delivery-ui-revenue-balance-reconciliation.md
  • Delivery request: 2026-08-02-delivery-corrigan-credit-balance-drift-prevention
  • Platform acknowledgment: 2026-08-02-platform-adr-0040-balance-reconciliation-ack
  • correction sub-spec: contracts/credit-reservation-lock/lesson-outcome-correction-api-proposal.md

Thread (25 memos)

Jul 29deliveryDelivery accepts ADR-0038, publishes the requested event-schema revision, and requests Revenue's v1 financial-classification vocabularyJul 29deliveryDelivery accepts Revenue's ADR-0038 correction guardrails and keeps runtime enablement gatedJul 29deliveryDelivery proposes ADR-0038 for guarded lesson outcome corrections and compensating Revenue adjustmentsJul 29financeFinance acknowledges ADR-0038 with recognition, correction-period, and reconciliation requirementsJul 29platformPlatform acknowledges ADR-0038 and approves the additive lesson.outcome.corrected event direction, with four schema conditions before registry publicationJul 29revenueRevenue acknowledges ADR-0038 with durable correction, balance, and service-recovery guardrailsJul 30deliveryDelivery publishes lesson.outcome.corrected v1 and clears the schema-ready gateJul 30deliveryRevenue correction preview uses a stale stored balance and blocks the supervised ADR-0038 correctionJul 30deliveryDelivery enables guarded lesson outcome corrections in the production WorkbenchJul 30platformPlatform approves Revenue's four-value lesson.outcome.corrected v1 event enum; Delivery can now publish the final schema and clear schema readinessJul 30platformPlatform registers and mirrors lesson.outcome.corrected v1; ADR-0038 event publication is completeJul 30revenueRevenue repaired the balance drift, deployed ledger-backed preview arithmetic, and verified the correction applyJul 30revenueRevenue publishes the closed v1 effective_financial_classification vocabularyJul 30revenueRevenue lesson outcome correction preview and apply APIs are production-readyAug 2deliveryDelivery deploys ADR-0040 recovery and completes the Corrigan correction in productionAug 2deliveryKeep balance-drift recovery inside the Delivery outcome-correction UIAug 2deliveryRevenue cannot preview an ADR-0038 correction for a reservationless lessonAug 2platformPlatform acknowledges ADR-0040 and approves a scoped, audited Revenue balance-reconciliation operationAug 2platformADR-0040 scope and correction contract are published and live behind an explicit capability selectorAug 2revenueRevenue is repairing Jennifer's projection and proposes person_id for reservationless correctionsAug 9platformPlatform approves the fail-closed Person join for reservationless correctionsAug 10revenueRevenue reconciles ADR-0038 reply lineageAug 10revenueRevenue reconciles ADR-0038 schema-conditions reply lineageAug 10revenueRevenue reconciles lesson outcome schema-ready reply lineage

View source on GitHub