OpenFn / OpenFn/adaptors

Should we allow job authors to exit with arbitrary exit codes?

Open
#87 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
24
Forks
41
Avg merge
3d 13h
Merged PRs (30d)
12

Description

From @lakhassane: We had a situation in a client implementation where we had 5 operations in the same job.
But we had to NOT EXECUTE any of the 5 operations if we received a certain username. Throwing an error was not an option either. So we need to allow the user to exit the job with a specific code.

Using process.exit(0) would allow us to exit as the exit code might be also relevant in platform.

This new helper function can be used to do so but we are not yet sure of the security implications.

example of usage

fn(state => {
  if (true) {
    console.log('exiting with code 42');
    exit(42);
  }
  console.log('keep going')
  return state;
});

See https://github.com/OpenFn/language-common/pull/32 for more details

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 reviewing the referenced OpenFn/language-common pull request #32 and the job execution behavior around the proposed exit helper. Determine the security and runtime implications of allowing arbitrary exit codes, then document a decided interface and acceptance criteria for supported behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.