BulkRoleCache.prefetch caches the legacy loop variable for openedx-authz roles

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, python

調査の方向性

Start in common/djangoapps/student/roles.py at BulkRoleCache.prefetch and trace both the legacy and openedx-authz loops. Reproduce the authz-only and mixed-batch cases with the described in-memory fixtures, then add regression coverage showing each user/course cache contains its own assignment and both cases pass.

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

説明

Checked 2026-09-30: master source at ca039029e4918f02903b1c7d62adf8b3ad74f75b and release/verawood source at 18ce9a9c2b20c745b0ee94f615c13855acd9624b. Both carry this code path. This is a source diagnostic; no upstream full integration suite or production mutation ran.

The openedx-authz loop iterates over its own role but inserts compat_role, which belongs to the preceding legacy loop.

Reproduction:

  1. Give an author an openedx-authz course assignment with no legacy CourseAccessRole rows in the prefetch batch.
  2. Call BulkRoleCache.prefetch for that batch. The first authz assignment raises UnboundLocalError.
  3. Repeat with a legacy role present, on another course. The authz course cache receives the last legacy role instead of that author's authz role.

An isolated execution of the current native function body with in-memory model/role fixtures reproduces both outcomes on master and Verawood. Changing only the insertion to the current authz loop role makes both controls cache the expected authz role. This is not a full Django/authorization integration claim.

Expected: authz-only and mixed batches cache their own per-user/course assignments, independent of which legacy role was last enumerated. Suggested regression controls are both cases above, including distinct courses and users.

Duplicate checks: current issue/PR searches for BulkRoleCache and compat_role. #38984 concerns platform-wide scope conversion, not this loop variable; #38943 concerns grade-report query cost. I found no report for this insertion case in those results.

主要言語
Python
スター
8.2k
フォーク
4.4k
平均マージ
2日 10時間
マージ済み PR(30日)
40

環境構築

はじめの一歩

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

openedx/openedx-platform のほかの issue

openedx/openedx-platform の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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