Discussion API: missing thread returns 500 (ForumV2RequestError not mapped to ThreadNotFoundError)
I maintainer di solito rispondono entro 1 giorno
@mbhavu2007-lang ci sta già lavorando.
Dal 31/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia da lms/djangoapps/discussion/rest_api/api.py in _get_thread_and_context e _get_comment_and_context, che intercettano CommentClientRequestError quando un thread o un commento manca. La chiamata che fallisce è Thread._retrieve in comment_client/thread.py, che richiama forum.api.get_thread e lascia propagare forum.utils.ForumV2RequestError. Puoi tradurre quell'errore in CommentClientRequestError nel comment client oppure intercettarlo nelle clausole except di quelle funzioni. È completato quando un DELETE, GET o PATCH su un thread mancante restituisce 404 invece di 500, con un test che lo copra.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 8.2k
- Fork
- 4.4k
- Merge medio
- 2g 10h
- PR unite (30g)
- 40
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openedx/openedx-platform
-
v3 notification preferences: PUT with email_cadence but no notification_channel raises KeyError (500)Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
openedx/openedx-platform#39221 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
openedx/openedx-platform#39169 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openedx/openedx-platform#39084 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 82/100
openedx/openedx-platform#38792 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
openedx/openedx-platform#38544 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openedx/openedx-platform
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
btclib-org/btclib-wallet#1045 ·
I maintainer di solito rispondono entro 1 giorno
-
area-templates triage:bot-seen triage:needs-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/aspire#22356 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[Train] An elastic ScalingConfig(num_workers=(0, 0)) is accepted and the run waits foreverForse già presa @wguo7 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ray-project/ray#68217 ·
I maintainer di solito rispondono entro 2 giorni