Skip to content

Improve version handling in Test-CIPPAPIModuleUpdate function - #90

Merged
kris6673 merged 12 commits into
BNWEIN:Devfrom
homotechsual:main
May 14, 2026
Merged

Improve version handling in Test-CIPPAPIModuleUpdate function#90
kris6673 merged 12 commits into
BNWEIN:Devfrom
homotechsual:main

Conversation

@homotechsual

Copy link
Copy Markdown
Contributor

Enhance version checks and error handling for multiple local installs in the Test-CIPPAPIModuleUpdate function. Ensure valid version information is processed and provide warnings for outdated installations.

Copilot AI review requested due to automatic review settings May 12, 2026 22:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refines how Test-CIPPAPIModuleUpdate determines the local module version by tolerating multiple returned install records and skipping invalid version values, and it adds warnings when older side-by-side installs are detected.

Changes:

  • Aggregates and parses multiple local version candidates, selecting the highest valid version for comparison.
  • Skips invalid/missing local version values rather than failing the update check.
  • Emits warnings when older local installs (lower versions) are detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CIPPAPIModule/private/Test-CIPPAPIModuleUpdate.ps1 Outdated
Comment thread CIPPAPIModule/private/Test-CIPPAPIModuleUpdate.ps1 Outdated
@homotechsual

Copy link
Copy Markdown
Contributor Author

Copilot Review Feedback - Resolved

Issue 1: Dead code - unused $LocalVersionString variable
Fixed: Removed the unused local version string variable assignment. The $LocalVersion is now directly converted to string inline in the verbose message, eliminating dead code.

Issue 2: Hard-coded module name in verbose message
Fixed: Updated the verbose message to use $ModuleName variable instead of hard-coding "CIPPAPIModule". This ensures consistency across the function and prevents future drift if the module name changes.

Commit: Apply Copilot PR review feedback: remove dead variable and use ModuleName variable in verbose log

@kris6673
kris6673 changed the base branch from main to Dev May 13, 2026 08:13
@kris6673

Copy link
Copy Markdown
Collaborator

Heya Mikey, thanks for another PR!
There seems to be a merge conflict however, did you pull latest before making the PR? :)

@homotechsual

Copy link
Copy Markdown
Contributor Author

Heya Mikey, thanks for another PR! There seems to be a merge conflict however, did you pull latest before making the PR? :)

Rebased :-)

@kris6673
kris6673 requested a review from Copilot May 13, 2026 22:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread CIPPAPIModule/private/Test-CIPPAPIModuleUpdate.ps1 Outdated
Comment thread CIPPAPIModule/private/Test-CIPPAPIModuleUpdate.ps1 Outdated
@homotechsual

Copy link
Copy Markdown
Contributor Author

Actioned remaining Copilot feedback.

@kris6673

Copy link
Copy Markdown
Collaborator

I might be missing something, but isnt this pretty much just stripping out the try/catch safety?
Could you explain the improvement from making this change?

@homotechsual

Copy link
Copy Markdown
Contributor Author

I might be missing something, but isnt this pretty much just stripping out the try/catch safety? Could you explain the improvement from making this change?

Sorry, I fumbled the rebase and it dropped a bunch of changes. Will reimplement and push now. The aim is to gracefully handle multiple installed module versions rather than throwing a warning which is what happens now if you have multiple versions installed.

image

…support for multiple local installs, improved version validation, and updated warning messages for outdated installations.
@homotechsual
homotechsual requested a review from Copilot May 14, 2026 10:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread CIPPAPIModule/private/Test-CIPPAPIModuleUpdate.ps1
…ate function. Removed uniqueness constraint in sorting to ensure all paths are reported for the same version.
@kris6673
kris6673 merged commit ad11056 into BNWEIN:Dev May 14, 2026
@kris6673

Copy link
Copy Markdown
Collaborator

Looks good, thanks for the PR!

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.

3 participants