fix(simulation): resolve infinite hang during deletion (#5886)#6254
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (2.16%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6254 +/- ##
============================================
+ Coverage 42.82% 42.83% +0.01%
- Complexity 6847 6851 +4
============================================
Files 2253 2254 +1
Lines 61648 61653 +5
Branches 8100 8100
============================================
+ Hits 26401 26411 +10
+ Misses 33564 33560 -4
+ Partials 1683 1682 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to fix simulation (exercise) deletion failures (notably right after cancellation) by refactoring the delete path to use direct deletes and by updating a FK on exercise_mails_reply_to to cascade on exercise deletion.
Changes:
- Refactors simulation deletion to go through
ExerciseService.delete(...)and uses a custom repository delete query. - Adjusts agent deletion to use a native delete query and ensures it runs within a transaction at the service layer.
- Adds an integration test covering deletion + cascading cleanup, and a Flyway migration to add
ON DELETE CASCADEforexercise_mails_reply_to.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| openaev-model/src/main/java/io/openaev/database/repository/ExerciseRepository.java | Adds a native deleteById to delete exercises directly. |
| openaev-model/src/main/java/io/openaev/database/repository/AgentRepository.java | Refactors agent deletion to a native DELETE query. |
| openaev-api/src/main/java/io/openaev/service/AgentService.java | Wraps agent deletion in a transaction at the service layer. |
| openaev-api/src/main/java/io/openaev/rest/exercise/service/ExerciseService.java | Introduces a tenant-validated delete(...) method for simulations. |
| openaev-api/src/main/java/io/openaev/rest/exercise/ExerciseApi.java | Routes DELETE endpoint through ExerciseService.delete(...). |
| openaev-api/src/test/java/io/openaev/rest/exercise/ExerciseApiTest.java | Adds an integration test to verify exercise deletion and cascade behavior. |
| openaev-api/src/main/java/io/openaev/migration/V5_20__Add_delete_cascade_exercise_email_reply_to.java | Updates FK on exercise_mails_reply_to to ON DELETE CASCADE. |
a19836
left a comment
There was a problem hiding this comment.
Ping me if you need some help
Proposed changes
Testing Instructions
Related issues
Related to #5886
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...