Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark invalid SARIF errors as user errors in the upload-sarif Action #1872

Merged
merged 3 commits into from
Sep 7, 2023

Conversation

henrymercer
Copy link
Contributor

@henrymercer henrymercer commented Sep 6, 2023

Found this while I was looking at CodeQL Action telemetry as I rolled out some other changes.

Categorizing user errors correctly in telemetry helps us detect and respond to incidents faster. This PR starts marking invalid SARIF upload requests as UserError when users use the upload-sarif Action, as here the SARIF is not under our control, and things like invalid paths or invalid SARIF are not problems with our service. On the other hand, when uploading SARIF in the analyze or init-post steps, invalid SARIF upload requests remain Errors, since these could indicate a problem with our service.

Suggestions for a better name for invalidRequestIsUserError welcome — this felt a little awkward.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@henrymercer henrymercer requested a review from a team as a code owner September 6, 2023 20:04
angelapwen
angelapwen previously approved these changes Sep 6, 2023
Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

/**
* An error that occurred due to an invalid SARIF upload request.
*/
class InvalidUploadSarifRequest extends Error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we we suffix this with Error?

/**
* Uploads a single SARIF file or a directory of SARIF files depending on what `sarifPath` refers to.
*
* @param invalidRequestIsUserError Whether an invalid request, for example one with a `sarifPath`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe considerInvalidRequestUserError makes more sense to me, though it's not more concise 😆

Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@henrymercer henrymercer merged commit 43750fe into main Sep 7, 2023
344 checks passed
@henrymercer henrymercer deleted the henrymercer/user-errors-for-upload-sarif branch September 7, 2023 21:46
@github-actions github-actions bot mentioned this pull request Sep 13, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants