fix(kyc): close the remaining 'Unlock region' loop doors + claim-geo via URL#2206
Conversation
…OW no-op loop A locked region has no functional rail by definition, so clicking one is always a cross-region request. The FE's private copy of the region->provider map said ROW->manteca, so a Manteca-verified user clicking 'Rest of the world' compared manteca===manteca, dropped the crossRegion flag, and the BE silently early-returned APPROVED -> onKycSuccess -> 'all set' with nothing unlocked. Send crossRegion unconditionally (BE ignores it pre-approval and answers 'unsupported-region' for ROW), and keep a single display-only mirror of the BE registry (ROW->null) in regions.utils with a lockstep test.
Its only mount gated on isKycApprovedModalOpen, which initializes false and has no setter-to-true anywhere — the modal could never open in production. Part of the loop-door cleanup: dead 'you're verified' surfaces hide real KYC-outcome signaling bugs behind code that looks like it handles them.
…region The page-level isBankRailPending boolean badged EVERY locked region (well, the hardcoded europe/north-america pair) whenever ANY bank rail was mid-flight — a pending AR rail marked Europe pending and made it unclickable, walling users off from regions they could actually start verifying. Derive pending per region from each rail's jurisdiction (BE catalog country values), so only the region that's actually provisioning shows the badge.
… in the URL The Pix / Mercado Pago tap on a claim link only lived in context state, which the auth redirect's full remount wiped — regionalMethodType fell back to its 'mercadopago' default, so a Pix (BR) claimer re-entered the flow looking like a Mercado Pago (AR) one. Persist the tapped method as ?method= alongside step=regional-claim (same plain-searchParams pattern the step param uses), restore it on re-entry, and make the context value null-until-chosen so a bare default can never masquerade as a real choice. MantecaFlowManager now passes targetCountry to the LATAM KYC action only when the geo is reliably known (explicit country pick, or BR/PIX vs AR/MP from a real method choice).
# Conflicts: # src/components/Claim/Link/MantecaFlowManager.tsx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
💤 Files with no reviewable changes (4)
WalkthroughThis PR refactors KYC region routing to use a capability-based model, removes the deprecated ChangesKYC Region Routing & Regional Claim Method Preservation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Code-analysis diffPainscore total: 5839.11 → 5836.99 (-2.12) 🆕 New findings (52)
…and 32 more. ✅ Resolved (50)
…and 30 more. 📈 Painscore deltas (top movers)
|
The worktree env shim (symlink to the primary tree's generated flags) got swept into a commit; in CI it's a broken symlink that makes the flag-generation postinstall mkdir fail, cascading every job red.
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
Summary
Audit follow-up to the cross-region loop work (#2191/#2194/#2199). Four issues, one theme: a surface decides wrong/nothing → BE silently no-ops → user loops on "You're all set".
crossRegionomitted → BE silently early-returned APPROVED → no-op loop. Now:crossRegion: trueunconditionally for locked-region clicks (safe — every BE cross-region branch requires APPROVED, so it's a no-op for fresh users), and the surviving display-only map is an exact BE-registry mirror (providerForRegionIntentin regions.utils, ROW→null) with lockstep tests.KycVerifiedOrReviewModalremoved — its only mount had a state that nothing ever set to true (verified by grep). Component + mount + showcase entries deleted.bankRails().some(pending)boolean badged (and disabled) EVERY locked region off any pending rail anywhere; a pending AR rail badged Europe. NewpendingBankRailRegionPathsscopes by the rail's jurisdiction.regionalMethodTypeis now null-until-chosen (was a 'mercadopago' default that masqueraded as a choice) and the guest tap carriesmethodin the URL (existing searchParams pattern +saveRedirectUrlpersistence), so post-login the PIX claim passestargetCountry: 'BR'instead of undefined-or-wrong-AR. Display fallback is deliberately separated from geo derivation.Risk
Medium-low. Item 1 changes when
crossRegionis sent (verified no-op for non-APPROVED users; BE has the explicitunsupported-regionsignal since #985). Item 4 touches claim-flow state init —regionalMethodTypeconsumers audited (ClaimBankFlowContext, MantecaFlowManager; RequestFulfillmentFlowContext has its own copy, untouched). BE-first deploy ordering already satisfied (#995 live).QA
selectedCountry?.id)