OpenFn / OpenFn/kit

Duplication of state loading

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

Nobody has claimed this yet.

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

Description

This is a small tech-debty issue but I want it out of my head while I do other things

The loading of initial state is currently handled both by the worker (which makes sense, it knows about lightning and how to load state) and the runtime (which kinda makes sense, just like it need to lazy-load credentials before a job starts, it may also need to lazy load initial state).

I don't think we need the behaviour in both places. I want it in one place where it's easy to monitor.

It probably just needs to live in the runtime, so it can decide when and how to fetch initial state.

A good use-case is the CLI: what if we later want to run a lightning workflow from the CLI, or even claim an attempt through the CLI? The CLI will need the ability to resolve a dataclip id to a state object.

I think it makes sense that the runtime decides WHEN to load initial state, but the wrapping runtime manager (the CLI or worker) decides HOW (for example the CLI may want to cache the data)

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

The issue names no files or tests; start by tracing where initial state is loaded in the worker and runtime. Then map the runtime manager boundary, including the CLI path. Done means the runtime decides when to load state while the worker or CLI decides how to fetch or cache it, with no duplicated loading behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.