Repository navigation
OpenConceptLab/ocl_online#870 | The bridge can be chosen as soon as it has loaded, and runs only for a user who is offered it - #149
Conversation
…t has loaded, and a saved one runs only for a user who is still offered it On a new project the bridge stayed greyed out until another field changed, because its answer was read once, before it had loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTEw8c6qZh5C69F1V4
|
Codex review, pass 1 (codex-cli 0.171.0, commit 9b25816) 5 findings: 2 P1, 3 P2. None of them is new with this change, so the code stays as it is.
findings.json{
"reviewer": "codex-cli 0.171.0",
"perspective": "defects",
"mode": "full",
"commit": "9b25816",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 3836,
"claim": "Manual refresh can permanently erase saved bridge candidates when the bridge is skipped.",
"scenario": "An editor opens a row with saved bridge candidates and clicks Refresh while the algorithm list is still loading, or after the bridge has stopped being offered. Refresh deletes the entire row's candidate state before discovering that the bridge cannot run. The next project save persists the row without its bridge results.",
"action": "Keep each algorithm's stored results until its refresh succeeds. Preserve bridge results when availability is pending or the bridge is skipped.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.2",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 806,
"claim": "The saved bridge permission check also disables separately authorized ScispaCy matching.",
"scenario": "A LOINC project has both CIEL Bridge and ScispaCy saved. The user has the ScispaCy capability and the deployment has ScispaCy enabled, but the server no longer offers that project's bridge. The bridge component never mounts, so `canScispacy` stays false and AutoMatch omits ScispaCy even though it ran before.",
"action": "Separate ScispaCy's target compatibility and entitlement checks from permission to execute the saved bridge.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.3",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 857,
"claim": "Checking the first saved bridge lets a second, unoffered bridge entry trigger a duplicate match.",
"scenario": "A project stores bridge IDs A and B in that order, the server offers only A, and A maps to the target. AutoMatch treats both entries as runnable and manual refresh visits both. Both dispatches use A's mounted handle, sending two one-row `$match` requests when only A is authorized.",
"action": "Check the ID of each bridge at dispatch and use a handle bound to that ID. Apply the same eligibility check to AutoMatch selection, quota estimates, and manual refresh.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.4",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 870,
"claim": "A bridge offered on a later page is treated as unavailable.",
"scenario": "The server offers the user more than 25 algorithms and the project's saved bridge appears on page two. The successful list request supplies only page one's `results` to the permission check, so both AutoMatch and manual refresh skip the authorized bridge.",
"action": "Follow the algorithm list's pagination or verify the saved bridge through its authenticated detail endpoint.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.5",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/__tests__/autoMatchRows.test.js",
"line": 415,
"claim": "The new-project readiness fix lacks the React lifecycle test called for by the repository's integration test conventions.",
"scenario": "With a compatible target selected, the lazy bridge resolves after the configuration has rendered. Reverting to a plain ref would leave the picker disabled until another edit, while both new helper tests would still pass.",
"action": "Add an integration test that resolves a deferred bridge with the runtime component's imperative-ref behavior and verifies that the picker enables without another user action.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTEw8c6qZh5C69F1V4
|
Simplification review (a fresh Claude subagent, commit 9b25816): two cuts, both made in dae0926.
Codex check of commits 9b25816..dae0926 (codex-cli 0.171.0): no findings. 833 tests pass and ESLint is clean. |
snyaggarwal
left a comment
There was a problem hiding this comment.
Approve. Merge order: merge this and release it to production before OpenConceptLab/react-bridge-match#7 is published. Merging the two in either order is fine, but the bridge file goes live everywhere the moment it's uploaded, while this needs a release. If the file goes first, a saved bridge runs for people the server doesn't offer it to, until this is deployed.
Checked
- "Offered" is the runtime answer from
/match-algorithms/on the OCL Online API. Nothing here works out who gets it. In a build withoutOCL_ONLINE_API_URLthe list stays empty, so a saved bridge doesn't load. Such a build has noBRIDGE_MATCH_URLeither, and the stub already answerscanBridge() === false, so nothing changes for the open product. - The ref callback:
BridgeMatchandBridgeMatchStubboth calluseImperativeHandlewithout deps. So the callback runs on every commit of the child (null, then the new handle), andcanBridgefollows prop changes such as the mapped sources arriving. Setting the same value bails out, so there's no render loop. The deps-less effect runs after layout, so it clearscanBridgeonly when the child has really gone (unmounted, or still suspended in the lazy loader). getBridgeToLoadmatches onidonly, so a core user's edited Bridge Source URL keeps working, as the test says.- CI is green.
Notes, not blocking
- A saved bridge now waits for
/match-algorithms/before the mapped-sources probe starts. On opening a project, the bridge becomes usable one request later than onmain. The AutoMatch dialog readscanBridgefrom state now, so it picks the bridge up when it's ready. Not running it when the list can't be read is the right call. user={user}(inline): keep it until react-bridge-match#7 is published, then it can go.
Codex F1.1 to F1.5 are already raised and answered in Jon's comment, so I'm not raising them again.
| @@ -6602,7 +6613,7 @@ const MapProject = () => { | |||
| bridgeRepoVersion={bridgeProbeAlgo?.target_repo_version} | |||
| limit={CANDIDATES_LIMIT} | |||
| user={user} | |||
There was a problem hiding this comment.
Keep this until OpenConceptLab/react-bridge-match#7 is published: the live file still reads user. After that, nothing reads it and it can be dropped.
|
Merge-ready only after Jonathan has reviewed it too, as the ticket asks: "@snyaggarwal and Jonathan review it themselves" (https://github.com/OpenConceptLab/ocl_online/issues/870#issuecomment-7373066624). |
Two small fixes to the bridge algorithm, for OpenConceptLab/ocl_online#870.
Choosing it on a new project. After picking a target repository, the bridge stayed greyed out in the list of algorithms until another field was changed. The form asked the bridge component whether it can run only once, before the component had loaded, and nothing made it ask again. The answer is now kept in state, so the list updates as soon as the component has loaded.
A bridge saved in a project. Projects keep the algorithms they were set up with, and people share projects. A saved bridge now loads only if the list of algorithms the server offers this user still has it. Otherwise it doesn't run: AutoMatch says that the project's algorithms aren't available, as it does already for other algorithms a user can't run, and a row refreshed by hand skips it. The project's settings keep it.
How to check
mainit's greyed out until you change, say, the name.I did all three in a browser against a local API, with the match answers mocked. 833 tests pass, 2 of them new, and ESLint is clean.
No words, screens or API calls change. If the list of offered algorithms can't be read, a saved bridge doesn't run until the page is loaded again.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qTEw8c6qZh5C69F1V4