GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor configuration errors by angelapwen · Pull Request #2105 · github/codeql-action

Conversation

@angelapwen

@angelapwen angelapwen commented Jan 30, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

As we add more configuration errors to improve our uptime measurements, I thought it would be nice to refactor the existing errors into their own file. I took inspiration from the FeatureConfig Record that we use for feature flags.

Also, I thought it would be nice to consolidate the place we check for configuration errors into codeql.ts, where the actual command invocations happen.

The PR also renames the UserError type to ConfigurationError to standardize on a single term.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@angelapwen
angelapwen force-pushed the refactor-config-errors branch from 3bcce67 to 7837cc7 Compare January 30, 2024 14:00
@angelapwen
angelapwen marked this pull request as ready for review January 30, 2024 14:25
@angelapwen
angelapwen requested a review from a team as a code owner January 30, 2024 14:25
@angelapwen angelapwen changed the title Refactor config errors Refactor configuration errors Jan 30, 2024
nickfyson
nickfyson reviewed Jan 30, 2024
View reviewed changes

@nickfyson nickfyson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I really like the direction, I think it makes a lot of sense to consolidate this class of errors and their handling into a single place. I've added a couple of comments/questions...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/codeql.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

nickfyson
nickfyson reviewed Jan 31, 2024
View reviewed changes
Comment thread src/codeql.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen
angelapwen force-pushed the refactor-config-errors branch from 2d5e89c to e8fcc9e Compare January 31, 2024 15:33
aeisenberg
aeisenberg reviewed Feb 2, 2024
View reviewed changes
Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/cli-config-errors.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

angelapwen added 11 commits February 6, 2024 15:50
@angelapwen
Refactor existing CLI errors into new class
1c5a7b0
@angelapwen
Move config error processing for database init
b5dd04b
As we add more configuration errors, we can standardize throwing and catching them in the `codeql` file where we actually invoke the commands.

Also, rename to `isCliConfigurationError` for more clarity.
@angelapwen
Fix config error checking condition
34d760d
To maintain parity with the previous logic: only 1 of the 2 conditions needs to hold: either the exit codes match, or the error messages match.
@angelapwen
Add processCliConfigurationError method
7fa31b7
@angelapwen
Combine action error text into original configuration Record
011aa0d
@angelapwen
Rename UserError to ConfigurationError
a84ad63
And all associated methods/comments that say `user error`
@angelapwen
Clarify CliErrorCategory
8c539c5
@angelapwen
Refactor configuration error parsing logic per review
fb9a552
@angelapwen
Fix up tests
8812654
Now that we are always appending the original error, this test needs to be updated.
@angelapwen
Rename to cli-errors, clean up logging and comments
b62de8d
@angelapwen
Clarify comment from PR review
a6cb48e
@angelapwen
angelapwen force-pushed the refactor-config-errors branch from e7bd740 to a6cb48e Compare February 6, 2024 15:56
@angelapwen

angelapwen commented Feb 6, 2024

Copy link
Copy Markdown
Contributor Author

Okay.. the refactoring based off of the feedback took a bit longer/was more complex than expected, but I think I'm happy with the results 😸

  • Now, we simply call wrapCliConfigurationError on any errors thrown from CLI command invocations in codeql.ts. This will return the appropriate Error type (possibly a ConfigurationError, if it matches any of our known CliConfigErrorCategory values, and possibly with an additional error message prepended for additional context to the user).
  • There was a dependency cycle so I moved CommandInvocationError to the same file as the CLI configuration errors and renamed the file cli-errors.ts to cover both.
  • We're unconditionally appending the original error to the additional error message now, because I didn't think it was worth adding an extra case where we don't include the original CLI error. I updated the test cases in codeql.test.ts to accommodate.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

angelapwen added 2 commits February 6, 2024 16:03
@angelapwen
Rename variable for clarity
d64851b
@angelapwen
Remove transpiled files
4382429
@angelapwen
angelapwen requested review from henrymercer and nickfyson February 6, 2024 17:35
nickfyson
nickfyson reviewed Feb 7, 2024
View reviewed changes

@nickfyson nickfyson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I like the direction, couple of small queries!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/status-report.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/codeql.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/codeql.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@angelapwen
Throw e even if not an Error
c78e96b
@angelapwen
angelapwen requested a review from nickfyson February 8, 2024 10:42
nickfyson
nickfyson previously approved these changes Feb 8, 2024
View reviewed changes

@nickfyson nickfyson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🚀

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@angelapwen
Rename enum variables per PR review
a2c26c9
@angelapwen
angelapwen dismissed nickfyson’s stale review via a2c26c9 February 8, 2024 16:39
nickfyson
nickfyson previously approved these changes Feb 8, 2024
View reviewed changes

@nickfyson nickfyson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🚀

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
angelapwen added 2 commits February 8, 2024 16:55
@angelapwen
Merge branch 'main' into refactor-config-errors
bcad4f7
@angelapwen
Resolve merge conflict
49b80d0
@angelapwen
angelapwen dismissed nickfyson’s stale review via 49b80d0 February 8, 2024 16:56
nickfyson
nickfyson approved these changes Feb 8, 2024
View reviewed changes
@angelapwen
angelapwen enabled auto-merge (squash) February 8, 2024 17:08
@angelapwen
angelapwen merged commit 1515e2b into github:main Feb 8, 2024
@angelapwen
angelapwen deleted the refactor-config-errors branch February 8, 2024 17:22
@github-actions github-actions Bot mentioned this pull request Feb 13, 2024
Merge main into releases/v3 #2131
Merged
7 of 8 tasks
@henrymercer henrymercer mentioned this pull request Feb 13, 2024
Merge releases/v3 into releases/v2 #2133
Merged
8 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aeisenberg aeisenberg aeisenberg left review comments
@nickfyson nickfyson nickfyson approved these changes
@henrymercer henrymercer Awaiting requested review from henrymercer

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@angelapwen @aeisenberg @nickfyson @henrymercer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.