-
Notifications
You must be signed in to change notification settings - Fork 18
feat(ws-worker): support multi-root @local adaptor resolution#1397
feat(ws-worker): support multi-root @local adaptor resolution #1397josephjclark merged 2 commits into
Conversation
OPENFN_ADAPTORS_REPO (and the --monorepo-dir / -m flag) now accept a colon-separated list of monorepo roots. When a job pins an adaptor to @Local, the worker walks the configured roots in order and resolves to the first root whose `packages/<shortName>/package.json` exists. This matches Lightning's AdaptorRegistry precedence so the registry view and the worker's execution path agree on which root supplies a given adaptor. Single-path values keep behaving exactly as before. When no root contains the adaptor the worker still surfaces a candidate path under the first root, so the runtime emits a clean "missing adaptor" error rather than crashing on a malformed colon-joined string. This unblocks the multi-root flow on the Lightning side, where the AdaptorRegistry already accepts the colon-separated form but the worker was rejecting it with ENOENT on @Local execution.
@josephjclark
josephjclark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jeremi, just taking a closer look at this. The solution is basically fine but it strikes me that this approach won't work for windows users, who have paths like c:/repo/adaptors.
I think a comma separated list will do just as well, and be a bit more accessible to other users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most obvious problem that strikes me here is that this will break on windows machines.
It's convenient that the colon approach mimics a unix path. And I'm not aware we have many windows users doing this stuff - although occasionally someone crops up.
Anyway I would prefer a comma or semi-colon separated list here so that it's safer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way too many comments here, and in the wrong place. But I can tidy that up before merge to main. I presume these are AI generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not wild about the file IO stuff in these tests to be honest. Mostly in this repo we use the mock-fs library to mock out the file system. If you're using an AI agent can you ask it to regenerate like that?
Colon collides with Windows drive letters (c:/repo); comma matches Lightning's parsing of OPENFN_ADAPTORS_REPO. Single-path callers are unchanged.
jeremi
commented
May 26, 2026
Thanks @josephjclark — addressed in 66e889b:
- Switched the split separator from
:to,so Windows drive-letter paths likec:/repostay usable; single-path callers (the common case) are unchanged. - Updated the comment block, CLI help text, changeset blurb, and the dedicated multi-root tests (titles + literals).
- Companion change on the registry side: feat: support multiple local adaptor repos in registry lightning#4714
Ready for another look.
josephjclark
commented
May 27, 2026
Alright @jeremi this looks great.
One more issue I see: we'll also need to update the CLI so that it can support comma-separated paths on OPENFN_ADAPTORS_REPO. That need to be done before I can release this.
Are you able to take a look at that, or shall try to resolve it for you?
ff1b1b6
into
OpenFn:multi-adaptor-repos
* feat(ws-worker): support multi-root @Local adaptor resolution (#1397) * feat(ws-worker): support multi-root @Local adaptor resolution OPENFN_ADAPTORS_REPO (and the --monorepo-dir / -m flag) now accept a colon-separated list of monorepo roots. When a job pins an adaptor to @Local, the worker walks the configured roots in order and resolves to the first root whose `packages/<shortName>/package.json` exists. This matches Lightning's AdaptorRegistry precedence so the registry view and the worker's execution path agree on which root supplies a given adaptor. Single-path values keep behaving exactly as before. When no root contains the adaptor the worker still surfaces a candidate path under the first root, so the runtime emits a clean "missing adaptor" error rather than crashing on a malformed colon-joined string. This unblocks the multi-root flow on the Lightning side, where the AdaptorRegistry already accepts the colon-separated form but the worker was rejecting it with ENOENT on @Local execution. * fix(ws-worker): use comma to separate multi-root adaptor paths Colon collides with Windows drive letters (c:/repo); comma matches Lightning's parsing of OPENFN_ADAPTORS_REPO. Single-path callers are unchanged. * simplify changeset * update cli * versions --------- Co-authored-by: Jeremi Joslin <jeremi@newlogic.com>
* feat(ws-worker): support multi-root @Local adaptor resolution (#1397) * feat(ws-worker): support multi-root @Local adaptor resolution OPENFN_ADAPTORS_REPO (and the --monorepo-dir / -m flag) now accept a colon-separated list of monorepo roots. When a job pins an adaptor to @Local, the worker walks the configured roots in order and resolves to the first root whose `packages/<shortName>/package.json` exists. This matches Lightning's AdaptorRegistry precedence so the registry view and the worker's execution path agree on which root supplies a given adaptor. Single-path values keep behaving exactly as before. When no root contains the adaptor the worker still surfaces a candidate path under the first root, so the runtime emits a clean "missing adaptor" error rather than crashing on a malformed colon-joined string. This unblocks the multi-root flow on the Lightning side, where the AdaptorRegistry already accepts the colon-separated form but the worker was rejecting it with ENOENT on @Local execution. * fix(ws-worker): use comma to separate multi-root adaptor paths Colon collides with Windows drive letters (c:/repo); comma matches Lightning's parsing of OPENFN_ADAPTORS_REPO. Single-path callers are unchanged. * simplify changeset * update cli * versions --------- Co-authored-by: Jeremi Joslin <jeremi@newlogic.com>
* feat(ws-worker): support multi-root @Local adaptor resolution (#1397) * feat(ws-worker): support multi-root @Local adaptor resolution OPENFN_ADAPTORS_REPO (and the --monorepo-dir / -m flag) now accept a colon-separated list of monorepo roots. When a job pins an adaptor to @Local, the worker walks the configured roots in order and resolves to the first root whose `packages/<shortName>/package.json` exists. This matches Lightning's AdaptorRegistry precedence so the registry view and the worker's execution path agree on which root supplies a given adaptor. Single-path values keep behaving exactly as before. When no root contains the adaptor the worker still surfaces a candidate path under the first root, so the runtime emits a clean "missing adaptor" error rather than crashing on a malformed colon-joined string. This unblocks the multi-root flow on the Lightning side, where the AdaptorRegistry already accepts the colon-separated form but the worker was rejecting it with ENOENT on @Local execution. * fix(ws-worker): use comma to separate multi-root adaptor paths Colon collides with Windows drive letters (c:/repo); comma matches Lightning's parsing of OPENFN_ADAPTORS_REPO. Single-path callers are unchanged. * simplify changeset * update cli * versions --------- Co-authored-by: Jeremi Joslin <jeremi@newlogic.com>
jeremi
commented
Jun 16, 2026
Thanks @josephjclark !
Uh oh!
There was an error while loading. Please reload this page.
Summary
Lets
@openfn/ws-workerresolve@localadaptors against a colon-separatedOPENFN_ADAPTORS_REPO, so a private adaptor monorepo can be loaded alongside the canonical OpenFn adaptors monorepo without forking.packages/<shortName>/package.json, the earlier root wins.Companion to Lightning PR
This is the executor-side half of OpenFn/lightning#4714. Without this patch, colon-separated
OPENFN_ADAPTORS_REPOonly widens what Lightning'sAdaptorRegistryexposes (picker UI, metadata, version validation); the worker still tries to load the literal joined path and dies withENOENT. The two PRs ship together so multi-root @Local execution works end-to-end.The first-wins semantics here mirror Lightning's
AdaptorRegistry: a private adaptor repo listed before the canonical OpenFn monorepo will override individual adaptors locally, and the registry view and the worker's execution path stay consistent.Test plan
pnpm --filter @openfn/ws-worker test— 30/30convert-lightning-plantests green, including 5 new cases:@localagainst a single existing rootpnpm --filter @openfn/ws-worker test:typescleanpnpm prettier --checkclean for the touched files@openfn/language-publicschema@localwas resolved by the patched worker to/private-adaptors/packages/publicschema/dist/index.js(the first root in the colon list), and the runtime loggedResolved adaptor @openfn/language-publicschema to version 0.0.1.Changeset
minorbump for@openfn/ws-worker.