Skip to content

fix: preserve login sessions after legacy profile imports - #88

Merged
AnnaSuSu merged 1 commit into
mainfrom
codex/fix-imported-profile-login
Oct 14, 2026
Merged

AnnaSuSu merged 1 commit into
mainfrom
codex/fix-imported-profile-login

Conversation

@AnnaSuSu

Copy link
Copy Markdown
Owner

Importing a legacy backup with unscored weak points could make /api/profile return 500. Preserve sr.last_score: null in 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.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_score values 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.

@AnnaSuSu
AnnaSuSu merged commit 99bf306 into main Oct 14, 2026
7 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