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 — Add support for diff-informed queries by cklin · Pull Request #2559 · github/codeql-action

Conversation

@cklin

@cklin cklin commented Oct 21, 2024

Copy link
Copy Markdown
Contributor

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
cklin added 2 commits October 21, 2024 10:37
@cklin
Add decodeGitFilePath()
2bfc468
@cklin
Add debug logging to runGitCommand()
5e475b7
@cklin
cklin marked this pull request as ready for review October 22, 2024 15:43
@cklin
cklin requested a review from a team as a code owner October 22, 2024 15:43
@cklin
cklin requested a review from henrymercer October 22, 2024 15:43
@cklin cklin assigned henrymercer Oct 22, 2024
henrymercer
henrymercer reviewed Oct 23, 2024
View reviewed changes

@henrymercer henrymercer 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.

Thanks! I have a bunch of comments and questions — feel free to only address the ones that make sense.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/actions-util.ts
Comment on lines +165 to +171
/**
* Deepen the git history of the given ref by one level. Errors are ignored.
*/
export const deepenGitHistory = async function () {

@henrymercer henrymercer Oct 23, 2024

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.

Two comments about the additions to this file in general:

  • Why completely ignore errors? Does it make sense to at least debug log them?
  • Nit, optional: This PR adds a bunch of functionality that interacts with git — now might be a good time to pull this functionality out into its own file.

Sorry, something went wrong.

Uh oh!

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

All reactions

@cklin cklin Oct 24, 2024

Copy link
Copy Markdown
Contributor Author

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.

The error is indeed logged centrally within runGitCommand(). By "Errors are ignored", I was trying to convey that errors are not reported back to the caller. I have update the function documentation to clarify the behavior.

Moving the git interactions to its own file sounds like a good idea, though trying to incorporate that into this PR is a bit messy. Can I defer that to a dedicated PR after this one merges?

Sorry, something went wrong.

Uh oh!

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

All reactions

@henrymercer henrymercer Oct 25, 2024

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.

Yes, that's fine!

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/actions-util.ts Resolved

Uh oh!

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

Comment thread src/actions-util.ts Resolved

Uh oh!

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

Comment thread src/analyze-action.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts
const results = new Array<[string, number, number]>();

let changedFile = "";
for (const line of diffHunkHeaders) {

@henrymercer henrymercer Oct 23, 2024

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.

In general this seems to keep going when it sees certain kinds of unexpected items in the diff. It seems that there's a risk of missing changed files — should we be more robust here, or fail more eagerly, or is that not important for now?

Sorry, something went wrong.

Uh oh!

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

All reactions

@cklin cklin Oct 24, 2024

Copy link
Copy Markdown
Contributor Author

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.

Can you tell me more about the risk you see, and how the code can be made more robust?

Sorry, something went wrong.

Uh oh!

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

All reactions

@henrymercer henrymercer Oct 25, 2024

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.

Here are some examples where we seem to find unexpected items in the diff:

  • // Not an actual file path; probably /dev/null
  • Failed to parse diff hunk header line: ${line}. Skipping.

In these cases we seem to be encountering something unexpected, but we log or ignore the error and carry on. My question is could these cases where the diff isn't quite as we expect cause us to miss some files that have been changed by the PR, and therefore cause us to miss alerts? If so, we'd probably want to return undefined and fall back to a full analysis.

Sorry, something went wrong.

Uh oh!

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

All reactions

@cklin cklin Oct 29, 2024

Copy link
Copy Markdown
Contributor Author

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.

That is a great observation. Thank you! I have updated the PR accordingly.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/actions-util.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts Resolved

Uh oh!

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

cklin added 2 commits October 23, 2024 14:32
@cklin
Add Git helper functions
db53998
@cklin
Add sarifRunPropertyFlag to databaseInterpretResults()
b311eee
@cklin
cklin force-pushed the cklin/diff-range-filtering branch from d757098 to 38487cd Compare October 23, 2024 21:48
@cklin

cklin commented Oct 24, 2024

Copy link
Copy Markdown
Contributor Author

Thanks! I have a bunch of comments and questions — feel free to only address the ones that make sense.

Thanks for the detailed comments and helpful suggestions! PTAL.

All reactions

Sorry, something went wrong.

Uh oh!

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

@cklin
cklin requested a review from henrymercer October 24, 2024 14:00
henrymercer
henrymercer previously approved these changes Oct 28, 2024
View reviewed changes

@henrymercer henrymercer 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.

There's one remaining thread here, but otherwise LGTM!

Sorry, something went wrong.

Uh oh!

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

All reactions
cklin added 2 commits October 29, 2024 07:01
@cklin
Diff-informed PR analysis
f7935cc
@cklin
build: refresh js files
94b5d39
@cklin
cklin dismissed henrymercer’s stale review via 94b5d39 October 29, 2024 14:01
@cklin
cklin force-pushed the cklin/diff-range-filtering branch from 38487cd to 94b5d39 Compare October 29, 2024 14:01
@cklin

cklin commented Oct 29, 2024

Copy link
Copy Markdown
Contributor Author

There's one remaining thread here, but otherwise LGTM!

I updated the PR, which implements your suggestion and also fixes a minor bug in the handling of deletion hunks (where git reports the insertion line range as 0). See diff for the latest force-push for details.

All reactions

Sorry, something went wrong.

Uh oh!

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

@cklin
cklin requested a review from henrymercer October 29, 2024 14:09
henrymercer
henrymercer previously approved these changes Oct 31, 2024
View reviewed changes

@henrymercer henrymercer 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.

Thanks @cklin!

Sorry, something went wrong.

Uh oh!

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

All reactions
@cklin
Merge branch 'main' into cklin/diff-range-filtering
a282158
@cklin
cklin dismissed henrymercer’s stale review via a282158 October 31, 2024 13:12
nickfyson
nickfyson approved these changes Oct 31, 2024
View reviewed changes
@cklin
cklin merged commit 48c3e26 into main Oct 31, 2024
@cklin
cklin deleted the cklin/diff-range-filtering branch October 31, 2024 13:47
This was referenced Nov 8, 2024
Merge main into releases/v3 #2585
Merged
Merge releases/v3 into releases/v2 #2587
Merged
@cklin cklin mentioned this pull request Dec 9, 2024
Extract git-utils.ts #2639
Merged
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nickfyson nickfyson nickfyson approved these changes
@henrymercer henrymercer henrymercer left review comments

Uh oh!

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

Assignees

@henrymercer henrymercer

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.

3 participants

@cklin @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.