Skip to content

chore: sync main → dev (manual merge of #2049)#2062

Merged
jjramirezn merged 4 commits into
devfrom
sync/main-to-dev-2026-05-18
May 18, 2026
Merged

chore: sync main → dev (manual merge of #2049)#2062
jjramirezn merged 4 commits into
devfrom
sync/main-to-dev-2026-05-18

Conversation

@jjramirezn

Copy link
Copy Markdown
Contributor

Manual-merge replacement for #2049 (which has unresolved conflicts).

Conflicts

Two files, both touched by:

  • dev (`810167cff chore: fix PR lint errors`, `9d8a8e616 fix: consolidate Manteca supported countries`) — cleanup to a new helper API
  • main (`cbf66b634 Fix migrated KYC withdrawal gating`, `25b6a13bf Tighten migrated Manteca KYC semantics`) — bugfix to broaden the matching logic

`src/components/Home/KycCompletedModal/index.tsx`

Both sides rewrote the verification-matching block in the `isMantecaApproved` useEffect.

Aspect dev main merged
Country gate `isMantecaSupportedCountryCode(v.mantecaGeo)` `supportedCountries.includes(v.mantecaGeo.toUpperCase())` dev's helper (cleaner)
Status check `v.status === MantecaKycStatus.ACTIVE` `isKycStatusApproved(v.status)` main's helper (bugfix — broader status set)
Provider filter `v.provider === 'MANTECA'` `(v.provider === 'MANTECA' \\\\| v.provider === 'SUMSUB')`

Net: kept dev's country helper, took main's broader provider + status logic. Dropped unused `MantecaKycStatus` and `MantecaSupportedExchanges` imports.

`src/hooks/useIdentityVerification.tsx`

Same pattern — single-block import conflict; the body was auto-merged with dev's helper (`isMantecaSupportedCountryCode`) + main's broader logic (`provider === MANTECA || SUMSUB`, `isKycStatusApproved`). Cleaned up unused imports that the auto-merge left dangling.

Verification

  • typecheck clean
  • 4/4 `kyc-withdrawal-gate.test.tsx` cases pass (covers the migrated-cohort behavior main introduced)

Closes #2049.

kushagrasarathe and others added 4 commits May 15, 2026 19:09
@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment May 18, 2026 9:02pm

Request Review

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR unifies KYC approval status checking across Manteca and Sumsub providers by introducing a shared isKycStatusApproved helper in place of provider-specific status comparisons. It broadens eligibility rules to accept both provider types where applicable, updates the component approval-type precedence logic, and adds comprehensive test coverage for withdrawal gating behavior.

Changes

Unified KYC approval status and provider handling

Layer / File(s) Summary
Hook approval status unification
src/hooks/useUnifiedKycStatus.ts, src/hooks/useIdentityVerification.tsx
Update imports and approval predicates to use isKycStatusApproved helper instead of provider-specific status constants. Manteca approval now treats SUMSUB verifications with mantecaGeo as eligible, and Sumsub approval now uses the unified helper instead of literal 'APPROVED' comparison.
Component approval type and country selection
src/components/Home/KycCompletedModal/index.tsx
Import and apply isKycStatusApproved in approval-type precedence logic (combined Bridge+Manteca yields 'all', Manteca-only yields 'manteca'). Broaden Manteca-country derivation to accept both MANTECA and SUMSUB provider rows via the unified helper.
KYC withdrawal gating test coverage
src/hooks/__tests__/kyc-withdrawal-gate.test.tsx
Validate SUMSUB-migrated verifications treated as approved, country-scoped withdrawals allowed for both MANTECA and SUMSUB-migrated verifications, and denial when only rail is enabled without active verification rows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • peanutprotocol/peanut-ui#2041: Overlapping refactor of migrated-KYC approval semantics applied to hooks, component logic, and coverage in kyc-withdrawal-gate.test.tsx.
  • peanutprotocol/peanut-ui#2056: Modifies the same KycCompletedModal and useIdentityVerification paths for KYC gating and Manteca eligibility via isMantecaSupportedCountryCode.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes this PR as a manual merge sync of main into dev, which is the primary change reflected in the conflicts and resolution described.
Description check ✅ Passed The description comprehensively documents the merge conflicts, resolution strategy for each file, and verification steps taken, directly relating to the changeset.
Linked Issues check ✅ Passed The PR successfully accomplishes the linked issue #2049 objective: syncing main into dev by resolving conflicts while preserving bugfixes from both branches and passing all KYC withdrawal gating tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving the merge conflicts between main and dev branches as specified in #2049, with no unrelated modifications introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 5718.33 → 5719.77 (+1.44)
Findings: +1 net (+15 new, -14 resolved)

🆕 New findings (15)

  • high complexity — src/hooks/useIdentityVerification.tsx — CC 43, MI 61.42, SLOC 166
  • medium high-mdd — src/hooks/useIdentityVerification.tsx:114 — useIdentityVerification: MDD 59.1 (uses across many lines from declarations)
  • medium high-mdd — src/hooks/useIdentityVerification.tsx:255 — : MDD 38.0 (uses across many lines from declarations)
  • medium high-mdd — src/components/Home/KycCompletedModal/index.tsx:15 — KycCompletedModal: MDD 36.9 (uses across many lines from declarations)
  • medium complexity — src/components/Home/KycCompletedModal/index.tsx — CC 28, MI 65.02, SLOC 79
  • medium complexity — src/hooks/useUnifiedKycStatus.ts — CC 25, MI 70.21, SLOC 80
  • medium high-mdd — src/hooks/useUnifiedKycStatus.ts:12 — useUnifiedKycStatus: MDD 24.9 (uses across many lines from declarations)
  • medium high-mdd — src/hooks/useIdentityVerification.tsx:165 — : MDD 22.7 (uses across many lines from declarations)
  • low high-dlt — src/components/Home/KycCompletedModal/index.tsx:15 — KycCompletedModal: DLT 18 (calls 18 distinct functions — high context load)
  • low high-dlt — src/hooks/useIdentityVerification.tsx:114 — useIdentityVerification: DLT 18 (calls 18 distinct functions — high context load)
  • low high-mdd — src/components/Home/KycCompletedModal/index.tsx:46 — : MDD 16.0 (uses across many lines from declarations)
  • low high-mdd — src/components/Home/KycCompletedModal/index.tsx:52 — : MDD 11.4 (uses across many lines from declarations)
  • low high-mdd — src/hooks/useIdentityVerification.tsx:183 — isRegionUnlocked: MDD 11.0 (uses across many lines from declarations)
  • low missing-return-type — src/hooks/useIdentityVerification.tsx:114 — useIdentityVerification: exported fn missing return type annotation
  • low missing-return-type — src/hooks/useUnifiedKycStatus.ts:12 — useUnifiedKycStatus: exported fn missing return type annotation

✅ Resolved (14)

  • src/hooks/useIdentityVerification.tsx — CC 42, MI 61.51, SLOC 165
  • src/hooks/useIdentityVerification.tsx:109 — useIdentityVerification: MDD 59.4 (uses across many lines from declarations)
  • src/hooks/useIdentityVerification.tsx:251 — : MDD 38.0 (uses across many lines from declarations)
  • src/components/Home/KycCompletedModal/index.tsx:15 — KycCompletedModal: MDD 31.3 (uses across many lines from declarations)
  • src/components/Home/KycCompletedModal/index.tsx — CC 27, MI 65.22, SLOC 78
  • src/hooks/useUnifiedKycStatus.ts:13 — useUnifiedKycStatus: MDD 24.5 (uses across many lines from declarations)
  • src/hooks/useIdentityVerification.tsx:161 — : MDD 22.7 (uses across many lines from declarations)
  • src/hooks/useUnifiedKycStatus.ts — CC 23, MI 70.79, SLOC 78
  • src/components/Home/KycCompletedModal/index.tsx:15 — KycCompletedModal: DLT 17 (calls 17 distinct functions — high context load)
  • src/hooks/useIdentityVerification.tsx:109 — useIdentityVerification: DLT 17 (calls 17 distinct functions — high context load)
  • src/hooks/useIdentityVerification.tsx:179 — isRegionUnlocked: MDD 11.0 (uses across many lines from declarations)
  • src/components/Home/KycCompletedModal/index.tsx:46 — : MDD 10.0 (uses across many lines from declarations)
  • src/hooks/useIdentityVerification.tsx:109 — useIdentityVerification: exported fn missing return type annotation
  • src/hooks/useUnifiedKycStatus.ts:13 — useUnifiedKycStatus: exported fn missing return type annotation

📈 Painscore deltas (top movers)

File Before After Δ
src/components/Home/KycCompletedModal/index.tsx 7.0 7.5 +0.5
src/hooks/useUnifiedKycStatus.ts 5.1 5.7 +0.5

@github-actions

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 1081 ran, 0 failed, 0 skipped, 18.1s

📊 Coverage (unit)

metric %
statements 46.9%
branches 28.1%
functions 28.8%
lines 46.7%
⏱ 10 slowest test cases
time test
0.4s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in updateUserById body
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in updateUserById
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle invalid ETH address (invalid characters)
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle invalid ETH address (missing 0x prefix)
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid US account with spaces
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid ETH address with surrounding spaces
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle too long for US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle invalid ETH address (too short)
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid US account with spaces 2
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/components/Home/KycCompletedModal/index.tsx (1)

54-61: 💤 Low value

Consider removing merge-resolution comments before merging.

These inline comments document the conflict resolution process but add noise for future readers. The code itself is now self-explanatory with the unified isKycStatusApproved helper.

🧹 Suggested cleanup
             user?.user.kycVerifications?.forEach((v) => {
                 if (
-                    // dev: scoped to Manteca via `isMantecaSupportedCountryCode` helper.
-                    // main: broadened to include SUMSUB-provider rows AND switched the
-                    // status gate from `=== MantecaKycStatus.ACTIVE` to
-                    // `isKycStatusApproved` (handles the post-migration cohort whose
-                    // status enum is the unified Bridge/Manteca approved set, not the
-                    // legacy Manteca-only ACTIVE).
-                    // Merge: keep dev's helper for country-gate readability, take
-                    // main's broader provider + status logic (the actual bugfix).
                     (v.provider === 'MANTECA' || v.provider === 'SUMSUB') &&
                     isMantecaSupportedCountryCode(v.mantecaGeo) &&
                     isKycStatusApproved(v.status)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Home/KycCompletedModal/index.tsx` around lines 54 - 61, Remove
the merge-resolution comment block that documents the conflict (the multiline
comment containing dev/main/Merge notes) and leave the current implemented logic
intact; specifically, keep the unified check that uses
isMantecaSupportedCountryCode for the country gate and isKycStatusApproved for
the status/provider logic, and delete the noisy merge commentary so the code
reads cleanly around the Home/KycCompletedModal index where those helpers are
used.
src/hooks/useIdentityVerification.tsx (1)

7-11: 💤 Low value

Consider removing merge-resolution comments before merging.

These comments explain the conflict resolution process but aren't relevant for ongoing maintenance. They could be removed to keep the codebase clean.

🧹 Suggested cleanup
-// Auto-merger took main's broader body (`provider === 'MANTECA' || === 'SUMSUB'`,
-// `isKycStatusApproved`) AND dev's helper call `isMantecaSupportedCountryCode`.
-// That means `MantecaKycStatus` (was the strict status enum) and
-// `MantecaSupportedExchanges` (was main's direct-map gate) are both unused
-// post-merge — drop them.
 import { BRIDGE_ALPHA3_TO_ALPHA2, countryData } from '`@/components/AddMoney/consts`'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useIdentityVerification.tsx` around lines 7 - 11, Remove the
merge-resolution comment block left in useIdentityVerification.tsx that explains
the conflict between main and dev (the note about `provider === 'MANTECA' || ===
'SUMSUB'`, `isKycStatusApproved`, and the helper
`isMantecaSupportedCountryCode`), and also delete the now-unused symbols left
over from that merge (`MantecaKycStatus` and `MantecaSupportedExchanges`) so the
file contains only the active logic (references to
`isMantecaSupportedCountryCode`, provider checks, and `isKycStatusApproved`)
without leftover commentary or dead declarations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hooks/__tests__/kyc-withdrawal-gate.test.tsx`:
- Around line 5-10: The test currently mocks '`@/assets`' but
useIdentityVerification.tsx imports the globe constants from '`@/assets/icons`',
so the mock isn't applied; update the jest.mock target to '`@/assets/icons`' (or
add an additional jest.mock for '`@/assets/icons`') so the imported symbols like
EUROPE_GLOBE_ICON, LATAM_GLOBE_ICON, NORTH_AMERICA_GLOBE_ICON, and
REST_OF_WORLD_GLOBE_ICON are overridden with the mocked values used in the test.

---

Nitpick comments:
In `@src/components/Home/KycCompletedModal/index.tsx`:
- Around line 54-61: Remove the merge-resolution comment block that documents
the conflict (the multiline comment containing dev/main/Merge notes) and leave
the current implemented logic intact; specifically, keep the unified check that
uses isMantecaSupportedCountryCode for the country gate and isKycStatusApproved
for the status/provider logic, and delete the noisy merge commentary so the code
reads cleanly around the Home/KycCompletedModal index where those helpers are
used.

In `@src/hooks/useIdentityVerification.tsx`:
- Around line 7-11: Remove the merge-resolution comment block left in
useIdentityVerification.tsx that explains the conflict between main and dev (the
note about `provider === 'MANTECA' || === 'SUMSUB'`, `isKycStatusApproved`, and
the helper `isMantecaSupportedCountryCode`), and also delete the now-unused
symbols left over from that merge (`MantecaKycStatus` and
`MantecaSupportedExchanges`) so the file contains only the active logic
(references to `isMantecaSupportedCountryCode`, provider checks, and
`isKycStatusApproved`) without leftover commentary or dead declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 140ece0e-d83e-4f73-884f-4902ce8cc91d

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb879a and 50dea08.

📒 Files selected for processing (4)
  • src/components/Home/KycCompletedModal/index.tsx
  • src/hooks/__tests__/kyc-withdrawal-gate.test.tsx
  • src/hooks/useIdentityVerification.tsx
  • src/hooks/useUnifiedKycStatus.ts

Comment thread src/hooks/__tests__/kyc-withdrawal-gate.test.tsx
@jjramirezn jjramirezn merged commit b7fed29 into dev May 18, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants