Skip to content

Comments

Fix remove reference missing version #5396

Merged
LTA-Thinking merged 4 commits intomainfrom
personal/rojo/remove-reference-version-bug
Feb 20, 2026
Merged

Fix remove reference missing version #5396
LTA-Thinking merged 4 commits intomainfrom
personal/rojo/remove-reference-version-bug

Conversation

@LTA-Thinking
Copy link
Contributor

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

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • When changing or adding behavior, if your code modifies the system design or changes design assumptions, please create and include an ADR.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@LTA-Thinking LTA-Thinking requested a review from a team as a code owner February 18, 2026 16:48
@LTA-Thinking LTA-Thinking added Bug Bug bug bug. Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs No-PaaS-breaking-change No-ADR ADR not needed labels Feb 18, 2026
@LTA-Thinking LTA-Thinking added this to the FY26\Q3\2Wk\2Wk17 milestone Feb 18, 2026
@LTA-Thinking LTA-Thinking added No-ADR ADR not needed and removed No-ADR ADR not needed labels 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.");
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

RB Johnson (He/Him) added 2 commits February 18, 2026 14:53
@LTA-Thinking LTA-Thinking merged commit ec479f3 into main Feb 20, 2026
61 checks passed
@LTA-Thinking LTA-Thinking deleted the personal/rojo/remove-reference-version-bug branch February 20, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug. No-ADR ADR not needed No-PaaS-breaking-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants