OpenFn / OpenFn/kit

Runtime: pass helper functions to edge expressions

Open
#511 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

At the moment edge conditions in workflows can take a Javascript expression with state in scope.

I want to expand the scope to include a bunch of helper functions, like previousJobFailed() or previousJobSucceeded(). This gives a richer and easier syntax for job writers (and lightning) for basic workflow control flow.

Right now we're passing a really ugly expression for this, like Boolean(state.errors && state.errors.${upstreamId} && true). Which is admittedly over-egged but I wanted the result to be boolean and the condition to be robust.

I have now idea how we'll do this, the helper function will need to trap the edge model in a closure or something.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the runtime entry point that evaluates JavaScript expressions for workflow edge conditions and review how state is currently passed into scope. Define the helper-function interface and closure behavior, then add coverage showing helpers such as previousJobFailed() and previousJobSucceeded() work for edge conditions and return boolean results.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.