Keep MSGraph request configuration across paginated pages - #71649
Keep MSGraph request configuration across paginated pages#71649SEPURI-SAI-KRISHNA wants to merge 2 commits into
Conversation
|
LGTM, thanks for the contribution. |
SameerMesiah97
left a comment
There was a problem hiding this comment.
I think the test is fine as is. I am ambivalent regarding whether or not all parameters need to be covered as the only 3 parameters you have covered are actually relevant to the bug.
The pagination defer rebuilt the trigger without the headers, body and scopes the operator was configured with, so only the first page of a paginated Graph query was issued as intended. The HTTP method was still forwarded, which meant a POST could be repeated on later pages with its body dropped.
The existing test asserts the deferred trigger is built with the operator's headers, body and scopes. This adds the complementary check that those survive all the way to the request issued for the second page, so a future regression in the pagination path is caught at the layer users actually observe.
f90f2cd to
c03bc05
Compare
|
Thanks both for the reviews. Good suggestion, I've added that test. It drives the operator through the full deferrable loop across both pages and asserts on the def test_pagination_issues_every_page_with_the_configured_request(self):
...
requests = [call.args[0] for call in mock_get_http_response.call_args_list]
assert len(requests) == 2
for request in requests:
assert request.headers.try_get("ConsistencyLevel") == {"eventual"}
assert request.content == json.dumps(data).encode("utf-8")I configured the operator with
which is the shape of the bug: the verb is carried over to the next page while the body and headers that gave it meaning are not. I kept the existing Both fail with the source change reverted and pass with it applied (13 pre-existing tests in the file are unaffected either way). |
MSGraphAsyncOperatordefers withMSGraphTriggerfrom two places. The initial defer inexecutepasses the full request configuration. The pagination defer intrigger_next_link, used for every@odata.nextLinkpage after the first, leaves outheaders,dataandscopes:All three default to
Noneon the trigger, andMSGraphTrigger.run()uses them directlywhen issuing the request, so nothing restores them. Page 1 is sent as configured and every
subsequent page is not.
The clearest symptom of the inconsistency is that
methodis forwarded. An operatorconfigured with a
POSTand a body therefore re-issues thatPOSTon page 2 withdata=None— the verb is preserved while its body is dropped.headersmatters for the same reason in ordinary use: Microsoft Graph requiresConsistencyLevel: eventualfor$countand$searchqueries, so a query that works onthe first page can start failing or returning inconsistent results partway through
pagination.
scopesfeeds token acquisition, so follow-up pages could authenticate withdifferent permissions than the first.
path_parametersandurl_templateare deliberately left out of this change. They existto build a URL, and pagination already has an absolute
nextLink, so not forwarding themis correct rather than an oversight.
No newsfragment: this is a provider change, and provider changelogs are regenerated from
git logby the release manager.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines