-
Notifications
You must be signed in to change notification settings - Fork 28
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
dev: Optimizations / Dead code removal for comparison class #725
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #725 +/- ##
==========================================
- Coverage 91.73% 91.72% -0.02%
==========================================
Files 632 632
Lines 17056 17054 -2
==========================================
- Hits 15646 15642 -4
- Misses 1410 1412 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #725 +/- ##
==========================================
- Coverage 91.73% 91.72% -0.02%
==========================================
Files 632 632
Lines 17056 17054 -2
==========================================
- Hits 15646 15642 -4
- Misses 1410 1412 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #725 +/- ##
================================================
- Coverage 96.03000 96.02000 -0.01000
================================================
Files 814 814
Lines 18430 18428 -2
================================================
- Hits 17699 17695 -4
- Misses 731 733 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -42,7 +42,7 @@ def test_update_user_when_agreement_is_false(self): | |||
assert self.current_user.terms_agreement_at == self.updated_at | |||
|
|||
self.current_user.refresh_from_db() | |||
self.current_user.email == before_refresh_business_email | |||
assert self.current_user.email == before_refresh_business_email |
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.
some added assertions here
@@ -272,7 +272,7 @@ def test_self_hosted_license_returns_null_if_invalid_license(self, license_mock) | |||
) | |||
assert data == { | |||
"config": { | |||
"selfHostedLicense": {"expirationDate": None}, | |||
"selfHostedLicense": None, |
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.
This is the correct test I think
@@ -1318,22 +1318,6 @@ def setUp(self): | |||
self.comparison = Comparison(user=owner, base_commit=base, head_commit=head) | |||
asyncio.set_event_loop(asyncio.new_event_loop()) | |||
|
|||
def test_returns_true_if_reverse_comparison_has_commits(self, get_adapter_mock): |
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.
These aren't needed anymore since we removed the param
@@ -64,7 +64,7 @@ def test_perform_backfill(self, backfill_dataset): | |||
) | |||
assert res.status_code == 302 | |||
|
|||
backfill_dataset.call_count == 2 | |||
assert backfill_dataset.call_count == 2 |
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.
added assertion
@@ -893,9 +893,11 @@ def test_get_proration_params(self): | |||
plan=PlanName.CODECOV_PRO_MONTHLY.value, plan_user_count=20 | |||
) | |||
desired_plan = {"value": PlanName.SENTRY_MONTHLY.value, "quantity": 19} | |||
self.stripe._get_proration_params(owner, desired_plan) == "none" | |||
assert self.stripe._get_proration_params(owner, desired_plan) == "none" |
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.
added assertion
@@ -953,7 +940,10 @@ def change_coverage(self) -> Optional[float]: | |||
and self.head_coverage | |||
and self.head_coverage.coverage | |||
): | |||
return float(self.head_coverage.coverage - self.base_coverage.coverage) | |||
return float( |
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.
This could result in some weird behavior if head_coverage.coverage was a non-float/int value
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.
@@ -774,12 +777,8 @@ def _fetch_comparison_and_reverse_comparison(self): | |||
self.base_commit.commitid, self.head_commit.commitid | |||
) | |||
|
|||
reverse_comparison_coro = adapter.get_compare( |
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.
This other routine was doing an extra Github API call every time we needed a fresh version of this property (assuming the caching worked to begin with)
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.
Hmmm how do we know we don't need this still?
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 return value from this thing was only being used in "has_unmerged_base_commits" which didn't seem to be used anywhere
@@ -791,18 +790,6 @@ def non_carried_forward_flags(self): | |||
flags_dict = self.head_report.flags | |||
return [flag for flag, vals in flags_dict.items() if not vals.carriedforward] | |||
|
|||
@cached_property | |||
def has_unmerged_base_commits(self): |
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.
This didn't seem to be used anywhere across gazebo, worker, api, or shared
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Purpose/Motivation
Looking to ease a bit of the comparison class pain that occurs anytime we fetch aspects related to this model, including "ImpactedFiles" and their properties, "compareWithBase" and related relations from the pull model, or aspects from the comparison itself, like "hasDifferentNumberOfHeadAndBaseReports."
This PR does a few things:
Links to relevant tickets
Notes to Reviewer
Anything to note to the team? Any tips on how to review, or where to start?
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.