fix: localize Pix key validation errors - #3103
chip-peanut-bot[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code-analysis diffPainscore total: 8994.43 → 8994.53 (+0.1) 🆕 New findings (2)
✅ Resolved (2)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
There was a problem hiding this comment.
Chip review — no blocking findings — this is not an approval
The Pix key screen now consistently renders validation failures through the selected locale, with focused Portuguese and Latin American Spanish regression coverage. No actionable defects found.
Findings
- MINOR · src/features/withdraw/views/PixKeySendView.tsx:38 · [claude-opus] Pasted PIX Automático code now says only "Invalid Pix key"
validatePixKey returns a deliberately specific message for recurring codes —PIX Automático (recurring) codes are not supported(src/utils/withdraw.utils.ts:329, with a comment stating the intent that "every recurring shape gets the specific message instead of the generic one"). Droppingresult.messagemeans a user who pastes a recurring copia-e-cola into this view now only seeswithdraw.pixKey.invalid("Chave Pix inválida"), with no hint that the code type itself is unsupported and that a regular Pix QR is needed. Everywhere else the product does explain it: the scanner classifies these as EQrType.PIX_RECURRING and qr-pay renders the localizedpixRecurring/titlePixRecurringcopy (src/i18n/app/messages/en.json:1335, 3218-3221, src/features/payments/flows/qr-pay/useQrFailureCopy.ts:38). This is exactly the pattern tracked as an open problem in product truth — /home/chip/mono/product/feedback/problems/payment-error-copy-wrong-or-generic.md, whose lead evidence is "A single generic error message is shown for all PIX payment failure causes, hiding the real reason from the user". The code is what's wrong here, not the product doc. Fix: keep the localization but branch on the known case, e.g.setErrorMessage(isPixRecurringCode(normalized) ? tQr('errors.pixRecurring') : t('pixKey.invalid')), reusing the string that already exists in all three locale files.
Checked clean
- Confirmed the detached worktree head, trusted author, dev base ref, base SHA, and merge base exactly match the supplied review pin.
- Traced every validatePixKey failure through PixKeySendView and confirmed invalid inputs now use withdraw.pixKey.invalid while valid inputs and QR-pay routing are unchanged.
- Verified pt-BR and es-419 contain localized invalid-key copy; es-AR inherits the es-419 value through the resolved catalog merge.
- Reviewed ValidatedInput debounce, stale-validation, clear, and state-update behavior for regressions around the changed callback.
- Exact-head unit, typecheck, eslint, format, native-export, CodeQL, and aggregate CI checks passed; the remaining bot-approval failure only awaits the human orderer's approval.
- Local Jest execution was unavailable because this detached worktree has no installed Jest binary; exact-head CI unit coverage passed instead.
Security review: did not run — this change has no security, privacy or money surface, so it was not asked. This review is one reviewer short.
Third opinion by claude-opus: 1 finding(s), marked with the model name. It answers only product truth, missing tests and the cross-repo contract, so treat its findings as advice.
Exact head: 25ea5a5ed111 · Context: repo · Took 8m
🖼 Visual diff — 11 screens moved15 of 74 shots changed · 59 identical · baseline
job summary · before/after/diff images — artifact Fixture screenshots, no backend. Advisory — this check never blocks a merge. Posted from the default branch by ds-shots-comment.yml; the report it renders is untrusted data. |
Summary
Why
The Pix key screen exposed the validator's internal English message even when the app language was Portuguese or Spanish.
Verification
pnpm exec jest src/features/withdraw/views/__tests__/PixKeySendView.test.tsx src/i18n/app/__tests__/messages.test.ts --runInBandpnpm exec eslint src/features/withdraw/views/PixKeySendView.tsx src/features/withdraw/views/__tests__/PixKeySendView.test.tsxpnpm typecheckpnpm prettier --check src/features/withdraw/views/PixKeySendView.tsx src/features/withdraw/views/__tests__/PixKeySendView.test.tsxRequested by @abalinda — https://discord.com/channels/972435984954302464/1483085665930444944/1547653726704246835