fix(auth): restore native sessions after WebView restart - #519
Conversation
|
To use Codex here, create a Codex account and connect to github. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe authentication context now uses ChangesInsforge session recovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change adds bounded native session recovery after a fresh WebView launch while preserving existing-session and failure behavior. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant InsforgeAuthContext
participant restoreInsforgeUser
participant client.auth
InsforgeAuthContext->>restoreInsforgeUser: Restore the current user
restoreInsforgeUser->>client.auth: Get current user
client.auth-->>restoreInsforgeUser: Return user or auth error
restoreInsforgeUser->>client.auth: Refresh session when recovery is allowed
client.auth-->>restoreInsforgeUser: Return refreshed session
restoreInsforgeUser->>client.auth: Get current user again
client.auth-->>restoreInsforgeUser: Return recovered user
restoreInsforgeUser-->>InsforgeAuthContext: Return session result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Your free Security trial is over. An organization admin can activate billing to continue. 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 |
Summary
Restore a native dashboard session after a fresh WKWebView launch by performing one bounded refresh through the local auth relay when persisted refresh credentials exist.
Scope
src/)dashboard/)TokenTrackerBar/)TokenTrackerWin/)Checklist
npm testpassesdashboard/src/content/copy.csv(no new user-facing strings)fix:)Risk layer addendum — expand if this PR touches any trigger below
Risk layer triggers
Rules / invariants
Boundary matrix (list at least 3)
Public exposure checklist (if applicable)
Codex review context — fill when requesting
@codexreviewnpm test— 2,432 passed, 0 failed, 2 skippednpm --prefix dashboard exec vitest run src/contexts/__tests__/InsforgeAuthContext.test.jsx— 6 passedMost likely regression surface
Native OAuth callback timing and signed-out dashboard startup behavior.
Verification method (choose at least one)
Uncovered scope
No automated real-Google-account reboot test; this still needs one manual verification on macOS 27 after merging.
Summary by CodeRabbit