Skip to content

Conversation

@azure-sdk
Copy link
Collaborator

Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#13005 See eng/common workflow

@azure-sdk azure-sdk requested a review from a team as a code owner November 22, 2025 00:32
@azure-sdk azure-sdk requested review from Copilot and danieljurek and removed request for Copilot November 22, 2025 00:32
@azure-sdk azure-sdk added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Nov 22, 2025
@azure-sdk azure-sdk added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Nov 22, 2025
@azure-sdk azure-sdk force-pushed the sync-eng/common-djurek/codeowners-ci-work-item-spec-repo-path-13005 branch from 965f64d to ed333df Compare November 25, 2025 20:37
Copilot AI review requested due to automatic review settings November 25, 2025 20:37
Copilot finished reviewing on behalf of azure-sdk November 25, 2025 20:39
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

This PR syncs the eng/common directory with changes from azure-sdk-tools PR #13005, adding support for tracking TypeSpec project paths (SpecProjectPath) in package properties and Azure DevOps work items.

  • Adds SpecProjectPath property to PackageProps class, read from tsp-location.yaml files
  • Updates work item creation/update logic to include and sync the Custom.SpecProjectPath field
  • Adds logging output for the spec project path in package property display

Reviewed changes

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

File Description
eng/common/scripts/Package-Properties.ps1 Adds SpecProjectPath property to PackageProps class and loads it from tsp-location.yaml if present
eng/common/scripts/Save-Package-Properties.ps1 Adds logging output to display the spec project path when processing packages
eng/common/scripts/Validate-All-Packages.ps1 Passes SpecProjectPath from package info to work item update function
eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 Adds Custom.SpecProjectPath field handling in work item queries, creation, and updates




if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The condition (!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) may not work as intended in PowerShell. When $packageInfo.SpecProjectPath is an empty string (the default value from the parameter), PowerShell will treat it as falsy, but you likely want to update the work item only when there's a non-empty value.

Consider using a more explicit check:

if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ![string]::IsNullOrEmpty($packageInfo.SpecProjectPath)) -or
    ($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))

This ensures that empty strings from the default parameter value don't trigger unnecessary updates.

Suggested change
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and -not [string]::IsNullOrEmpty($packageInfo.SpecProjectPath)) -or

Copilot uses AI. Check for mistakes.
}

if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) {
$this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The code assumes that LoadFrom-Yaml will return an object with a .directory property, but doesn't handle the case where the YAML file exists but doesn't contain a directory field, or when LoadFrom-Yaml returns $null (which can happen on parse errors).

Consider adding a null check:

if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) {
    $yamlContent = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')
    if ($yamlContent -and $yamlContent.directory) {
        $this.SpecProjectPath = $yamlContent.directory
    }
}

This prevents potential null reference exceptions when accessing the .directory property.

Suggested change
$this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory
$yamlContent = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')
if ($yamlContent -and $yamlContent.directory) {
$this.SpecProjectPath = $yamlContent.directory
}

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

Central-EngSys This issue is owned by the Engineering System team. EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants