Skip to content

fix(manteca): PIX QR no longer vanishes — settling gates on stage, not PROCESSING#2337

Merged
Hugo0 merged 1 commit into
mainfrom
fix/pix-qr-processing-state
Jul 2, 2026
Merged

fix(manteca): PIX QR no longer vanishes — settling gates on stage, not PROCESSING#2337
Hugo0 merged 1 commit into
mainfrom
fix/pix-qr-processing-state

Conversation

@jjramirezn

Copy link
Copy Markdown
Contributor

Fix: PIX QR vanishes into a permanent loader (state-machine bug from #2335)

Bug (reported by Jota testing prod): QR renders, then the screen flips back to a loader and the QR is lost — before the user can pay.

Root cause: Manteca flips a ramp-on synthetic to ACTIVE seconds after creation ("QR live, awaiting fiat" — nobody paid). ACTIVE maps to intent PROCESSING on the BE, and useMantecaDepositPolling treated PROCESSING as "payment detected, settling" → the next 5s poll swapped the QR for CyclingLoading, permanently.

Fix: the settling screen now gates on the synthetic stage returned by GET /manteca/deposit/:id/status (api#1112): stage 1 = QR stays visible; stage ≥ 2 = fiat received → settling; COMPLETED → success. A missing/null stage (older BE, legacy intent) degrades to keeping the QR visible — never stranding the user on a loader — so deploy order vs api#1112 is flexible (BE-first still preferred; until it deploys, the interstitial simply doesn't appear).

Tests: hook — the regression case (PROCESSING + stage 1 → pending), stage ≥ 2 → processing, stage: null degrade, plus the existing completed/failed/no-id cases. Full suite 1659/1663 (1 pre-existing main failure: add-money-states › loaded EVM deposit, unrelated; 3 skipped).

Cross-repo: companion BE peanutprotocol/peanut-api-ts#1112.

🤖 Generated with Claude Code

…t PROCESSING

Manteca flips a ramp-on to ACTIVE (→ intent PROCESSING) seconds after
creation, while the user hasn't paid. The polling hook read PROCESSING as
'payment detected' and swapped the QR for a permanent CyclingLoading —
the reported 'QR shows, then loads again, and it's lost'. The BE status
endpoint now returns the synthetic stage (api#1112); the settling screen
only shows once stage >= 2 (fiat actually received). Absent/null stage
(older BE, legacy row) degrades to keeping the QR visible.
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
peanut-wallet Building Building Preview, Comment Jul 2, 2026 8:59pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 2, 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: f5aa99e8-0a9a-4139-8728-56fe663792a3

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4b994 and 6f027c8.

📒 Files selected for processing (3)
  • src/components/AddMoney/hooks/__tests__/useMantecaDepositPolling.test.tsx
  • src/components/AddMoney/hooks/useMantecaDepositPolling.ts
  • src/services/manteca.ts

Walkthrough

The Manteca deposit polling hook now determines "processing" status based on a numeric synthetic stage field (stage >= 2) rather than the intent's status value. The getDepositStatus API return type gains an optional stage field, and tests were updated to cover stage-based transitions.

Changes

Stage-based deposit status

Layer / File(s) Summary
API type update
src/services/manteca.ts
getDepositStatus return type now includes optional stage?: number | null with a documenting comment.
Stage-based processing derivation
src/components/AddMoney/hooks/useMantecaDepositPolling.ts
Adds PAID_STAGE = 2 constant; status logic now maps stage >= PAID_STAGE to "processing", keeps COMPLETED/failed status handling, and defaults to "pending" when stage is missing or non-numeric.
Hook tests for stage transitions
src/components/AddMoney/hooks/__tests__/useMantecaDepositPolling.test.tsx
New tests assert "pending" at stage 1, "processing" only at stage >= 2, and fallback to "pending" when stage is null/missing; removes prior status-only test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Related PRs: None specified

Suggested labels: bug-fix, add-money, manteca

Suggested reviewers: None specified

Poem:
A rabbit watched the stages climb,
No longer trusting status time,
At stage of two, the coins arrive,
"Processing" now begins to thrive,
Tests confirm each hop and stage—
Hop, hop, hooray, we turn the page! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: switching Manteca QR settling from PROCESSING to stage-based gating.
Description check ✅ Passed The description clearly matches the implemented stage-based QR fix and test updates.
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.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 5840.45 → 5840.84 (+0.39)
Findings: +1 net (+5 new, -4 resolved)

🆕 New findings (5)

  • medium structural-dup — services/manteca.ts:151 — 29 duplicate lines / 56 tokens with services/manteca.ts:415
  • medium complexity — src/components/AddMoney/hooks/useMantecaDepositPolling.ts — CC 15, MI 64.92, SLOC 42
  • low high-mdd — src/components/AddMoney/hooks/useMantecaDepositPolling.ts:24 — useMantecaDepositPolling: MDD 11.4 (uses across many lines from declarations)
  • low high-mdd — src/services/manteca.ts:406 — withdrawWithSignedTx: MDD 11.4 (uses across many lines from declarations)
  • low missing-return-type — src/components/AddMoney/hooks/useMantecaDepositPolling.ts:24 — useMantecaDepositPolling: exported fn missing return type annotation

✅ Resolved (4)

  • services/manteca.ts:151 — 29 duplicate lines / 56 tokens with services/manteca.ts:412
  • src/components/AddMoney/hooks/useMantecaDepositPolling.ts — CC 15, MI 65.25, SLOC 42
  • src/services/manteca.ts:403 — withdrawWithSignedTx: MDD 11.4 (uses across many lines from declarations)
  • src/components/AddMoney/hooks/useMantecaDepositPolling.ts:21 — useMantecaDepositPolling: exported fn missing return type annotation

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 1663 ran, 0 failed, 0 skipped, 25.2s

📊 Coverage (unit)

metric %
statements 54.9%
branches 37.9%
functions 42.7%
lines 54.8%
⏱ 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.4s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.4s 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/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
0.1s src/services/__tests__/resolveClaimLink.test.ts › restores the pristine password after a redirect mangles the fragment
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 valid ETH address
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle minimum length (6 digits) US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle invalid ETH address (invalid characters)
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@Hugo0 Hugo0 merged commit 1b75fbb into main Jul 2, 2026
19 of 23 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