Skip to content

(#3802) Ensure licensed feed stays disabled even when the license file is updated/changed#3803

Merged
corbob merged 2 commits into
chocolatey:developfrom
vexx32:license-source
Oct 21, 2025
Merged

(#3802) Ensure licensed feed stays disabled even when the license file is updated/changed#3803
corbob merged 2 commits into
chocolatey:developfrom
vexx32:license-source

Conversation

@vexx32

@vexx32 vexx32 commented Oct 15, 2025

Copy link
Copy Markdown
Member

Description Of Changes

  • Ensure that CLI checks the current state of the chocolatey.licensed feed before overwriting it
  • If the currently existing source is disabled, retain that state when overwriting the licensed feed
  • Ensure users cannot make unsupported changes to the licensed feed source entry

Motivation and Context

See #3802

Testing

You will need two separate valid licenses in order to manually test the PR.

  1. With no license applied, run choco source list
  2. There should be no chocolatey.licensed feed present
  3. Install a valid and not-expired license
  4. choco source list
  5. The chocolatey.licensed feed should have been added automatically
  6. choco source disable -n chocolatey.licensed
  7. choco source list
  8. The licensed feed should be listed as [disabled]
  9. Replace the license with another valid license
  10. choco source list
  11. The licensed feed should still be listed as [disabled]
  12. Remove the license file
  13. choco source list
  14. The licensed feed should have been removed
  15. Reinstall either license
  16. choco source list
  17. The licensed feed should have been added back once again, but is now enabled.
    i. This is expected behaviour; CLI does not have a way to track the state of the licensed feed when it has been removed.

Operating Systems Testing

Win11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #3802

@vexx32 vexx32 requested a review from corbob October 15, 2025 19:52
Comment thread tests/pester-tests/chocolatey.Tests.ps1 Outdated
Comment thread tests/pester-tests/chocolatey.Tests.ps1 Outdated
corbob
corbob previously approved these changes Oct 17, 2025

@corbob corbob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. It behaves as expected. I've kicked off a targeted Test Kitchen run, once that finishes I'll get this merged in.

gep13
gep13 previously approved these changes Oct 17, 2025

@gep13 gep13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Previously, when changing licenses the licensed source entry was not
retained at all and totally overwritten. This change ensures we at
least retain whether the source was disabled when we overwrite it.

Additionally, we ignore unsupported changes to the licensed source and
overwrite them.
@vexx32 vexx32 dismissed stale reviews from gep13 and corbob via 72d56fd October 21, 2025 15:52
@vexx32 vexx32 force-pushed the license-source branch 2 times, most recently from 72d56fd to 70079e8 Compare October 21, 2025 15:55
Ensure that when a license is installed, CLI adds the
chocolatey.licensed source correctly so that users can install the
licensed extension.

Additionally, when the license is removed, the feed should be removed,
and if the license is swapped out, CLI should remember the disabled
state of the licensed feed.

Noticed and removed a superfluous `return` statement in one of the
helper functions.

@corbob corbob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. I'll merge it in once we confirm the CI builds.

@corbob corbob merged commit 466e231 into chocolatey:develop Oct 21, 2025
5 checks passed
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.

Installing a New License Enables Licensed Feed Even When Originally Disabled

3 participants