Skip to content

fix(simulation): resolve infinite hang during deletion (#5886)#6254

Merged
savacano28 merged 15 commits into
mainfrom
fix/141
Jun 16, 2026
Merged

fix(simulation): resolve infinite hang during deletion (#5886)#6254
savacano28 merged 15 commits into
mainfrom
fix/141

Conversation

@savacano28

@savacano28 savacano28 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Refact method deletebyId for simulations
  • Add Delete on for foreign key exercise in exercise_email_reply_to

Testing Instructions

  1. Connect via SSO
  2. Create a new tenant
  3. Navigate to the tenant
  4. Create a scenario and set up the required agent/player configuration
  5. Execute the simulation
  6. Immediately cancel the simulation
  7. Once the simulation is in a canceled state, attempt to delete it
  8. Observe the UI response
  9. Refresh the page

Related issues

Related to #5886

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

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...

@savacano28 savacano28 self-assigned this Jun 15, 2026
@savacano28 savacano28 added the filigran team Item from the Filigran team. label Jun 15, 2026
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.83%. Comparing base (95c4767) to head (19434b8).

❌ 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     
Flag Coverage Δ
backend 65.16% <100.00%> (+0.01%) ⬆️
e2e 18.06% <ø> (ø)
frontend 2.16% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@savacano28 savacano28 marked this pull request as ready for review June 15, 2026 17:55
Copilot AI review requested due to automatic review settings June 15, 2026 17:55
@savacano28 savacano28 changed the title fix: fix simulation delete (#4864) fix(simulation): resolve infinite hang during deletion (#4864) Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CASCADE for exercise_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.

Comment thread openaev-model/src/main/java/io/openaev/database/repository/AgentRepository.java Outdated
Comment thread openaev-api/src/main/java/io/openaev/rest/exercise/service/ExerciseService.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread openaev-api/src/main/java/io/openaev/rest/exercise/service/ExerciseService.java Outdated
Comment thread openaev-api/src/main/java/io/openaev/rest/exercise/ExerciseApi.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

@a19836 a19836 self-requested a review June 16, 2026 09:05

@a19836 a19836 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping me if you need some help

Comment thread openaev-api/src/main/java/io/openaev/service/AgentService.java Outdated
Comment thread openaev-api/src/main/java/io/openaev/rest/exercise/service/ExerciseService.java Outdated
Comment thread openaev-model/src/main/java/io/openaev/database/repository/AgentRepository.java Outdated
@savacano28 savacano28 changed the title fix(simulation): resolve infinite hang during deletion (#4864) fix(simulation): resolve infinite hang during deletion (#5886) Jun 16, 2026
@savacano28 savacano28 merged commit 44f7c44 into main Jun 16, 2026
39 checks passed
@savacano28 savacano28 deleted the fix/141 branch June 16, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants