Skip to content

Add ARM poller helper under azure_core::http::poller::resource_manager#4508

Open
Copilot wants to merge 12 commits into
mainfrom
copilot/add-heuristic-lro-helper
Open

Add ARM poller helper under azure_core::http::poller::resource_manager#4508
Copilot wants to merge 12 commits into
mainfrom
copilot/add-heuristic-lro-helper

Conversation

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Adds azure_core::http::poller::resource_manager::new_poller(...) for resource manager long-running operations.

The helper selects polling behavior heuristically from azure-asyncoperation, operation-location, location, or the original resource URL fallback. It also resolves relative and absolute poll/final URLs, avoids deserializing a monitor for empty terminal bodies, and returns explicit errors for failed or canceled terminal states.

This change also adds focused mock-based coverage for async, body, operation-location, and location polling paths in sdk/core/azure_core/src/http/poller/resource_manager/tests.rs.

Co-authored-by: Heath Stewart heaths@microsoft.com

Copilot AI linked an issue Jun 1, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits June 1, 2026 23:38
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Copilot AI changed the title [WIP] Add heuristic-based LRO helper for ARM crates Add ARM heuristic LRO helper under azure_core::http::poller::resource_manager Jun 1, 2026
Copilot finished work on behalf of heaths June 1, 2026 23:43
Copilot AI requested a review from heaths June 1, 2026 23:43

@heaths heaths left a comment

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.

Also make sure to format and lint code per instructions.

Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/tests.rs
Comment thread sdk/core/azure_core/src/http/poller.rs Outdated

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@heaths I've opened a new pull request, #4510, to work on those changes. Once the pull request is ready, I'll request review from you.

…#4510)

Thanks for the feedback on #4508. I've created this new PR, which merges
into #4508, to address your comment. I will work on the changes and keep
this PR's description up to date as I make progress.

Original PR: #4508
Triggering reviews:
-
#4508 (comment)
> @copilot expand on these monikers better, like "async" should mention
the `azure-asyncoperation` header.
-
#4508 (comment)
> @copilot since we clone the `initial_request` above as well as its
URL, I don't think we need to clone `resource_url` here yet again. Can't
we just `initial_request.url().clone()` here?
-
#4508 (comment)
> @copilot make sure we cover all test cases for async, body, and loc
directories for `*_test.go` files under
https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/azcore/internal/pollers.
-
#4508 (comment)
> @copilot this field shouldn't be necessary. Undo changes related to
this `state` field and I'll handle that in a separate PR.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/tests.rs Outdated
@heaths heaths marked this pull request as ready for review June 2, 2026 01:46
@heaths heaths requested review from RickWinter and xirzec as code owners June 2, 2026 01:46
Copilot AI review requested due to automatic review settings June 2, 2026 01:46
@heaths heaths requested a review from LarryOsterman as a code owner June 2, 2026 01:46
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>

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.

Pull request overview

Adds an ARM-specific long-running-operation (LRO) poller helper under azure_core::http::poller::resource_manager, aiming to centralize ARM polling heuristics (async/body/location) behind a single entrypoint and provide mock-based test coverage.

Changes:

  • Introduces azure_core::http::poller::resource_manager::new_poller(...) implementing ARM header/body heuristics and relative/absolute URL handling.
  • Adds a new resource_manager module to the public http::poller namespace.
  • Adds mock HTTP tests covering async, body, and location patterns plus some terminal/failure cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
sdk/core/azure_core/src/http/poller/resource_manager/mod.rs New ARM heuristic poller implementation and link-resolution helpers.
sdk/core/azure_core/src/http/poller/resource_manager/tests.rs New mock-based tests for common ARM LRO polling patterns.
sdk/core/azure_core/src/http/poller.rs Exposes the new resource_manager module.

Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs Outdated
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Comment thread sdk/core/azure_core/src/http/poller.rs
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Copilot finished work on behalf of heaths June 2, 2026 01:57
Copilot AI requested a review from heaths June 2, 2026 01:57
@copilot also make sure to format and lint changed code.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Also make sure to format and lint code per instructions.

Addressed in d2d0b84. I ran cargo fmt, the targeted new_poller_ tests, and cargo clippy for azure_core.

Copilot finished work on behalf of heaths June 2, 2026 02:23
Copilot AI requested a review from heaths June 2, 2026 02:23

@heaths heaths left a comment

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.

"ARM" and "LRO" are not good in customer-facing error messages. Use "resource manager" instead of "ARM" and "poller" or "long-running operation" instead of "LRO" where appropriate i.e., "poller" when referring to the code itself or "long-running operation" when referring to service behavior.

Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
Copilot AI and others added 3 commits June 2, 2026 02:35
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>

@heaths heaths left a comment

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.

I'll pull down and finish it myself.

Copilot finished work on behalf of heaths June 2, 2026 02:40
Copilot AI requested a review from heaths June 2, 2026 02:40
@heaths

heaths commented Jun 2, 2026

Copy link
Copy Markdown
Member

@copilot update the title and the PR description to match the current implementation. The description should be concise and mention that it resolves #4296.

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update the title and the PR description to match the current implementation. The description should be concise and mention that it resolves #4296.

I can’t edit the PR title directly with the tools available here, but this would match the current implementation:

Title: Add resource manager poller helper under azure_core::http::poller::resource_manager``

Description: Adds azure_core::http::poller::resource_manager::new_poller(...)for resource manager long-running operations, using header/body heuristics to chooseazure-asyncoperation, operation-location, location, or resource polling, with focused mock-based coverage for those paths. Resolves #4296.

Copilot AI changed the title Add ARM heuristic LRO helper under azure_core::http::poller::resource_manager Add resource manager poller helper under azure_core::http::poller::resource_manager Jun 2, 2026
Copilot finished work on behalf of heaths June 2, 2026 02:46
Fixed references to "ARM" and "LRO" to be more user-friendly in user-facing errors. Also made sure to always set the `api-version` query parameter which should be universal for all ARM operations.
@heaths heaths requested review from antkmsft and jhendrixMSFT June 2, 2026 04:03
@heaths heaths changed the title Add resource manager poller helper under azure_core::http::poller::resource_manager Add ARM poller helper under azure_core::http::poller::resource_manager Jun 2, 2026
Comment thread sdk/core/azure_core/src/http/poller/resource_manager/mod.rs
@heaths

heaths commented Jun 10, 2026

Copy link
Copy Markdown
Member

Discussed offline: I'll create an ArmPoller and probably will re-export from within poller but still define in a separate submodule for cleanliness based more on Java's implementation that otherwise took a similar approach for DP pollers for TypeSpec as us. I'll probably just abandon this Frankenbranch and start anew with newly generated azure_resourcemanager_keyvault as well since a lot has changed in the emitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need heuristic-based LRO helper for ARM crates

4 participants