NIAD-3467 Fixed undeleted logs bug#1286
Open
chiaramapellimt wants to merge 1 commit into
Open
Conversation
|
Looks good. All 3 mutations in this change were killed.
|
There was a problem hiding this comment.
Pull request overview
Fixes a large-message GP2GP transfer edge case where canMergeCompleteBundle could return true when attachment logs are empty (due to cleanup), causing the bundle to be built prematurely without attachments.
Changes:
- Added an empty-list guard in
InboundMessageMergingService.canMergeCompleteBundleto returnfalsewhen no undeleted attachment logs are found. - Added a unit test covering the “all attachment logs deleted” scenario.
- Documented the fix in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingService.java | Prevents vacuous allMatch() truthiness on an empty log list from triggering early bundle creation. |
| gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingServiceTests.java | Adds a regression test asserting canMergeCompleteBundle returns false when logs are empty. |
| CHANGELOG.md | Notes the bug fix and the user-visible impact (blank record after large transfers). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Add an empty list guard to
canMergeCompleteBundleinInboundMessageMergingServiceto prevent premature bundle building when all attachment logs have been deleted.Why
When the last attachment chunk of a large GP2GP patient record transfer arrives,
checkAndMergeFilePartsmerges the fragments and then deletes their logs from the DB as cleanup. Immediately after,canMergeCompleteBundlechecks those same logs to decide if the bundle is ready to build but they've just been deleted, so the list is empty. Java'sallMatch()on an empty list always returnstrue, so the bundle gets built too early with no attachments.The result is a blank patient record in Medicus after the transfer which is ofc wrong.
Type of change
Please delete options that are not relevant.
Checklist: