fix(auth): preserve output preferences on logout#49
Open
johnpmitsch wants to merge 1 commit into
Open
Conversation
`qn auth logout` deleted the entire config file, wiping the user's `[output]` preferences (format, wide) along with the API key. Logout now clears only `[api].key` and rewrites the file, keeping output settings intact. Extracts the atomic-write path from `save_api_key` into a shared `write_config` helper, reused by the new `clear_api_key`. Adds 3 config tests (preserves output section, writes defaults when no file exists, keeps 0600 perms).
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.
qn auth logoutdeleted the entire config file, wiping the user's[output]preferences (format,wide) along with the API key. Now logout clears only the API key and keeps output settings intact.What changed
clear_api_keyremoves[api].keyand rewrites the config, replacing the old full-file delete inauth logout.save_api_keyinto a sharedwrite_confighelper, reused by both save and clear.delete_config(logout was its only caller).agent contextguide to note logout preserves output prefs.Tests
3 new config tests: preserves output section, writes defaults when no file exists, keeps 0600 perms. Full suite + clippy + fmt pass.
Verification
Seeded a config with a key plus
format = "json"/wide = true, ranqn auth logout, confirmed the key is gone and both output prefs remain.