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

fix/ref: 1460 - remove trial start when org has no private repos #2787

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Apr 17, 2024

Description

Goal of this PR is to prevent the trial starting for a user when their organization that they are using to sign up for Codecov with has no private repos. The first commit of this PR has all the logic / tests that were updated for that aspect.

The rest of this PR is a simple TS conversion of one of the hooks called on the component, and a couple typos being fixed. Didn't want to blow up the PR any further for a bug fix so thought this was a decent stopping point.

Closes codecov/engineering-team#1460

Code Example

Manual Testing

Shown below are some screenshots of my local environment DB of the repos and owners tables being empty prior to creating a user object

The next screenshot is upon entering the "Which organization" page, which we can see pulls back hasPrivateRepos: true for the codecov organization, hinting that by the time the user reaches this page they should already have repos for the organizations they are a part of in their system.

I have a feeling there are some race conditions / edge cases that may need extra consideration here, but for the majority of use cases (and the sake of this bug) I believe this fix should do the trick.

Screenshots

Screenshot 2024-04-17 at 3 22 20 PM Screenshot 2024-04-17 at 3 22 34 PM Screenshot 2024-04-17 at 3 23 49 PM

Link to Sample Entry

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-qa
Copy link

codecov-qa bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.45%. Comparing base (018fd49) to head (3221e2d).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2787       +/-   ##
===========================================
+ Coverage   34.71%   98.45%   +63.74%     
===========================================
  Files         852      873       +21     
  Lines       12564    12634       +70     
  Branches     3317     3317               
===========================================
+ Hits         4361    12439     +8078     
+ Misses       8094      191     -7903     
+ Partials      109        4      -105     
Files Coverage Δ
...rc/pages/DefaultOrgSelector/DefaultOrgSelector.jsx 100.00% <100.00%> (ø)
...efaultOrganization/useUpdateDefaultOrganization.ts 100.00% <100.00%> (ø)
...nentMeasurements/useDeleteComponentMeasurements.ts 100.00% <100.00%> (+100.00%) ⬆️
src/services/trial/useStartTrial.ts 100.00% <100.00%> (+43.47%) ⬆️

... and 563 files with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (+2.61%) ⬆️
Layouts 97.25% <ø> (+96.93%) ⬆️
Pages 99.28% <100.00%> (+76.56%) ⬆️
Services 99.56% <100.00%> (+69.11%) ⬆️
Shared 99.84% <ø> (+37.45%) ⬆️
UI 94.18% <ø> (+2.40%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 018fd49...3221e2d. Read the comment docs.

Copy link

codecov-public-qa bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.45%. Comparing base (018fd49) to head (3221e2d).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2787       +/-   ##
===========================================
+ Coverage   15.58%   98.45%   +82.86%     
===========================================
  Files         846      873       +27     
  Lines       12555    12634       +79     
  Branches     3317     3317               
===========================================
+ Hits         1957    12439    +10482     
+ Misses      10447      191    -10256     
+ Partials      151        4      -147     
Files Coverage Δ
...rc/pages/DefaultOrgSelector/DefaultOrgSelector.jsx 100.00% <100.00%> (+100.00%) ⬆️
...efaultOrganization/useUpdateDefaultOrganization.ts 100.00% <100.00%> (ø)
...nentMeasurements/useDeleteComponentMeasurements.ts 100.00% <100.00%> (+100.00%) ⬆️
src/services/trial/useStartTrial.ts 100.00% <100.00%> (+100.00%) ⬆️

... and 700 files with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (+5.55%) ⬆️
Layouts 97.25% <ø> (+97.25%) ⬆️
Pages 99.28% <100.00%> (+99.09%) ⬆️
Services 99.56% <100.00%> (+93.09%) ⬆️
Shared 99.84% <ø> (+50.27%) ⬆️
UI 94.18% <ø> (+4.16%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 018fd49...3221e2d. Read the comment docs.

@codecov-notifications
Copy link

codecov-notifications bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2787       +/-   ##
===========================================
+ Coverage   34.71%   98.45%   +63.74%     
===========================================
  Files         852      873       +21     
  Lines       12564    12634       +70     
  Branches     3316     3316               
===========================================
+ Hits         4361    12439     +8078     
+ Misses       8094      191     -7903     
+ Partials      109        4      -105     
Files Coverage Δ
...rc/pages/DefaultOrgSelector/DefaultOrgSelector.jsx 100.00% <100.00%> (ø)
...efaultOrganization/useUpdateDefaultOrganization.ts 100.00% <100.00%> (ø)
...nentMeasurements/useDeleteComponentMeasurements.ts 100.00% <100.00%> (+100.00%) ⬆️
src/services/trial/useStartTrial.ts 100.00% <100.00%> (+43.47%) ⬆️

... and 563 files with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (+2.61%) ⬆️
Layouts 97.25% <ø> (+96.93%) ⬆️
Pages 99.28% <100.00%> (+76.56%) ⬆️
Services 99.56% <100.00%> (+69.11%) ⬆️
Shared 99.84% <ø> (+37.45%) ⬆️
UI 94.18% <ø> (+2.40%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 018fd49...3221e2d. Read the comment docs.

@hootener
Copy link

Bundle Report

Changes will decrease total bundle size by 108 bytes ⬇️

Bundle name Size Change
gazebo-staging-array-push 6.46MB 108 bytes ⬇️

Copy link

codecov bot commented Apr 17, 2024

Bundle Report

Changes will decrease total bundle size by 108 bytes ⬇️

Bundle name Size Change
gazebo-production-array-push 6.46MB 108 bytes ⬇️

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.46%. Comparing base (018fd49) to head (3221e2d).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##            main   #2787      +/-   ##
========================================
+ Coverage   42.61   98.46   +55.85     
========================================
  Files        853     873      +20     
  Lines      12568   12634      +66     
  Branches    3317    3317              
========================================
+ Hits        5355   12439    +7084     
+ Misses      7137     191    -6946     
+ Partials      76       4      -72     
Files Coverage Δ
...rc/pages/DefaultOrgSelector/DefaultOrgSelector.jsx 100.00% <100.00%> (ø)
...efaultOrganization/useUpdateDefaultOrganization.ts 100.00% <100.00%> (ø)
...nentMeasurements/useDeleteComponentMeasurements.ts 100.00% <100.00%> (+100.00%) ⬆️
src/services/trial/useStartTrial.ts 100.00% <100.00%> (ø)

... and 480 files with indirect coverage changes

Components Coverage Δ
Assets 55.55% <ø> (+2.92%) ⬆️
Layouts 97.25% <ø> (+94.05%) ⬆️
Pages 99.28% <100.00%> (+76.52%) ⬆️
Services 99.56% <100.00%> (+48.59%) ⬆️
Shared 99.84% <ø> (+1.43%) ⬆️
UI 94.18% <ø> (+1.74%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 018fd49...3221e2d. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Apr 17, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Commit Created Cloud Enterprise
4b77743 Wed, 17 Apr 2024 23:15:21 GMT Expired Expired
4b77743 Wed, 17 Apr 2024 23:16:23 GMT Expired Expired
4b77743 Wed, 17 Apr 2024 23:17:54 GMT Expired Expired
4b77743 Wed, 17 Apr 2024 23:19:51 GMT Expired Expired
3221e2d Mon, 22 Apr 2024 18:28:24 GMT Expired Expired
3221e2d Mon, 22 Apr 2024 18:53:06 GMT Cloud Enterprise

}
},
onError: (e) => {
onError: (e: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do you need the any?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we do, due to this setting I believe:

"noImplicitAny": true,

@ajay-sentry ajay-sentry merged commit d57a320 into main Apr 22, 2024
59 of 60 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/1460-no-trial-when-no-private-repos branch April 22, 2024 18:54
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.

Remove trial option when there are no private repos related to organization
4 participants