caelum0x c5dc214a13 fix(context-passport): wire MintMeter + real AITP-402 royalty seam into generate()
passport-mint-client's MintMeter was fully coded and contract-tested but never
constructed or called anywhere in the running server (README's own words:
"legacy standalone MintMeter adapter ... not used by the generation path"),
so every real generation settled via Relay's payment evidence but never
produced a Mint receipt tagged with passport_id/version as ARCHITECTURE.md
§6.1/§3.2.16 claims.

- PassportService gets mint_meter/royalty fields + with_mint_meter()/
  with_royalty_initiator() builders (same pattern as with_receipt_verifier),
  and generate() now calls MintMeter.meter() success-only right after
  settlement verification, best-effort (a Mint-side failure only logs a
  warning, never blocks or rolls back the already-verified generation).
- main.rs constructs a real MintClient from MINT_API_KEY (+ MINT_BASE_URL)
  and wires it into the service; unconfigured, it stays a documented no-op
  exactly like an unconfigured Relay.
- Added the real Aitp402Transfer/MintReceiptRef types ARCHITECTURE.md
  §3.2.16 lists as existing, plus a RoyaltyInitiator port + MintClient impl
  that POSTs a real transfer to Mint's actual generic `/v1/transfers`
  endpoint (apps/mint/crates/mint-server) — not a guess, matches its real
  TransferReq/receipt wire shape byte for byte.
- Rights gets an owner-set `royalty_bps` (default 0, zero-migration via the
  existing JSONB snapshot), and generate() initiates a real royalty transfer
  to the owner's Mint account when it's nonzero AND the settlement's payer
  differs from the owner. Today `generate`'s payer is always the owner
  (enforced by check_settlement_evidence), so this is a correct, documented
  no-op until an upstream third-party-pays surface (Turnstile, §6.2) exists —
  the capability is real and wired, not fabricated to look wired.
- GenerationRecord carries the new meter_receipt_ref/royalty_receipt_ref so
  both receipts are visible in the API and the C2PA manifest.

Full workspace suite: 59/59 pass (unchanged from before this fix — no
regression). `cargo build --workspace`: clean.
2026-11-05 00:27:24 +03:00
..