Skip to content

Fix/fill custom algo form - #131

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

filiperochalopes wants to merge 2 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: Populate custom algorithm canonical URLs from discovery metadata and support GET discovery both without and with the $ operation marker. No tracking issue linked.


Main Changes

Area Files Description
Custom algorithm form src/components/map-projects/MultiAlgoSelector.jsx (+6/−8) Apply discovered metadata to the form and use the metadata fallback when verifying an endpoint.
Metadata handling src/components/map-projects/customAlgoMetadata.js (+27/−0) Validate and extract canonical URLs; try the metadata URL without $ first, then the original URL if needed.
Shared validation src/components/map-projects/algorithms.jsx (+2/−7) Reuse and re-export the canonical URL validator.
Tests src/components/map-projects/__tests__/customAlgoMetadata.test.js (+73/−0) Cover metadata extraction, fallback order, authentication errors, and real GET requests to a disposable local server.

Key Decisions

Decision Choice Rationale
Canonical URL source Use a valid canonical_url from discovery metadata. Avoid manual entry; retain the existing form value if metadata is missing or invalid.
Metadata discovery Try the final path segment without $, then the original URL when the first response is not usable metadata. Support servers exposing discovery on either endpoint without changing the configured POST URL.
Authentication failures Preserve an initial 401/403 if the alternative also fails. Keep the token-required feedback when the alternative path is missing.
URL transformation Preserve query strings, fragments, and trailing slash. Only change the operation marker in the final path segment.

Verification Checklist

npm test
npm run test:integration
npm run eslint
./node_modules/.bin/webpack --mode development --env NODE_ENV=development --output-path /path/to/scratch/build
  • Unit tests: 675 passed, including metadata fallback and local HTTP server coverage.
  • Integration suite: 11 passed (run before the final test-only addition).
  • ESLint passed.
  • Development Webpack build passed.
  • Verify the actual form in a browser against a running custom algorithm endpoint.
  • Verify deployed behavior after release.

@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".

name: data.name || '',
description: data.description || '',
});
updateSelected(key, metadataFields(data));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve duplicate-ID detection when adding canonical metadata

If two configured custom endpoints report the same ID, name and description but different valid canonical URLs, including canonical_url in this patch prevents updateSelected's filter(value, patch) from matching the first row. The second row therefore receives no conflict error, whereas the previous three-field patch detected the duplicate. This matters because MapProject.getAlgoDef selects the first configuration by ID and mergeIntoRowMatchState removes existing candidates with the incoming algorithm_id, so the endpoints can overwrite each other's results. Validate ID/name uniqueness independently of the full metadata patch.

Useful? React with 👍 / 👎.

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.

1 participant