microsoftgraph / microsoftgraph/msgraph-sdk-java

Calling toPatchInformation prior to calling patch causes patch to silently fail

オープン
#2,295 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

status:waiting-for-triage type:bug
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
4

説明

Describe the bug

When calling a patch operation on an Application request, calling toPatchInformation causes the .patch(app) to not work. If true, then this probably needs either a doc update or a fix.

This does not work, but no error is thrown and the logs are clean it seems:

// DOES NOT WORK
val trequest = graphClient.applications().byApplicationId(oid)
val emptyApp = Application()
emptyApp.setNotes(s"Updated via code. ${java.time.ZonedDateTime.now()}")
trequest.toPatchRequestInformation(emptyApp)
trequest.patch(emptyApp)

but this works and the application registration is changed

// WORKS
val trequest = graphClient.applications().byApplicationId(oid)
val emptyApp = Application()
emptyApp.setNotes(s"Updated via code. ${java.time.ZonedDateTime.now()}")
//trequest.toPatchRequestInformation(emptyApp)
trequest.patch(emptyApp)

This may be related to something not idempotent and there is some hidden state somewhere.

OTEL logging suggest that the only difference in calling is that the following is called twice when including the toPatchRequestInformation prior to patch. patch also calls toPatchRequestInformation as well. However,
it looks like creating RequestInformation is idempotent...hmm...

// this is the only difference in the trace which is expected since setContentFromParsable is called when toPatchRequestInformation is called.
[otel.javaagent 2025-02-09 16:38:49:625 -0500] [main] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'setContentFromParsable' : ace455a22586ba518b85e4a1b307630d b731da65e1939a46 INTERNAL [tracer: com.microsoft.kiota:] AttributesMap{data={thread.id=1, com.microsoft.kiota.request.type=com.microsoft.graph.models.Application, thread.name=main}, capacity=128, totalAddedValues=3}
[otel.javaagent 2025-02-09 16:38:49:625 -0500] [main] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'setContentFromParsable' : 9e931b04f0305f0ef5df1bb3a8b59f78 30a5455e58f3fb17 INTERNAL [tracer: com.microsoft.kiota:] AttributesMap{data={thread.id=1, com.microsoft.kiota.request.type=com.microsoft.graph.models.Application, thread.name=main}, capacity=128, totalAddedValues=3}
Expected behavior

The patch works even if toPatchRequestInformation is called prior to calling patch.

How to reproduce
SDK Version

6.x, latest

Latest version known to work for scenario above?

No response

Known Workarounds

None

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Application のリクエストエントリポイントである toPatchRequestInformationpatch から始め、両者で繰り返し行われる setContentFromParsable の呼び出しと、共有しているリクエスト状態を比較します。issue にある 2 つのシーケンスを再現し、先に toPatchRequestInformation を呼び出しても patch による Application の更新が妨げられないことを示す回帰テストを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。