Repository navigation
fix: preserve login sessions after legacy profile imports - #88
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The contract, session-recovery implementation, generated types, and regression coverage are consistent with the stated behavior.
0 open findings
What changed in this PR
Preserves legacy profile data compatibility and adds recoverable session verification for transient backend failures.
Changes:
- Allows nullable legacy
last_scorevalues across contracts and generated types. - Adds identity/settings verification with retry recovery while preserving valid saved sessions.
- Adds migration and frontend regression tests.
| File | Description |
|---|---|
tests-ts/data-migration.test.ts |
Tests repeated reads after legacy import. |
packages/contracts/src/profile-responses.ts |
Accepts nullable legacy scores. |
packages/contracts/openapi.json |
Documents nullable scores. |
frontend/src/lib/sessionVerification.test.js |
Tests verification outcomes. |
frontend/src/lib/sessionVerification.js |
Implements session verification. |
frontend/src/contexts/AuthContextBase.ts |
Exposes recovery state and retry. |
frontend/src/contexts/AuthContext.tsx |
Preserves sessions on transient failures. |
frontend/src/components/SessionRecovery.tsx |
Adds the retry screen. |
frontend/src/App.tsx |
Routes verification failures to recovery. |
frontend/src/api/schema.d.ts |
Updates generated nullable-score types. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Importing a legacy backup with unscored weak points could make
/api/profilereturn 500. Preservesr.last_score: nullin profile responses, and keep saved login sessions through transient identity or settings failures with a retry screen. Invalid tokens and mismatched identities still end the session.Validation: legacy archive import followed by repeated HTTP profile reads without rewriting the saved data; 532 backend and contract tests; frontend regression tests, type checks, lint and production builds. Browser checks cover 500 responses, reload, retry and a failing profile after successful authentication.