Discussion API: missing thread returns 500 (ForumV2RequestError not mapped to ThreadNotFoundError)
メンテナーはふだん 1 日以内に返信
@mbhavu2007-lang がすでに取り組んでいます。
2026年10月31日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
調査の方向性
lms/djangoapps/discussion/rest_api/api.py の _get_thread_and_context と _get_comment_and_context から確認してください。これらはスレッドやコメントが存在しない場合に CommentClientRequestError を捕捉しています。失敗している呼び出しは comment_client/thread.py の Thread._retrieve で、forum.api.get_thread を呼び出し、forum.utils.ForumV2RequestError をそのまま上に伝播させています。このエラーを comment client 内で CommentClientRequestError に変換するか、これらの関数の except 節で捕捉するかのどちらかで対応してください。存在しないスレッドに対する DELETE、GET、PATCH が 500 ではなく 404 を返し、それをカバーするテストがあれば完了です。
索引モデルが issue の本文から書いたものです。
説明
With the forum v2 backend (openedx/forum, used in-process), DELETE /api/discussion/v1/threads/<id>/ for a thread that no longer exists returns a bare 500, not 404:
forum.utils.ForumV2RequestError: Thread does not exist with Id: 137
File ".../forum/api/threads.py", line 141, in get_thread
File ".../forum/backends/mysql/api.py", line 993, in validate_object
raise self.model.DoesNotExist(
Internal Server Error: /api/discussion/v1/threads/137/
Cause: _get_thread_and_context in lms/djangoapps/discussion/rest_api/api.py turns a missing thread into ThreadNotFoundError (404) by catching CommentClientRequestError, the error the old HTTP comments-service client raised. The comment client now calls forum.api.get_thread directly (comment_client/thread.py, Thread._retrieve), which raises forum.utils.ForumV2RequestError instead. Nothing maps it, so it escapes as a 500. Any endpoint that goes through _get_thread_and_context should behave the same way (GET/PATCH/DELETE of a thread, and a thread's comment list). The same except CommentClientRequestError pattern is used elsewhere in the module, e.g. _get_comment_and_context.
Impact: a client cannot tell "already deleted" from a server fault. An idempotent cleanup, such as a retry or a teardown after the UI deleted the post, fails with a 500 and an error in the logs.
Expected: 404, as before. Either the comment client translates ForumV2RequestError into CommentClientRequestError, or these except clauses also catch it.
Environment: Tutor main with tutor-forum, openedx-forum 0.4.7 (MySQL backend), 2026-09-23. Code unchanged on master as of 2026-10-13. Found by the Open edX end-to-end test suite.
- 主要言語
- Python
- スター
- 8.2k
- フォーク
- 4.4k
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 40
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openedx/openedx-platform のほかの issue
-
v3 notification preferences: PUT with email_cadence but no notification_channel raises KeyError (500)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
openedx/openedx-platform#39221 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
openedx/openedx-platform#39169 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openedx/openedx-platform#39084 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 82/100
openedx/openedx-platform#38792 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openedx/openedx-platform#38544 ·
メンテナーはふだん 1 日以内に返信
openedx/openedx-platform の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
btclib-org/btclib-wallet#1045 ·
メンテナーはふだん 1 日以内に返信
-
area-templates triage:bot-seen triage:needs-human
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/aspire#22356 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[Train] An elastic ScalingConfig(num_workers=(0, 0)) is accepted and the run waits forever対応中かも @wguo7 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ray-project/ray#68217 ·
メンテナーはふだん 2 日以内に返信