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

feat: Add bundle analysis comparisons #330

Merged
merged 11 commits into from
Jan 11, 2024
Merged

feat: Add bundle analysis comparisons #330

merged 11 commits into from
Jan 11, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Jan 7, 2024

Purpose/Motivation

  • Foundational code for bundle analysis in API
  • Add GraphQL endpoints to do bundle analysis comparisons between Pulls and Commits

Links to relevant tickets

codecov/engineering-team#955
codecov/engineering-team#959
codecov/engineering-team#960

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-staging
Copy link

codecov-staging bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d43a7bb) 96.02% compared to head (72b400c) 96.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #330      +/-   ##
==========================================
+ Coverage   96.02%   96.05%   +0.03%     
==========================================
  Files         620      623       +3     
  Lines       15985    16141     +156     
==========================================
+ Hits        15349    15505     +156     
  Misses        636      636              
Flag Coverage Δ
unit 96.05% <100.00%> (+0.03%) ⬆️
unit-latest-uploader 96.05% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codecov-public-qa bot commented Jan 7, 2024

Codecov Report

Merging #330 (72b400c) into main (d43a7bb) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #330      +/-   ##
==========================================
+ Coverage   96.02%   96.05%   +0.03%     
==========================================
  Files         620      623       +3     
  Lines       15985    16141     +156     
==========================================
+ Hits        15349    15505     +156     
  Misses        636      636              
Flag Coverage Δ
unit 96.05% <100.00%> (+0.03%) ⬆️
unit-latest-uploader 96.05% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
graphql_api/dataloader/bundle_analysis.py 100.00% <100.00%> (ø)
graphql_api/types/__init__.py 100.00% <100.00%> (ø)
...l_api/types/bundle_analysis_comparison/__init__.py 100.00% <100.00%> (ø)
..._analysis_comparison/bundle_analysis_comparison.py 100.00% <100.00%> (ø)
graphql_api/types/commit/commit.py 100.00% <100.00%> (ø)
graphql_api/types/pull/pull.py 100.00% <100.00%> (ø)
services/bundle_analysis.py 100.00% <100.00%> (ø)

Impacted file tree graph

Copy link

codecov bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d43a7bb) 95.64% compared to head (72b400c) 95.68%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #330     +/-   ##
=======================================
+ Coverage   95.64   95.68   +0.04     
=======================================
  Files        735     738      +3     
  Lines      16500   16655    +155     
=======================================
+ Hits       15781   15936    +155     
  Misses       719     719             
Flag Coverage Δ
unit 96.05% <100.00%> (+0.03%) ⬆️
unit-latest-uploader 96.05% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry changed the title [WIP] feat: initial commit for bundle analysis [WIP] feat: Add bundle analysis comparisons Jan 8, 2024
@JerrySentry JerrySentry changed the title [WIP] feat: Add bundle analysis comparisons feat: Add bundle analysis comparisons Jan 8, 2024

assert loader == True

def test_loader_only_coverage_base_report(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: prefer renaming this test and the one below to test_loader_only_missing_base/head_report as that what we are asserting on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍


def load_time_conversion(size):
"""
Converts total size in bytes to approximate time (in seconds) to download using a 3G internet (3 Mbps)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we decide on 3G as a standard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we did a full discussion around what download speed we should do, but probably the most widely used speed. I envision in future iterations we can provide as input what the preferred speed is to make the calculation. But this should suffice for now in the v0.

self.comparison.head_report
and self.comparison.head_report.bundle_report(bundle_change.bundle_name)
):
head_bundle_report_size = self.comparison.head_report.bundle_report(
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider declaring self.comparison.head_report.bundle_report(..) as a variable so we're not calling it twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

BundleAnalysisComparison
| FirstPullRequest
| MissingBaseCommit
| MissingHeadCommit
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever be MissingHeadCommit?. The function the resolver calls in commit.py does not return that type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also gets called in pull.py which can return MissingHeadCommit

@JerrySentry JerrySentry merged commit fc0d938 into main Jan 11, 2024
21 checks passed
@JerrySentry JerrySentry deleted the api_955 branch January 11, 2024 19:08
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.

None yet

2 participants