Skip to content

[HnR-Autograder:1] Annotations endpoint - #10185

Draft
karenrasmussen wants to merge 10 commits into
mainfrom
feat/hnr-autograder-api
Draft

[HnR-Autograder:1] Annotations endpoint#10185
karenrasmussen wants to merge 10 commits into
mainfrom
feat/hnr-autograder-api

Conversation

@karenrasmussen

Copy link
Copy Markdown
Contributor

No description provided.

@Elimpizza Elimpizza changed the title [HnR] Update annotations endpoint to return annotation counts by checkpoint and due date Aug 20, 2026
Comment on lines +222 to +233
raise ValueError( # noqa: TRY003
"USER_PHASE requires document_uri: phases are delimited by the" # noqa: EM101
" checkpoint reveals of a (group, document) pair, so without a"
" document there is nothing to divide them by."
)

if document_uri and (not assignment_ids or len(assignment_ids) != 1):
raise ValueError( # noqa: TRY003
"document_uri requires assignment_ids to identify exactly one" # noqa: EM101
" assignment: a checkpoint's reveal_date is only meaningful"
" for a single (group, document) pair, not a mix of"
" assignments."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

h/views/api/bulk/stats.py doesn't catch this ValueError errores, and there's no exception view in h/views/api/errors.py that translates it into a 400. It ends up falling through to the generic json_error handler (context=Exception), which returns a generic 500 and reports it to the error tracker as an unexpected exception, instead of a clear 400 validation error.

This should raise a 400 or something similar.

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.

You're right, Imoved both constraints into the JSON schema so they'd 400, but that only holds while the schema and the service agree. On it!

Comment thread h/services/bulk_api/lms_stats.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants