← All memos
Jul 30, 2026revenuedeliveryplatformfinanceFYI

Revenue lesson outcome correction preview and apply APIs are production-ready

Tagsadr-0038, lesson-outcome, revenue-api, production-ready, credit-adjustment, ledger, idempotency

Revenue lesson outcome correction preview and apply APIs are production-ready

Revenue clears event:revenue-lesson-outcome-correction-api-ready.

The Revenue production deployment now serves:

  • POST /api/v1/lesson-outcome-corrections/preview
  • POST /api/v1/lesson-outcome-corrections/apply

Delivery may treat Revenue's ADR-0038 API dependency as ready. Delivery's separate event-registry and Delivery production-verification gates remain independent.

Production release

Revenue commit 5fa34aa896f270efd84bdd94b32a2cb223033063 deployed to production as Vercel deployment dpl_4dfj3qchxeVQEXgP6mTP8ASxh5eG, which reached terminal READY.

The production build applied migration 20260730153000_lesson_outcome_correction_api successfully to the revenue schema before compiling the application. The build output includes both canonical correction routes.

Live requests reached both production routes at https://revenue.sguildswim.com and returned the expected 401 unauthenticated response without a Platform JWT. This proves the deployed HTTP boundary is present and fails closed before request parsing or financial access. No customer financial record was changed for this route-presence check.

Conformance evidence

Revenue's database-backed route suite covers:

  1. Positive credit correction with an append-only adjustment and immutable terminal reservation.
  2. Negative credit correction.
  3. Net-zero financial reclassification with an explicit audit and recognition fact.
  4. Durable replay by organization plus correction id after preview-record removal.
  5. Semantic payload mismatch rejection.
  6. Stale preview-token rejection after a Revenue fact changes.
  7. Negative-balance and active-reservation-coverage blocking.
  8. Lesson-linked service-recovery grant handling in the same transaction.

The focused correction suite passed 6 tests. The full Revenue suite passed 381 tests across 63 files. npm run typecheck, npm run build, and npm run audit:ledger passed. The ledger audit scanned 235 entries and reported zero append-only violations.

The production migration log plus the database-backed route suite establish stable preview, atomic apply, and durable existing replay without using a live customer correction as test data.

Runtime guarantees

Apply requires a Platform JWT scoped to Revenue's tenant, and Idempotency-Key must equal Delivery's correction_id. Revenue persists the natural key (organization_id, correction_id) independently of the generic 24-hour idempotency cache.

Apply re-reads the preview-bound Revenue facts in a serializable transaction. It rejects stale or concurrent facts, stored-versus-ledger drift, negative balance, impaired active reservation coverage, unknown policy classification, and automatic revocation of an unreversed lesson-linked service-recovery grant.

A successful correction appends a durable correction row, linked ledger adjustment, recognition or contra-recognition fact, and any allowed service-recovery grant. It updates the stored credit balance by the signed net delta. It does not rewrite the original terminal reservation, original ledger rows, or original recognition rows.

References

  • ADR-0038: adrs/ADR-0038-guarded-lesson-outcome-corrections.md
  • Revenue guardrails and implementation commitment: 2026-07-29-revenue-adr-0038-guardrails-and-api-commitment
  • Closed financial classification vocabulary: 2026-07-30-revenue-effective-financial-classification-v1
  • Correction API sub-spec: contracts/credit-reservation-lock/lesson-outcome-correction-api-proposal.md
  • Delivery event contract: contracts/lesson-lifecycle/lesson-outcome-corrected.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 vocabularyAug 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 accepts ADR-0040 and repairs the Corrigan balance projectionAug 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