Skip to content

frontend: show backend validation details for 400 errors#404

Open
Bhawna109 wants to merge 3 commits intohatnote:masterfrom
Bhawna109:fix/frontend-show-backend-400-errors
Open

frontend: show backend validation details for 400 errors#404
Bhawna109 wants to merge 3 commits intohatnote:masterfrom
Bhawna109:fix/frontend-show-backend-400-errors

Conversation

@Bhawna109
Copy link

@Bhawna109 Bhawna109 commented Mar 10, 2026

This PR fixes issue #400 by addressing both parts of the problem:

  1. Frontend showed a generic 400 toast without backend validation details.
  2. Backend had conflicting ranking constraints that could make ranking submission fail with 400.

Frontend Fix

Updated frontend/src/services/alertService.js to prioritize backend error payloads:

  1. response.data.errors (array or string)
  2. response.data.message + response.data.detail
  3. fallback to Axios error.message

Result: users now see actionable backend validation messages instead of only:
Request failed with status code 400.

Backend Fix

Updated montage/juror_endpoints.py:

  1. In get_tasks_from_round(), ranking rounds now fetch all open tasks using total_open_tasks (not fixed 100).
  2. In submit_ratings(), the MAX_RATINGS_SUBMIT limit is now enforced only for rating and yesno, not ranking.

Result: ranking rounds with more than 100 entries can submit full ballots as required by backend ranking validation.

Scope

  • Frontend + backend change.
  • No schema changes.
  • No behavior change for rating / yesno limits.

Testing

  1. Triggered 400 flow and verified frontend now shows backend validation text.
  2. Verified backend module compiles after changes:
    • python -m py_compile montage/juror_endpoints.py

Production Verification Note

I attempted to verify on the linked Toolforge campaign from issue #400, but my account was redirected to #/permission-denied for that route.
So I could not fully execute the affected ranking flow on production data.

Please verify this PR on the original campaign/round with coordinator/juror permissions.

@Bhawna109 Bhawna109 mentioned this pull request Mar 10, 2026
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.

2 participants