[v3 wrappers] Make session request-adapter caching Graph-profile-aware
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp, powershell
調査の方向性
Start with SessionAdapterCache.cs and GraphClientCmdlet.cs to trace how the session HttpClient selects and reuses adapters, then inspect CmdletEmitter.cs for the profile passed by generated wrappers. Review SessionAdapterCacheTests.cs and add stub-transport URI regressions for both profile invocation orders, including reuse and client replacement; done means requests retain the intended profile without stale session transport.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Track the shared runtime/generator routing problem discussed in #3839 for a separate follow-up PR, rather than extending the Bookings retirement change.
When wrapper cmdlets use the active Connect-MgGraph session without -AccessToken, GraphClientCmdlet.GetRequestAdapter() returns an adapter from SessionAdapterCache. The cache is keyed only by reference identity of the session HttpClient, so v1.0 and beta wrappers share one adapter. Generated Kiota clients set RequestAdapter.BaseUrl to their profile URL only when it is empty, then capture that value in their path parameters.
Consequently, the first profile used in a session wins: running a v1.0 wrapper first can make subsequent beta Bookings cmdlets call /v1.0/...; running beta first can make subsequent v1.0 wrappers call /beta/.... The correct /solutions/bookingBusinesses path does not prevent this API-version misrouting.
Expected behavior
Each wrapper uses its intended Graph profile regardless of invocation order or concurrent activity. Adapters may be reused for the same session transport and profile, but must not share mutable profile-specific BaseUrl state across v1.0 and beta.
Retain the existing session transport and lifecycle behavior: reconnecting, changing request context, or disconnecting must not leave requests bound to a stale session HttpClient.
How to reproduce
Code-derived reproduction scenario from review; no live Graph request reproduction was performed while filing this issue:
- Establish a
Connect-MgGraphsession and use wrapper cmdlets without-AccessToken. - Invoke a v1.0 wrapper command, for example from Calendar, so its client initializes the cached adapter's base URL to
https://graph.microsoft.com/v1.0. - Invoke a beta Bookings wrapper command in the same session. Its generated client sees a nonempty adapter base URL and retains
/v1.0instead of selecting/beta. - Repeat with beta first, then v1.0, to observe the reverse routing risk.
Add deterministic tests that capture outgoing request URIs with a stub transport, without depending on live Graph data.
SDK Version
Unreleased powershell-v3 wrapper implementation, observed during #3839 at commit 037ab5db249e97a44338a0b08a2ecb0dc67e0e23. No claim is made about released v2 service modules.
Latest version known to work for scenario above?
Unknown.
Known Workarounds
Supplying -AccessToken currently creates a separate request adapter per invocation and bypasses this session adapter cache. This is a different authentication path, not a fix for session-based usage.
Do not fix this by unconditionally overwriting the shared adapter's BaseUrl: that still mutates shared state and can misroute concurrent or subsequent requests. Removing caching outright also loses its session-lifecycle purpose.
Debug output
N/A. Report based on the referenced review discussion and current runtime/generator source inspection; no live request logs were collected.
Configuration
Applies to v1.0 and beta wrapper modules sharing the same session HttpClient. No OS-specific dependency identified; runtime reproduction across PowerShell editions has not been performed.
Other information
Relevant sources:
src/GraphWrapperRuntime/Runtime/SessionAdapterCache.cs: single cached adapter keyed only by session client identity.src/GraphWrapperRuntime/Runtime/GraphClientCmdlet.cs: adapter acquisition does not receive a Graph profile.tools/WrapperGenerator/CmdletEmitter.cs: emits parameterlessGetRequestAdapter()calls.src/Bookings/wrapper/beta/Client/ApiClient.cs: profile base URL is assigned only when the adapter base URL is empty.src/GraphWrapperRuntime/Runtime.Tests/SessionAdapterCacheTests.cs: existing session-client reuse/replacement coverage.
Suggested follow-up scope and acceptance criteria:
- Make adapter acquisition and cache identity profile-aware, for example
(session HttpClient reference, Graph profile), while preserving the authenticated session transport. - Update the generator to supply the intended profile and regenerate affected wrapper sources through the established workflow; avoid hand-editing generated clients.
- Add same-session v1.0 → beta → v1.0 and beta → v1.0 → beta request-URI regressions.
- Cover same-profile reuse, distinct adapters for different profiles, client replacement/context changes, and interleaved or concurrent requests without cross-profile mutation.
- Keep
-AccessTokenbehavior and the supported Bookings/solutions/...cmdlet surface unchanged.
Original finding: https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/3839#discussion_r4405262434
Follow-up explanation requested for tracking: https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/3839#discussion_r4405694648
- 主要言語
- C#
- スター
- 904
- フォーク
- 235
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-powershell のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
メンテナーはふだん 1 日以内に返信
-
Tracking for V3 Upgrade対応中かも @ramsessanchez が 2 日前に担当しました。 オープンtype:epic
microsoftgraph/msgraph-sdk-powershell#3874 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:bug
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
microsoftgraph/msgraph-sdk-powershell#3872 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:bug
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
microsoftgraph/msgraph-sdk-powershell#3831 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
microsoftgraph/msgraph-sdk-powershell#3827 ·
メンテナーはふだん 1 日以内に返信
microsoftgraph/msgraph-sdk-powershell の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
GameShowLDA/AskMkiM#1075 ·
メンテナーはふだん 1 日以内に返信
-
kind/bug triage/untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unoplatform/uno.resizetizer#414 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信