Fix inherited extension slices incorrectly appearing in child differential #1609
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.
Problem
When a child profile inherits from a parent that defines an extension slice (e.g., on
content.component.extensionin the example below), and the child adds its own slicing on a parent element (e.g.,contentwith anoutcomeslice), the inherited extension slice incorrectly appears in the child's differential under the new slice path (which later leads to validation errors in the IG Publisher).How to reproduce
Minimal reproduction case: https://github.com/glichtner/fsh-extension-slice-repro
Expected
The
Childprofile's differential should only contain elements that were actually constrained:Actual
The differential incorrectly contains the inherited extension slice:
Cause
In
cloneChildren(), whenrecaptureSliceExtensions=false, extension slices retain their original_originalviae.clone(false), but the cloned element'sidis updated to include the new slice prefix. Sinceidis compared inhasDiff(), this mismatch causes the inherited extension slice to appear in the differential even though nothing actually changed.Suggested fix
Update
_original.idto match the cloned element's newidwhen not recapturing, so the id comparison doesn't produce false positives inhasDiff().