Skip to content

OpenConceptLab/ocl_issues#3055 | Fix/fill custom algo form - #131

Open
filiperochalopes wants to merge 6 commits into
OpenConceptLab:mainfrom
filiperochalopes:fix/fill-custom-algo-form
Open

filiperochalopes wants to merge 6 commits into
OpenConceptLab:mainfrom
filiperochalopes:fix/fill-custom-algo-form

Conversation

@filiperochalopes

@filiperochalopes filiperochalopes commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: The custom algorithm form now fills canonical_url from the algorithm's discovery GET, finds that metadata on up to three URLs, and no longer flags an algorithm as conflicting with itself. Tracked in OpenConceptLab/ocl_issues#3055.

Closes OpenConceptLab/ocl_issues#3055


Main Changes

Area Files Description
Custom algorithm form src/components/map-projects/MultiAlgoSelector.jsx (+9/−17) Apply discovered metadata (including canonical_url) to the form; verify the endpoint through the metadata fallback; use conflictingFields for ID/name conflicts; drop the unused filter import.
Metadata handling src/components/map-projects/customAlgoMetadata.js (+48/−0) metadataFields (valid canonical_url only), fetchAlgorithmMetadata (three-step GET discovery) and conflictingFields (ID/name conflicts against other algorithms).
Shared validation src/components/map-projects/algorithms.jsx (+2/−7) Import and re-export isLikelyCanonicalUrl from the new module, so existing imports keep working.
Tests src/components/map-projects/__tests__/customAlgoMetadata.test.js (+148/−0) Metadata extraction, discovery order, authentication errors, conflict rules, and real GET requests to disposable local HTTP servers.

Net diff against origin/main: 4 files, +207/−24. Commits: 2370122, 3198b26, c800ed0, 74f1b88, 520e12e, b709f42.


Discovery order

The configured URL is the one the Mapper POSTs $match to; discovery only changes which URLs are read with GET. Example for https://host/api/ciel-bridge-rxnorm/$match:

Step GET URL Stops when
1 https://host/api/ciel-bridge-rxnorm/$match the response has name and ID/id
2 https://host/api/ciel-bridge-rxnorm/match same
3 https://host/api/ciel-bridge-rxnorm same

A URL without $ is requested once. Query strings and fragments are preserved; the operation-path candidates retain a trailing slash. If every step fails, a 401/403 from any step is the reported error (token-required feedback); otherwise the last response is.


Key Decisions

Decision Choice Rationale
Canonical URL source Fill an empty canonical_url from the GET when it is a valid http(s) URL. The field is required and was always empty although the ICD agent already returns it. An existing hand-entered value is preserved; an absent or invalid metadata value is ignored.
Discovery URLs Configured URL first, then without $, then parent path. Servers expose the describe route at different paths (FastAPI services register GET /api/<name> next to POST /api/<name>/$match).
Authentication failures Keep a 401/403 over a later 404. The form needs to ask for a token, not report "not found".
Conflict check Compare only against the other algorithms; evaluate ID and name separately. The previous check included the algorithm being edited, so blurring API URL or Token re-applied its own ID/name and showed "Conflicting ID/Name". Clearing one error no longer clears the other.
Helper placement New .js module instead of algorithms.jsx. algorithms.jsx imports React/MUI and cannot be loaded by node --test.

Verification Checklist

npm test
npm run test:integration
npm run eslint
./node_modules/.bin/webpack --mode development --env NODE_ENV=development --output-path <scratch dir>
  • npm test: 683 passed, 0 failed (reported in the review follow-up at b709f42; baseline before this branch: 667).
  • npm run test:integration: 11 passed.
  • npm run eslint: no findings.
  • Development Webpack build compiled successfully.
  • Discovery tested with real GET requests against local HTTP servers (steps 1→2 and 1→2→3).
  • Conflict regression: a test failed before the fix, and an algorithm no longer conflicts with itself.
  • Verify in the browser: ICD Agent form, edit API URL then leave the field; Canonical URL is filled and ID/Name show no conflict.
  • Verify a genuinely duplicated ID/name still shows the conflict in the browser.
  • Verify a server serving metadata only on $match in the browser. No automated component test covers the MultiAlgoSelector.jsx wiring.

@filiperochalopes
filiperochalopes marked this pull request as ready for review November 16, 2026 20:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T20:59:32.421938Z 3198b26 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3198b26e7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 3198b26. I ran the new test file locally and all 7 tests pass.

Filling the canonical URL from metadata and sharing the validator both look good. Two things I'd change before merging, plus one question (details inline):

  1. Probe order. The stripped /match path is now requested before the configured $match URL. Endpoints that work today now take two requests, and they can pick up the wrong document. Trying the configured URL first, with the stripped path as the fallback, avoids both.
  2. Duplicate ID/name check. I agree with the Codex comment. Adding canonical_url to the patch weakens the conflict check in updateSelected. A fix is suggested inline.
  3. Question: should metadata overwrite a canonical URL the user typed by hand?

The PR's browser check is still unticked. It's worth running against a server that serves metadata only on $match, to confirm the extra 404 on /match doesn't show up anywhere in the form.

@snyaggarwal

Copy link
Copy Markdown
Contributor

There's no ticket for this change. The PR body says no tracking issue is linked, and the commits don't reference one. Please file a ticket in OpenConceptLab/ocl_issues first, describing the problem (custom algorithm form not filling the canonical URL from metadata, and servers that serve discovery on the path without $). Then reference it in the PR title and commit messages (OpenConceptLab/ocl_issues#<n> | ...), so the change can be tracked and prioritized before merge.

…he configured URL first, then the path without the operation marker, then the parent path
…s the canonical URL only when empty; document why the validator exists
@filiperochalopes

Copy link
Copy Markdown
Contributor Author

Review round addressed at b709f42, tracked in OpenConceptLab/ocl_issues#3055.

Item Status Where
Codex P2: duplicate ID detection lost when canonical_url joins the patch Done 74f1b88 (conflictingFields)
Probe order: request the configured URL first, stripped path as fallback Done 520e12e
Duplicate ID/name check against other rows only Done 74f1b88
Metadata overwriting a hand-entered canonical URL Done: fills only when empty b709f42
Comment on the validator Done b709f42

Checks: npm test 683 passed, 0 failed; npm run test:integration 11 passed; npm run eslint clean. With the previous customAlgoMetadata.js, 8 of the 15 tests in customAlgoMetadata.test.js fail.

Still pending: the browser checks in the PR description (ICD Agent form; a genuinely duplicated ID/name; a server that serves metadata only on $match). No automated component test covers the MultiAlgoSelector.jsx wiring.

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving at b709f42. Everything from my Nov 17 review is in, and thanks for filing OpenConceptLab/ocl_issues#3055:

  • Probe order: fetchAlgorithmMetadata asks the configured URL first, then /match, then the parent path, and stops at the first usable metadata. An endpoint that works today stays at one request and never reaches another document, and a 401/403 still wins over a later 404. The ConceptMap/$translate test pins it.
  • Duplicate ID/name: conflictingFields checks id and name separately, against the other rows only (by __key). A row no longer conflicts with itself, and canonical_url or description in the patch can't hide a duplicate. The form reads the flags as booleans, so true/false both work.
  • A hand-entered canonical URL is kept: metadataFields fills it only when the field is empty.
  • The validator's comment now says why it exists.

Two small things before merging:

  • The title is still "Fix/fill custom algo form". A squash merge takes the title, so please prefix it with OpenConceptLab/ocl_issues#3055 | , as asked on Nov 17.
  • The description is behind the code. Its "Discovery order" table still lists /match first, and the opening line still says no tracking issue is linked.

The browser checks you list (the ICD Agent form, a real duplicate, a server with metadata only on $match) are still worth a run, since no component test covers the MultiAlgoSelector wiring. CI is green, and it merges cleanly with main.

@filiperochalopes filiperochalopes changed the title Fix/fill custom algo form OpenConceptLab/ocl_issues#3055 | Fix/fill custom algo form Nov 23, 2026
@filiperochalopes

Copy link
Copy Markdown
Contributor Author

Two small things before merging:

  • The title is still "Fix/fill custom algo form". A squash merge takes the title, so please prefix it with OpenConceptLab/ocl_issues#3055 | , as asked on Nov 17.
  • The description is behind the code. Its "Discovery order" table still lists /match first, and the opening line still says no tracking issue is linked.

The browser checks you list (the ICD Agent form, a real duplicate, a server with metadata only on $match) are still worth a run, since no component test covers the MultiAlgoSelector wiring. CI is green, and it merges cleanly with main.

Is it really needed to merge? We need to have a shared repo of skills to sync these minor rules @snyaggarwal @paynejd, @snyaggarwal I'd think you are the most capable one (editing code) to write the know arch skills and guardrails https://github.com/OpenConceptLab/skills?

@filiperochalopes

Copy link
Copy Markdown
Contributor Author

The description is behind the code. Its "Discovery order" table still lists /match first, and the opening line still says no tracking issue is linked.

Done

This branch has not been deployed

No deployments
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.

Bug: Mapper custom algorithm form leaves Canonical URL empty, can't verify parent-path endpoints, and flags an algorithm as conflicting with itself

2 participants