Repository navigation
GH Issue 1720: Test saveBatch and saveRuns transform callbacks during folder delete - #3265
Merged
Merged
Conversation
…res, and run updates
Also makes the existing-run update test prove its own transform ran.
labkey-klum
reviewed
Oct 27, 2026
| Run run = new Run(); | ||
| run.setProperties(Map.of(SLEEP_SECONDS, sleepSeconds, CALLBACK_STATUS, callbackStatus)); | ||
| run.setResultData(List.of(Map.of("ParticipantID", participantId, "VisitID", 1))); | ||
| return run; |
Contributor
There was a problem hiding this comment.
Consider supporting material and data inputs/outputs for completeness.
Contributor
Author
There was a problem hiding this comment.
Agreed. Rather than widening callbackRun, the tests set inputs and outputs on the Run it returns. Added a save with material and data inputs and outputs that checks each is attached exactly once, and one that posts a material as both input and output to confirm the cycle is refused before any script runs. That second test showed the save API reported a cycle as a server error, so it's now a validation error.
labkey-klum
approved these changes
Oct 28, 2026
labkey-jeckels
added a commit
to LabKey/platform
that referenced
this pull request
Oct 29, 2026
…he save transaction (#8220) ## Rationale The assay batch and run save APIs now run Standard assay transform scripts before opening their database transaction, so a script that calls back into the server can no longer deadlock with other work such as a folder delete ([GH Issue 1720](LabKey/internal-issues#1720)). This extends the GH Issue 1707 fix for single-run imports to requests that save several runs together: every run's scripts finish before the shared transaction opens, and if any script fails nothing is written. It also fixes a regression from #8183 that broke `BiologicsAssayFilesTest.testImportAssayWithFileFieldData` ([TeamCity failure](https://teamcity.labkey.org/buildConfiguration/LabKey_Trunk_Premium_ProductSuites_Biologics_BiologicsBPostgres/4231858)): when an assay has a transform script, the uploaded data file's audit event was recorded outside the import transaction and lost its transaction ID. ## Related Pull Requests - LabKey/testAutomation#3265 ## Changes - Save handlers can look up a request's data and materials without creating them - saveBatch and saveRuns run each run's transform scripts in a read-only first pass, then save the runs inside the transaction and record the scripts' output - A run whose data changes while its scripts run fails the save and asks the client to retry - saveBatch and saveRuns reject a request that lists the same run more than once - Standard assays configured for background upload get the same behavior through these APIs - Custom file-based assay save handlers keep running scripts inside the transaction - Audit events for files uploaded before a transform script runs are recorded in the import's transaction again; a failed import records them only for files it keeps Tested locally: AssayTransformCallbackTest passes, including the new saveBatch and saveRuns cases and the new file audit cases. --------- Co-authored-by: Lum <klum@labkey.com>
XingY
pushed a commit
to LabKey/platform
that referenced
this pull request
Oct 29, 2026
…he save transaction (#8220) ## Rationale The assay batch and run save APIs now run Standard assay transform scripts before opening their database transaction, so a script that calls back into the server can no longer deadlock with other work such as a folder delete ([GH Issue 1720](LabKey/internal-issues#1720)). This extends the GH Issue 1707 fix for single-run imports to requests that save several runs together: every run's scripts finish before the shared transaction opens, and if any script fails nothing is written. It also fixes a regression from #8183 that broke `BiologicsAssayFilesTest.testImportAssayWithFileFieldData` ([TeamCity failure](https://teamcity.labkey.org/buildConfiguration/LabKey_Trunk_Premium_ProductSuites_Biologics_BiologicsBPostgres/4231858)): when an assay has a transform script, the uploaded data file's audit event was recorded outside the import transaction and lost its transaction ID. ## Related Pull Requests - LabKey/testAutomation#3265 ## Changes - Save handlers can look up a request's data and materials without creating them - saveBatch and saveRuns run each run's transform scripts in a read-only first pass, then save the runs inside the transaction and record the scripts' output - A run whose data changes while its scripts run fails the save and asks the client to retry - saveBatch and saveRuns reject a request that lists the same run more than once - Standard assays configured for background upload get the same behavior through these APIs - Custom file-based assay save handlers keep running scripts inside the transaction - Audit events for files uploaded before a transform script runs are recorded in the import's transaction again; a failed import records them only for files it keeps Tested locally: AssayTransformCallbackTest passes, including the new saveBatch and saveRuns cases and the new file audit cases. --------- Co-authored-by: Lum <klum@labkey.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.
Rationale
Adds test coverage for GH Issue 1720: saving assay batches or runs through the API must not hold a database transaction while transform scripts run.
Related Pull Requests
Changes