Fix remove reference missing version #5396
Merged
LTA-Thinking merged 4 commits intomainfrom Feb 20, 2026
Merged
Conversation
feordin
reviewed
Feb 18, 2026
| if (!resourceWrapper.RawResource.Data.Contains($"\"lastUpdated\":\"{date}\"", StringComparison.Ordinal)) | ||
| { | ||
| _logger.LogWarning("Cannot parse lastUpdated value from input raw resource when trying to sync lastUpdated in meta."); | ||
| throw new ArgumentException("Cannot parse lastUpdated value from input raw resource when trying to sync lastUpdated in meta."); |
Contributor
There was a problem hiding this comment.
in the bulk-delete scenario described, this exception would have thrown and caused the bulk-delete to fail? Is the method SyncVersionIdAndLastUpdatedInMeta used anywhere else?
Contributor
Author
There was a problem hiding this comment.
No, the last updated time was still present even with the bug. It was just the version id that was missing. I added this as an additional layer of protection against similar scenarios in the future.
added 2 commits
February 18, 2026 14:53
feordin
approved these changes
Feb 19, 2026
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.
Description
When using the _remove-reference option in $bulk-delete the version number wasn't being shown in the modified resources. This fixes that bug and adds a defensive guard to prevent similar situations from happening.
What was happening:
When making the resource wrapper the metadata wasn't being preserved, which removed the version id from the raw resource. The version was still being properly tracked, it just wasn't being put into the resource. This led the replace used in the data store to not find a version id to replace, so the updated version was never saved to the resource. It was still properly numbered in the database, so no data was lost and if the resource was updated the version would display properly.
Related issues
Addresses Bug 183765
Testing
Manual testing
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)