Skip to content

revert(TASK-22471): back out tech-debt integration — dev must be shippable for the KYC binary rebuild - #3078

Closed
kushagrasarathe wants to merge 2 commits into
devfrom
revert/22471-tech-debt
Closed

kushagrasarathe wants to merge 2 commits into
devfrom
revert/22471-tech-debt

Conversation

@kushagrasarathe

Copy link
Copy Markdown
Contributor

TASK-22471 · P1 · Revert the tech-debt integration so dev is shippable to production

What: single git revert -m 1 b9d78f104 (PR #3062, tech-debt-integration — which carried PR #3008's qr-pay split inside it; #3008 never merged to the dev mainline separately). Dev returns to the code production runs, plus every post-tech-debt production fix.

Why: Kushagra's call — the tech-debt restructures are broken at runtime (unit/typecheck don't cover flow behavior; no Nutcracker smoke was run on them), and BOTH ship pipelines (release-ota.yml and release-native.yml) hard-guard ref == dev, so nothing can ship to users until dev tip is production-safe. This revert is the sanctioned path: the Android binary rebuild for the Sumsub/KYC P1 dispatches from dev right after this merges (the web-fallback alternative, PR #3077, was closed — Kushagra wants the corrected binary instead). The migration flag was rolled back (v7: existing users only, 90%), so there is no urgency spike — but the KYC binary still waits on this.

Correctness proof — diff vs the live production OTA tag 77fdd881b:

git diff --name-only 77fdd881b HEAD -- src/   ===   git diff --name-only b9d78f104 origin/dev -- src/
→ IDENTICAL 13-file sets
 add-money/__tests__/add-money-states.test.tsx      |  16 +
 withdraw/crypto/__tests__/crypto-withdraw-confirm  | 120 +-
 withdraw/crypto/page.tsx                           |  73 +-
 Claim/__tests__/useClaimLink.sentry.test.tsx       |  24 +
 Claim/useClaimLink.tsx                             |  41 −
 LandingPage/LandingPageClient.tsx                  |  27 +-
 Send/.../Success.link.send.view.tsx (+cancel test) |  24 +-
 TransactionDetails/useReceiptActions (+test)       |  16 +-
 src/content (submodule)                            |   2 +-
 hooks/query/user.ts (+test)                        |  24 +-
 = 13 files, +305 −62

Every file traces to the post-tech-debt production merges (#3063, #3071, #3074, #3073 back-merge). Nothing from #3008/#3062 survives; nothing production loses.

The one hand-merge (documented per instruction) — withdraw/crypto/page.tsx + its test were the only conflicts: #3063 (TASK-21087, cancel abandoned withdrawal drafts) landed on the refactored page, so its semantics were re-expressed onto the pre-refactor shape:

  • post-refactor stepper.step leaving 'review' → pre-refactor currentView leaving 'CONFIRM' (watcher covers Back and every other exit; the redundant back-handler call was not duplicated)
  • alreadySpent guard line already existed differently pre-refactor; only fix(TASK-21087): cancel abandoned crypto withdrawal drafts #3063's cancelledChargeIdsRef guard was added
  • all draft-cleanup refs, generation guards, in-flight locks, cancel-on-failed-create/fetch, never-cancel-after-signing: ported 1:1
  • test suite ported to the pre-refactor harness (initial-view testid, currentView switching, ActionModal mock upgraded to expose onClose): 8 draft-cleanup tests, all green

Gate (fresh worktree at 48c998e): typecheck clean · unit 523/525 suites green — the 2 failures (AddWithdrawCountriesList, UnlockPayments) are pre-existing timezone-flaky date assertions that fail identically on unmodified dev tip from an IST machine and are green in CI/UTC · prettier clean · npm run build green. (Worktree note: the phantom TS2307 *.svg class is the gitignored generated next-env.d.ts — copy it from an existing checkout; worth adding to the worktree docs.)

After merge: dispatch release-native.yml (Android rebuild with the Sumsub plugin actually synced — verify the cap-sync step in the workflow) and release-ota.yml as needed; both build from dev.

…integration"

This reverts commit b9d78f1, reversing
changes made to 77fdd88.
@notion-workspace

Copy link
Copy Markdown

@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
peanut-wallet Ready Ready Preview Sep 9, 2026 6:31pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6f5103cb-8b30-4300-bb64-629d2b11aaf6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

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

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 8914.96 → 7294.87 (-1620.09)
Findings: -491 net (+901 new, -1392 resolved)

🆕 New findings (901)

  • critical complexity — src/components/Global/InvitesGraph/index.tsx — CC 515, MI 53.31, SLOC 1723
  • critical complexity — src/app/(mobile-ui)/qr-pay/page.tsx — CC 345, MI 52.77, SLOC 1251
  • critical complexity — src/components/Claim/Link/Initial.view.tsx — CC 226, MI 49.87, SLOC 807
  • critical complexity — src/utils/general.utils.ts — CC 177, MI 58.04, SLOC 663
  • critical complexity — src/app/(mobile-ui)/withdraw/manteca/page.tsx — CC 173, MI 51.38, SLOC 667
  • critical complexity — src/components/AddWithdraw/DynamicBankAccountForm.tsx — CC 150, MI 51.87, SLOC 464
  • critical complexity — src/app/(mobile-ui)/card/page.tsx — CC 143, MI 56.21, SLOC 546
  • critical complexity — src/app/(mobile-ui)/withdraw/page.tsx — CC 125, MI 53.28, SLOC 375
  • critical complexity — src/app/(mobile-ui)/withdraw/crypto/page.tsx — CC 124, MI 50.31, SLOC 561
  • critical complexity — src/components/AddWithdraw/AddWithdrawCountriesList.tsx — CC 124, MI 56.34, SLOC 384
  • critical complexity — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx — CC 122, MI 57.36, SLOC 411
  • critical complexity — src/components/Claim/Link/views/BankFlowManager.view.tsx — CC 116, MI 47.55, SLOC 450
  • critical complexity — src/context/kernelClient.context.tsx — CC 115, MI 56.58, SLOC 550
  • critical complexity — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx — CC 107, MI 53.41, SLOC 399
  • critical complexity — src/components/Claim/Claim.tsx — CC 100, MI 53.63, SLOC 400
  • critical complexity — src/components/AddWithdraw/AddWithdrawRouterView.tsx — CC 99, MI 58.24, SLOC 278
  • critical complexity — src/components/Request/link/views/Create.request.link.view.tsx — CC 97, MI 52.95, SLOC 336
  • critical complexity — src/components/Home/HomeHistory.tsx — CC 96, MI 56.03, SLOC 302
  • critical complexity — src/components/Setup/Views/Residence.tsx — CC 94, MI 61.08, SLOC 295
  • critical method-complexity — src/app/(mobile-ui)/qr-pay/page.tsx:114 — QRPayPage CC 90 SLOC 461

…and 881 more.

✅ Resolved (1392)

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx — CC 190, MI 50.97, SLOC 741
  • src/components/Claim/Link/useInitialClaimFlow.ts — CC 182, MI 48.69, SLOC 775
  • src/utils/general.utils.ts — CC 177, MI 58.06, SLOC 662
  • src/features/payments/flows/qr-pay/useQrPayFlow.ts — CC 157, MI 52.82, SLOC 610
  • src/components/AddWithdraw/DynamicBankAccountForm.tsx — CC 146, MI 51.99, SLOC 442
  • src/app/(mobile-ui)/withdraw/crypto/page.tsx — CC 135, MI 49.16, SLOC 591
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx — CC 133, MI 56.19, SLOC 394
  • src/components/Claim/Link/views/BankFlowManager.view.tsx — CC 116, MI 47.63, SLOC 446
  • src/context/kernelClient.context.tsx — CC 115, MI 57.01, SLOC 530
  • src/components/Home/HomeHistory.tsx — CC 96, MI 56.02, SLOC 302
  • src/features/card/useCardFlow.ts — CC 96, MI 53.08, SLOC 454
  • src/components/Setup/Views/Residence.tsx — CC 94, MI 61.42, SLOC 287
  • src/app/(setup)/setup/page.tsx — CC 86, MI 56.6, SLOC 304
  • src/components/Global/InvitesGraph/useInvitesGraphRendering.ts — CC 85, MI 37.45, SLOC 404
  • src/components/Invites/InvitesPage.tsx — CC 85, MI 55.6, SLOC 207
  • src/features/withdraw/useWithdrawRootFlow.ts — CC 85, MI 50.82, SLOC 335
  • src/components/Request/link/views/useCreateRequestLink.ts — CC 82, MI 53.4, SLOC 329
  • src/components/Claim/useClaimFlow.ts — CC 80, MI 52.96, SLOC 387
  • src/components/Invites/JoinWaitlistPage.tsx — CC 78, MI 56.17, SLOC 292
  • src/components/Global/InvitesGraph/useInvitesGraphData.ts — CC 77, MI 55.27, SLOC 273

…and 1372 more.

📈 Painscore deltas (top movers)

File Before After Δ
src/components/Global/InvitesGraph/index.tsx 12.9 28.4 +15.5
src/app/(mobile-ui)/qr-pay/page.tsx 17.5 32.2 +14.7
src/components/Withdraw/views/Initial.withdraw.view.tsx 0.0 10.7 +10.7
src/components/Withdraw/views/Confirm.withdraw.view.tsx 0.0 10.6 +10.6
src/components/AddWithdraw/AddWithdrawRouterView.tsx 0.0 10.5 +10.5
src/app/(mobile-ui)/add-money/[country]/bank/page.tsx 7.8 18.2 +10.4
src/context/WithdrawFlowContext.tsx 0.0 9.6 +9.6
src/app/(mobile-ui)/card/page.tsx 5.8 15.0 +9.2
src/components/Withdraw/views/PixKeySend.view.tsx 0.0 7.8 +7.8
src/app/(mobile-ui)/withdraw/page.tsx 7.2 14.6 +7.3
src/app/(mobile-ui)/qr/[code]/page.tsx 3.1 10.1 +7.0
src/hooks/useSetupStepUrlSync.ts 0.0 7.0 +7.0
src/app/(mobile-ui)/qr-pay/init-error-classifier.ts 0.0 6.0 +6.0
src/app/(mobile-ui)/fix-card-signature/page.tsx 2.2 8.1 +5.8
src/components/Claim/Link/Initial.view.tsx 14.8 20.3 +5.5
src/app/(mobile-ui)/card-recovery/page.tsx 2.9 8.3 +5.5
src/components/Kyc/SumsubKycWrapper.tsx 6.1 11.4 +5.3
src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx 12.9 17.4 +4.6
src/redux/slices/bank-form-slice.ts 0.0 4.2 +4.2
src/app/(mobile-ui)/rewards/page.tsx 4.5 8.7 +4.2

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • ✅ unit: 6684 ran, 0 failed, 0 skipped, 2.2m

📊 Coverage (unit)

metric %
statements 76.7%
branches 63.1%
functions 70.8%
lines 77.7%
⏱ 10 slowest test cases
time test
🐢 9.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Network failure keeps loading while retries remain, then shows the generic error
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › MANTECA_MERCHANT_VOLUME_NEAR_CAP fails fast with copy that names the real cause
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › MANTECA_MERCHANT_RECENT_REFUND fails fast with copy that names the real cause
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › User KYC not approved fails fast with copy that names the real cause
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › MANTECA_USER_NOT_PROVISIONED fails fast with copy that names the real cause
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › routes the KYC rejection on its wire code, and does not retry it
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › MANTECA_SOURCE_OVER_MONTHLY_CAP fails fast with copy that names the real cause
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › a refused idempotency key tells the user to scan again, not to contact support
3.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Going offline blames the connection, and reconnecting clears it for the recovered scan
3.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Scan that recovers on the retry lands on the payment screen, not an error
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

the revert restores one pre-tech-debt hover file; the ratchet only goes
down, so the intentional increase is recorded with --allow-increase
(TASK-22471)
@kushagrasarathe

Copy link
Copy Markdown
Contributor Author

Re-scoped: this PR is no longer the release vehicle for the Android KYC fix — the team ships from release/android-kyc (Jota's branch off the production OTA tag, with sanctioned workflow-guard extensions; Hugo's call to keep dev untouched). This revert now stands only as a dev-hygiene proposal for the tech-debt-on-dev question. Jota flagged he's not confident every one of his dev merges is correctly preserved here — please treat his review as required before any merge, or close in favor of a fix-forward on the tech-debt work. Not urgent.

@kushagrasarathe

Copy link
Copy Markdown
Contributor Author

Closing per Kushagra: the Android KYC fix ships from release/android-kyc (Jota's branch), so this revert has no release role, and as a dev-hygiene change it needs Jota's line-by-line review he's flagged he can't confidently give it. Branch revert/22471-tech-debt is retained — reopen if the dev-runtime question lands on 'revert' after a Nutcracker/manual smoke of the tech-debt flows on dev tip (the open question this PR was answering; to be settled by Kushagra + Jota separately). The diff-vs-OTA-tag verification method and the #3063 hand-port notes in the PR body remain the reference for that work.

@chip-peanut-bot

Copy link
Copy Markdown
Contributor

This pull request was already closed when the review finished, so these findings are follow-up work rather than a gate.

Chip review — no blocking findings — this is not an approval

The application rollback preserves the post-integration fixes and exact-head required CI is green, but the revert also restores the 250-commit ceiling in both provenance gates, blocking valid large promotion PRs.

Findings

  • MAJOR · .github/workflows/bot-approval.yml:112 · Keep the large-PR provenance pagination fix
    This restored pulls.listCommits call can enumerate at most 250 commits, after which lines 120-123 deliberately fail closed. The revert therefore undoes standalone fix 5c9a2ac and deletes its >250-commit regression test: the next large dev-to-main promotion cannot satisfy either required bot-approval or human-authors gate even when every commit is valid. Exclude that fix and its test from the rollback so both workflows retain the pinned, paginated compare implementation.

  • MAJOR · src/components/Claim/Link/Initial.view.tsx:1026 · [claude-opus] Post-auth auto-claim restored with no test and no consume-once guard
    The revert deletes src/components/Claim/Link/__tests__/Initial.view.autoClaim.test.tsx (347 lines) and restores the ?step=claim auto-claim effect inline in Initial.view.tsx:1026-1044, which calls handleClaimLink(false, true) — an on-chain claim of a send link. Nothing else covers it: the only remaining step=claim tests are src/services/__tests__/post-auth-redirect.test.ts and src/hooks/__tests__/post-auth-redirect-consumers.test.tsx, and both assert the redirect producer, never the consumer that moves the money.

Exact untested case (the deleted test's fourth assertion, 'a user refetch mid-claim (new user identity) does not fire a second claim POST'): the restored effect depends on [user, searchParams, isPeanutWallet, selectedTokenData, address] and its only de-dupe is removeParamStep(), which in src/components/Claim/useClaimLink.tsx:499-506 is a raw window.history.replaceState — Next's useSearchParams() does not observe it, so searchParams.get('step') still reads 'claim' on the next run. handleClaimLink itself calls fetchUser() at Initial.view.tsx:328 for a user without app access, which replaces the user object identity and re-fires the effect. Result: a second claim POST against an already-claimed link, which rejects and paints an error over the success screen. The #3062 version had a consume-once guard; the restored version has neither the guard nor the test (_autoClaim is an unused parameter).

Fix: add a useRef consume-once latch around the stepFromURL === 'claim' branch and restore a test covering the fetchUser-mid-claim re-render, or keep the extracted useInitialClaimFlow guard.

  • MAJOR · src/components/TransactionDetails/strategies/registry.ts:25 · [claude-opus] IntentKind union drops four TransactionIntentKind values peanut-api-ts writes
    The revert replaces the OpenAPI-derived IntentKind (paths['/history/{entryId}']['get']['parameters']['query']['kind']) with a hand-written union at src/components/TransactionDetails/strategies/registry.ts:25 and deletes strategies/intent/ledger-generic.ts. The hand-written union omits P2P_SEND, INTERNAL_TRANSFER, REWARD_PAYOUT and CHARGEBACK. All four are live members of TransactionIntentKind in peanut-api-ts/prisma/schema.prisma:1399-1417, and INTERNAL_TRANSFER / REWARD_PAYOUT are actively written today (src/ledger/card-spend.ts:487, src/routes/rain/helpers.ts:675; REWARD_PAYOUT is an INFLOW kind per src/depositWatchService.ts:42-45). The same commit strips the enum from the vendored src/types/api.openapi.json /history/{entryId} kind parameter, so pnpm gen:api no longer catches the drift and the compile-time totality check over Record<IntentKind, …> is gone.

Failure: a REWARD_PAYOUT history entry reaches dispatchStrategy (registry.ts:103-106), isIntentKind returns false, and it falls through to intentFallback, which returns direction: 'send' / transactionCardType: 'send' — a reward credit rendered to the user as an outgoing payment — plus a pipelineAlert('unknown_transformer_kind', …) warning per row. resolveReceiptKind likewise returns undefined for ?kind=REWARD_PAYOUT, so those receipt URLs stop resolving. This is exactly the shape the deleted ledger-generic.ts header names as TASK-21403.

This does not break peanut-api-ts — the direction is the other way: peanut-ui will misrender live backend rows. Note that the backend half of the paired TASK-21815 change is already merged and tolerant (peanut-api-ts/src/routes/rain/withdraw.ts:418-421 explicitly accepts and ignores the re-sent kind), so the rain-prepare side of this revert is safe; only the history vocabulary is not.

Fix: keep IntentKind derived from api.generated.ts and restore the INTERNAL_TRANSFER / CHARGEBACK strategies plus the P2P_SEND and REWARD_PAYOUT map entries, or, if the revert must stay whole, re-run pnpm gen:api and add the four kinds back to the hand-written union.

Inline anchors unavailable for 3 finding(s); the findings remain in this summary.

Checked clean

  • Verified HEAD, base, and merge base against the supplied SHAs; the detached worktree is clean and git diff --check passes.
  • Compared the final tree with ota-1.5.4: only the 13 post-integration application/content files plus the intentional design-system baseline differ; every other rolled-back path is byte-identical to that production tag.
  • Reviewed the manually ported crypto-withdraw draft cleanup: generation invalidation, double-submit locks, back/modal/unmount cancellation, and post-signing non-cancellation are covered by eight focused tests.
  • Reviewed the preserved post-integration fixes for link-cancellation refresh, transient user-query failures, the landing download CTA, and the content pointer.
  • Exact-head ci-success, unit, typecheck, format, native-export, eslint, ds-lint, analysis, deployment preview, human-authors, and bot-approval passed; ds-shots was still running at review time.
  • Focused Jest execution was unavailable locally because dependencies are absent from the detached worktree; the exact-head CI unit suite passed.

Security review by moonshotai/kimi-k3: 0 finding(s), marked with the model name. It reads the diff only and answers only security, privacy and money, so treat its findings as advice.

Third opinion by claude-opus: 2 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: debb2136460c · Context: repo, api · Took 13m

This branch was successfully deployed

1 active deployment
Preview — debb2136 Deployed Sep 9, 2026 by vercel[bot]
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.

1 participant