Repository navigation
fix(no-ticket): write launcher settings as the text each option accepts - #551
Closed
cloudsmith-iduffy wants to merge 1 commit into
Closed
cloudsmith-iduffy wants to merge 1 commit into
cloudsmith-iduffy wants to merge 1 commit into
Conversation
The install command kept the parsed value of each CLOUDSMITH_* option. An enum value such as the --color choice went to shlex.quote and the install stopped with a TypeError. Now each value becomes the text that its option accepts. A list of values is not kept. The launcher writer refuses a value that is not a string, with a clear message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix addresses the reported failure with regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes serialization of install-time settings in credential-helper launchers, preventing crashes from non-text values while preserving text accepted by each CLI option.
Changes:
- Normalize choices and scalar values to text; skip multi-value settings.
- Reject non-string launcher values with an error naming the variable.
- Add regression coverage for enum choices, integers, skipped multi-values, and launcher validation.
| File | Description |
|---|---|
cloudsmith_cli/credential_helpers/launchers.py |
Validate that launcher environment values are strings. |
cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py |
Cover setting serialization and non-string rejection. |
cloudsmith_cli/cli/commands/credential_helper/manage.py |
Convert retained settings to option-compatible text. |
Review effort: Balanced
Collaborator
Author
|
I will handle this as part of #512 |
Collaborator
Author
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.
Description
cloudsmith credential-helper installcrashes when a launcher keeps a setting whose value is not text (Sentry CLOUDSMITH-CLI-1F). The install keeps eachCLOUDSMITH_*option that comes from a flag or the environment, but it only turnedboolvalues into text. The--color/CLOUDSMITH_COLORoption parses to aColorModeenum, and that enum went straight intoshlex.quote.Before (with a helper that keeps install-time settings):
str()is not a fix on its own. It givesColorMode.NEVER, and the helper then refuses to start:After:
The changes:
click.Choicevalue goes throughChoice.normalize_choice, so an enum becomes its name in the case the option takes (never). Anintorfloatbecomesstr(). Aboolkeeps its lower-case form.multiple=Trueornargs) is not kept, because one launcher variable holds one value. No currentCLOUDSMITH_*option oninstalltakes a list.TypeErrordeep inshlex.Type of Change
Additional Notes
This PR stacks on #511 and fixes code that has not been released, so it has no CHANGELOG entry.
#512 already leaves
colorout of the kept settings. With that branch plus this fix, andcolorput back in the kept list, the install writesCLOUDSMITH_COLOR=never. The launcher then runs the helper, which accepts the value and goes on to the credential lookup. With the oldstr()form, the helper exits with the usage error above.🤖 Generated with Claude Code