OpenFn / OpenFn/kit

Sync v2 fails if an edge is invalid

Open
#1,354 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I've just hit a weird use-case where I'm getting an error processing this edge:

{
  edge: {
    id: '93b9c964-027a-4407-8e68-e79659dd0ead',
    target_job_id: undefined,
    enabled: true,
    source_trigger_id: 'e4e67da6-65f8-49eb-99df-460d9ca77176',
    condition_type: 'always'
  }
}

It looks like I've managed to get a workflow locally with an invalid edge lost inside it? Weird. And probably a lightning bug.

Bit the CLI shouldn't die in this case

[CLI] ✘ TypeError: Cannot read properties of undefined (reading 'name')
    at file:///home/joe/repo/openfn/kit/packages/project/dist/index.js:282:57
    at Array.map (<anonymous>)
    at generateHash (file:///home/joe/repo/openfn/kit/packages/project/dist/index.js:276:46)
    at Workflow.getVersionHash (file:///home/joe/repo/openfn/kit/packages/project/dist/index.js:465:12)
    at findLocallyChangedWorkflows (file:///home/joe/repo/openfn/kit/packages/cli/dist/process/runner.js:2253:35)
    at handler3 (file:///home/joe/repo/openfn/kit/packages/cli/dist/process/runner.js:3359:27)
    at async handler4 (file:///home/joe/repo/openfn/kit/packages/cli/dist/process/runner.js:3438:3)
    at async parse (file:///home/joe/repo/openfn/kit/packages/cli/dist/process/runner.js:3991:12)

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 in packages/project around generateHash and Workflow.getVersionHash, then follow the call from packages/cli's findLocallyChangedWorkflows. Reproduce Sync v2 with the invalid edge shown in the report. Done means the CLI handles the invalid edge without the reported TypeError instead of dying.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.