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: Migrate isEnterprisePlan to GQL Field #3576

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

ajay-sentry
Copy link
Contributor

Description

This PR aims to remove the isEnterprisePlan helper function in Gazebo in favor of the new GraphQL field for the same.

As part of this PR there are also some changes removing the accountDetails hook has the SOT for retrieving a user's plan in favor of the usePlanData hook, which seems to be the "go-to" pattern for more recently created components anyway.

Outside of that, all the tests that touch plan details had to be updated to include this new field, and in the cases where we deprecated the useAccountDetails hook in favor of usePlanData we also had to add or update the mocks to reflect the differences in the plan mocks as well.

Closes codecov/engineering-team#3061

This PR will probably be the "biggest" of these migration PRs because it's the first one. I don't expect others to be as meaty, though they may have just as many files touched

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

codecov-staging bot commented Dec 12, 2024

Bundle Report

Changes will increase total bundle size by 438 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 5.72MB 230 bytes (0.0%) ⬆️
gazebo-staging-system 5.67MB 208 bytes (0.0%) ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Dec 12, 2024

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
5637 2 5635 0
View the top 2 failed tests by shortest run time
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx > BillingOptions > when rendered > planString is set to annual plan > renders annual button as "selected"
Stack Traces | 0.199s run time
Error: expect(element).toHaveClass("bg-ds-primary-base")

Expected the element to have class:
  bg-ds-primary-base
Received:
  flex-1 py-1 px-2 text-sm cursor-pointer whitespace-nowrap disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary rounded-l
 ❯ .../TeamPlanController/BillingOptions/BillingOptions.test.tsx:128:27
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx > UpgradeForm > when rendered > when the user has a basic plan > renders the organization and owner titles
Stack Traces | 1.25s run time
TestingLibraryElementError: Unable to find an element with the text: /Organization/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div />
</body>

Ignored nodes: comments, script, style
<body>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx:385:48

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Dec 12, 2024

Bundle Report

Changes will increase total bundle size by 438 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.67MB 208 bytes (0.0%) ⬆️
gazebo-production-system-esm 5.72MB 230 bytes (0.0%) ⬆️

@codecov-staging
Copy link

codecov-staging bot commented Dec 12, 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    #3576   +/-   ##
=======================================
  Coverage   98.90%   98.91%           
=======================================
  Files         806      806           
  Lines       14485    14478    -7     
  Branches     4116     4112    -4     
=======================================
- Hits        14327    14321    -6     
+ Misses        151      150    -1     
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/AccountSettings/AccountSettings.jsx 100.00% <100.00%> (ø)
.../pages/AccountSettings/AccountSettingsSideMenu.jsx 100.00% <100.00%> (ø)
...rsPage/MembersActivation/Activation/Activation.jsx 100.00% <100.00%> (ø)
...ation/Activation/ChangePlanLink/ChangePlanLink.jsx 100.00% <100.00%> (ø)
...anPage/subRoutes/CancelPlanPage/CancelPlanPage.tsx 100.00% <100.00%> (ø)
...CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.tsx 100.00% <100.00%> (ø)
...Plan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx 100.00% <ø> (ø)
...Plan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx 100.00% <100.00%> (ø)
...tPlanCard/shared/ActionsBilling/ActionsBilling.jsx 100.00% <100.00%> (ø)
...CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx 100.00% <100.00%> (ø)
... and 7 more

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (-0.01%) ⬇️
Services 99.36% <ø> (+0.03%) ⬆️
Shared 99.32% <100.00%> (-0.01%) ⬇️
UI 99.14% <ø> (ø)

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 617411d...e2e1e8d. Read the comment docs.

Copy link

codecov-public-qa bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.91%. Comparing base (617411d) to head (e2e1e8d).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3576   +/-   ##
=======================================
  Coverage   98.90%   98.91%           
=======================================
  Files         806      806           
  Lines       14485    14478    -7     
  Branches     4109     4105    -4     
=======================================
- Hits        14327    14321    -6     
+ Misses        151      150    -1     
  Partials        7        7           
Files with missing lines Coverage Δ
src/pages/AccountSettings/AccountSettings.jsx 100.00% <100.00%> (ø)
.../pages/AccountSettings/AccountSettingsSideMenu.jsx 100.00% <100.00%> (ø)
...rsPage/MembersActivation/Activation/Activation.jsx 100.00% <100.00%> (ø)
...ation/Activation/ChangePlanLink/ChangePlanLink.jsx 100.00% <100.00%> (ø)
...anPage/subRoutes/CancelPlanPage/CancelPlanPage.tsx 100.00% <100.00%> (ø)
...CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.tsx 100.00% <100.00%> (ø)
...Plan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx 100.00% <ø> (ø)
...Plan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx 100.00% <100.00%> (ø)
...tPlanCard/shared/ActionsBilling/ActionsBilling.jsx 100.00% <100.00%> (ø)
...CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx 100.00% <100.00%> (ø)
... and 7 more

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (-0.01%) ⬇️
Services 99.36% <ø> (+0.03%) ⬆️
Shared 99.32% <100.00%> (-0.01%) ⬇️
UI 99.14% <ø> (ø)

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 617411d...e2e1e8d. Read the comment docs.

Copy link

codecov bot commented Dec 12, 2024

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
5637 2 5635 0
View the top 2 failed tests by shortest run time
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx > BillingOptions > when rendered > planString is set to annual plan > renders annual button as "selected"
Stack Traces | 0.199s run time
Error: expect(element).toHaveClass("bg-ds-primary-base")

Expected the element to have class:
  bg-ds-primary-base
Received:
  flex-1 py-1 px-2 text-sm cursor-pointer whitespace-nowrap disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary rounded-l
 ❯ .../TeamPlanController/BillingOptions/BillingOptions.test.tsx:128:27
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx > UpgradeForm > when rendered > when the user has a basic plan > renders the organization and owner titles
Stack Traces | 1.25s run time
TestingLibraryElementError: Unable to find an element with the text: /Organization/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div />
</body>

Ignored nodes: comments, script, style
<body>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx:385:48

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Dec 12, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
6f63edf Thu, 12 Dec 2024 16:41:58 GMT Expired Expired
a1e195e Thu, 12 Dec 2024 16:53:03 GMT Expired Expired
f0fc3e8 Thu, 12 Dec 2024 17:04:32 GMT Expired Expired
e2e1e8d Thu, 12 Dec 2024 18:34:26 GMT Cloud Enterprise

@rohitvinnakota-codecov
Copy link
Contributor

@codecov-ai-reviewer review

Copy link
Contributor

@RulaKhaled RulaKhaled left a comment

Choose a reason for hiding this comment

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

lgtm!

@@ -161,6 +161,8 @@ describe('AccountSettings', () => {
plan: {
...mockPlanData,
value: planValue,
isEnterprisePlan:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could just do planValue === Plans.USERS_ENTERPRISEM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great point

@ajay-sentry ajay-sentry added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit c05416a Dec 12, 2024
55 of 62 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/migrate-is-enterprise-plan branch December 12, 2024 18:47
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.

Migrate isEnterprisePlan to use GQL field directly
4 participants