Skip to content

Fix stale default configuration after removing a saved config - #118

Merged
const-cloudinary merged 1 commit into
masterfrom
fix/default-config-consistency
Aug 11, 2026
Merged

Fix stale default configuration after removing a saved config#118
const-cloudinary merged 1 commit into
masterfrom
fix/default-config-consistency

Conversation

@const-cloudinary

Copy link
Copy Markdown
Member

__default__ could name a config that no longer exists, which suppressed the auto-default rule on the next save.

  • load_config drops a __default__ naming no saved config; stale keys clear on the next write, since every mutation rebuilds the file from a load_config result.
  • Add remove_named_config, counterpart to save_named_config: one atomic write that deletes the config and re-points the default. Used by logout and config -rm.
  • Promote a lone survivor to default when the removed config held it, unless the environment configures Cloudinary - a stored default outranks the environment, so promoting would take precedence from CLOUDINARY_URL. _is_sole_usable_config holds that rule for the save and remove paths.
  • cld logout with a single saved login confirms it instead of showing a one-item menu.

Brief Summary of Changes

What does this PR address?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • New feature
  • Bug fix
  • Adds more tests

Are tests included?

  • Yes
  • No

Reviewer, please note:

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I ran the full test suite before pushing the changes and all the tests pass.

`__default__` could name a config that no longer exists, which suppressed
the auto-default rule on the next save.
- `load_config` drops a `__default__` naming no saved config; stale keys
clear on the next write, since every mutation rebuilds the file from a
load_config result.
- Add `remove_named_config`, counterpart to `save_named_config`: one atomic
write that deletes the config and re-points the default. Used by `logout`
and `config -rm`.
- Promote a lone survivor to default when the removed config held it, unless
the environment configures Cloudinary - a stored default outranks the
environment, so promoting would take precedence from CLOUDINARY_URL.
`_is_sole_usable_config` holds that rule for the save and remove paths.
- `cld logout` with a single saved login confirms it instead of showing a
one-item menu.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@const-cloudinary
const-cloudinary merged commit 813fa90 into masterAug 11, 2026
8 checks passed
@const-cloudinary
const-cloudinary deleted the fix/default-config-consistency branch August 11, 2026 15:42
Sign up for freeto 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

@const-cloudinary