Skip to content

Fix ConsentInterceptor destroying sibling entries in repeating fields (e.g. contained) when replacing a resource - #8213

Open
jkiddo wants to merge 1 commit into
hapifhir:masterfrom
trifork:fix/willSeeResource-bug
Open

Fix ConsentInterceptor destroying sibling entries in repeating fields (e.g. contained) when replacing a resource#8213
jkiddo wants to merge 1 commit into
hapifhir:masterfrom
trifork:fix/willSeeResource-bug

Conversation

@jkiddo

@jkiddo jkiddo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This pull request addresses an important bug (#8212) in the ConsentInterceptor related to handling resources in repeating fields (such as contained) when processed by an IConsentService. Previously, replacing a resource in a repeating field could inadvertently remove all sibling entries, but this is now fixed. The changes also add comprehensive tests to ensure correct behavior and document the fix.

Bug fix for replacing resources in repeating fields:

  • Updated IMutator interface and its implementations (BaseRuntimeDeclaredChildDefinition, RuntimeChildExt) to add a replace method that swaps only the targeted entry in a repeating field, instead of clearing the entire list. [1] [2] [3]
  • Modified ConsentInterceptor to use the new replace method instead of setValue, ensuring that only the intended resource is replaced and sibling entries remain unaffected.

Testing and documentation:

  • Added new tests in ConsentInterceptorTest to verify that all contained resources survive when unchanged and that replacements occur in place without disturbing sibling entries. [1] [2] [3] [4]
  • Added a changelog entry describing the bug and its resolution.

@jkiddo
jkiddo requested a review from jamesagnew as a code owner August 4, 2026 19:08
@jkiddo jkiddo changed the title Fixing https://github.com/hapifhir/hapi-fhir/issues/8212 Fix ConsentInterceptor destroying sibling entries in repeating fields (e.g. contained) when replacing a resource Aug 4, 2026
@tadgh

tadgh commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Formatting check succeeded!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants