fix(demo+passkey): /rain/cards demo fixture, WebKit 'Load failed' classification, full auth clear - #2517
fix(demo+passkey): /rain/cards demo fixture, WebKit 'Load failed' classification, full auth clear#2517innolope-dev wants to merge 2 commits into
Conversation
…ssification, full auth clear Ports the applicable subset of mobile-release 9cdb8ae: - demo: add /rain/cards fixture so overview consumers never see the {} fallback (crashes deref of .status/.cards — PEANUT-UI-RM6 on native) - passkey: classify WebKit 'Load failed' fetch errors as NETWORK instead of the LOGIN_ERROR modal (PEANUT-UI-QV6) - auth: clearAuthState delegates to clearAuthToken so native token stores are cleared too, not just the jwt cookie
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a demo ChangesRain cards demo fallback
Shared authentication token cleanup
WebAuthn network-error classification
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Comment |
Code-analysis diffPainscore total: 6273.99 → 6275.16 (+1.17) 🆕 New findings (7)
✅ Resolved (7)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/utils/__tests__/demo-api.test.ts (1)
81-88: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert that the fallback cards list is empty.
Line 87 only verifies the type, so the test would still pass if demo mode returned unexpected cards. Assert the exact fallback value.
Proposed test assertion
- expect(Array.isArray(data.cards)).toBe(true) + expect(data.cards).toEqual([])🤖 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/utils/__tests__/demo-api.test.ts` around lines 81 - 88, The rain card overview test should verify the fallback cards list is empty, not only that data.cards is an array. Update the assertion in the “demoRespond — rain card overview” test to check the exact empty-array value while preserving the existing response status, status, and balance assertions.
🤖 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/utils/auth.utils.ts`:
- Around line 24-26: Update clearAuthState to be asynchronous and await
clearAuthToken instead of discarding its Promise, ensuring native token cleanup
completes before the function returns. Find every caller of clearAuthState and
await the returned Promise, preserving the existing cleanup behavior.
---
Nitpick comments:
In `@src/utils/__tests__/demo-api.test.ts`:
- Around line 81-88: The rain card overview test should verify the fallback
cards list is empty, not only that data.cards is an array. Update the assertion
in the “demoRespond — rain card overview” test to check the exact empty-array
value while preserving the existing response status, status, and balance
assertions.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 105a83f7-6017-4223-967e-d0b895443421
📒 Files selected for processing (5)
src/utils/__tests__/demo-api.test.tssrc/utils/__tests__/webauthn.utils.test.tssrc/utils/auth.utils.tssrc/utils/demo-api.tssrc/utils/webauthn.utils.ts
Review follow-up: clearAuthToken's Preferences/cookie-jar clears are async; make clearAuthState await them so callers can't proceed on a half-cleared session (in-memory clear was already synchronous).
…s, PIX exit, verification tasks Cherry-picks the open native-facing work onto the release branch: - KYC now routes every native entry point through the Sumsub Cordova SDK instead of the WebSDK (peanut-ui #2562) — the one change here that genuinely requires a new binary rather than an OTA. - Deferred deep linking survives the store install, so a link followed before install lands on its destination on first launch (#2560, TASK-20772). - PIX deposit "Done" exits to home from both the completed and processing states instead of dropping the user into a new deposit (#2548). - Pending Bridge verification tasks card on home, dismissible and resurfaced under Unlocked regions (#2549). - Native demo/passkey follow-ups: the awaited token clear in clearAuthState plus the two callers it changed (#2517 — the rest shipped in 1.0.40). - Documents left running on a superseded deployment now reload (#2563). - Android safe zone sized from natively measured insets. Not carried: the CSP allow-list gaps (#2564). It builds on the #2519 collector rework — a /api/csp-report route and ten commits that are not on this branch — and the policy is report-only, so the gaps cost report fidelity, not behaviour.
Ports the applicable subset of the v1.0.40 mobile-release fix (
9cdb8aec0) to main.Context
Two native regressions reported on TestFlight 1.0.39 (34):
demoinvite code crashed the app on /home (PEANUT-UI-RM6): the demo router has no/rain/cardsroute, so its shape-aware fallback returned{}, and overview consumers deref.status/.cards.TypeError: Load failed, whichisNetworkErrordidn't match, so transient connection drops (typical right as the app foregrounds from the passkey sheet) surfaced as "We couldn't verify your passkey" instead of the network-error copy.Changes
demo-api.ts:GET /rain/cards→{ status: { hasApplication: false }, balance: null, cards: [] }(+ test). Also future-proofs the guardedrefetchIntervalthat currently lives on mobile-release.webauthn.utils.ts: addload failedto the network-error heuristic (+ test).auth.utils.ts:clearAuthStatedelegates toclearAuthToken()so native token stores are cleared too, not just the jwt cookie.Not ported (mobile-release-only stack): the
/passkeys/*non-2xx Sentry reporting innative-auth-capture.tsand the mid-flight token-rotation guard inuseUserQuery— those files/mechanisms don't exist on main yet and will arrive with the next mobile-release↔main sync.Testing
jest demo-api.test.ts webauthn.utils.test.ts— 28 passed.Summary by CodeRabbit
NETWORK.