Skip to content

DataRequirementsVisitor resolvedCache key strips version, causing incorrect caching for multi-version dependencies #946

@c-schuler

Description

@c-schuler

In DataRequirementsVisitor.gatherDependenciesWithClassification(), the resolvedCache is keyed by Canonicals.getUrl(dependency.getReference()) which strips the version from the canonical. This means if two dependencies reference different versions of the same artifact (e.g. http://example.org/ValueSet/my-vs|1.0.0 and http://example.org/ValueSet/my-vs|2.0.0), only the first version resolved will be cached and returned for both lookups.

Location: cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/visitor/DataRequirementsVisitor.java

var dependencyUrl = Canonicals.getUrl(dependency.getReference());  // strips version
// ...
if (resolvedCache.containsKey(dependencyUrl)) {
    dependencyAdapter = resolvedCache.get(dependencyUrl);
} else {
    dependencyAdapter = tryResolveDependencyReadOnly(...);
    resolvedCache.put(dependencyUrl, dependencyAdapter);
}

Suggested fix:

Use the full reference (including version) as the cache key:

var cacheKey = dependency.getReference();

This preserves version-specific resolution while still de-duplicating identical references. Unversioned references will still cache correctly since their full reference has no version suffix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions