Skip to content

Leaderboard Ordering - Reject repeated score uploads for a submission - #2608

Merged
ObadaS merged 1 commit into
developfrom
fix_leaderboard_ordering
Oct 27, 2026
Merged

ObadaS merged 1 commit into
developfrom
fix_leaderboard_ordering

Conversation

@ihsaan-ullah

@ihsaan-ullah ihsaan-ullah commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • upload_submission_scores now returns 409 Conflict when the submission already has scores for its phase leaderboard, instead of creating another set of score rows. Repeated uploads previously added duplicate rows, and the leaderboard ranks on the sum of a column's rows, so a submission could rank above higher-scoring submissions.
  • The check uses the submission's own scores, so each child of a multi-task or multi-queue parent can still upload once.
  • Add UploadSubmissionScoresTests covering successful uploads, unknown keys, leaderboard placement, wrong secret, missing scores, repeated uploads and child/parent uploads.

For more details check this comment: #1540 (comment)

Issues this PR resolves

Additional files

I used the follwoing bundle and submissions to check everything

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ihsaan-ullah ihsaan-ullah changed the title Leaderboard Ordering: Reject repeated score uploads for a submission Leaderboard Ordering - Reject repeated score uploads for a submission Oct 4, 2026
@ihsaan-ullah
ihsaan-ullah force-pushed the fix_leaderboard_ordering branch from 0f5bf58 to 09f5e57 Compare October 20, 2026 06:16
@ObadaS
ObadaS force-pushed the fix_leaderboard_ordering branch from 09f5e57 to 9f13bde Compare October 20, 2026 11:14
@ObadaS

ObadaS commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

I am trying to test this PR but I can't manage to recreate the problem.

I used the bundle provided here then submitted the Sample Submission as well as submissions 1 through 4 on this branch then 1 through 5 skipping 4 on develop, but I get the same results on the leaderboard when compared to the develop branch :

This branch

image image

Develop Branch

image image

Am I doing something wrong ?

@Didayolo Didayolo self-assigned this Oct 21, 2026
@Didayolo
Didayolo force-pushed the fix_leaderboard_ordering branch from 9f13bde to ec0da6b Compare October 21, 2026 03:50
@Didayolo

Copy link
Copy Markdown
Member

@ObadaS This problem has always been tricky to reproduce. It happened sometimes quite randomly (you can find examples in the associated issue).

@ihsaan-ullah

ihsaan-ullah commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Sorry @obada, I did not provide enough details for testing:

Steps to reproduce the problem

  1. Upload the provided bundle
  2. Upload the provided submissions (1-6)
  3. Note down the submission 1 (sub_1.zip) ID and replace <SUB_ID> with this ID in the following steps
  4. Get submission 1 secret using the following code
docker compose exec django python manage.py shell -c "from competitions.models import Submission; print(Submission.objects.get(pk=<SUB_ID>).secret)"
  1. Execute the following 2 times so that this submission has 3 score rows
curl -X POST http://localhost/api/upload_submission_scores/<SUB_ID>/ \
  -H "Content-Type: application/json" \
  -d '{"secret": "<secret>", "scores": {"final_score": 0.17}}'
  1. Reload the leaderboard. Submission 1 now ranks first while still showing 0.17, because it's ranked on 0.51. (If you want to know why 0.51, this issue will explain it: Leaderboard ranking is computed using Sum of multiple scores #2676)
  2. Switch to the PR branch, delete current submissions, repeat step 2-6. The api call should return 409 and the ranking will stay correct.

upload_submission_scores now returns 409 Conflict when the submission
already has scores for its phase leaderboard, instead of creating
another set of score rows. Repeated uploads previously added duplicate
rows, and the leaderboard ranks on the sum of a column's rows, so a
submission could rank above higher-scoring submissions.

The check uses the submission's own scores, so each child of a
multi-task or multi-queue parent can still upload once.

Add UploadSubmissionScoresTests covering successful uploads, unknown
keys, leaderboard placement, wrong secret, missing scores, repeated
uploads and child/parent uploads.
@ObadaS
ObadaS force-pushed the fix_leaderboard_ordering branch from 2a56793 to 040d6f2 Compare October 27, 2026 10:25
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