chocolatey / chocolatey/choco

`choco source --noop` doesn't reflect actual operation(s)

Open
#3,703 3 comments 0 reactions 0 assignees View on GitHub
0 - Backlog Bug Priority - Low
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [x] I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org).
- [x] I have verified this is the correct repository for opening this issue.
- [x] I have verified no other issues exist related to my problem.
- [x] I have verified this is not an issue for a specific package.
- [x] I have verified this issue is not security related.
- [x] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.

### What You Are Seeing?

When using noop/whatif, updating a choco source password doesn't not match the behaviour seen when not using noop/whatif.

### What is Expected?

If the password does not need to be updated, the output message should reflect that.

### How Did You Get This To Happen?

1. Set up a source (see "Updated ChocolateyInternal..."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'originalPassword'"`
2. "Update" the password to the same password (see "Nothing to change. Config already set."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'originalPassword'"`
3. Update the password to a new password (see "Updated ChocolateyInternal..."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'newPassword'"`
4. Reset the password to a known value (see: "Update ChocolateyInternal"): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'originalPassword'"`
5. "Update" the password the same password, but noop (see "Would have made a change to the configuration."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'originalPassword'" --whatif`
6. Update the password to a new password, but noop (see "Would have made a change to the configuration."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'newPassword'" --whatif`
7. "Update" the password the same password, but noop and limit-output (see "Would have made a change to the configuration."): `choco source add --name="ChocolateyInternal" --source="https://2022bare.ch0.co:8443/repository/ChocolateyInternal/index.json" -p="'originalPassword'" --whatif --limit-output`

...etc.

### System Details

- Operating System: N/A
- Windows PowerShell Version: N/A
- Chocolatey CLI Version: 2.3.0
- Chocolatey Licensed Extension version: 6.2.1
- Chocolatey License type (Professional / Business / ?): Business
- Terminal/Emulator: Windows Terminal

### Installed Packages

N/A

### Output Log

N/A

### Workarounds

1. Monitor the config file and see if it's changed (not appropriate if you don't want to modify if it doesn't need changing)
2. Calculate expected value and compare it to the config file (not appropriate to distribute to customers?)

### Proposed Solution

1. Whatif/Noop should reflect the action (or inaction) of the operation

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the listed `choco source add` commands with `--whatif` and compare their output with normal execution, especially when the password is unchanged. Trace the source-update command's noop handling and add coverage showing that unchanged and changed passwords report the corresponding action or inaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.