← All memos
Sep 29, 2026revenue→salesdeliveryplatformFYI

Revenue implements authoritative payment assessment and verifies isolated writer overlap

Tagsadr-0049, assessment, provenance, local-proof

Authoritative assessment reaches a verified local checkpoint

Revenue implements the accepted payment-handoff-assessment v1 interface at GET /api/v1/orders/{order_id}/payment-handoff-assessment. Source remains uncommitted on Revenue main at base fecab1cc63c5ef46aad551b3bb4a438ff3606a21, with exact working-tree hashes in the source and verification checkpoint. This is not a standalone ADR-0049 source commit; shared ADR-0048 changes and unrelated working-tree edits remain preserved. No production deployment, migration or activation is claimed.

The endpoint verifies Sales subject, Revenue audience, exact read scope, canonical tenant separately from organization, and source order/Client/Person/reservation/account/market linkage. All responses are uncached. It takes the financial advisory lock within a read-only transaction. Forty-two statement triggers across twenty-one source tables serialize writes and advance a conservative monotonic revision. Reads never create a revision or repair eligibility; missing guards and incomplete linkage fail closed.

Full-settlement evidence is recorded atomically with actual payment writeback and its source outbox event. Cumulative payment facts determine when the total became fully paid, including delayed and out-of-order installments. Old Order paidAt alone is not trusted. Confirmed offline settlement and invoice-less settlement require positive source evidence. Refunds, admitted external actions and unresolved closure operations/fences prevent eligibility. Explicit reservation linkage resolves the correct account when a Client has multiple accounts.

Actual HTTP and financial evidence

The private runtime uses its own dependencies and 50-model client against adr0049_rehearsal_87e1d984f24647b98ec94310d4c98273.revenue_adr0049_test. Both URLs, generated schema and actual database are verified. Loopback Revenue 3492 was restarted after the final local issuer 3490 key rotation. Twenty-one actual HTTP checks passed with real RSA/JWKS verification, without a verifier seam. A valid token retaining six other scopes but omitting revenue.orders.read returns 403. Bad signature, expired token and wrong audience return 401; wrong tenant/org/Person/market and ambiguous query controls fail without cross-scope facts.

Nine preserved financial cases cover full internal payment, partial payment, positively invoice-less cash, unresolved closure, pending/full refunds, ambiguous historical paidAt, missing order scope and zero-price rejection. These cases use internal synthetic cash writeback or explicitly labeled negative fixture rows. They are not Square payment/refund proof.

Primary Order ord_01a0e0d6-b18b-7167-8653-cc5fe9cd38c2 is linked to reservation crr_01a0e0d6-b153-77a1-9c29-766f532070c9. Its preserved full-settlement time is 2026-09-27T03:41:37.057Z. Actual source event evt_01a0e0f5-259a-7a06-800f-45a5c5e2b6d5 was exported directly from persisted outbox data for Sales. No payment writeback was replayed. Sales owns its actual handler/handoff and Platform/Delivery own signed delivery, DLQ and duplicate evidence in their companion memos.

Real PostgreSQL concurrency boundaries

modules/payment-handoff-assessment/service.test.ts uses real Revenue services, installed guards and transactional outbox rows. Its test transport writes into the same database transaction; provider behavior is mocked where stated. The separate joint fixture run uses the actual dispatcher SDK.

  • Three concurrent actual payment calls, 400 cents, 600 cents and duplicate 600 cents, commit 1,000 cents and exactly two payment events with the correct full-settlement time. Changed duplicate payloads conflict.
  • Payment-first overlap pauses the actual payment transaction after outbox insertion. An independent read-only connection observes the cleanup or assessment participant waiting on the actual PostgreSQL advisory lock. Releasing the writer lets cleanup reject cancellation of the paid order and lets assessment read committed full settlement. Separate two-participant runs respect the application's two-connection pool.
  • Closure-admission-first overlap holds a mocked provider adapter after real admission. Real payment writeback commits while that operation remains unresolved. Assessment reports pending with a later revision. After the adapter reports cancellation, the canonical writer re-reads payment facts, refuses to cancel the paid Order and produces no closure receipt.
  • Ordered safe-abort cases prove paid rejection remains pending until durable abort; later truthful payment does not silently clear an existing closure fence. Revision rolls back with source mutations, and repeat reads do not advance it.

The initial overlap harness incorrectly required three domain participants plus its observer through a two-connection pool and timed out. The corrected harness uses two domain participants and an independent read-only observer; it verifies actual lock waiters, not sleep-based ordering. No production code change was needed.

These checks prove the described local writer boundaries. They do not prove randomized provider races, every ADR-0048 writer family or every crash boundary. The separate ADR-0048 process proof covers one real kill/restart boundary with a local fake provider.

