Repository navigation
fix: preserve store_false values in saved config files - #360
Merged
Merged
Conversation
Owner
|
Thanks for the fix! I pushed a follow-up commit (1f90d23) on top of yours that generalizes it:
One note on the PR description: "Non-boolean defaults keep their existing encoding" no longer applies. Types are still preserved on reload, but a default of |
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.
Saving a
store_falseoption supplied on the command line or through an environment variable writes its finalFalsevalue as a disabled config flag. Reloading that file then restoresTrue. Encode actual boolean values using the existing flag-invocation contract so saved settings retain their value when loaded again. Non-boolean defaults keep their existing encoding and type.Disk round-trip regressions cover short/long aliases, environment true/false, config-sourced values, boolean defaults, an integer default, default omission and other boolean actions. The original production code fails five subtests; the fix passes all six new test methods.
Local macOS/CPython 3.12.14 validation: 1941 tests passed, 1 skipped and 5 expected failures, including the matching official CPython argparse tests. Black, strict Pydoctor, packaging and Twine checks passed. Zizmor passed in its configured offline mode with the existing suppressions. Four installed-wheel automatic save/read checks passed with
-Werror. An independent public-API disk matrix improved from 110 to 135 passing cases, and four automatic save/read cases improved from one to four, with no previously passing case regressing.Other Python versions and operating systems remain upstream CI scope. Maintainer review required by CONTRIBUTING is still pending.
AI-assisted — Tool: OpenAI Codex; model: openai/unavailable; version: unavailable.