Skip to content

Add Spector coverage for LRO client metadata - #5740

Closed
iscai-msft wants to merge 5 commits into
Azure:mainfrom
iscai-msft:add-lro-spector-tests
Closed

iscai-msft wants to merge 5 commits into
Azure:mainfrom
iscai-msft:add-lro-spector-tests

Conversation

@iscai-msft

@iscai-msft iscai-msft commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a Document Intelligence-shaped operation-ID scenario with bare @lroOperationId on the polling GET's exact resultId path parameter
  • preserve the complete deep, query-bearing Operation-Location URI for polling while making the server-issued ID independently identifiable
  • add an atomic Content Understanding-shaped @lroStatusMetadata scenario for optional nested usage?: UsageDetails, including a Record<int32> token dictionary
  • use explicit polling operations and status-envelope types consistently in @pollingOperation and LongRunningStatusLocation<T>
  • describe these as Azure HTTP contracts for emitter-specific generated-client tests without claiming this PR validates emitter API surfaces

Depends on #5677. This branch intentionally contains only the Azure HTTP Specs/Spector changes and is based on main; validation was performed with finalized dependency commit 535ba05b9 applied locally.

The mocks verify the observable HTTP contract: clients poll the complete server-issued URI, and nested usage data is present in the status response. Emitter-specific Spector opt-ins still need to assert each generated SDK's public operation-ID and typed status-metadata surface.

Validation

Validated with #5677 commit 535ba05b9 applied locally:

  • mise exec -- pnpm -r --filter "@azure-tools/typespec-client-generator-core..." build
  • mise exec -- pnpm --filter @azure-tools/azure-http-specs generate-scenarios-summary
  • mise exec -- pnpm --filter @azure-tools/azure-http-specs validate-scenarios — 81 full scenarios / 61 scenarios valid
  • mise exec -- pnpm --filter @azure-tools/azure-http-specs build
  • mise exec -- pnpm --filter @azure-tools/azure-http-specs validate-mock-apis — all mock APIs present
  • live Spector server/knock run exercised both new scenarios successfully: POST + Running GET + Succeeded GET, 6/6 requests passed; the repository-wide run also reported 8 unrelated existing ARM operation-template failures
  • mise exec -- pnpm format
  • mise exec -- pnpm lint

@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:tcgc Issues for @azure-tools/typespec-client-generator-core library lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package meta:website TypeSpec.io updates labels Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @azure-tools/azure-http-specs
Show changes

@azure-tools/azure-http-specs - feature ✏️

Add service-shaped Azure HTTP scenarios for LRO operation ID extraction and nested typed status metadata.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📦 Package size report

