Skip to content

Fix cascading delete - #3732

Open
meisterT wants to merge 2 commits into
DOMjudge:mainfrom
meisterT:cascadedelete
Open

meisterT wants to merge 2 commits into
DOMjudge:mainfrom
meisterT:cascadedelete

Conversation

@meisterT

Copy link
Copy Markdown
Member

No description provided.

@meisterT

meisterT commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Before merging I need to think though the unit tests and think whether it needs an update or points to an issue in the new code

- Extract checkEntityDeleteConstraints() from buildDeleteTree() to
  simplify per-entity foreign key checks and eliminate deep loop
  nesting and multi-level breaks.
- Harden getDependentEntities() BFS traversal with a visited set to
  prevent potential infinite loops on cyclic relationships.
- Handle diamond cascading delete paths for Contest, Team, and
  ContestProblem in BaseController::commitDeleteEntity by pre-deleting
  multi-parent leaf and intermediary records (judging_run, external_run,
  balloon, submission, scorecache) in reverse topological order.
- Add missing em->flush() in API ProblemController::unlinkProblemAction.
- Add unit tests for Problem, Contest, and Team deletions with full
  submissions, judgings, and judging runs.
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