Skip to content

f-1251 Add blind grading permission foundation - #1562

Open
morozov-av wants to merge 2 commits into
RunestoneInteractive:mainfrom
morozov-av:f-1251
Open

morozov-av wants to merge 2 commits into
RunestoneInteractive:mainfrom
morozov-av:f-1251

Conversation

@morozov-av

Copy link
Copy Markdown
Contributor

Summary

Adds the backend foundation for delegated and blind grading:

  1. introduced a course-level delegated grader role
  2. added an opt-in blind_grading assignment flag
  3. added fail-closed capability resolution and persistence helpers
  4. includes the corresponding database migration

This PR does not change existing grading routes or UI behavior. Instructor access remains unchanged, and delegated graders are not yet connected to production endpoints.

Follow-up

In next PRs I will add the anonymous grading API and React workflow

@morozov-av
morozov-av requested a review from bnmnetp as a code owner September 29, 2026 18:51
@morozov-av morozov-av changed the title f-1251Add blind grading permission foundation f-1251 Add blind grading permission foundation Sep 29, 2026
@bnmnetp
bnmnetp requested a balanced review from Copilot September 30, 2026 20:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new module breaks supported Python 3.10 deployments, and concurrent grader grants can raise uniqueness errors.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds the persistence and authorization foundation for delegated blind grading without integrating it into production routes.

Changes:

  • Adds course grader membership and assignment blind-grading policy storage.
  • Introduces fail-closed grading capability resolution.
  • Adds migration and permission-focused tests.
File Description
components/​rsptx/​auth/​grader_permissions.py Resolves instructor and delegated-grader capabilities.
components/​rsptx/​db/​crud/​grading_permissions.py Adds grader membership and policy persistence helpers.
components/​rsptx/​db/​crud/​__init__.py Exports the new persistence helpers.
components/​rsptx/​db/​models.py Defines grader membership and assignment policy fields.
migrations/​versions/​c2f8a1d4e7b9_add_blind_grading_foundation.py Migrates the database schema.
test/​components/​rsptx/​auth/​test_grader_permissions.py Tests membership, policy, and capability behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4 to +13
from enum import StrEnum

from rsptx.db.crud import (
fetch_assignment_grading_policy,
fetch_instructor_courses,
is_course_grader,
)


class GraderRole(StrEnum):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use python 3.10 anymore. The minimum python should be 3.13

Comment on lines +28 to +32
membership = result.scalar_one_or_none()
if membership is None:
membership = CourseGrader(course_id=course_id, user_id=user_id)
session.add(membership)
await session.flush()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don' t think this is a real concern since requests are going to be generated from the UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants