OpenFn / kit

The bits & pieces that make OpenFn work. (diagrammer, cli, compiler, runtime, runtime manager, logger, etc.)
8 stars 12 forks source link

CLI Deploy: bad error message if project yaml has a workflow not in state json #713

Closed josephjclark closed 3 weeks ago

josephjclark commented 3 weeks ago

I don't really know how this state occurs, but if state.json and project.yaml lose sync, and a workflow exists in the project but not the state, you get an unhelpful error message:

Workflow found in project state but not spec. Spec: undefined State: [object Object]

[CLI] ✘ Command failed!
[CLI] ✘ Error: Cannot continue: workflow from state not found in spec.
 at file:///d/repo/openfn/kit/packages/deploy/dist/index.js:344:17
    at Array.map (<anonymous>)
    at mergeSpecIntoState (file:///d/repo/openfn/kit/packages/deploy/dist/index.js:311:50)
    at deploy (file:///d/repo/openfn/kit/packages/deploy/dist/index.js:636:21)
    at async deployHandler (file:///d/repo/openfn/kit/packages/cli/dist/process/runner.js:1177:18)

I would also love stack traces to be removed from these errors, unless perhaps logging in debug mode. It's not helpful and looks like the CLI is broken

Repro Steps

Note that straight deleting a workflow from state.json seems to cause a different problem which also needs investigating. All the step/trigger ids seem to change, like it's confusing workflows (like it's applying the ids from the removed workflow to the remaining workflow).