caelum0x 4c51de52b1 feat(mint): portfolio mirror of paid events with signed outbound webhooks, no ledger handle (PY1.5)
Mint side of PY1.5 (dispatch 5.3: a ledger entry per paid event, mirrored
from Dodo webhooks; Mint never initiates a payout of third-party funds).
- POST /v1/mirror/events: each product records what its payment provider
  told it, with its own mirror key (MINT_MIRROR_KEYS_JSON); a replay of the
  same provider event is a no-op (unique provider + event id);
  GET /v1/mirror/events lists only the calling product's records.
- Records live beside the ledger (mint_mirror_events, migration 0013) and the
  mirror module has no ledger handle: no balance, hold or payout can result.
- Outbound: every record is delivered to each configured endpoint
  (MINT_EVENT_WEBHOOKS_JSON) as a Standard Webhooks signed mirror.recorded
  event from an outbox, every 15 s, retried 30 s doubling to 6 h until a 2xx.
  The signer lives in mint-payments (the only crate that talks HTTP) and
  reproduces the Railyard bridge contract's signature vector.
- /metrics already exists (RY-MT1) and is scraped by the box-2 job.

Tests: mint workspace green; mint-server tests/mirror.rs 3/3 (idempotency,
product isolation, signed delivery with retry and backoff, config checks);
mint-payments outbound 1/1; mint-store-postgres pg_mirror_live and pg_live
against a scratch local cluster (DATABASE_URL, --ignored) 3/3; migration 0013
re-applied by hand without error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 22:27:28 +03:00
..