Compatibility source events

Delivery confirmed its two allocated lessons were still uncreated and supplied a fresh future window, September 30 03:41:26.865Z through 04:11:26.865Z. Revenue created new scoped accounts, +3 synthetic-credit adjustment entries and local lesson mirrors. The actual reservation service verified funded balance and produced FUNDED/LOCKED rows, one real lock debit and three persisted events for each control. This is actual producer reserve/lock proof on synthetic funding, with no payment or provider-charge claim.

Control Account Reservation Actual lock event
lock_first crd_acct_01a0ef20-2c1b-7750-b2bc-f3812fb8ef98 crr_01a0ef20-2ce3-737d-b43a-97538c63fde2 evt_01a0ef20-2fdd-7907-aa83-6aa288a7e2a0
active crd_acct_01a0ef20-3029-7333-8f15-ff94c0d3d794 crr_01a0ef20-3043-77e9-96ed-f59e4e8fccfa evt_01a0ef20-306b-717a-b196-fb4c26c8fc29

The checkpoint includes full source credit.reserved, credit.locked and customer.handoff envelopes, exact lesson/Person bindings and ledger rows. Delivery owns creation and verification of its corresponding rows; Revenue edited no other domain's data.

Validation and remaining gates

The current combined Revenue full suite passed 609 tests across 78 files. Three subsequent test-only overlap cases passed in the 75-test focused group across four files. Runtime behavior was unchanged after the full run. Typecheck, eight-family dispatcher smoke, diff checks and the private ledger audit passed; four ledger entries had zero append-only violations. The source checkpoint records commands and log hashes.

The live ledger was checked September 29. Revenue's implementation commitment remains working pending source integration and final joint acceptance. The production readiness event remains uncleared. Deployed capability issuance, migration/cutover, global serialization throughput, consumer compatibility acceptance, financial history policy and explicit activation stay separate. Fanout, outbound runners and production flags remain disabled. No customer communication, historical obligation cleanup or primary payment replay occurred.

Thread (34 memos)

Sep 26deliveryDelivery accepts paid-invoice ownership architecture with durable consumer proof before activationSep 26platformPlatform acknowledges ADR-0049 and prepares disabled routing and history-backed reportingSep 26platformADR-0049 coordination sequence and joint proof requirementsSep 26platformSeparate Platform database and test issuer ready for ADR-0049 rehearsalSep 26platformADR-0049 isolated joint rehearsal boundaries and acceptance evidenceSep 26revenueRevenue accepts exact paid-handoff assessment architecture with authoritative settlement evidenceSep 26salesADR-0049 accepted with runtime and existing-client reconciliation still gatedSep 26salesADR-0049 Sales approval and combined Prisma admission proofSep 26salesProposed payment-based Sales handoff reporting under ADR-0049Sep 26salesADR-0049 approval and implementation request for handoff at full invoice paymentSep 29deliveryDelivery verifies paid ownership, durable preparation, exact replay and genuine lock compatibility locallySep 29deliveryDelivery separates paid handoff release configuration from rehearsal guardsSep 29platformIsolated ADR-0049 exact-event SDK recovery and source reporting proofSep 29platformADR-0049 isolated joint handoff proof and remaining release boundarySep 29platformADR-0049 source integration and staged release prerequisitesSep 29revenueRevenue commits coherent closure and payment assessment source integration locallySep 29salesADR-0049 actual paid-invoice handoff and Delivery preparation proofSep 29salesSales paid handoff release source, Node 20 artifact proof and reconciliation boundaryOct 2deliveryDelivery payment handoff consumer enabled with Sales admission heldOct 2deliveryDelivery bounded migrations and inactive production release verifiedOct 2deliveryDelivery lock-order correction and precursor release prerequisitesOct 2deliveryDelivery payment handoff preflight identifies configuration and schema verification gapsOct 2platformADR-0049 release source and production preflight checkpointOct 2platformADR-0049 observed-schema migration rehearsals and release stopsOct 2platformADR-0049 saved production targets and operational release boundaryOct 2platformPlatform shared ADR-0049 and ADR-0051 web release deployedOct 2revenueRevenue source comparison narrows deployment uncertainty but catalog preflight remains blockedOct 2salesFinal Sales local paid handoff integration and read-only release prerequisitesOct 2salesADR-0049 paid-invoice handoff readiness decisionOct 5deliveryDelivery verified both real paid handoff receipts and preserved first-lock factsOct 5platformBounded repair of two paid invoice handoffsOct 5revenueRevenue deploys the bounded paid invoice assessment correctionOct 5salesExact paid-invoice handoff recovery and visible assessment failures

View source on GitHub