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

Copilot AI review requested due to automatic review settings November 22, 2025 00:32
@azure-sdk azure-sdk requested a review from a team as a code owner 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
Copilot finished reviewing on behalf of azure-sdk November 22, 2025 00:33
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 synchronizes the eng/common directory with azure-sdk-tools for PR #13005. The primary purpose is to add support for tracking the spec project path (from TypeSpec location files) in Azure DevOps work items used for release tracking. This enables better linkage between SDK packages and their corresponding API specification projects.

Key changes:

  • Added SpecProjectPath property to the PackageProps class that reads from tsp-location.yaml files
  • Updated work item creation/update logic to include the spec project path in Azure DevOps tracking
  • Removed a redundant title comparison check in the work item update logic

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 Added SpecProjectPath property to PackageProps class and logic to read it from tsp-location.yaml
eng/common/scripts/Save-Package-Properties.ps1 Added logging output to display the spec project path
eng/common/scripts/Validate-All-Packages.ps1 Updated function call to pass SpecProjectPath parameter
eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 Added spec project path handling throughout work item operations, including querying, creation, and updating

}

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 22, 2025

Choose a reason for hiding this comment

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

The code accesses .directory property on the result of LoadFrom-Yaml without checking if the result is null. If the YAML file exists but is malformed or empty, LoadFrom-Yaml returns null (as seen in the function definition), which will cause a null reference error when accessing .directory. Add a null check before accessing the property.

Suggested change
$this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory
$tspLocation = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')
if ($tspLocation -ne $null) {
$this.SpecProjectPath = $tspLocation.directory
}
else {
$this.SpecProjectPath = $null
}

Copilot uses AI. Check for mistakes.
Comment on lines +1338 to +1340
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or
($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))
) {
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition can be simplified for better readability. The current logic checks if the field is missing and there's a value, or if the field exists and has a different value. This can be more concisely expressed as: update if $packageInfo.SpecProjectPath is present and either the field doesn't exist or has a different value. Consider: if ($packageInfo.SpecProjectPath -and ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath')) -or ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath)))

Suggested change
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or
($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))
) {
if ($packageInfo.SpecProjectPath -and ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath')) -or ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))) {

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