githubtraining / exercise-scheduled-events

A hands-on exercise using GitHub Actions. See README.md for instructions on how to get started.
Creative Commons Attribution 4.0 International
1 stars 2 forks source link

Incorrect payload sent to looking-glass when YAML syntax is wrong #12

Closed hectorsector closed 3 years ago

hectorsector commented 3 years ago

When a user uses improper workflow syntax:

Screen Shot 2021-05-06 at 10 52 30 AM

We don't send the right error.expected and error.got fields to Looking Glass. In response, Looking Glass threw out:

grade-learnerOops, looks like something isn't working right. This is most likely not your fault! Please open an issue in this lab's template repository!
--
grade-learnerValueError: error.expected and error.got cannot be blank if msg is 'Error'

Additionally, could we write some tests so that the author can't get themselves into this problem for this (and future) labs?

/cc @mattdavis0351

mattdavis0351 commented 3 years ago

We set the proper error for the situation. The payload that got sent to looking glass contains and invalid schema which is why we got the ValueError.

We need to fix the grading action to forward the error to looking glass properly.

Which is essentially exactly what you said 😂

Tests would help. The other thing is figuring out what part of Actions threw that error. Was it the thrown as the workflow file was read for the run and if so how should we handle that output.

This is more for a note when I come back to this issue than it is a resolution to the problem

mattdavis0351 commented 3 years ago

@hectorsector I also think something is crossed up.

This screenshot seems to be for scheduled events and this repo is for enable pages 😂😂

hectorsector commented 3 years ago

This screenshot seems to be for scheduled events and this repo is for enable pages 😂😂

my bad, fixed now

mattdavis0351 commented 3 years ago

@hectorsector The more I think about this, them more I'm wondering "who" has the responsibility here.

IF it's an Actions failure, like an invalid workflow rather than an invalid answer, then we should just prevent the Looking Glass step from running.

I'd even be willing to be the grading action didn't run either.

Can you send me a link to the workflow run please?

mattdavis0351 commented 3 years ago

I used the workflow run that was linked in slack, which threw the same error as you posted. The payload that was sent to Looking Glass is as follows:

{
  "reports": [
    {
      "filename": "/home/runner/work/supreme-engine/supreme-engine/.github/workflows/stale-weekly.yml",
      "isCorrect": false,
      "display_type": "actions",
      "level": "fatal",
      "msg": "",
      "error": {
        "expected": "",
        "got": "An internal error occurred.  Please open an issue at: https://github.com/githubtraining/lab-scheduled-events and let us know!  Thank you"
      }
    }
  ]
}

So looking at this I'm starting to think Looking glass failed to handle it properly. It apparently didn't like the blank expected field even though it should have converted the blank value into null.

I'll examine LG to see if I can find the probelm.

mattdavis0351 commented 3 years ago

all of this is being addressed in this pull