lightning icon indicating copy to clipboard operation
lightning copied to clipboard

Improve error messaging on CLI by specifying job names/edges in error messages

Open christad92 opened this issue 1 year ago • 3 comments

When using openfn deploy in the CLI to migrate projects, users sometimes get back error messages on incorrect job names and edge condition labels, etc .

It would be super valuable to be able to see which job name and edge condition the error is related to without having to manually go through have 200+ jobs.

This is NOT a priority but would be important to have at some point.

It would be great if we can format error messages like workflow-1/job-3: invalid character in job name

christad92 avatar May 20 '24 00:05 christad92

This is also impacting debugging GH sync failures of existing projects on app

ritazagoni avatar May 23 '24 07:05 ritazagoni

Hi @ritazagoni - I've been meaning to get to this all week. It's sort of been second on my list every day :grimacing:

I think it's an easy fix, I'll get on it

josephjclark avatar May 23 '24 08:05 josephjclark

Hey @christad92 turns out that this is actually a Lightning issue. The error strings are coming from the Lightning backend

I've tightened up a few things in CLI deploy and i's been worth checking, but I'm going to have to hand this one over to a grown up now

josephjclark avatar May 23 '24 14:05 josephjclark

@josephjclark will the cli still make a request to the server if the workflow and job names are missing from the yaml? Without the names in the params, the backend won't be quite helpful either 😬 .

If they're editing an existing workflow/job, then yes, but for a new workflow / job, I don't see a way

midigofrank avatar Jun 03 '24 07:06 midigofrank

@midigofrank This isn't so much about missing names

Lightning is already running a bunch of validation in lib/lightning/workflows/job.ex :: validate(). Stuff like checking what characters are in the name string, ensuring an adaptor is set.

We just need to append some kind of pathing information into the message.

Maybe check this slack thread for a bit more context

josephjclark avatar Jun 03 '24 10:06 josephjclark

@christad92 I haven't been able to format the error messages as in the description. What I have been able to do is group the error messages based on the workflow/job/trigger/edge name. For example: Previous

{
  "errors": {
    "workflows": [
      {
        "jobs": [
          {
            "body": ["Code editor cannot be empty."]
          }
        ]
      }
    ]
  }
}

NOW:

{
  "errors": {
    "workflows": {
      "workflow-one": {
        "jobs": {
          "first-job": {
            "body": ["Code editor cannot be empty."]
          }
        }
      }
    }
  }
}

Can this suffice?

midigofrank avatar Jun 04 '24 13:06 midigofrank

As for edges, the key will be source_job->target_job as it is in the yaml file

midigofrank avatar Jun 04 '24 13:06 midigofrank

@midigofrank I think this will be fine. I'll try and test against this against your branch and comment in the PR

josephjclark avatar Jun 04 '24 14:06 josephjclark