Conversation
Split the delete loop into two passes — delete all principal_job rows first, then delete all jobs. The previous single-pass loop deleted parent's principal_job and then called jobFacade.deleteJob(parent), which recursively deletes child jobs whose principal_job rows still existed, causing fk_principal_job_job violations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a foreign key violation (fk_principal_job_job) when deleting a project deployment/integration instance by ensuring principal_job rows are deleted for all associated jobs before any job rows are deleted (preventing recursive job deletion from encountering still-referenced principal_job records).
Changes:
- Split deployment/config deletion into two passes: (1) delete
principal_jobrows for all job IDs, then (2) delete the jobs. - Add an integration test to assert the intended ordering in
ProjectDeploymentFacadedeletion. - Add an integration test in
atlas-execution-serviceto validate thatJobFacade.deleteJobdeletes child jobs and task executions recursively; extend test wiring/dependencies accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
server/libs/automation/automation-configuration/automation-configuration-service/src/main/java/com/bytechef/automation/configuration/facade/ProjectDeploymentFacadeImpl.java |
Two-pass deletion to remove principal_job rows before deleting jobs. |
server/libs/automation/automation-configuration/automation-configuration-service/src/test/java/com/bytechef/automation/configuration/facade/ProjectDeploymentFacadeIntTest.java |
Adds test asserting principal-job deletion ordering vs job deletion. |
server/ee/libs/embedded/embedded-configuration/embedded-configuration-service/src/main/java/com/bytechef/ee/embedded/configuration/facade/IntegrationInstanceConfigurationFacadeImpl.java |
Mirrors the two-pass deletion fix for embedded integration instance configurations. |
server/libs/atlas/atlas-execution/atlas-execution-service/src/test/java/com/bytechef/atlas/execution/facade/JobFacadeIntTest.java |
Adds recursive delete integration test + required JDBC converter wiring. |
server/libs/atlas/atlas-execution/atlas-execution-service/build.gradle.kts |
Adds test dependencies needed by the new integration test wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jobFacade.deleteJob recursively deletes child jobs, so iterating a flat jobIds list that contains both parents and children revisits already-deleted rows. Sort by id descending (children have larger ids since they are inserted later) and de-dup before the delete loop. Loosen the ordering assertion in the deployment test accordingly. Co-Authored-By: Claude Opus 4.6 (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.
Split the delete loop into two passes — delete all principal_job rows first, then delete all jobs. The previous single-pass loop deleted parent's principal_job and then called jobFacade.deleteJob(parent), which recursively deletes child jobs whose principal_job rows still existed, causing fk_principal_job_job violations.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com