Skip to content

fix(kyc): surface per-label reject copy in action-required drawer (dev)#2300

Closed
jjramirezn wants to merge 2 commits into
devfrom
fix/kyc-reject-label-precedence-dev
Closed

fix(kyc): surface per-label reject copy in action-required drawer (dev)#2300
jjramirezn wants to merge 2 commits into
devfrom
fix/kyc-reject-label-precedence-dev

Conversation

@jjramirezn

Copy link
Copy Markdown
Contributor

Summary

Dev-targeting twin of #2293 (which lands the same fix on main). Opening directly into dev so the fix is present here without waiting on the main→dev back-merge.

The KYC action-required drawer (KycActionRequired.tsx) checked actionMessage first; the backend always sends a generic action_required message, so the specific per-label copy (notably DUPLICATE_EMAIL → "Email already in use → sign in to that account or contact support") was never reachable. Users hitting an email collision saw a misleading generic "verify your ID" prompt. Fix: prefer RejectLabelsList when reject labels are present; fall back to actionMessage only when there are none.

Risk

Low — single presentational component, no logic/data/contract change. Identical diff to #2293.

QA

  • action_required + rejectLabels:['DUPLICATE_EMAIL'] → shows the email-collision copy, not the generic resubmit message.
  • action_required with no labels → generic actionMessage fallback.
  • jest 5/5: 2 precedence tests + 1 integration test rendering the real RejectLabelsList.

Related

The action-required drawer checked actionMessage first, but the backend
always sends a generic "resubmit your documents" actionMessage for every
action_required state — so the specific reject-label copy (e.g.
DUPLICATE_EMAIL → "Email already in use, sign in to that account or contact
support") was never reachable. Users hitting an email collision saw a
misleading "verify your ID" prompt with no actionable next step. Prefer
RejectLabelsList when reject labels are present; fall back to the generic
actionMessage only when there are none.
Address /code-review findings: collapse the three-branch ternary to two
(RejectLabelsList already renders its own empty-state fallback, so the
duplicated branch was dead weight), and add an integration test that renders
the real RejectLabelsList so the DUPLICATE_EMAIL → 'Email already in use'
copy mapping is actually exercised, not mocked away.
@vercel

vercel Bot commented Jun 29, 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 Jun 29, 2026 12:01pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13d2758c-f9ea-4ef7-9f60-04cde3fd886f

📥 Commits

Reviewing files that changed from the base of the PR and between efbb2bd and ddf8140.

📒 Files selected for processing (3)
  • src/components/Kyc/states/KycActionRequired.tsx
  • src/components/Kyc/states/__tests__/KycActionRequired.rejectCopy.test.tsx
  • src/components/Kyc/states/__tests__/KycStates.test.tsx

Walkthrough

KycActionRequired is updated so that when rejectLabels is non-empty, RejectLabelsList is rendered instead of the generic actionMessage InfoCard. Two test files add coverage for both branches and verify that DUPLICATE_EMAIL-specific copy is selected over the generic resubmit message.

KycActionRequired reject-label rendering precedence

Layer / File(s) Summary
Conditional rendering logic and comment
src/components/Kyc/states/KycActionRequired.tsx
The conditional is changed so the InfoCard with actionMessage only renders when rejectLabels is empty; a comment documents the precedence between reject-label copy and the generic backend message.
Tests for reject-label vs generic message branching
src/components/Kyc/states/__tests__/KycStates.test.tsx, src/components/Kyc/states/__tests__/KycActionRequired.rejectCopy.test.tsx
Two test suites cover the new branching: one asserts RejectLabelsList renders and actionMessage is suppressed when labels are present (and vice versa); the other verifies real DUPLICATE_EMAIL-specific copy is chosen over the generic resubmit text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • peanutprotocol/peanut-ui#2265: Updates REJECT_LABEL_MAP text for the DUPLICATE_EMAIL guidance, directly affecting the copy asserted in the new test added by this PR.

Suggested labels

enhancement

Suggested reviewers

  • kushagrasarathe
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the KYC drawer change to prefer per-label reject copy over the generic action message.
Description check ✅ Passed The description matches the PR’s KYC reject-copy fix and fallback behavior, so it is clearly on-topic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 5845.66 → 5846.08 (+0.42)
Findings: 0 net (+1 new, -1 resolved)

🆕 New findings (1)

  • low missing-return-type — src/components/Kyc/states/KycActionRequired.tsx:16 — KycActionRequired: exported fn missing return type annotation

✅ Resolved (1)

  • src/components/Kyc/states/KycActionRequired.tsx:10 — KycActionRequired: exported fn missing return type annotation

@github-actions

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 1599 ran, 0 failed, 0 skipped, 22.8s

📊 Coverage (unit)

metric %
statements 54.2%
branches 36.7%
functions 41.7%
lines 54.1%
⏱ 10 slowest test cases
time test
3.6s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
0.6s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in updateUserById
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in updateUserById body
0.1s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Manteca PIX form ready shows merchant card + amount input + pay button
0.1s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Perk claim in progress shows disabled button + progress
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 valid US account with spaces
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 ETH address
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@jjramirezn jjramirezn marked this pull request as ready for review June 29, 2026 12:02
@jjramirezn jjramirezn requested a review from Hugo0 June 29, 2026 12:02
@jjramirezn jjramirezn closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant