Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
113 stars 177 forks source link

Improve LintDiff error in case an OpenAPI spec file path mentioned in README does not exist (related to Avocado) #7904

Open konrad-jamrozik opened 7 months ago

konrad-jamrozik commented 7 months ago

Bug reported in Teams by Suhas Rao here

Affected PR:

Root-cause

The file https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/monitoringAccounts_API.json

is missing from the RPSaaSMaster branch but it is mentioned in the processed README resulting in error of:

Could not read 'file:///mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/monitoringAccounts_API.json

Root-cause analysis

From the build log:

[
  {
    "type": "AutoRest exception",
    "message": "Process() cancelled due to failure",
    "readmeUrl": "[https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md",](https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md%22,)
    "tag": "default",
    "context": "before"
  },
  {
    "type": "AutoRest exception",
    "message": "!Error: Could not read 'file:///mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/monitoringAccounts_API.json'.",
    "readmeUrl": "[https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md",](https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md%22,)
    "tag": "default",
    "context": "before"
  },
  {
    "type": "AutoRest exception",
    "message": "Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.",
    "readmeUrl": "[https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md",](https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSMaster/specification/monitor/resource-manager/readme.md%22,)
    "tag": "default",
    "context": "before"
  }
]

We can see:

Could not read 'file:///mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/monitoringAccounts_API.json

From the check run we can get link to README.md:

In both cases we can see that Tag: package-2023-04 has input files:

At the same time we can see that specification/monitor/resource-manager/Microsoft.Monitor does not even have stable directory, in both RPSaaSMaster and the "new" commit.

However, it is present in public main:

As well as private main:

Hence the issue is that the file is missing from RPSaaSMaster

Related work

konrad-jamrozik commented 7 months ago

In general, we should nicely wrap relevant AutoRest exceptions. Another, different case (from Teams, here, by Zhenhua Hu):

{
    "type": "AutoRest exception",
    "message": "!Error: There are multiple operations defined for   'get: /providers/Microsoft.PortalServices/operations'.  You are probably trying to use an input with multiple API versions with an autorest V2 generator, and that will not work.",
    "readmeUrl": "[https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSDev/specification/portalservices/resource-manager/readme.md",](https://github.com/Azure/azure-rest-api-specs-pr/blob/RPSaaSDev/specification/portalservices/resource-manager/readme.md%22,)
    "tag": "package-2023-08-01-preview",
    "context": "before"
  },