Repository navigation
Support workflow aliases via folder names - #1579
midigofrank wants to merge 2 commits into
Conversation
A workflow's folder name in the workspace now acts as a local alias when it differs from the workflow id. Aliases can be used to look up workflows, are preserved across checkout and pull, and are never deployed. Aliases that clash with another workflow's id or alias are dropped with a warning.
Aliases are folder names, so they only exist on the checked-out project. List them next to the workflow ids of the active project so users can see which short names are available.
5f8548f to
a7f2237
Compare
|
Hey @josephjclark, I've picked something up while doing a review: An alias is the workflow's folder name, and
The fix claude is suggesting is to keep |
|
Well if there are multiple matches for a workflow we need to throw an error. Just like we do with Workspace.getProject. I'm also up for a fuzzy |
Short Description
Workflows can now be given a short local alias by renaming their folder in the workspace, so
workflows/my-really-long-workflow-name→workflows/wflets you runopenfn wf.Fixes #1292
Implementation Details
The alias is just the folder name, as suggested in the issue, so there's no extra metadata to track.
@openfn/projectfrom-fs: if a workflow's folder name differs from its id, it's set asWorkflow.alias. The alias lives on theWorkflowinstance only, so it never ends up in the workflow yaml, the state file, or a deploy.to-fs: aliased workflows are written toworkflows/<alias>/instead ofworkflows/<id>/.Project.getWorkflowalso matches on alias, soopenfn <alias>,project version <alias>etc. work.Workspace.getCheckedOutProjectnow passes its logger to the fs parser so that warning is visible. Side effect: existing parser messages (e.g. "Error loading expression from …") that were previously silent now show up.@openfn/clicheckout(and thereforepullandclean) copies aliases from the checked-out project to the incoming one, matched by workflow id, so renamed folders aren't deleted. An alias that clashes with an incoming workflow's id is dropped with a warning.Known limitation: aliases are matched by workflow id. Renaming a workflow in the app changes its id, so the next
pullwrites it back to a folder named after the new id and the alias has to be set again. Matching by UUID would fix this, butpulloverwrites the state file before checkout runs, so the old id → UUID mapping is gone by then. Storing a UUID → alias map inopenfn.yamlwould also work, but it needs anopenfn project aliascommand to record it reliably. Both felt like more than this PR needed and can follow later if renames turn out to be common.QA Notes
Tested end to end against a local Lightning:
mv workflows/<id> workflows/wfopenfn wfruns the workflow;openfn project version wfresolves itopenfn project pullkeepsworkflows/wfand doesn't recreateworkflows/<id>workflows/wf, thenopenfn project deploy. The diff only contains the edit and no alias reaches Lightningnameand deploy), then pull. The workflow moves to a folder named after the new id (the known limitation above)AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy