Protect shared reservations across pack and legacy wallet writes

Draft
SI
6d ago
+1008-0

Shared reservations currently leave money in the wallet that legacy debits and pack approvals can spend. This successor integrates Database #115 unchanged onto current main and adds a wallet-write guard so those operations cannot consume reserved funds. Settlement closes only its own hold within the charge transaction; failures restore the hold. A wallet row-version update on reserve also closes a reproduced repeatable-read race.

Released pack holds already deduct funds, so the existing pack-aware refill remains unchanged. API #1026 adapters retain their inputs and receipts; companion https://github.com/recoupable/api/pull/1249 documents this composition. Original #115 remains untouched. This is the common primitive work for recoupable/app#2105 milestone 1 and #2123, separate from Context request/pilot ceilings and Sites hosting policy.

Validation: initial composition regressions failed in six cases; 36 reservation/composition tests now pass on PostgreSQL15 and17, and 11 existing pack tests pass on17. Independent review passed and independently reran all17 new composition tests. Fixtures use real owning migration functions on disposable local PostgreSQL with synthetic balances and TCP disabled. CI adds the composition suite on15/16.

No caller is activated, no price changes, and no production schema/grant or financial operation was performed. One-wallet enforcement remains a separate prerequisite; legacy callers can incur provider expense before a guarded debit fails, so this is not pre-dispatch spend authorization. Release requires the original reservation migration, released pack migration, then the additive composition migration and verified grants. Do not remove the guard or retained receipts while live holds exist; stop new reservations and reconcile holds before any rollback. Root retains review/merge/release authority.