OpenFn / OpenFn/kit

Compiler: warn when bare state chains are used

Open
#630 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

We teach users to pass state values into operations.

But state references can go stale (an issue made worse by global state, which I think should be removed, see #17) or not be assigned yet because they are read synchronously.

For example:

get('/some-data')
post('some-data', state.data)

This code will fail because the value of state.data is read synchronously, because the get was completed.

It should be written with some kind of lazy state evaluation, like this:

get('/some-data')
post('some-data, (state) => state.data)

The compiler should be able to detect references to state (literally that global variable reference) and raise a warning when it is used in a naive chain like this.

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 compiler entry point that analyzes operation chains and references to the global state variable; the issue names no specific file or test. Review the synchronous state example and the proposed lazy callback, then define and test warning behavior for naive state references while preserving valid lazy evaluation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.