OpenConceptLab/ocl_issues#2558 | Divert target-repo concept fetch to custom lookup source#41
Merged
Conversation
…custom lookup source ensureLoaded's direct-fetch branch fetched a concept's ocl_url verbatim, so concepts resolving to the project's target repo -- notably ocl-bridge cascade targets, whose ocl_url points into the target repo -- were fetched from the target repo even when a custom lookup source is configured. When the target repo is definition-only (e.g. the public WHO ICD-11 repo, kept content-empty under WHO's license), those GETs 404. Divert the direct fetch to the configured lookup source when the concept belongs to the target repo, reusing the existing conceptBelongsToTargetRepo predicate. Branch 2 ($resolveReference) already honored lookupConfig.url; this brings the direct-fetch branch in line. Adds buildLookupConceptUrl (shares the Branch 2 double-encode) + unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
snyaggarwal
approved these changes
Jun 4, 2026
Contributor
|
Contributor
|
LGTM, merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the symptom in ocl_issues#2558. @snyaggarwal for review.
Problem
When a map project uses a custom lookup source because its target repo is a definition/metadata-only canonical repo (e.g. the public WHO
ICD-11-WHOrepo, kept content-empty under WHO's license), some concept-detail GETs still hit the empty target repo and 404.ensureLoadedresolves not-yet-fullConceptDefinitions two ways:ocl_url→$resolveReference) already honorslookupConfig.url.ocl_url→ direct GET) fetched theocl_urlverbatim, never consultinglookupConfig.ocl-bridge/ocl-ciel-bridgecascade targets resolve against the target repo (concept_identity.cascade_target.reference_source: 'target_repo') and arrive with anocl_urlthat points into the target repo → they take Branch 1 → fetch the empty repo → 404.Evidence
ICD-11 IMO eval run (target
WHO/ICD-11-WHO, lookupOpenMRS-OCL-Squad/ICD-11-WHO-Mapper): 6 GETs hit/orgs/WHO/sources/ICD-11-WHO/concepts/<code>/and 404'd; the same codes return 200 from the lookup source. Failing URLs were not double-encoded → confirms Branch 1 (only Branch 2 double-encodes). The fetch is state-driven (mergeIntoRowMatchState→ensureLoadedon not-fullarrival), not triggered by opening the details panel.Change
In Branch 1, when the concept belongs to the target repo and a lookup source is configured, fetch the lookup source by code instead of the target-repo
ocl_url:conceptBelongsToTargetRepopredicate (canonical-equal ORocl_urlstarts with the target relative URL) rather than a hand-rolled equality.buildLookupConceptUrl(normalizers) shares the Branch 2 double-encode so a code resolves to the same URL on both paths. Pure + unit-tested.fetchConceptByOclUrl's existing URL-dedup + 404-retry apply unchanged.npm test145/145, eslint clean.Why no server-side change
WHO/ICD-11-WHObeing empty is by design (definition-only canonical repo, WHO license). Content lives in the lookup source. So this is purely client-side routing.Open questions for review (the "not certain" parts)
ensureLoaded. Should the diversion instead live where the cascade-targetConceptDefinition.ocl_urlis minted (normalizerscascadeTargetToConceptDefinition), so the stub never carries a target-repoocl_urlin the first place? That might be the more principled fix.$matchcandidates already carry a lookup-sourceocl_url, so rebuilding lands at the same place (harmless) — but confirm that's acceptable vs. narrowing to bridge targets only.lookupConfig.urlas configured and don't graft the target's pinned version onto it (matches Branch 2). Correct for your intended semantics?Background analysis (HAR forensics + repro) lives in the ocl-mapper-eval
2026-06-02-imo-prepubrun notes; happy to share.