Azure / azure-sdk-tools

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

Renaming API version and directory at the same time leads to confusing BreakingChange checks experience #7786

Open konrad-jamrozik opened 8 months ago

konrad-jamrozik commented 8 months ago

Resources


  "additions": [
    "specification/orbital/resource-manager/Microsoft.Orbital/aodg/stable/2024-03-01/aodg.json"
  ],
  "deletions": [
    "specification/orbital/resource-manager/Microsoft.Orbital/aodg/preview/2024-03-01-preview/aodg.json"
  ],
  "changes": []
}
// Processing swaggers:
[
  'specification/orbital/resource-manager/Microsoft.Orbital/aodg/stable/2024-03-01/aodg.json'
]
// Found new version swaggers:
[
  'specification/orbital/resource-manager/Microsoft.Orbital/aodg/stable/2024-03-01/aodg.json'
]
// Found new existing version swaggers:
[]
// Found changed existing swaggers:
[]
// The following changed swaggers are not existed in base branch:
[]
// The following are deleted swaggers that need to do the comparison: 
[
  'specification/orbital/resource-manager/Microsoft.Orbital/aodg/preview/2024-03-01-preview/aodg.json'
]

Explanation

The API version 2024-03-01-preview was renamed to 2024-03-01 and moved from specification/orbital/resource-manager/Microsoft.Orbital/aodg/preview/2024-03-01-preview/aodg.json to specification/orbital/resource-manager/Microsoft.Orbital/aodg/stable/2024-03-01/aodg.json

As a result, the "Same version" breaking change check verifies only 2024-03-01-preview and it thinks the new version is completely missing, thus reporting everything got removed. This is because the directory was renamed, hence the aodg.json for preview is gone.

The 2024-01-01 stable is not verified by "Same version" check as it looks like a completely new file. This is because a dir rename shows in git as a pair of "remove old, add new", for all files in the renamed dir.

Fortunately, the "Cross-version" breaking change check still runs, hence if there were any changes made during the rename, it should catch them.

Workaround

Do not rename directory and API version at the same time.

Make a first PR that creates the new version in new directory, for stable. Then, in a second PR, remove the preview.

konrad-jamrozik commented 5 months ago

Another case on Teams here