Skip to content

[release/v7.5] Fix ConvertFrom-ClearlyDefinedCoordinates to handle API object coordinates#26987

Merged
adityapatwardhan merged 1 commit intoPowerShell:release/v7.5from
adityapatwardhan:backport/release/v7.5/26893-312291762
Mar 10, 2026
Merged

[release/v7.5] Fix ConvertFrom-ClearlyDefinedCoordinates to handle API object coordinates#26987
adityapatwardhan merged 1 commit intoPowerShell:release/v7.5from
adityapatwardhan:backport/release/v7.5/26893-312291762

Conversation

@adityapatwardhan
Copy link
Member

Backport of #26893 to release/v7.5

Triggered by @adityapatwardhan on behalf of @app/copilot-swe-agent

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Fixes ConvertFrom-ClearlyDefinedCoordinates to handle both string and PSCustomObject coordinate inputs from the ClearlyDefined API, preventing Start-ClearlyDefinedHarvest from failing ValidateSet on PackageType.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Original PR was tested by the author. The cherry-picked change applies cleanly to the ClearlyDefined.psm1 file. The only conflicts were in unrelated version files which were resolved by keeping the target branch versions.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

The change only affects the ClearlyDefined tooling module used during build/packaging. It adds handling for PSCustomObject input alongside the existing string input path. No runtime or engine code is modified.

Merge Conflicts

7 files had conflicts (DotnetRuntimeMetadata.json, 4 .csproj files, cgmanifest.json) — all were package version bumps from the .NET 11 upgrade on master, unrelated to the actual fix. Resolved by keeping the release/v7.5 (ours) versions.

…nates (PowerShell#26893)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TravisEz13 <[email protected]>
Co-authored-by: Travis Plunk <[email protected]>
Co-authored-by: PowerShell Team Bot <[email protected]>
Co-authored-by: Dongbo Wang <[email protected]>
@adityapatwardhan adityapatwardhan requested a review from a team as a code owner March 10, 2026 22:49
Copilot AI review requested due to automatic review settings March 10, 2026 22:49
@adityapatwardhan adityapatwardhan added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Mar 10, 2026
@adityapatwardhan adityapatwardhan merged commit dbd6caf into PowerShell:release/v7.5 Mar 10, 2026
37 checks passed
@adityapatwardhan adityapatwardhan deleted the backport/release/v7.5/26893-312291762 branch March 10, 2026 22:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backport to release/v7.5 that updates the ClearlyDefined tooling module to correctly normalize coordinates returned by the ClearlyDefined API when it is a deserialized object (not a string), preventing downstream failures when starting harvest jobs.

Changes:

  • Broadened ConvertFrom-ClearlyDefinedCoordinates input type to accept non-string coordinate objects.
  • Added logic to handle both string coordinates (type/provider/namespace/name/revision) and object coordinates (.type/.provider/.namespace/.name/.revision).

Comment on lines 42 to 45
[parameter(mandatory = $true, ValueFromPipeline = $true)]
[string]
[object]
$Coordinates
)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

$Coordinates is now typed as [object], but the function no longer fails fast on $null (or unexpected object types). For example, $null input will take the else branch and return an object with all $null fields, which can later fail Start-ClearlyDefinedHarvest validation in a less obvious way. Consider adding ValidateNotNull() on the parameter and/or an explicit guard in Process that throws when $Coordinates is $null or does not contain the expected type/provider/namespace/name/revision fields (and similarly validate the split string has enough parts).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants