OpenFn / OpenFn/kit

Make it easy to fail a job

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

Nobody has claimed this yet.

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

Description

When a workflow runs, we generate an exit reason.

Basically if the last step didn't throw, we call the run a success. Even if there's a fail in the middle somewhere.

We usually assume that if there was an error but the last step succeeded, then the error was handled and all is well.

But! A common use case is to send an email on error. But if the email step succeeds, you still want to consider the run a fail. This run did not recover, it failed and reported the fail. Its misleading to call this a success.

So in my error reporting step, I need to say "Send the email and then return an error". And probably the final error needs to be the upstream error.

Right now you would probably do this by throwing the downstream error. Kind of awkward - you have to find the right error on state based on the job name (or job id?). And the throw is kinda weird itself.

So (and this has come up before): we need maybe a common helper called exit(). If you exit without an error, we'll stop the whole workflow with success (regardless of everything else that happened. If you exit with an error, that error will be used to force a fail.

We might also want a helper to make it easy to load an error object (getLastError() seems nice)

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 tracing workflow exit-reason generation and the state used for upstream errors. Define the behavior for an exit without an error, an exit with an error, and retrieving the last error; done means a reporting step can send its email while forcing the workflow to fail with the relevant upstream error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.