Skip to content

Conversation

@cmoesel
Copy link
Member

@cmoesel cmoesel commented Dec 15, 2025

Description: The current version of SUSHI loads all automatic dependencies first, which gives them lowest priority in resolution. Based on #1602 and this Zulip thread, however, the automatically loaded extensions package should have highest priority.

This PR updates the automatic dependency mechanism to support the notion of automatic dependency priority. Automatic dependencies with low priority (e.g., hl7.fhir.uv.tools, hl7.terminology) are loaded first so they have lowest priority for resolution. Automatic dependencies with high priority (e.g., hl7.fhir.uv.extensions) are loaded last so they have highest priority for resolution.

I've run a full regression on this code. Of 1000+ FSH projects, only 12 are affected by this change in package loading. Of the 12 projects, two projects are impacted negatively, one package is impacted very positively (fixes a bug), and the other nine projects are impacted in a neutral/positive way. Details:

  • Negative Impact:
    • HL7/fhir-directory-exchange, HL7/fhir-directory-attestation#master: The CareTeam1 FSH instance inlcudes the following rule: * extension[careteam-alias].valueString = "CareTeam1". The current SUSHI resolves careteam-alias to http://hl7.org/fhir/us/directory-query/StructureDefinition/careteam-alias from the hl7.fhir.us.directory-query package, but this updates causes it to resolve to http://hl7.org/fhir/StructureDefinition/careteam-alias from the hl7.fhir.uv.extensions package. To fix this, the IG authors will need to update the FSH to refer to the desired extension by its canonical rather than its id.
  • Positive Impact:
    • alpivonka/FHIR-ClinicalTrial-Examples: The FSH profiles SoaActivity, SoaPlanDefinition, and SoaQuesstionnaire include the rule * extension contains replaces named replaces 0..1. The current SUSHI resolves replaces to http://hl7.org/fhir/StructureDefinition/task-replaces, which is the wrong extension (because it is intended for Task resources only). This update now resolves replaces to http://hl7.org/fhir/StructureDefinition/replaces, which is the correct extension.
  • Neutral/Positive Impact:
    • paciowg/functional-performance-fsh, HL7/fhir-pacio-cognitive-status, HL7/fhir-pacio-functional-status: These projects profile the FHIR core Event Location extension. This update changes those extension profiles because they are now based on the most recent version of Event Location. Changes include the addition of the can-bind extension to the StructureDefinition and changes to the declared extension context.
    • hl7-it/dossier-pharma, hl7-it/lab-report, hl7ch/ch-core, HL7Chile/clcore_ig, ansforge/IG-fhir-repertoire-offre-ressources-sante-me24, hl7au/draft-diagnostic-orders: These projects profile other FHIR core extensions. This update changes those extension profiles because they are now based on the most recent versions of their parent extensions. The only change for these is that the can-bind extension has been added to the StructureDefinition.

Testing Instructions:

  1. Unit tests show the differences in loading order.
  2. You can also observe the loading order by reviewing SUSHI logs when you run SUSHI on a FSH project. If you compare the logs from the released version of SUSHI with the version from this branch, you'll see that dependencies are loaded in a different order.
  3. If you'd like to run the regression on only the repos that changed, you can use this command: npm run regression -- run -a gh:master -b local --repo HL7/fhir-directory-exchange#master HL7/fhir-directory-attestation#master alpivonka/FHIR-ClinicalTrial-Examples#master paciowg/functional-performance-fsh#master HL7/fhir-pacio-cognitive-status#master HL7/fhir-pacio-functional-status#master hl7-it/dossier-pharma#master hl7-it/lab-report#master hl7ch/ch-core#master HL7Chile/clcore_ig#master ansforge/IG-fhir-repertoire-offre-ressources-sante-me24#main hl7au/draft-diagnostic-orders#master

Related Issue: Fixes #1602

Load automatic dependencies last in order to give them highest priority.
See: #1602
Specify automatic dependencies as having low or high priority. Low priority auto dependencies are loaded first (before everything else). High priority auto dependencies are loaded last (after everything else).

Currently, the terminology and tools packages are low priority; the extensions package is high priority.
@cmoesel cmoesel requested a review from jduteau December 23, 2025 17:48
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.

SUSHI prioritizes FHIR Core over Extensions package, contradicting Grahame's guidance

3 participants