Skip to content

[python-integration] Build mock specs from source to fix client/mock skew#11377

Merged
l0lawrence merged 1 commit into
mainfrom
l0lawrence/bump-azure-http-specs-armidwithgroupscope
Jul 24, 2026
Merged

[python-integration] Build mock specs from source to fix client/mock skew#11377
l0lawrence merged 1 commit into
mainfrom
l0lawrence/bump-azure-http-specs-armidwithgroupscope

Conversation

@l0lawrence

@l0lawrence l0lawrence commented Jul 23, 2026

Copy link
Copy Markdown
Member

Do we even need to pin devDep for http-specs then?

Summary

The Python Integration → Mock API Tests job (.github/workflows/python-integration.yml) can fail on http-client-python PRs with body-validation errors unrelated to the PR under test, due to a client/mock spec skew.

Root cause

The job:

  • regenerates the client from the freshly checked-out Azure/typespec-azure main .tsp source, but
  • overwrites the mock server dist (azure-http-specs / http-specs) with the versions resolved via http-client-python's package.json pin (@azure-tools/azure-http-specs@0.1.0-alpha.43).

Whenever typespec-azure main advances a spec beyond the pinned bundle, client and mock disagree. After Azure/typespec-azure#4891 added the armIdWithGroupScope ARM common property, the regenerated client sends 5 properties but the pinned alpha.43 mock expects 4 → the 4 test_arm_resource_identifiers_* failures on every Python PR.

The change

Build the mock servers from the same checked-out source used to regenerate the client, instead of pinning them to the http-client-python-resolved version. Client and mock stay in lockstep, removing this entire class of failure (issue #11348, option 3).

- name: Build http-specs and azure-http-specs from source
  run: pnpm turbo run build --filter "@typespec/http-specs..." --filter "@azure-tools/azure-http-specs..."

The @azure-tools/azure-http-specs devDependency pin is intentionally left at alpha.43 — it is still needed by the emitter's own npm run regenerate (which resolves specs from node_modules/@azure-tools/azure-http-specs/specs) and its RegenCheck. This change only decouples the mock server from that pin.

Because this PR edits python-integration.yml (a trigger path), the workflow's own run here validates the fix.

Why not just bump the azure-http-specs pin?

Tried and rejected. Bumping to 0.1.0-alpha.44-dev.5 makes Mock API Tests pass, but breaks the blocking typespec - ci … RegenCheck: the emitter's npm run regenerate compiles specs from the bundle against its pinned @azure-tools/typespec-azure-*: ~0.70.0, and every published alpha.44 build also pulls in the new service-group spec / ServiceGroup scope, which requires typespec-azure 0.71-dev (only dev pre-releases exist; no stable 0.71). RegenCheck failed on both linux and windows in that attempt. This workflow-only fix avoids that skew entirely and leaves the pin untouched.

Fixes

Closes #11348 — including the 4 test_arm_resource_identifiers_* Mock API failures.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Jul 23, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@11377

commit: 6022145

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

No changes needing a change description found.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:ec09e28b3d2990734d1b54ebad85411adb148d12 vs this PR.

⚠️ emitter-diff failed (exit 1) — tool/build error, not a diff. See the run.

Informational check (eng/emitter-diff); does not block the PR.

@azure-sdk-automation

azure-sdk-automation Bot commented Jul 23, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@l0lawrence
l0lawrence force-pushed the l0lawrence/bump-azure-http-specs-armidwithgroupscope branch from 0ca4385 to ba40f80 Compare July 23, 2026 22:45
@l0lawrence l0lawrence changed the title [python] Bump @azure-tools/azure-http-specs to 0.1.0-alpha.44-dev.1 [python-integration] Build mock specs from source to fix client/mock skew Jul 23, 2026
…ock skew

The "Python Integration -> Mock API Tests" job regenerated the client from
the checked-out Azure/typespec-azure `main` `.tsp` source, but overwrote the
mock server dist (`azure-http-specs`/`http-specs`) with the versions resolved
via http-client-python's `package.json` pin (currently
`@azure-tools/azure-http-specs@0.1.0-alpha.43`).

Whenever typespec-azure `main` advanced a spec beyond the pinned bundle, the
client and mock disagreed and otherwise-green http-client-python PRs failed
with body-validation errors unrelated to the PR (e.g. the 4
`test_arm_resource_identifiers_*` common-properties failures after
Azure/typespec-azure#4891 added `armIdWithGroupScope`).

Build the mock servers from the same checked-out source used to regenerate the
client instead of pinning them, keeping client and mock in lockstep and
removing this class of failure. This intentionally does not bump the
`azure-http-specs` pin: alpha.44 requires typespec-azure 0.71-dev features
(`ServiceGroup`) that the emitter''s pinned ~0.70.0 libraries can''t compile,
which would break `npm run regenerate` / the RegenCheck.

Fixes #11348.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8f756746-2ff4-4e4f-9f15-23f07a9d11fe
@l0lawrence
l0lawrence force-pushed the l0lawrence/bump-azure-http-specs-armidwithgroupscope branch 2 times, most recently from a0b7bc0 to 6022145 Compare July 24, 2026 16:46
@l0lawrence l0lawrence changed the title [python-integration] Build mock specs from source to fix client/mock skew [python] Bump @azure-tools/azure-http-specs to 0.1.0-alpha.44-dev.5 Jul 24, 2026
@l0lawrence
l0lawrence force-pushed the l0lawrence/bump-azure-http-specs-armidwithgroupscope branch from 6022145 to a0b7bc0 Compare July 24, 2026 17:11
@l0lawrence l0lawrence changed the title [python] Bump @azure-tools/azure-http-specs to 0.1.0-alpha.44-dev.5 [python-integration] Build mock specs from source to fix client/mock skew Jul 24, 2026
@l0lawrence
l0lawrence marked this pull request as ready for review July 24, 2026 18:23
@l0lawrence
l0lawrence added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 4da8bc8 Jul 24, 2026
63 checks passed
@l0lawrence
l0lawrence deleted the l0lawrence/bump-azure-http-specs-armidwithgroupscope branch July 24, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python eng

Projects

None yet

3 participants