Skip to content

OpenConceptLab/ocl_issues#2840 | Mapper caches lookup 404s and drops bridge targets missing from the target version - #113

Merged
snyaggarwal merged 2 commits into
mainfrom
issues#2840
Oct 26, 2026
Merged

snyaggarwal merged 2 commits into
mainfrom
issues#2840

Conversation

@snyaggarwal

Copy link
Copy Markdown
Contributor

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

  • 404s cached for the session (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.
  • Missing bridge targets dropped: once a code is known missing, its bridge_child candidates 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.
  • Both caches reset when the target version or lookup URL changes, since a code missing from one version may exist in another.

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 for dropMissingBridgeTargets)
  • eslint clean
  • Not exercised against a live bridge run

🤖 Generated with Claude Code

…ssion and drops bridge targets missing from the target version
@snyaggarwal
snyaggarwal requested a review from paynejd October 23, 2026 08:21
@snyaggarwal snyaggarwal self-assigned this Oct 23, 2026

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/components/map-projects/MapProject.jsx Outdated

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@snyaggarwal
snyaggarwal merged commit d92c71d into main Oct 26, 2026
2 checks passed
@snyaggarwal
snyaggarwal deleted the issues#2840 branch October 26, 2026 02: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.

Mapper: the CIEL bridge proposes codes missing from the target version, and 404s aren't cached

1 participant