Desktop RTDB: Repo::HandleTransactionResponse collapses every non-datastale server error (incl. permission_denied) to kErrorUnknownError with an empty message
まだ誰も着手していません。
評価
調査の方向性
database/src/desktop/core/repo.cc の Repo::HandleTransactionResponse() と RerunTransactionQueue() から始め、次に database/src/desktop/connection/persistent_connection.cc のレスポンスのステータスとメッセージのフローを比較します。トランザクションの失敗が、permission_denied を含め、マッピングされたサーバーエラーコードとメッセージを保持し、空のメッセージを伴う kErrorUnknownError として完了しないことを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Environment
- Firebase C++ SDK 13.9.0 (desktop/Windows; the cited code is unchanged at the 13.11.0 tag)
- Identified while tracing FlutterFire
firebase_database12.4.6 on Windows; the defect below is independently confirmed from the pinned desktop C++ source.
What happens
When the server rejects a transaction commit (e.g. a security-rules fence returns permission_denied on the wire), the transaction Future<DataSnapshot> completes with:
error()=kErrorUnknownError(10) — notkErrorPermissionDenied(8)error_message()=""(empty)
so callers cannot distinguish "rules denied this commit" from any other failure, and there is no message to log. Plain SetValue() writes on the same path correctly surface kErrorPermissionDenied, which makes the transaction behavior surprising.
Where the information is lost (pinned to 3d7ce2a, the 13.9.0 tag)
- The wire layer maps the response status correctly and retains the server message.
HandlePutResponse()converts the status and passes the response body toTriggerResponse():
https://github.com/firebase/firebase-cpp-sdk/blob/3d7ce2a584d0b8daf1374bc2534c6ea71fa7fd6c/database/src/desktop/connection/persistent_connection.cc#L955-L970
TriggerResponse()stores both values, and the adjacent status map includespermission_denied→kErrorPermissionDenied:
https://github.com/firebase/firebase-cpp-sdk/blob/3d7ce2a584d0b8daf1374bc2534c6ea71fa7fd6c/database/src/desktop/connection/persistent_connection.cc#L1244-L1281 Repo::HandleTransactionResponse()then discards both fields for every error response other thandatastale:
https://github.com/firebase/firebase-cpp-sdk/blob/3d7ce2a584d0b8daf1374bc2534c6ea71fa7fd6c/database/src/desktop/core/repo.cc#L982-L1000for (auto& transaction : response->queue()) { transaction->status = TransactionData::kStatusNeedsAbort; transaction->abort_reason = kErrorUnknownError; }RerunTransactionQueue()finally completes the future with the no-message overload, soerror_message()is empty:
https://github.com/firebase/firebase-cpp-sdk/blob/3d7ce2a584d0b8daf1374bc2534c6ea71fa7fd6c/database/src/desktop/core/repo.cc#L1003-L1138DataSnapshot snapshot(new DataSnapshotInternal( database_, node, QuerySpec(transaction->path))); transaction->ref_future->CompleteWithResult(transaction->future_handle, abort_reason, snapshot);
Expected
abort_reason should carry the mapped response code (8 for permission_denied, etc.) and the completion should pass the response's error message through, matching what the Android SDK reports for the same server rejection.
Impact
Any desktop app implementing fenced/optimistic transactions (rules-enforced epochs, leases, counters) receives an undiagnosable unknown/empty failure for what is actually a well-defined rules denial. Downstream SDK wrappers (e.g. FlutterFire's Windows plugin) inherit the collapsed code, so the loss is user-visible in every binding built on this implementation.
- 主要言語
- C++
- スター
- 326
- フォーク
- 138
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firebase/firebase-cpp-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
firebase/firebase-cpp-sdk#1905 · コメント 2 件 ·
-
api: firestore
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
firebase/firebase-cpp-sdk#1920 · コメント 3 件 ·
-
new type: question
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
firebase/firebase-cpp-sdk#1892 · コメント 1 件 ·
-
nightly-testing
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
firebase/firebase-cpp-sdk#1859 ·
-
nightly-testing
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
firebase/firebase-cpp-sdk#1858 ·
firebase/firebase-cpp-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ros2/message_filters#338 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
subsurface/subsurface#4984 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google-ai-edge/LiteRT-LM#3739 ·