Skip to content

Add linter rule arm-post-lro-response-mismatch for ARM POST LRO operations#4145

Draft
Copilot wants to merge 20 commits intomainfrom
copilot/add-linter-for-arm-post-lro
Draft

Add linter rule arm-post-lro-response-mismatch for ARM POST LRO operations#4145
Copilot wants to merge 20 commits intomainfrom
copilot/add-linter-for-arm-post-lro

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

  • New rule arm-post-lro-response-mismatch for ARM POST LRO operations
  • Template-based detection for ArmResourceActionAsync, ActionAsync, ArmProviderActionAsync
  • Fallback for non-template operations checking 200 response body
  • Uses resolveArmResources for both resource-level and provider-level actions
  • Codefix arm-post-lro-set-final-result using ArmLroLocationHeader<FinalResult = ResponseType>
  • Uses isAssignableTo from typekit for type compatibility checks
  • Fixed void matching: "void" finalResult is compared against TypeSpec builtin void type via isVoidType
  • Response type properly allows void, Model, Scalar, and UnknownType (matching the Response extends Model | unknown | void template constraint)
  • Tests refactored to use it.each for parameterized type matching/non-matching scenarios
  • Tests: 18 tests covering all template types, void matching, type mismatches, scalar types, unknown types, and codefix
  • All 296 tests pass, files formatted correctly
  • Merged latest from main — no merge conflicts, only PR-related files differ

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library label Mar 28, 2026
…-lro-response-mismatch

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/7bf3456e-7b67-406e-a438-d26cf5637117

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a linter to check Response value matches FinalResult for ARM LRO POST Add linter rule arm-post-lro-response-mismatch for ARM POST LRO operations Mar 28, 2026
Copilot AI requested a review from markcowl March 28, 2026 00:57
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.

@copilot Pull the latest from main and then apply the fixes in the comments. Ensure that all tests pass and all files are correctly formatted.

Copilot AI and others added 2 commits March 31, 2026 18:30
…r-arm-post-lro

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

Copilot AI commented Mar 31, 2026

@copilot Pull the latest from main and then apply the fixes in the comments. Ensure that all tests pass and all files are correctly formatted.

Pulled latest from main, applied all review fixes, and verified all 286 tests pass with correct formatting. Changes in a9c28e6.

Copilot AI requested a review from markcowl March 31, 2026 18:58
@markcowl
Copy link
Copy Markdown
Member

@copilot Please pull the latest from main, regenrate docs for tyepspec-azure-resource-manager, validate that all files are correctly formatted.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot Please pull the latest from main, regenrate docs for tyepspec-azure-resource-manager, validate that all files are correctly formatted.

Pulled latest from main (already up to date at a228fc5), regenerated docs for typespec-azure-resource-manager (added the new rule to README.md and linter.md), validated formatting, and confirmed all 286 tests pass. Done in 7e87831.

@microsoft-github-policy-service microsoft-github-policy-service bot added the meta:website TypeSpec.io updates label Mar 31, 2026
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.

Please pull the latest from main, make the changes suggested, ensure all tests are passing and all files are correctly formatted.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

Please pull the latest from main, make the changes suggested, ensure all tests are passing and all files are correctly formatted.

Pulled latest from main (already up to date), added the fallback for non-template operations that checks the 200 response body vs final-result-schema, and verified all 288 tests pass with correct formatting. Done in fcb4809.

Copilot AI requested a review from markcowl March 31, 2026 20:28
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

Pull the latest, make the change, add additional tests to verify, make sure all tests are passing and all files are correctly formatted.

Pulled latest from main, fixed the "void" matching to use TypeSpec's builtin void type via isVoidType, and added a test verifying void-void match. All 290 tests pass and files are formatted. Done in e8aef92.

Copilot AI requested a review from markcowl April 2, 2026 02:51
@markcowl markcowl added the int:azure-specs Run integration tests against azure-rest-api-specs label Apr 2, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-azure-resource-manager@4145
npm i https://pkg.pr.new/@azure-tools/typespec-azure-rulesets@4145

commit: 1196313

@markcowl
Copy link
Copy Markdown
Member

markcowl commented Apr 2, 2026

@copilot pull the latest and fix any merge issues

…r-arm-post-lro

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

Copilot AI commented Apr 2, 2026

@copilot pull the latest and fix any merge issues

Pulled latest from main and merged cleanly in e5dbc09. The three-dot diff only contains PR-related files. All 290 tests pass and files are formatted.

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.

Pull the latest, make the suggested fixes and also add tests (or add to existing tests) to test these additional finalResult types for both template instantiations and raw operations.

Ensure that all tests pass, that there are no merge issues with main and that all files are correctly formatted.

Copilot AI and others added 3 commits April 2, 2026 21:47
…r-arm-post-lro

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
…or scalar and unknown types

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/097ee85d-b143-454b-baab-9431c663682b

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

Copilot AI commented Apr 2, 2026

Pull the latest, make the suggested fixes and also add tests (or add to existing tests) to test these additional finalResult types for both template instantiations and raw operations.

Ensure that all...

Pulled latest from main (merged cleanly), updated getResponseTemplateParam to handle Scalar and UnknownType in addition to Model, and added 4 new tests for these types. All 294 tests pass and files are formatted. Done in ebf307a and da8e547.

Copilot AI requested a review from markcowl April 2, 2026 22:21
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.

Pull the latest from main, make the suggested changes and add any tests that are necessary to cover code changes, make sure all tests pass, all files are correctly formatted, and there are no merge issues with the main branch

Copilot AI and others added 2 commits April 3, 2026 20:42
…r-arm-post-lro

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

Copilot AI commented Apr 3, 2026

Pull the latest from main, make the suggested changes and add any tests that are necessary to cover code changes, make sure all tests pass, all files are correctly formatted, and there are no merge i...

Pulled latest from main (merged cleanly), fixed void type handling, refactored tests to use it.each, and added parameterized tests for all Response types (Model, unknown, scalar, void). All 296 tests pass, files formatted, no merge issues. Done in 1196313.

Copilot AI requested a review from markcowl April 3, 2026 21:04
@markcowl
Copy link
Copy Markdown
Member

markcowl commented Apr 3, 2026

/azp run typespec-azure - PR Tools

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk
Copy link
Copy Markdown
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-azure-resource-manager
  • @azure-tools/typespec-azure-rulesets
Show changes

@azure-tools/typespec-azure-resource-manager - feature ✏️

Add linter rule arm-post-lro-response-mismatch to warn when a long-running POST operation's final result type does not match the 200 response body

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

Add linter rule arm-post-lro-response-mismatch to warn when a long-running POST operation's final result type does not match the 200 response body

@azure-sdk
Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

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-resource-manager Issues for @azure-tools/typespec-azure-core library meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linter] Add a linter to warn if the Response value doesn't match the FinalResult for ARM LRO POST

3 participants