Skip to content

Add missing https:// to setup addresses and offer Odoo JSON-RPC switch - #1453

Merged
helpcodeai merged 4 commits into
mainfrom
fix/setup-address-and-odoo-version
Nov 2, 2026
Merged

helpcodeai merged 4 commits into
mainfrom
fix/setup-address-and-odoo-version

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Two dead ends found in an end-to-end run of the guided setup page (/connectors/setup/<slug>?connector=<id>&from=claude):

  1. An address without a scheme was refused. Typing amcp-e2e-test.odoo.com into "Odoo address" showed "Only the address up to the host, e.g. https://mycompany.odoo.com (…)" and blocked the save. The message never said that the https:// was missing. The backend already added https:// to a variable that starts the base URL. The client checked the pattern first and refused the value before the backend saw it. Address variables outside the base URL (Zoho accounts server, Amazon Ads / DocuSign auth URLs, …) were never normalised anywhere.
  2. An Odoo below 19 on the JSON-2 connector was a dead end. The check already said "This Odoo is version X, older than 19 … Use the Odoo 14-18 (JSON-RPC) connector instead". The user then had to find that connector by hand, retype the address and database, and was left with a dead odoo draft in the workspace.

Changes

  • Generic scheme fix (no adapter list). New adapters/address-fix.ts: withMissingScheme adds https:// to an address field (kind address or an address-like name, never a secret) only when the field's pattern refuses the value as typed and accepts it with https://. Applied wherever the pattern is enforced: install/verify (prepareConnector via normalizeAdapterEnvValues(adapter, …)), the variable editor (ConnectorsController.normalizeVariables), the chat install (ConnectorSetupService.install) and the setup page (on blur, in validate() and in the values sent). Values that are wrong in another way are still refused (a path after the host, www. on odoo.com, a single-label host such as erp:8069, where http vs https cannot be guessed). A field whose pattern wants a bare host (Exercise.com) keeps it. This covers every adapter whose address pattern requires https:// or https?:// (WooCommerce, PrestaShop, Xentral, GitLab, n8n, Zoho, …), with no list of adapters.
  • Concrete pattern errors. addressFix finds the smallest change the pattern accepts: add https://, http→https, drop a trailing /, drop www., cut what follows the host. Fixes that change less are preferred. The backend check, the chat install and the setup page now say e.g. "Remove /web after the host: https://erp.acme.de." or "Add https:// in front and remove /odoo/discuss after the host: https://acme.odoo.com". If no such change exists, the adapter's own patternMessage is shown, as before. Fix phrases are translated (en/de/it). The fixed value is shown only for non-secret address fields.
  • switchTo in the verify result. When the verify suggests another adapter (Odoo < 19 → odoo-jsonrpc), the result now also carries switchTo: { slug, name, prefill }. prefill comes from the new carriedSetupValues: only variables both adapters declare under the same name that neither treats as a secret or credential. Both Odoo adapters use ODOO_URL and ODOO_DB, so those two carry over. ODOO_API_KEY never does, and ODOO_UID exists only on JSON-RPC. suggest/suggestName stay for existing consumers.
  • "Switch to Odoo 14-18 (JSON-RPC)" button on the setup page. It opens /connectors/setup/odoo-jsonrpc?prefill.ODOO_URL=…&prefill.ODOO_DB=…&from=<from>&replaces=<connector id>. No key or secret goes into the URL: the backend only offers non-secret values, and the target page never reads a credential from a link (existing rule). The old plain link is shown only when there is no switchTo.
  • Draft clean-up (replaces=). After the JSON-RPC connector is saved, the page loads the replaced connector through the existing GET /api/connectors/:id and deletes it through DELETE /api/connectors/:id. It deletes only if the connector exists, is not ready, and comes from a different catalog adapter. Both endpoints are org-scoped and write-checked as before. A ready connector (e.g. one saved with "Save anyway") or a failure keeps the old connector, which stays visible under Connectors. The prompt allowed keeping the draft if deletion got risky; I kept the deletion, with these guards.
  • Tests: backend specs next to the code; a Playwright spec for the page (no frontend unit-test runner exists). One existing e2e assertion (WooCommerce trailing slash) and two backend message assertions now expect the concrete fix text instead of the generic pattern message.

Not changed: the verify still offers the switch when Odoo's version cannot be read at all (the adapter's verifyHints suggestion, as before). switchTo follows suggest in that case too. No adapter JSON, Prisma schema or ee/ code is touched.

Cloud and self-hosted

Both deployments behave the same: the code has no isCloud() branch. On self-hosted setups the scheme fix does not change single-label internal hosts (odoo:8069, localhost). Those must still be typed with http:// or https://, as before. An internal dotted host typed without a scheme gets https://, which the base-URL normaliser already did for base-URL variables. The draft deletion uses the normal connector API with the signed-in user's rights. A user who may not delete connectors gets an error that the page ignores, so the draft is kept.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

Commands run (all through the shared lock script, Jest with --maxWorkers=4):

Directory Command Result
repo root npm ci --no-audit --no-fund --ignore-scripts added 1728 packages
packages/backend DATABASE_URL=postgresql://x:y@localhost:5433/z npx prisma generate generated Prisma Client 7.10.1
packages/backend npm run lint 0 errors, 11 warnings (none in touched files); --fix changed no files
packages/backend npx tsc --noEmit -p tsconfig.json exit 0
packages/backend npx jest --maxWorkers=4 (full suite) 985 suites passed, 6 skipped; 30307 tests passed, 1810 skipped
repo root node scripts/validate-adapters.mjs --warn 707 passed, 0 failed, 1443 warnings (existing; no adapter JSON changed)
packages/frontend npm run lint 0 errors, 49 warnings (existing; none in touched files)
packages/frontend npx tsc --noEmit -p tsconfig.json exit 0
packages/frontend CI=1 npx playwright test (full suite, chromium already installed) 321 passed

The new e2e spec tests/e2e/connector-setup-address.spec.ts covers four cases, with API calls mocked:

  • amcp-e2e-test.odoo.com turns into https://amcp-e2e-test.odoo.com and is sent that way.
  • A wrong path gets the concrete fix message.
  • An Odoo below 19 gets the Switch link, with the exact query: prefill, from=claude, replaces, no key. The JSON-RPC page opens prefilled with an empty key field, and saving deletes the needs_input draft.
  • A ready draft is not deleted.

The first full backend run had one failure: connectors.controller.spec.ts still expected the old generic Odoo /web message. I updated that assertion to the new fix text, and the run above is the rerun.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable). The setup page's query docs (replaces=) and the code comments are updated; no user docs describe these messages.
  • All existing tests pass (npm test)
  • This PR has a descriptive title

Related Issues

None filed. Found in an end-to-end test of the chat setup link on Cloud.

An address typed without a scheme (acme.odoo.com) was refused by the
field pattern with a message that never named the missing https://.
Address fields whose pattern wants a scheme now get https:// added before
the check, on the setup page, the chat install, the import and the
variable editor. A value still refused names the smallest change the
pattern accepts (add https://, cut /web after the host, drop a trailing
slash).

When the Odoo JSON-2 check finds a version below 19, the verify result
carries switchTo with the JSON-RPC adapter and the non-secret values to
carry over. The setup page turns it into a Switch button that opens the
JSON-RPC setup prefilled with address and database, keeps from=, and
deletes the left-behind draft once the new connector is saved, if that
draft is still not ready.
@helpcodeai
helpcodeai enabled auto-merge (squash) November 2, 2026 17:55
@helpcodeai
helpcodeai merged commit 1a9bef8 into main Nov 2, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/setup-address-and-odoo-version branch November 2, 2026 18:07
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants