Skip to content

fix(storage): deserialize legacy ChatGPT auth mode and data variants (#58) - #196

Open
ege-arhan wants to merge 2 commits into
Lampese:mainfrom
ege-arhan:fix/issue-58-legacy-auth-mode-deserialization
Open

ege-arhan wants to merge 2 commits into
Lampese:mainfrom
ege-arhan:fix/issue-58-legacy-auth-mode-deserialization

Conversation

@ege-arhan

Copy link
Copy Markdown

Summary

Fixes #58 by adding serde aliases for legacy ChatGPT enum variants in AuthMode and AuthData.

Problem

After upgrading to v0.2.2+, accounts.json files containing legacy ChatGPT enum spellings (chat_gpt, chatgpt, chat_g_pt) failed to deserialize when loaded via serde_json::from_str::<AccountsStore>(), throwing an error and rendering saved accounts inaccessible:

Failed to load accounts
Failed to parse accounts file: /Users/<user>/.codex-switcher/accounts.json

Solution

  • Added #[serde(alias = "chat_gpt", alias = "chatgpt", alias = "chat_g_pt")] to AuthMode::ChatGPT.
  • Added the matching serde aliases to AuthData::ChatGPT.
  • New entries continue to serialize cleanly to canonical snake_case (chat_g_p_t).
  • Added unit tests covering deserialization of all legacy spellings for both enums.

…ampese#58)

Add serde aliases for legacy ChatGPT auth enum variants (chat_gpt,
chatgpt, chat_g_pt) on AuthMode and AuthData. Prevents accounts.json
parsing failures on upgrades from older versions.
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.

v0.2.2 fails to load legacy accounts.json ChatGPT auth type spelling

1 participant