Skip to content

✨ Optimize SAST check#2191

Merged
azeemshaikh38 merged 5 commits intoossf:mainfrom
spencerschrock:graphql-change
Aug 26, 2022
Merged

✨ Optimize SAST check#2191
azeemshaikh38 merged 5 commits intoossf:mainfrom
spencerschrock:graphql-change

Conversation

@spencerschrock
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Optimization

What is the current behavior?

CheckRuns info is fetched via 30 REST API calls.

What is the new behavior (if this is a feature change)?**

Caches info about CheckRuns which is pulled in during the initial graphQL step without an increase in that API cost (currently cost=1). This makes the info available for the SAST check without needing 30 REST API calls.

If any uncached info is requested, REST API calls are performed, same as before.

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Partial fix for #1916

Special notes for your reviewer

Might run into uncached scenarios for repos that don't squash on merge.

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

NONE

@spencerschrock
Copy link
Copy Markdown
Member Author

Need to double check E2E behavior on a repo that doesn't squash commits. When run on github.com/ossf/scorecard, everything is cached.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 24, 2022

Codecov Report

Merging #2191 (3a126e4) into main (11ff78e) will decrease coverage by 0.35%.
The diff coverage is 2.66%.

@@            Coverage Diff             @@
##             main    #2191      +/-   ##
==========================================
- Coverage   42.28%   41.92%   -0.36%     
==========================================
  Files          95       95              
  Lines        7871     7935      +64     
==========================================
- Hits         3328     3327       -1     
- Misses       4283     4348      +65     
  Partials      260      260              

Copy link
Copy Markdown
Contributor

@azeemshaikh38 azeemshaikh38 left a comment

Choose a reason for hiding this comment

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

Awesome work @spencerschrock with the quick turn around here! Can't wait to see this running in prod.

Comment thread clients/githubrepo/graphql.go Outdated
Comment thread clients/pull_request.go Outdated
Comment thread clients/githubrepo/client.go Outdated
Comment thread clients/githubrepo/client.go Outdated
Comment thread clients/githubrepo/graphql.go Outdated
@spencerschrock
Copy link
Copy Markdown
Member Author

Looks like some consistent failures in the e2e token tests. I'll take a look

@azeemshaikh38
Copy link
Copy Markdown
Contributor

Looks like some consistent failures in the e2e token tests. I'll take a look

May need to include checks: read permission.

@spencerschrock spencerschrock temporarily deployed to integration-test August 25, 2022 22:13 Inactive
@github-actions
Copy link
Copy Markdown

@spencerschrock spencerschrock temporarily deployed to integration-test August 25, 2022 22:35 Inactive
@github-actions
Copy link
Copy Markdown

@azeemshaikh38 azeemshaikh38 enabled auto-merge (squash) August 26, 2022 19:47
@azeemshaikh38 azeemshaikh38 temporarily deployed to integration-test August 26, 2022 19:48 Inactive
@azeemshaikh38 azeemshaikh38 merged commit a8e9050 into ossf:main Aug 26, 2022
@github-actions
Copy link
Copy Markdown

@spencerschrock spencerschrock deleted the graphql-change branch August 29, 2022 17:21
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