2 packages changed size, +7.66 KB (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-client-generator-core 246.09 KB → 251.34 KB +5.25 KB (+2.1%) 🔴 1.31 MB → 1.34 MB +31.77 KB (+2.4%) 🔴
@azure-tools/azure-http-specs 144.49 KB → 146.29 KB +1.80 KB (+1.2%) 🔴 1.21 MB → 1.22 MB +10.79 KB (+0.9%) 🔴
12 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-resource-manager 186.58 KB → 186.93 KB +363 B (+0.2%) 1.12 MB → 1.12 MB +2.70 KB (+0.2%)
@azure-tools/typespec-azure-core 136.55 KB → 136.79 KB +251 B (+0.2%) 733.30 KB → 734.49 KB +1.19 KB (+0.2%)
@azure-tools/typespec-azure-rulesets 5.57 KB → 5.59 KB +20 B (+0.4%) 34.21 KB → 34.40 KB +193 B (+0.6%)
@azure-tools/typespec-ts 530.77 KB → 530.76 KB -8 B (-0.0%) 2.67 MB → 2.67 MB —
@azure-tools/typespec-azure-portal-core 36.26 KB → 36.26 KB +2 B (+0.0%) 242.62 KB → 242.62 KB —
@azure-tools/typespec-autorest 87.87 KB → 87.87 KB — 424.17 KB → 424.17 KB —
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB — 26.00 KB → 26.00 KB —
@azure-tools/typespec-azure-examples 80.15 KB → 80.15 KB — 383.36 KB → 383.36 KB —
@azure-tools/typespec-go 263.76 KB → 263.76 KB — 1.35 MB → 1.35 MB —
@azure-tools/typespec-java 20.22 MB → 20.22 MB — 22.51 MB → 22.51 MB —
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB — 62.26 KB → 62.26 KB —
@azure-tools/typespec-python 42.54 KB → 42.54 KB — 165.94 KB → 165.94 KB —

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed. Packages from the core/ submodule are not included.
🔴 grew · 🟢 shrank — only changes of at least 512 B and 0.5% are marked.

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 74764156-f3ea-445f-9ebd-67821f33bb10
@iscai-msft
iscai-msft force-pushed the add-lro-spector-tests branch from 7e92bd7 to 9020570 Compare October 16, 2026 20:01
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d18612ec-bd77-4fdd-86d0-467051688ac6

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Both POST operations omit the API-version query parameter required by their mocks, and dependency #5677 remains unmerged.

1 open issue
What changed in this PR

Adds Azure HTTP Spector scenarios for the LRO client metadata proposed in #5677.

Changes:

  • Covers operation-ID extraction and typed polling metadata.
  • Adds running-to-succeeded mock flows and scenario documentation.
  • Records the spec-package change in Chronus.
File Description
packages/​azure-http-specs/​specs/​azure/​client-generator-core/​lro/​metadata/​mockapi.ts Implements both polling flows.
packages/​azure-http-specs/​specs/​azure/​client-generator-core/​lro/​metadata/​main.tsp Defines metadata scenarios and service models.
packages/​azure-http-specs/​spec-summary.md Documents expected requests and metadata.
.chronus/​changes/​add-lro-metadata-spector-2026-10-15.md Records the added coverage.

Review effort: Balanced

Comment thread packages/azure-http-specs/specs/azure/client-generator-core/lro/metadata/main.tsp Outdated
iscai-msft and others added 2 commits October 19, 2026 15:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d18612ec-bd77-4fdd-86d0-467051688ac6
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d18612ec-bd77-4fdd-86d0-467051688ac6
@microsoft-github-policy-service microsoft-github-policy-service Bot added the lib:azure-core Issues for @azure-tools/typespec-azure-core library label Oct 19, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5066e9e2-6a77-46f5-9ab4-b1472cdd5bc8
@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/azure-http-specs@5740
npm i https://pkg.pr.new/@azure-tools/typespec-azure-core@5740
npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@5740

commit: 4d3f31b

response: {
status: 200,
body: json({
id: "analysis-123",

@weidongxu-microsoft Weidong Xu (weidongxu-microsoft) Oct 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body should not have this id: "analysis-123" (ContentAnalysisStatus model too)

The problem of Document Intelligence is that they do not follow the guideline and did not have this id.
If they had this id, @operationId is not needed at all.
They just want to extract the equivalent of this id from operation-location header (to call another getAnalyzeResultPdf/getAnalyzeResultFigure API).

That is the reason they added/customized the getResultId() in Java that parse the value of operation-location header and return the last segment.

AKA, this is not used for polling related thing. It is only about "extract" the non-exist id from operation-location header.

body: json({
id: "usage-123",
status: "Running",
usage: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we want a test without usage being returned?

@iscai-msft

Copy link
Copy Markdown
Member Author

Superseded by #5677 for @lroStatusMetadata with Content Understanding Spector coverage and #5782 for @lroOperationId with Document Intelligence Spector coverage. Closing this standalone Spector PR now that each scenario is reviewed with its implementation.

@iscai-msft iscai-msft closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:azure-http-specs For issues/prs related to the @azure-tools/typespec-azure-http-specs package lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants