Skip to content

Allow original-uri final state for POST operations and warn on missing GET#4277

Open
Copilot wants to merge 9 commits intorelease/april-2026from
copilot/fix-final-state-override-202-response
Open

Allow original-uri final state for POST operations and warn on missing GET#4277
Copilot wants to merge 9 commits intorelease/april-2026from
copilot/fix-final-state-override-202-response

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

  • Allow original-uri for POST operations in final-state.ts
  • Add no-operation-at-original-uri warning diagnostic in lib.ts
  • Handle POST with original-uri override in lro-helpers.ts
  • Add azure-core tests for original-uri scenarios
  • Rewrite ARM tests per review feedback:
    • Replace ArmResourceActionAsync with ActionAsync template
    • Add diagnostic emission tests for both ArmProviderActionAsync and ActionAsync
    • Add diagnostic suppression + void result validation tests
    • Minimize code duplication with shared spec strings and helpers
  • Update changelog text per reviewer suggestion
  • Fix lint warnings (unused variables in test file)
  • Add changeset entries for typespec-azure-resource-manager and typespec-client-generator-core
  • All files correctly formatted
  • All tests pass

… GET exists at original URI

- Updated validateFinalState to allow original-uri for POST operations (in addition to PUT and PATCH)
- Added no-operation-at-original-uri diagnostic warning
- Updated createLroMetadata to emit diagnostic and treat result as void when @useFinalStateVia("original-uri") is used and no GET exists
- Added tests for PUT, PATCH, POST with original-uri and no GET
- Updated existing test for non-PUT validation

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/1902076d-04e7-43e4-bed4-faed5f55e80c

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:azure-core Issues for @azure-tools/typespec-azure-core library label Apr 17, 2026
Copilot AI and others added 2 commits April 17, 2026 02:48
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/1902076d-04e7-43e4-bed4-faed5f55e80c

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cannot overwrite finalStateVia for 202 response Allow original-uri final state for POST operations and warn on missing GET Apr 17, 2026
Copilot AI requested a review from markcowl April 17, 2026 02:52
Copy link
Copy Markdown
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

Add tests to typespec-azure-reseource-manager validating that

  • An async provider actio0n using the standard async provider action template can use original-uri as the final state without a GET operation at the same uri as long as the appropriate rule is suppressed. Ensure that getLroMetadata returns the expected finalResult (void)
  • A resource action using ArmResourceActionAsync can use original-uri as the final state without a GET at the same uri as long as the appropriate rule is suppressed. Ensure that getLroMetadata returns the expected finalResult (void)

Fix any issues that you find, ensure that all tests pass and all files are correctly formatted

…sync with original-uri and no GET

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/81f1ef67-6caa-46f6-b6cc-cdc9be0b456c

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

Add tests to typespec-azure-reseource-manager validating that

  • An async provider actio0n using the standard async provider action template can use original-uri as the final state without a GET ope...

Added both tests in commit c233a24:

  1. ArmProviderActionAsync with original-uri: Uses SubscriptionActionScope, suppresses no-operation-at-original-uri, and validates getLroMetadata returns finalResult: "void" and finalStateVia: "original-uri".

  2. ArmResourceActionAsync with original-uri: Uses @useFinalStateVia("original-uri") on the interface operation with the diagnostic suppressed, no GET operation present, and validates getLroMetadata returns finalResult: "void" and finalStateVia: "original-uri".

All 287 ARM tests and 317 azure-core tests pass.

@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library label Apr 20, 2026
Copilot AI requested a review from markcowl April 20, 2026 20:52
Comment thread packages/typespec-azure-resource-manager/test/lro-metadata.test.ts Outdated
…/suppression tests, minimize duplication

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/c946af4e-91ff-4292-a0a2-1d7a9ef83ac9

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot AI requested a review from markcowl April 20, 2026 21:17
Copy link
Copy Markdown
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

This looks great, one minor change. Please make sure all files are correctly formatted.

Comment thread .chronus/changes/allow-original-uri-post-operations-2026-04-17-02-40-00.md Outdated
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

This looks great, one minor change. Please make sure all files are correctly formatted.

Ran pnpm format across the repo — all files were already correctly formatted. Updated changelog text per your other suggestion in 4e762cf.

Copilot AI requested a review from markcowl April 20, 2026 23:11
@markcowl markcowl marked this pull request as ready for review April 20, 2026 23:18
@markcowl markcowl added the int:azure-specs Run integration tests against azure-rest-api-specs label Apr 20, 2026
@azure-sdk
Copy link
Copy Markdown
Collaborator

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @azure-tools/typespec-azure-resource-manager
  • @azure-tools/typespec-client-generator-core

The following packages have already been documented:

  • @azure-tools/typespec-azure-core
Show changes

@azure-tools/typespec-azure-core - feature ✏️

Allow @useFinalStateVia("original-uri") for long-running POST operations, even when there is no GET operation modeled at the POST url.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-azure-core@4277
npm i https://pkg.pr.new/@azure-tools/typespec-azure-resource-manager@4277
npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@4277

commit: cdf97dd

@markcowl
Copy link
Copy Markdown
Member

@copilot the PR is failing the linting check. Please lint the files and fix any issues

@azure-sdk
Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

@copilot the PR is failing the linting check. Please lint the files and fix any issues

Fixed in c25be81:

  1. Removed 3 unused runner variables in operations.test.ts (the ESLint no-unused-vars warnings)
  2. Added changeset entry for @azure-tools/typespec-azure-resource-manager and @azure-tools/typespec-client-generator-core (flagged by the chronus check as having undocumented changes relative to main)

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/3d2c55c7-a1f5-42f6-8bb1-4fcf9e92a7c9

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot AI requested a review from markcowl April 20, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

int:azure-specs Run integration tests against azure-rest-api-specs lib:azure-core Issues for @azure-tools/typespec-azure-core library lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot overwrite finalStateVia for 202 response

3 participants