Conversation
… is open What was broken In Design challenges the submitter could still delete a submission after the phase that created it had ended. In particular a checkpoint submission stayed deletable for the whole Submission phase, so it could be removed after it had already been screened and scored in Checkpoint Screening / Checkpoint Review. Root cause SubmissionsTable computed the delete permission from a single "submissionPhaseStartDate" prop, which was the start date of *any* open Submission or Checkpoint Submission phase, and compared it against subObject.submissionDate - a field that member submissions do not carry (they expose "created"). The comparison therefore resolved to "now is after the open phase start", i.e. the delete button was enabled for every submission whenever any submission phase was open, regardless of which phase actually produced the submission. What was changed - Added belongsToActiveSubmissionPhase() to utils/challenge-detail/submission-limit, which reuses the existing getActiveSubmissionType() phase precedence to decide whether a submission was created by the currently open submission phase. - SubmissionsTable now derives allowDelete from the submission's own type against the open phase, so checkpoint submissions stop being deletable when the Checkpoint Submission phase closes, and nothing is deletable once every submission phase is closed. - Removed the now-unused submissionPhaseStartDate prop from the submission management container and components. Any added/updated tests - __tests__/shared/utils/challenge-detail/submission-limit.test.js: new belongsToActiveSubmissionPhase suite covering checkpoint deletion during the checkpoint phase, checkpoint deletion blocked once the Submission phase opens, everything blocked during screening/review, and missing submission/phase input. - Updated the SubmissionsTable shallow snapshot for the now-boolean allowDelete prop. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What was broken
In Design challenges the submitter could still delete a submission after the phase that created it had ended. A checkpoint submission stayed deletable for the whole Submission phase, so it could be removed after it had already passed Checkpoint Screening and been scored in Checkpoint Review — exactly the scenario in the PM-5961 recording.
Expected behaviour: a submission can only be deleted while the phase that produced it is open (Checkpoint Submission for checkpoint submissions, Submission for contest submissions), and nothing is deletable once every submission phase is closed.
Root cause
SubmissionsTablecomputed the delete permission from a singlesubmissionPhaseStartDateprop, which the container derived as the start date of any openSubmissionorCheckpoint Submissionphase:Two problems:
submissionDateis not a field on member submissions (they exposecreated), somoment(undefined)resolved to "now". The expression collapsed to "now is after the open phase start", i.e. always true whenever any submission phase was open.What was changed
belongsToActiveSubmissionPhase()toutils/challenge-detail/submission-limit. It reuses the existinggetActiveSubmissionType()phase precedence (already used for submission limits and for typing new uploads) to decide whether a submission was created by the currently open submission phase, and returnsfalsewhen no submission phase is open at all. Both the V6typeand the legacysubmissionTypefields are supported.SubmissionsTablenow derivesallowDeletefrom that helper againstchallenge.phases, so:submissionPhaseStartDateprop from the submission management container and components (it existed only to feed the old check).The existing "You can delete this submission only after the review is complete" workflow-run gating and the
COMPLETED/ Design-track conditions on the delete button are unchanged.Any added/updated tests
__tests__/shared/utils/challenge-detail/submission-limit.test.js— newbelongsToActiveSubmissionPhasesuite:falsefor missing submissions or missing phasesAlso updated the
SubmissionsTableshallow snapshot, which now records the booleanallowDelete={false}prop (previouslyundefined, and therefore omitted, because the test fixture supplies nosubmissionPhaseStartDate).Validation run:
npm run lint(clean),npm run jest— 380 passed, 141 snapshots passed, 0 failures;npm run buildsucceeds.The companion API enforcement is in topcoder-platform/review-api-v6 PM-5961.
🤖 Generated with Claude Code