FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Gracefully continue if `createStatusReportBase` throws by angelapwen · Pull Request #2225 · github/codeql-action · GitHub

Gracefully continue if createStatusReportBase throws - #2225

Merged
angelapwen merged 1 commit into
mainfrom
angelapwen/audit-status-report-exceptions
Apr 4, 2024
Merged

angelapwen merged 1 commit into
mainfrom
angelapwen/audit-status-report-exceptions

Conversation

angelapwen commented Apr 4, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Previously, we weren't catching any possible exceptions in createStatusReportBase and runs would fail if any of the telemetry sub-items threw exceptions. As telemetry should not block the analysis, we continue here even if the status report throws.

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.

angelapwen force-pushed the angelapwen/audit-status-report-exceptions branch from 788a476 to 17bf96c Compare April 4, 2024 21:09
Previously, we weren't catching any possible exceptions in `createStatusReportBase` and runs would fail if any of the telemetry sub-items threw exceptions. As telemetry should not block the analysis, we continue here even if the status report throws.
angelapwen force-pushed the angelapwen/audit-status-report-exceptions branch from 17bf96c to 9e8cae9 Compare April 4, 2024 21:12
angelapwen marked this pull request as ready for review April 4, 2024 21:25
angelapwen requested a review from a team as a code owner April 4, 2024 21:25

aeisenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice. A few comments inline. If the answer to my question is "no", then this can go in as-is.

Comment thread src/analyze-action.ts
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
} else {
await statusReport.sendStatusReport(report);
if (config && didUploadTrapCaches) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do we ever reasonably expect config to be falsy, but didUploadTrapCaches to be true? If so, we might want to still upload in that case:

Suggested change
if (config && didUploadTrapCaches) {
if (didUploadTrapCaches) {

And the change below. But only if this is not already an error state.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think so — if config is undefined, we should be erroring out much earlier:

if (config === undefined) {
.

Comment thread src/analyze-action.ts
...report,
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(
await getTotalCacheSize(config.trapCaches, logger),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Only if also adding above.

Suggested change
await getTotalCacheSize(config.trapCaches, logger),
await getTotalCacheSize(config?.trapCaches || {}, logger),

Comment thread src/status-report.ts
status === "success" ||
status === "failure" ||
status === "aborted" ||
status === "user-error"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should this change to configuration-error? (Not in this PR)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We could: the configuration-error was codified in the overall job status (rather than status for each action, which is what this is). It would be nice to have them use the same syntax. But we would want to make sure that everyone consuming the data are aware about the transition, because we likely have existing monitors/queries/dashboards using user-error. I can write up an internal issue for this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sure. I'd say it's low priority since it's just changing a name.

angelapwen merged commit 7df281f into main Apr 4, 2024
angelapwen deleted the angelapwen/audit-status-report-exceptions branch April 4, 2024 22:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL