Skip to content

Conversation

@danieljurek
Copy link
Member

@danieljurek danieljurek commented Nov 19, 2025

Partial #12992

When running validate-all-packages.yml, add SpecProjectPath if a path can be found from a tsp-location.yml in the DirectoryPath of the package.

This PR changes the JSON output of package metadata which causes failures in the matrix generator scripts so it includes updates to the expected outputs of those scripts and an easier way to update the files containing expectations going forward.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@danieljurek danieljurek self-assigned this Nov 19, 2025
@danieljurek danieljurek moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys 🍔🌭 Nov 19, 2025
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@danieljurek danieljurek changed the title Add field for Spec Project Path property Add field for Spec Project Path to Package Work Item Nov 21, 2025
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@danieljurek danieljurek marked this pull request as ready for review November 22, 2025 00:10
@danieljurek danieljurek requested a review from a team as a code owner November 22, 2025 00:10
Copilot AI review requested due to automatic review settings November 22, 2025 00:10
Copilot finished reviewing on behalf of danieljurek November 22, 2025 00:13
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 adds a SpecProjectPath field to Package Work Items to track the path from the root of the azure-rest-api-specs repository to the spec project. The field is populated by reading from a tsp-location.yaml file in the package directory if it exists.

Key changes:

  • Added SpecProjectPath property to the PackageProps class, reading from tsp-location.yaml if present
  • Updated DevOps work item helpers to include Custom.SpecProjectPath field when creating/updating work items
  • Added test infrastructure to enable easier scenario file updates with a flag

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
eng/common/scripts/Package-Properties.ps1 Added SpecProjectPath property to PackageProps class and logic to read from tsp-location.yaml
eng/common/scripts/Validate-All-Packages.ps1 Updated function call to pass specProjectPath parameter
eng/common/scripts/Save-Package-Properties.ps1 Added logging output for SpecProjectPath field
eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 Added Custom.SpecProjectPath field handling in work item functions and removed title comparison check
eng/common-tests/matrix-generator/pr-matrix-samples/pr-matrix-generation-acceptance.tests.ps1 Added $updateScenarios flag and logic to update scenario files programmatically
eng/common-tests/matrix-generator/pr-matrix-samples/python_scenarios.json Updated test expectations to include SpecProjectPath: null or actual spec paths
eng/common-tests/matrix-generator/pr-matrix-samples/net_scenarios.json Updated test expectations to include SpecProjectPath: null
eng/common-tests/matrix-generator/pr-matrix-samples/js_scenarios.json Updated test expectations to include SpecProjectPath: null or actual spec paths
eng/common-tests/matrix-generator/pr-matrix-samples/java_scenarios.json Updated test expectations to include SpecProjectPath: null
eng/common-tests/matrix-generator/pr-matrix-samples/go_scenarios.json Updated test expectations to include SpecProjectPath: null

| ForEach-Object { Get-Content -Raw $_ | ConvertFrom-Json -AsHashtable }
| Sort-Object -Property Name


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] Extra blank line should be removed for consistency with the rest of the code.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +1336 to +1337


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] There are extra blank lines here. Consider removing these unnecessary blank lines for code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +534 to +536
if ($specProjectPath) {
$fields += "`"Custom.SpecProjectPath=${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.

The SpecProjectPath field is added to the work item fields but is not included in the change detection logic (lines 546-553). This means that if only the SpecProjectPath changes for an existing work item, the work item will not be updated. Consider adding a check like if ($specProjectPath -ne $existingItem.fields["Custom.SpecProjectPath"]) { $changedField = "Custom.SpecProjectPath" } after line 553.

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

Choose a reason for hiding this comment

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

The code doesn't handle the case where LoadFrom-Yaml returns $null (which happens if the YAML file fails to parse) or where the parsed YAML object doesn't contain a directory field. This could cause a null reference error. Consider adding null-checking:

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

Copilot uses AI. Check for mistakes.
if ($updateScenarios) {
$netScenarios | ConvertTo-Json -Depth 100 | Set-Content (Join-Path $PSScriptRoot net_scenarios.json)
}

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] Extra blank line should be removed for consistency with the rest of the code.

Suggested change

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

None yet

Projects

Status: 🔬 Dev in PR

Development

Successfully merging this pull request may close these issues.

4 participants