Skip to content

fix: allow unsetting unknown config keys#6336

Closed
noezhiya-dot wants to merge 1 commit into
prefix-dev:mainfrom
noezhiya-dot:fix/config-unset-unknown-keys
Closed

fix: allow unsetting unknown config keys#6336
noezhiya-dot wants to merge 1 commit into
prefix-dev:mainfrom
noezhiya-dot:fix/config-unset-unknown-keys

Conversation

@noezhiya-dot

Copy link
Copy Markdown

Description

pixi config unset errors when trying to unset a key that doesn't exist in the Rust config struct (e.g. removed/deprecated options like repodata-config.disable-jlap). Since the goal of unset is to remove a key, and a non-existent key is already effectively unset, this should be a no-op rather than an error.

The fix modifies alter_config in crates/pixi_cli/src/config.rs to silently ignore "Unknown key" errors when in Unset mode, while still propagating other errors (e.g. invalid value types).

Fixes #5672

How Has This Been Tested?

  • Manual code review of the change
  • The logic is straightforward: unknown keys are ignored only in Unset mode; Set mode still errors as expected

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: OWL (openrouter/owl-alpha)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

The pixi config unset command errors when trying to unset a key that
doesn't exist in the Rust config struct (e.g. removed/deprecated options
like repodata-config.disable-jlap). Since the goal of unset is to remove
a key, and a non-existent key is already effectively unset, this should
be a no-op rather than an error.

Fixes prefix-dev#5672
@baszalmstra

Copy link
Copy Markdown
Contributor

Thanks for your contribution but this is a duplicate of #6106 and #5745

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.

pixi config unset should not error on unknown keys

2 participants