Repository navigation
MVP live path: rate-locked Pix → USDT (Solana mainnet) with operator controls - #105
Merged
Merged
Conversation
Read-only audit findings, approved decisions D1-D8, the selected strategy (live path alongside sandbox, split by environment), design sections, staged rollout and Go/No-Go criteria for the first real Pix -> USDT (Solana mainnet) transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 tasks in six phases implementing the approved recovery spec: money environment foundation, rate-locked purchase flow, send and on-chain verification, onboarding and legal gate, operations, and staged validation through the internal transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…smatch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migration 043 adds peragus_database_environment and a before insert/update trigger on the ten money tables that rejects rows whose environment differs from the recorded one (or when none is recorded). Environment checks widen to test|live, network columns to solana:devnet|solana:mainnet with a pairing check, and the test/devnet defaults are dropped. migrate.mjs records the environment from PERAGUS_DEPLOYMENT_ENV and aborts on DATABASE_ENVIRONMENT_CONFLICT. Repositories and services take the money mode and write/filter environment and network explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extend migration 043 to the customer onboarding/invitation tables (012-019, 030, 037 outbox, 038, 040): environment accepts test|live, defaults dropped, row-environment trigger added. Block TRUNCATE of the recorded environment. migrate.mjs now refuses an unset or unknown PERAGUS_DEPLOYMENT_ENV before connecting. Onboarding repositories, invites, email outboxes, documents, operator alerts/queue/audit, withdrawal results, operation history and the sandbox closure lock write and filter the configured mode instead of 'test'. Adds a pg_constraint catalog test over every guarded table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backend responses, provider capability gates and key guards now follow the configured money mode instead of hard-coded test/devnet values. - purchase-capabilities reports environment, network and real_purchase from the mode; sandbox simulate routes (Pix, verification) and the OZAV sandbox-customer routes are registered only in test mode. - Wallet proof binds to MoneyEnvironment (domain, network) and omits "TEST" in live; the repository stores the verified message. - Invitation e-mail drops the [TESTES] subject and banner in live and must point at the production frontend; the outbox idempotency key is peragus-invitation-<mode>/<id> (migration 044 rebinds the check). - OzavClient.getCustomerCapabilities and the withdrawal provider require the client's mode; onboarding, quote and Pix services compare against the configured mode. - Notification runtime safety, document upload, reconciliation reader and sandbox recovery reader derive the key prefix from the mode; the deployment audit reports provider_key_mode/provider_matches_money_mode. - Customer and operator views report environment/proof_network/ real_money from the mode (sandbox closure and execution stay test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- config.ts: MoneyMode, moneyMode()/useMoneyMode() from VITE_PERAGUS_MONEY_MODE (only "live" selects live; default test fails closed), moneyNetwork() and walletProofDomain(). - Test-environment notices (header, footer, public layout, purchase) render only in test mode; signup accepts an invitation only when its environment matches the configured mode. - Wallet link, capabilities, reads, onboarding status, documents, purchases, refunds and Pix validators accept the configured mode and network instead of hard-coded test/devnet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- env.ts refuses CUSTOMER_SANDBOX_PIX(_SIMULATION), verification simulation, SANDBOX_WITHDRAWAL_EXECUTION and _CLOSURE when the money mode is live (MONEY_PATH_NOT_LIVE_READY naming the flag); Tasks 7 and 10 lift it for the Pix and send paths. GET-only recovery stays allowed. - providerKeyMatchesMode replaces the duplicated key-prefix checks. - Customer screens, public landing, Pix, documents and onboarding show test-environment copy only in test mode; live label reads "Ao vivo". - Tests: live guard per flag, live/test copy on registration, dashboard and landing, simulate routes registered in test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the purchase operation lifecycle (OperationStatus, canTransition, OPEN_STATUSES), migration 045 with a DB transition guard, an append-only environment-guarded status event log, an immutability trigger for the accepted financial snapshot and a one-open-operation-per-customer index. Purchase range (PURCHASE_MIN_BRL/PURCHASE_MAX_BRL) is enforced at quote and accept time; PURCHASE_MAX_OPEN_GLOBAL is enforced under an advisory lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migration 045 now expires every legacy record-only intent, the immutability trigger rejects unknown locked-column names, purchase transactions pin read committed and discard the connection if rollback fails, and an open operation in any environment is diagnosed as PURCHASE_CUSTOMER_HAS_OPEN_OPERATION. Test trigger bypasses are exception-safe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Live quotes ask OZAV for the facility preview and store terms_version and the locked USDT amount; accepted purchases copy and lock both immutably. A live quote without the facility block is refused, AMOUNT_BELOW_MINIMUM maps to QUOTE_AMOUNT_OUT_OF_RANGE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Live Pix transfers send facility_terms_accepted and the purchase's facility_terms_version; instructions are shown only after OZAV locks the rate at exactly the purchase's locked_usdt_amount (facility.amount). A refused, unapplied or mismatched lock fails the operation. The service is renamed CustomerPixService, moves accepted -> awaiting_pix, adds the v1/me/pix alias and lifts MONEY_PATH_NOT_LIVE_READY for the Pix path only. Live quote saves without a facility block are refused, and the frontend mints a fresh quote request_id after a lock/recovery refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve the quote Store facility.deadline_at once (migration 047) and fail the operation with LOCK_DEADLINE_INVALID when it is missing, malformed or past. Live instructions are payable only before min(Pix expiry, lock deadline), which is the validity shown. Ruling 18: facility.amount >= locked amount passes. Create checks an accepted operation before any provider call; frontend gates live instructions on awaiting_pix; one shared USDT micro-unit helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
transfer.* webhooks and the reconciliation worker re-read the transfer by GET and drive the purchase operation to awaiting_approval (one system withdrawal request), or to failed/expired/needs_review/refund_pending (one manual refund request; recording it moves the operation to refunded). Webhooks from the other environment are ignored without changing state. Adds accepted -> needs_review (048) for ambiguous live Pix creates, operator alerts for operations under review and Pix left payable after close, and lets the reconciliation guard accept the configured mode's key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ement OZAV needs_review now holds the operation in needs_review (reason OZAV_TRANSFER_NEEDS_REVIEW) and progression resumes from it only for that reason (new edges needs_review -> pix_confirmed/converted in 048 and canTransition); refund_pending only after a paid failed/cancelled/expired transfer. pix_open_after_close also flags completed transfers of closed operations. The worker and API refuse to boot when the database environment differs from the money mode. Manual refund completion and the refunded transition are one statement and fail unless the operation is refund_pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds POST /v1/admin/operations/:purchaseId/refund-decision (allowlisted AAL2 operator, idempotent per request_id, audited): one SQL statement locks the purchase, requires a paid Pix, records the decision and moves the operation to refund_pending from needs_review, pix_confirmed, converted, awaiting_approval, expired or failed, then creates or reuses the manual refund request. Migration 048 adds expired/failed -> refund_pending, guarded in SQL by the paid source leg, and the append-only decisions table. transitionOperation accepts the expected from-status and last event reason, checked under the row lock; progression passes them and resumes from OZAV review relative to the stage it left, never backwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- requireFreshMfa (amr totp <= OPERATOR_MFA_MAX_AGE_SECONDS, default 300) for withdrawal approval/execution, operator refund decision and refund completion - execution waits OPERATOR_EXECUTION_MIN_DELAY_SECONDS (default 900) from the persisted approval; optional four eyes (OPERATOR_FOUR_EYES_ENABLED=false) - ruling 23: approval locks the purchase row, requires awaiting_approval and moves it to approved in the same transaction; refund decision refuses with REFUND_WITHDRAWAL_IN_PROGRESS once an approval or execution exists - GET /v1/admin/operator-status; frontend offers MFA enrollment to operators only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- refund decision locks the purchase row in its own statement before the decision CTE (fresh snapshot), like the withdrawal approval - execution delay measured by the database clock (now() - approval created_at) - TOTP amr future skew tolerance reduced to 10 s - operator refund screen: on OPERATOR_MFA_STALE re-verify TOTP and retry the same request once with the new token - real PostgreSQL lock-contention test for approve vs refund decision (runs when TEST_INVITE_DATABASE_URL is set) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Execution sends the purchase's immutable locked_usdt_amount, identifies the self-custodied destination with the wallet proof timestamp, and checks the destination token account for the environment's USDT mint before anything is reserved or POSTed. The claim locks the purchase row, requires approved and moves it to sending in one transaction before the send POST, so a double or concurrent execute yields one claim and one POST. Accepted sends move to sent with the transfer id and tx hash; ambiguous answers stay sending; definitive refusals such as TRAVEL_RULE_REQUIRED move to needs_review and are never re-POSTed. SANDBOX_WITHDRAWAL_EXECUTION_ENABLED is allowed in live; closure stays refused. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- verifyUsdtDelivery reads one finalized transaction (getParsedTransaction) and compares the wallet's credit of the environment USDT mint with the expected units. - Reconciliation moves sent -> delivered_verified only when the credit equals the OZAV net amount (amounts.target.amount) and that net is >= locked - tolerance (USDT_DELIVERY_TOLERANCE_UNITS, default 100000); otherwise sent -> needs_review. Test sends absent from devnet stay sent and are labelled simulated. - Migration 050: delivery evidence columns and live pilot slot release when the operation reaches delivered_verified, refunded, failed or expired. - Send hardening: 404 is no longer a definitive refusal; refused sends are looked up by metadata (GET) and a found transfer raises a high-severity alert; the reserved row must carry the validated amount and destination; identification failures carry the provider HTTP status; frozen token accounts are reported. - Customer views expose the net delivered amount and the explorer link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Customer reads accept a verified delivery only with the explorer link of the backend-reported cluster (mainnet-beta in live, devnet in test) and never accept mainnet execution in test. The operation detail shows the net amount delivered on chain, the backend explorer link, or the simulated-send label in test. The public RPC fallback follows the money mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- One transaction never verifies two operations: unique index on the verified provider_tx_hash (050) plus an in-transaction check; conflicts become needs_review TX_ALREADY_USED. - The transaction block time must not predate the send claim (send_attempted_at, 120 s allowance), else needs_review TX_PREDATES_SEND. - Ruling 30: verified iff the on-chain credit is within locked - tolerance and locked, and equals OZAV's settled target.amount (else ONCHAIN_CREDIT_DIFFERS_FROM_SETTLED); without a settled target the operation stays sent with delivery_pending_reason SETTLED_TARGET_NOT_REPORTED. - Live: an invalid tx hash is needs_review TX_HASH_INVALID; undecided sends store delivery_pending_reason; RPC failures are logged as an error code only. - Frontend: explorerTx/explorerAddress require a mode; legacy demo passes "test". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…iew) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Port the terms and privacy pages from the legal-documents branch, publish the final refund policy (2026-11-02) verbatim, and pin all three with SHA-256 in LEGAL_REQUIRED_DOCUMENTS (docs/operations + .env.example). A backend test recomputes the hashes from the HTML on disk so text and config cannot drift; .gitattributes forces LF for stable hashes. Frontend: signup checkboxes (all three documents), a post-login acceptance gate that reads required versions from GET /v1/me/legal-acceptances and posts them, reacts to LEGAL_ACCEPTANCE_REQUIRED from any customer request, and a refund policy link before the Pix QR. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Policy 7.1: POST /v1/me/purchase-intents/:id/cancel, idempotent by request_id. Fresh GET gates the request; payment after a cancel withdraws it; accepted without Pix expires as CUSTOMER_CANCELLED under the purchase row lock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Migration 055 adds peragus_operator_notifications, an e-mail outbox with one row per event and recipient role (operator, trusted person), and the append-only peragus_daily_reviews. Both are environment-guarded, RLS-enabled and revoked. Money events enqueue from AFTER INSERT triggers on their audit rows (status events, refund requests/decisions/completions, runtime control events), in the same transaction. A 5-minute scanner enqueues stuck and overdue operations (sending/sent > 30 min, awaiting_pix past its deadline, needs_review 4 h/12 h, refund_pending 12 h/20 h), the existing high-severity alerts and a missing daily review, each once. Delivery follows the invite outbox: stable Idempotency-Key per row, attempt recorded before the Resend call, ambiguous outcomes end uncertain with no retry. Bodies are plain pt-BR with ids, statuses and amounts only. The worker runs both jobs behind OPERATOR_NOTIFICATIONS_ENABLED (default off) and requires OPERATOR_ALERT_EMAIL and TRUSTED_ALERT_EMAIL. New operations (every new_operations gate) answer 503 DAILY_REVIEW_REQUIRED when the previous Sao Paulo day had activity and no review, recorded via POST /v1/admin/daily-reviews (operator allowlist + fresh MFA). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewing the current Sao Paulo day answers 409 DAILY_REVIEW_DAY_NOT_ENDED. High-severity notifications never expire unsent; expired rows are counted by kind and severity only. Migration 055 indexes status events by (environment, created_at) for the activity check. The per-drain cap (15 x 10 s) fits the 240 s job expiry, asserted at load. E-mail bodies use Portuguese kind and status labels with the raw codes on a Codigo line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Run CI on pushes to develop, add the configuration checklist (with a drift test against env.ts), operator runbook, MFA reset, backup/restore and internal transaction runbooks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Operator area under /operador: dashboard, runtime controls, daily review, withdrawal queue (approve/execute/details/reconcile), refunds (operation decision, completion, 24 h deadline) and alerts with uncertain/failed notifications. Shared operator API module, proxy allowlist, fresh-MFA single-retry hook and confirm dialogs. Backend: GET /v1/admin/operator-notifications and remaining_delay_seconds on EXECUTION_TOO_EARLY. Customer copy for DAILY_REVIEW_REQUIRED. Runbook points to the screens; curl moved to an appendix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The withdrawal queue owns the approve/execute action: rows, filter and Cancelar stay locked while a request is in flight or unresolved, nothing is aborted, and leaving the screen records the intent for the next visit. repeat() reuses the last (fresh) token; Conciliar surfaces errors with the fresh-MFA retry. Add read-only GET /v1/admin/daily-reviews?day= and show yesterday's status on the dashboard. estornos reads ?operacao= via Route.useSearch; the operator proxy closes the unused approval GET and audit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds scripts/staging-e2e-smoke.mjs, a guarded journey against the deployed staging API (legal acceptance, runtime switches, daily review, onboarding with simulated KYC, quote, Pix, approval, execution, delivery). The guard refuses production env, ozav_sk_live_ keys and any target not reporting test + solana:devnet; switches turned on are always turned off again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Shared abort flag (SIGINT/SIGTERM and step timeout) stops new requests and cancels in-flight ones; switch restoration bypasses it. Extract runWithSwitches/withDeadline with unit tests, and refuse redirects. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds scripts/ozav-live-capabilities.mjs (GET /v2/capabilities only, GET-enforced, no redirects, timeout, key never printed), tests, CI node --check, and the production release sequence in the internal transaction runbook. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e URL guard, onboarding email order Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… existing data Ruling 40: the migration runner (extracted to scripts/lib/migration-runner.mjs) records the money environment inside the 043 transaction and keeps the final idempotent record. 045/046 backfill pre-043 rows with the row-environment guard bypassed only for the in-place update, so a production database with legacy test rows also migrates. Amends 043/045/046, which have not been applied to any environment. Tests drive the real runner against PGlite seeded with pre-043 quotes and purchase intents for staging and production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST v1/me/purchase-intents/<uuid>/cancel was unreachable from the browser.
The purchase proxy now allows it with a strict {request_id} body. A new test
scans the browser code for every backend path it calls and asserts each one is
allowed by exactly the intended proxy allowlist with the methods it uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…book codes The Pix repository hard-coded a 1000 BRL floor; it now takes purchaseLimits(env) (PURCHASE_MIN_BRL..PURCHASE_MAX_BRL) from the API and worker wiring. The runbook states that LOCKED_AMOUNT_MISMATCH fails the operation, and the configuration checklist explains how the negotiated 50 BRL floor is enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The *.pg.test.ts files take their URL from realPostgresUrl(), which skips locally but throws when CI=true and TEST_INVITE_DATABASE_URL is missing. A guard test pins the CI wiring (backend job env -> postgres:17 on 127.0.0.1). Adds the real-Postgres race for Pix create vs customer cancel (Task 13b minor 1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… dead ends Migration 056 (new): needs_review -> delivered_verified for a review entered from sent (Ruling 39), refused_find_clear_at on executions (Ruling 38), refund decisions that supersede a rejection, operator resolutions audit table, the awaiting_approval and operator_resolution notification kinds and worker heartbeats. TS transition table updated to match (225-pair test). - I3: accepted operations expire after the TTL when no Pix create was claimed, and after a grace period when a claimed create has no listed transfer; create() re-claims a reserved, never-claimed row instead of replaying it. - R38: the operator refund decision is refused only for approved/sending/sent/ delivered_verified or a claimed send that is not definitively refused with a GET-only find confirming no transfer. - Progression closes an unpaid pre-payment review as failed when OZAV reports the transfer terminal and unpaid; a send that OZAV ends failed/cancelled/expired moves the operation to needs_review; a transaction without blockTime stays sent (pending) instead of review; re-verification of a delivery review. - I5/I6: Pix checkpoints keep polling with backoff until OZAV is terminal and the operation left funding; OZAV needs_review never ends polling; ordinary unpaid Pix no longer raise reconciliation_mismatch. - I6: awaiting_approval notification and stage thresholds for accepted, pix_confirmed, converted, awaiting_approval and approved. - I9: instruction margin and expiry grace hooks (wired from env next). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, worker heartbeat
- Ruling 39: POST /v1/admin/operations/:id/resolutions/{close-unpaid-review,
reverify-delivery,return-approved-to-review}, POST .../reconcile-pix and GET
.../resolutions (allowlist + AAL2; resolutions need fresh TOTP, reason,
request_id idempotency; append-only peragus_operator_resolutions).
- I7: with settled operations an approving refund decision needs fresh MFA and a
refund_pending operation under the purchase row lock; it supersedes a legacy
rejection (audited) so the refund can complete.
- I8: any unreviewed ended day since DAILY_REVIEW_FLOOR_DATE blocks new
operations and raises daily_review_missing (oldest first).
- I3/I5/I9 wiring: ACCEPTED_OPERATION_TTL_MINUTES sweep in the worker,
PIX_CREATE_NOT_FOUND_GRACE_MINUTES, PIX_EXPIRY_GRACE_MINUTES,
PIX_INSTRUCTIONS_HIDE_MARGIN_MINUTES; the customer Pix reconcile runs progression.
- I12: live Pix/send refuse to boot without MANUAL_REFUNDS_ENABLED,
CUSTOMER_WEBHOOKS_ENABLED and TRUST_PROXY_HOPS>0; the worker beats every minute
and hosted /ready fails the queue check when the beat is older than 3 minutes.
- /ready shares in-flight database/queue probes and caches them for 2 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive registration needs a confirmed e-mail - A create failure that leaves no session (OZAV lists none) releases the claim; a stale claim (> 2 min) with no listed session is released on the next start. - An expired hosted session allows a new one; ended ids are kept in previous_verification_ids (056, unapplied) and never recovered again. - session_url is no longer stored once the session is closed. - Live registration requires email_confirmed_at from the verified Supabase user (ONBOARDING_EMAIL_NOT_CONFIRMED), besides the project setting. - Guard catalog test lists peragus_operator_resolutions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re-claim; claimAttempt required Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esholds and the daily-review backlog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r state - Operator console (estornos): audited resolutions (encerrar revisão sem pagamento, verificar entrega de novo, voltar aprovada para revisão) with fresh TOTP and reason, plus Reconciliar Pix; operator proxy allows exactly those paths and the allowlist manifest covers them. - I11: cancel message distinguishes no-Pix (slot free), expired (do not pay; late payment refunded) and open Pix (slot held until the Pix expires). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…failed post-refresh restore, 10 s refresh floor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ndbox delivers nothing on Solana); live path unchanged Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…RLF ledger hashes still accepted); migrations pinned to LF Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ed by drop database force are not unhandled errors Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the approved recovery spec (
docs/superpowers/specs/2026-11-11-peragus-mvp-recovery-design.md) and plan (docs/superpowers/plans/2026-11-11-peragus-mvp-live-recovery.md): the same code now runs in test/devnet (staging) and live/mainnet (production), selected byPERAGUS_DEPLOYMENT_ENV, with every money path gated and audited.transfer.*webhooks and polling; customer cancel before Pix (policy 7.1).wallet → crypto_addresssend with destination identification and token-account check; on-chain verification (finalized, mint, recipient owner, locked−tolerance ≤ credit ≤ locked, equal to OZAV settled target, unique tx, block time after send); pilot slot release./ready, operator console screens, operator resolutions for stuck states.env.ts), operator runbook, internal-transaction runbook (Go/No-Go), backup/restore, MFA reset, staging smoke script, read-only OZAV live capability probe. CI also runs ondevelopand runs the real-Postgres race tests.New migrations:
043–056(none applied to any environment yet).Before deploying to staging (required config)
The API/worker refuse to boot without the configuration in
docs/operations/configuration-checklist.md— notablySOLANA_USDT_MINT,LEGAL_REQUIRED_DOCUMENTS(value indocs/operations/legal-required-documents.json),TRUST_PROXY_HOPS=1,PERAGUS_DEPLOYMENT_ENVset explicitly on every service/job that runsdb:migrate, andCUSTOMER_RECONCILIATION_ENABLED=trueon the worker. Runtime switches start OFF after migration 054.Known open items (from the final review)
needs_reviewwith no in-system exit;docs/operations/operator-runbook.mdrows for that case must be corrected before the internal transaction.*.pg.test.tsreal-Postgres race suites have never run locally; this PR's CI run is their first execution and must be green.Test plan
*.pg.test.ts(backend) and frontend/readyreturns 200app/backend/scripts/staging-e2e-smoke.mjs, seedocs/operations/staging-smoke.md) green🤖 Generated with Claude Code