OpenFn / OpenFn/kit

Runtime: force each step to return a state object

Open
#1,510 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The runtime right now is generous about return types from expressions. You can return anything: objects, arrays, primitives, falsy values.

I think we need, in the worker at least, to enforce that a step returns an OBJECT type.

Here's the thing. A dataclip MUST be an object. That's what a dataclip is.

Technically in the runtime, a step can return anything. This is correct and fine.

I just think we need a mode where the runtime enforces the return of an object from each step, or throws an exception. The worker would enable this mode.

This lets us remove an awkward fix in lightning where scalar return values are wrapped in a { value } object, which is really messy.

There was a debate around this but I'm struggling to find the issue. Might be in lightning somewhere.

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 the runtime step return handling and how the worker invokes it, then locate the Lightning code that wraps scalar returns in a { value } object. Define how an object-only mode should be enabled by the worker, how invalid returns should fail, and how existing runtime behavior remains unchanged; verify the behavior with the relevant runtime and worker tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.