Skip to content

Fix duplicate results from Get-Command fuzzy matching - #28042

Open
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
PowerShell:masterfrom
daxian-dbw:daxian-dbw-fix-fuzzy-command-duplicates
Open

Dongbo Wang (daxian-dbw) wants to merge 1 commit into
PowerShell:masterfrom
daxian-dbw:daxian-dbw-fix-fuzzy-command-duplicates

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #26593

Note: It's much easier to review the PR by ignoring the whitespace changes: https://github.com/PowerShell/PowerShell/pull/28042/changes?w=1

  • Filter fuzzy module candidates through the existing Get-Command duplicate and parameter checks before adding them to scored output
  • Preserve the score associated with each accepted command
  • Add a cross-platform regression test using two discoverable copies of the same module

Filter fuzzy module candidates before adding them to the scored output collection, and cover duplicate module discovery with a focused regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner September 21, 2026 21:09
Copilot AI lite review requested due to automatic review settings September 21, 2026 21:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Sep 21, 2026

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.

Copilot review overview

🟢 Approval recommended

All reviewed changes are covered by the supplied validation and have no unresolved blocking issues.

Review effort: Lite
Findings: None

What changed in this PR

Fixes duplicate results from fuzzy Get-Command matching while preserving candidate scores.

Changes:

  • Filters duplicate fuzzy candidates using existing checks.
  • Adds cross-platform regression coverage.
File Description
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​Get-Command.Tests.ps1 Adds duplicate-result regression coverage.
src/​System.Management.Automation/​engine/​GetCommandCommand.cs Filters fuzzy candidates and retains scores.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@kilasuit Ryan Yates (kilasuit) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM - tested a local build of this branch too and all good there

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Sep 29, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-Command -UseFuzzyMatching output includes duplicates

3 participants