You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[python] Python Integration Mock API Tests fail due to azure-http-specs version skew (pinned alpha.43 mock vs client regenerated from typespec-azure main) #11348
The Python Integration → Mock API Tests check (workflow .github/workflows/python-integration.yml) can fail with a body-validation error that is unrelated to the PR under test, due to a version skew between:
the azure-http-specs mock server (pinned to @azure-tools/azure-http-specs@0.1.0-alpha.43 via http-client-python), and
the generated client, which is regenerated from the Azure/typespec-azuremain.tsp source checked out by the workflow.
When the spec source on typespec-azuremain is newer than the pinned alpha.43 bundle, the client and the mock disagree and the tests fail.
Observed failure
Seen on PR #11272 (a change that only touches content-type header serialization, unrelated to ARM common-properties):
FAILED mock_api/azure/test_azure_arm_commonproperties.py::test_arm_resource_identifiers_create_or_replace
FAILED mock_api/azure/test_azure_arm_commonproperties.py::test_arm_resource_identifiers_get
FAILED mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py::test_arm_resource_identifiers_create_or_replace
FAILED mock_api/azure/asynctests/test_azure_arm_commonproperties_async.py::test_arm_resource_identifiers_get
azure.core.exceptions.HttpResponseError: (None) Body provided doesn't match expected body:
at $.properties: Key count mismatch: expected 4 but got 5. extra: [armIdWithGroupScope]
The generated client sends 5properties (including armIdWithGroupScope); the mock server expects 4.
Root cause
The Build & Regenerate job pins only the compiled mock /dist to the http-client-python-resolved alpha.43, but the client is regenerated from the freshly checked-out typespec-azuremain.tsp source:
Mock server dist is overwritten with the pinned alpha.43 bundle:
Meanwhile, armIdWithGroupScope was added to both the model and the mock in typespec-azuremain by PR Azure/typespec-azure#4891 (2026-07-15), which is newer than the alpha.43 bundle:
So within typespec-azuremain the spec is internally consistent (model and mock both have 5 fields). The skew is introduced only by the workflow, which mixes:
Any PR that only touches packages/http-client-python/** (which is what triggers this workflow) can get a red Mock API Tests check it did not cause, whenever typespec-azuremain advances an azure-http-specs/http-specs spec beyond the pinned alpha.43 bundle. This blocks otherwise-green PRs (e.g. #11272).
Suggested fixes (pick one)
Bump the pin in packages/http-client-python/package.json for @azure-tools/azure-http-specs (and @typespec/http-specs) to a version that includes Add built-in service group extension support Azure/typespec-azure#4891, so the mock dist matches the spec source used for regeneration.
Regenerate the client from the same pinned bundle used for the mock, instead of from the checked-out typespec-azuremain source — i.e. make both sides use one source of truth in python-integration.yml.
Do not pin the mock dist to the http-client-python-resolved version — build/use the mock from the same checked-out typespec-azure source used for regeneration, keeping client and mock in lockstep.
Option 2 or 3 removes the class of failure entirely; option 1 fixes the current occurrence.
Notes
The http-client-python package's own unit/e2e tests (typespec - ci on Azure DevOps) are unaffected and pass; this is specific to the downstream typespec-python (Azure/typespec-azure) Mock API e2e run wired up by python-integration.yml.
Summary
The Python Integration → Mock API Tests check (workflow
.github/workflows/python-integration.yml) can fail with a body-validation error that is unrelated to the PR under test, due to a version skew between:@azure-tools/azure-http-specs@0.1.0-alpha.43viahttp-client-python), andAzure/typespec-azuremain.tspsource checked out by the workflow.When the spec source on
typespec-azuremainis newer than the pinnedalpha.43bundle, the client and the mock disagree and the tests fail.Observed failure
Seen on PR #11272 (a change that only touches content-type header serialization, unrelated to ARM common-properties):
Run: https://github.com/microsoft/typespec/actions/runs/29883405836/job/88810730906
The generated client sends 5
properties(includingarmIdWithGroupScope); the mock server expects 4.Root cause
The
Build & Regeneratejob pins only the compiled mock/distto the http-client-python-resolvedalpha.43, but the client is regenerated from the freshly checked-outtypespec-azuremain.tspsource:alpha.43bundle:typespec/.github/workflows/python-integration.yml
Lines 70 to 75 in f7ab083
typespec-azuresource:typespec/.github/workflows/python-integration.yml
Lines 81 to 83 in f7ab083
The pinned version:
typespec/packages/http-client-python/package.json
Line 111 in f7ab083
Meanwhile,
armIdWithGroupScopewas added to both the model and the mock intypespec-azuremainby PR Azure/typespec-azure#4891 (2026-07-15), which is newer than thealpha.43bundle:.tspmodel (5th property):https://github.com/Azure/typespec-azure/blob/1081f0678431238b3451fdfd82dce3679e572f21/packages/azure-http-specs/specs/azure/resource-manager/common-properties/arm-resource-identifier.tsp#L68
https://github.com/Azure/typespec-azure/blob/1081f0678431238b3451fdfd82dce3679e572f21/packages/azure-http-specs/specs/azure/resource-manager/common-properties/mockapi.ts#L277-L296
So within
typespec-azuremainthe spec is internally consistent (model and mock both have 5 fields). The skew is introduced only by the workflow, which mixes:typespec-azuremainsource (post-OpenAI - Ordering changes for internal constructors #4891 → 5 fields), andalpha.43dist (pre-OpenAI - Ordering changes for internal constructors #4891 → 4 fields).Impact
Any PR that only touches
packages/http-client-python/**(which is what triggers this workflow) can get a red Mock API Tests check it did not cause, whenevertypespec-azuremainadvances anazure-http-specs/http-specsspec beyond the pinnedalpha.43bundle. This blocks otherwise-green PRs (e.g. #11272).Suggested fixes (pick one)
packages/http-client-python/package.jsonfor@azure-tools/azure-http-specs(and@typespec/http-specs) to a version that includes Add built-in service group extension support Azure/typespec-azure#4891, so the mock dist matches the spec source used for regeneration.typespec-azuremainsource — i.e. make both sides use one source of truth inpython-integration.yml.typespec-azuresource used for regeneration, keeping client and mock in lockstep.Option 2 or 3 removes the class of failure entirely; option 1 fixes the current occurrence.
Notes
http-client-pythonpackage's own unit/e2e tests (typespec - cion Azure DevOps) are unaffected and pass; this is specific to the downstreamtypespec-python(Azure/typespec-azure) Mock API e2e run wired up bypython-integration.yml.