hapi-fhir icon indicating copy to clipboard operation
hapi-fhir copied to clipboard

Making sure that we are not accidentally overwriting an existing reso…

Open jkiddo opened this issue 1 year ago • 2 comments

…urce with the same ID from another IG by comparing identifier, url or whatever constitutes uniqueness.

jkiddo avatar Sep 16 '24 13:09 jkiddo

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.58%. Comparing base (406db33) to head (698c821). Report is 38 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6291      +/-   ##
============================================
+ Coverage     83.54%   83.58%   +0.04%     
- Complexity    27432    27562     +130     
============================================
  Files          1707     1715       +8     
  Lines        106185   106675     +490     
  Branches      13397    13434      +37     
============================================
+ Hits          88710    89169     +459     
+ Misses        11750    11746       -4     
- Partials       5725     5760      +35     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 16 '24 15:09 codecov[bot]

@codeforgreen can I persuade you to have a look at this?

jkiddo avatar Sep 17 '24 17:09 jkiddo

Ping @codeforgreen ?

jkiddo avatar Oct 26 '24 17:10 jkiddo

Ping @codeforgreen ?

HI @jkiddo what is this related to? The title of this issue does not ring a bell to me. Can you provide more details and link any related issue or pull request? Thanks. Do you just want me to review your changes?

codeforgreen avatar Oct 26 '24 19:10 codeforgreen

An issue I discovered in the starter project using the IG installer functionality. If you install multiple IGs with overlapping resources then the order of installing suddenly starts to play a part which it shouldnt. This PR makes sure that all resources are installed using conditional logic and stops that non deterministic behaviour. So yes, please review/comment/merge.

jkiddo avatar Oct 26 '24 19:10 jkiddo

@codeforgreen does the above provide the needed clarity?

jkiddo avatar Oct 28 '24 21:10 jkiddo

@dotasek the error will be thrown in https://github.com/hapifhir/hapi-fhir/blob/8676cf2045375ee37d33f1978c6629fd92cd272a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java#L252

I've added this test here https://github.com/hapifhir/hapi-fhir/pull/6291/files#diff-aa258240972be5bb70e69c9bb6ff0a8cd9ea9a93815c0d1e79e4cf446986f789R273 that might better explain and reproduce it.

jkiddo avatar Mar 01 '25 19:03 jkiddo

I'm a bit uncertain on what the test should be on https://github.com/hapifhir/hapi-fhir/pull/6291/files#diff-aa258240972be5bb70e69c9bb6ff0a8cd9ea9a93815c0d1e79e4cf446986f789R285 - as the current expected behaviour is a bit dangerous, IMHO, as only parts of the IG being installed will pass through

jkiddo avatar Mar 03 '25 08:03 jkiddo

@dotasek here's the test that shows the issue - or not? It utterly depends on what expected behaviour is when you install different packages that by coincidence have same id in their resources. Current logic is that last one wins. The logic in this PR will stop that as you can end up in an unexpected state.

jkiddo avatar Mar 28 '25 14:03 jkiddo