Problem
The apiview-stub-generator version used to generate Python APIView token files can differ from the parser version configured for Python in APIView. This produces token files whose hashes do not match the approved APIView revisions and makes release failures difficult to diagnose.
We recently observed the following:
- APIView was configured to use
apiview-stub-generator 0.3.28 for Python.
azure-sdk-for-python/eng/apiview_reqs.txt pinned apiview-stub-generator 0.3.31.
- The Python release pipeline ran the
apistub check through the in-repository azpysdk tooling. That tooling installed eng/apiview_reqs.txt and generated a token file using 0.3.31.
- The generated token file did not hash to the approved APIView revision, which had been produced with 0.3.28.
- When APIView processed the token file, it detected that its parser version differed and initiated regeneration using its configured 0.3.28 version.
- Several minutes later, APIView replaced the token file with one whose hash matched the approved revision.
The delayed regeneration obscured the parser mismatch and contributed to an initial misdiagnosis. During the delay, the release appeared to be using an unapproved API surface even though the underlying API had already been approved.
Current Python CI path
The SDK pipeline runs eng/scripts/dispatch_checks.py with --checks="apistub". The apistub implementation in eng/tools/azure-sdk-tools/azpysdk/apistub.py installs the dependencies pinned in eng/apiview_reqs.txt, including apiview-stub-generator, before generating the Python token file.
The generated token file is subsequently submitted to apiview.dev/autoreview by eng/common/scripts/Create-APIReview.ps1.
Proposed change
Add a required CI check that runs whenever eng/apiview_reqs.txt changes. The check should:
- Read the pinned
apiview-stub-generator version from eng/apiview_reqs.txt.
- Read
ApiStubVersion from eng/pipelines/apiview-review-gen-python.yml in Azure/azure-sdk-tools. This is the version installed by the Python APIView token regeneration pipeline.
- Read
PythonLanguageService.VersionString from src/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.cs in Azure/azure-sdk-tools. This is the parser version APIView expects for Python reviews.
- Fail with a clear error unless all three versions match.
- Report all three versions and explain that APIView must be updated and deployed before the Python dependency pin can be merged.
This check should prevent azure-sdk-for-python from moving to a parser version that APIView is not yet using.
Required update sequence
Parser upgrades should occur in this order:
- Release the new
apiview-stub-generator version from azure-sdk-tools.
- Update the Python parser version in APIView and deploy APIView.
- Update
eng/apiview_reqs.txt in azure-sdk-for-python.
APIView must be updated first because it can automatically regenerate token files using its configured parser version. Updating the Python repository first creates a window where locally generated tokens and APIView-generated tokens differ.
Acceptance criteria
- A change to
apiview_reqs.txt in the azure-sdk-for-python repository triggers the synchronization check.
- CI reads
ApiStubVersion from Azure/azure-sdk-tools/eng/pipelines/apiview-review-gen-python.yml.
- CI reads
PythonLanguageService.VersionString from Azure/azure-sdk-tools/src/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.cs.
- CI passes only when both
azure-sdk-tools versions exactly match the version pinned in eng/apiview_reqs.txt.
- A mismatch fails before package release steps and displays all three versions and their source locations.
- The failure message documents the required update order.
- The check itself does not initiate or wait for an APIView parser upgrade.
Version sources
The synchronization check compares these values:
| Repository |
File |
Value |
Azure/azure-sdk-for-python |
eng/apiview_reqs.txt |
apiview-stub-generator==<version> |
Azure/azure-sdk-tools |
eng/pipelines/apiview-review-gen-python.yml |
ApiStubVersion: '<version>' |
Azure/azure-sdk-tools |
src/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.cs |
VersionString { get; } = "<version>" |
The check should read the azure-sdk-tools files from its default branch. Passing the source check confirms that the coordinated APIView change has merged; the documented update sequence must still require APIView deployment before the azure-sdk-for-python update is merged.
Problem
The
apiview-stub-generatorversion used to generate Python APIView token files can differ from the parser version configured for Python in APIView. This produces token files whose hashes do not match the approved APIView revisions and makes release failures difficult to diagnose.We recently observed the following:
apiview-stub-generator0.3.28 for Python.azure-sdk-for-python/eng/apiview_reqs.txtpinnedapiview-stub-generator0.3.31.apistubcheck through the in-repositoryazpysdktooling. That tooling installedeng/apiview_reqs.txtand generated a token file using 0.3.31.The delayed regeneration obscured the parser mismatch and contributed to an initial misdiagnosis. During the delay, the release appeared to be using an unapproved API surface even though the underlying API had already been approved.
Current Python CI path
The SDK pipeline runs
eng/scripts/dispatch_checks.pywith--checks="apistub". Theapistubimplementation ineng/tools/azure-sdk-tools/azpysdk/apistub.pyinstalls the dependencies pinned ineng/apiview_reqs.txt, includingapiview-stub-generator, before generating the Python token file.The generated token file is subsequently submitted to
apiview.dev/autoreviewbyeng/common/scripts/Create-APIReview.ps1.Proposed change
Add a required CI check that runs whenever
eng/apiview_reqs.txtchanges. The check should:apiview-stub-generatorversion fromeng/apiview_reqs.txt.ApiStubVersionfromeng/pipelines/apiview-review-gen-python.ymlinAzure/azure-sdk-tools. This is the version installed by the Python APIView token regeneration pipeline.PythonLanguageService.VersionStringfromsrc/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.csinAzure/azure-sdk-tools. This is the parser version APIView expects for Python reviews.This check should prevent
azure-sdk-for-pythonfrom moving to a parser version that APIView is not yet using.Required update sequence
Parser upgrades should occur in this order:
apiview-stub-generatorversion fromazure-sdk-tools.eng/apiview_reqs.txtinazure-sdk-for-python.APIView must be updated first because it can automatically regenerate token files using its configured parser version. Updating the Python repository first creates a window where locally generated tokens and APIView-generated tokens differ.
Acceptance criteria
apiview_reqs.txtin theazure-sdk-for-pythonrepository triggers the synchronization check.ApiStubVersionfromAzure/azure-sdk-tools/eng/pipelines/apiview-review-gen-python.yml.PythonLanguageService.VersionStringfromAzure/azure-sdk-tools/src/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.cs.azure-sdk-toolsversions exactly match the version pinned ineng/apiview_reqs.txt.Version sources
The synchronization check compares these values:
Azure/azure-sdk-for-pythoneng/apiview_reqs.txtapiview-stub-generator==<version>Azure/azure-sdk-toolseng/pipelines/apiview-review-gen-python.ymlApiStubVersion: '<version>'Azure/azure-sdk-toolssrc/dotnet/APIView/APIViewWeb/Languages/PythonLanguageService.csVersionString { get; } = "<version>"The check should read the
azure-sdk-toolsfiles from its default branch. Passing the source check confirms that the coordinated APIView change has merged; the documented update sequence must still require APIView deployment before theazure-sdk-for-pythonupdate is merged.