Repository navigation
Tasks API - refuse to delete a task that submissions have been run on - #2648
Merged
Didayolo merged 2 commits intoDec 2, 2026
Conversation
Submission.task is SET_NULL, so deleting a task erases which task every submission scored on it ran on: the leaderboard shows n/a with no history and the submission can no longer be re-run. The UI never hits this because a task in a phase cannot be deleted, but a script that first replaces the phase task and then deletes the old one passes that check. Guard on submissions like we already guard on phases, in destroy and delete_many. Related to codalab#2636 codalab#2637
3 of 7 tasks
|
I agree that this will help to have the same failsafe than with UI |
Member
|
I think this should be a warning or confirmation popup, not a hard limitation. In the current form, it basically becomes impossible to delete a task. In the otherhand, a task is just made of pointers and do not take up any storage, so it may be fine. |
11 tasks done
Didayolo
changed the base branch from
develop
to
protect-task-with-submissions
December 2, 2026 02:08
10 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Root cause of the
n/aleaderboard problem we hit on eeg2025 (see #2636 / #2637 discussion): not the task replacement but the task deletion.Submission.taskison_delete=SET_NULL. Deleting a task setstask=Noneon every submission scored on it, so:n/aand there is no record of which task the scores belonged ton/ascores - Show an error when re-running a submission whose tasks have changed #2620 can only report "task deleted")The UI never triggers this because
check_delete_permissionsrefuses to delete a task that is still in a phase. But a script that (1) swaps the phase to a new task and then (2) deletes the old task passes that check. Updating a task in place through the UI/API works fine, as @sylvchev noted.This PR adds the same guard for submissions, in
destroyanddelete_many:No migration, no behaviour change for tasks without submissions. Organizers who want fresh scores on a new task can keep the old task around (it only costs the row) and use re-run/resubmit (#2644) or edit the task in place.
Issues this PR resolves
A checklist for hand testing
DELETE /api/tasks/{id}/: refused with the message aboveChecklist