Skip to content

fix(auth): preserve output preferences on logout#49

Open
johnpmitsch wants to merge 1 commit into
mainfrom
fix/logout-preserves-output-prefs
Open

fix(auth): preserve output preferences on logout#49
johnpmitsch wants to merge 1 commit into
mainfrom
fix/logout-preserves-output-prefs

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

qn auth logout deleted 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_key removes [api].key and rewrites the config, replacing the old full-file delete in auth logout.
  • Extracted the atomic-write path (tempfile + 0600 + fsync + rename) out of save_api_key into a shared write_config helper, reused by both save and clear.
  • Removed the now-unused delete_config (logout was its only caller).
  • Updated the embedded agent context guide 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, ran qn auth logout, confirmed the key is gone and both output prefs remain.

`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).
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.

1 participant