Repository navigation
OpenConceptLab/ocl_issues#2840 | Mapper caches lookup 404s and drops bridge targets missing from the target version - #113
Conversation
…ssion and drops bridge targets missing from the target version
snyaggarwal
left a comment
There was a problem hiding this comment.
Issue complete: no.
The cache reset needs to invalidate in-flight lookups and account for candidates already removed from rowMatchState. Otherwise switching target versions/lookup URLs during or after a missing lookup can leave valid bridge candidates permanently absent, and a late response from the previous target can mutate the new target's missing-key set. Please address the inline finding before merge.
Testing gap: please add a regression test for changing target version while a 404 lookup is still retrying, including restoration or recomputation of candidates.
snyaggarwal
left a comment
There was a problem hiding this comment.
Re-review of the latest head: the previous P1 is addressed. The new lookup session adds generation checks so late results from an earlier target are ignored, restores bridge candidates when the target version/lookup URL changes, retries interrupted lookups, and includes regression coverage for the stale-404 and restoration cases.
I found no new blocking correctness issues in the updated diff. GitHub does not allow an approval from the PR author, so this is posted as a review comment.
Fixes OpenConceptLab/ocl_issues#2840
Problem
The CIEL bridge filters cascade targets by the target repo URL, not its pinned version, so it can propose codes the version doesn't have (e.g. LOINC codes a newer CIEL maps to but LOINC 2.81 lacks). Each of those 404s, and since failed lookups were evicted from the URL cache, every row proposing the same code fetched it again.
Changes
fetchConceptByOclUrl): a lookup that is still 404 after its retries stays in the URL cache, so other rows reuse the result instead of fetching again. Other errors stay retryable.bridge_childcandidates are removed from every row, and later rows drop them on merge (no lookup triggered). A concept another algorithm also proposed keeps its row. Logic lives in a new pure helper,dropMissingBridgeTargets(normalizers.js), with unit tests.Caveat: retry on 404
The first row that proposes a missing code still makes 3 attempts (0s → 3s → 7s). That 404 retry comes from OpenConceptLab/ocl_issues#2537 and is intentional: a lookup repo may build a concept lazily, so its first 404 can turn into a hit a few seconds later. This PR keeps that behaviour unchanged, so a missing code costs 3 requests once per session rather than 3 per row.
Filtering missing codes before any fetch would need the bridge request (server or bridge component) to filter cascade targets by the target version — out of scope here.
Testing
npm test: 572 pass (3 new fordropMissingBridgeTargets)🤖 Generated with Claude Code