Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@RulaKhaled
Copy link
Contributor

@RulaKhaled RulaKhaled commented Jan 31, 2025

Purpose/Motivation

What is the feature? Why is this being done?

We are replacing occurrences of the basic free plan with the new users-developer plan. As part of this change, we are defaulting users to the new plan if the basic plan is sent. This ensures the change takes effect immediately on Gazebo's side and will be removed once Gazebo is updated to use the new plan.

Additionally, I’ve included tests and removed the basic plan from mocks.

Links to relevant tickets

Closes Update Plan Service Logic to use new Free Plan in API

What does this PR do?

Include a brief description of the changes in this PR. Bullet points are your friend.

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.

@RulaKhaled RulaKhaled requested review from a team as code owners February 3, 2025 12:18
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2025

This PR includes changes to shared. Please review them here: codecov/shared@74c0888...b7bb750

@RulaKhaled RulaKhaled changed the title [WIP] default api to new free plan feat: default api to new free plan Feb 3, 2025
@RulaKhaled RulaKhaled changed the title feat: default api to new free plan feat: Default api to new free plan Feb 3, 2025
@codecov
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.71%. Comparing base (714ba37) to head (490be8b).
Report is 2 commits behind head on main.

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1118      +/-   ##
==========================================
- Coverage   96.06%   95.71%   -0.35%     
==========================================
  Files         837      750      -87     
  Lines       19756    14572    -5184     
==========================================
- Hits        18979    13948    -5031     
+ Misses        777      624     -153     
Flag Coverage Δ
unit ?
unit-latest-uploader ?

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.

@codecov-notifications
Copy link

codecov-notifications bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
api/internal/owner/views.py 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.96%. Comparing base (714ba37) to head (490be8b).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2025

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@codecov-public-qa
Copy link

codecov-public-qa bot commented Feb 3, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2733 1 2732 6
View the top 1 failed tests by shortest run time
api/internal/tests/views/test_account_viewset.py::AccountViewSetTests::test_update_team_plan_must_fail_if_too_many_activated_users_during_trial
Stack Traces | 0.038s run time
self = <test_account_viewset.AccountViewSetTests testMethod=test_update_team_plan_must_fail_if_too_many_activated_users_during_trial>

    def test_update_team_plan_must_fail_if_too_many_activated_users_during_trial(self):
        self.current_owner.plan = DEFAULT_FREE_PLAN
        self.current_owner.plan_user_count = 1
        self.current_owner.trial_status = TrialStatus.ONGOING.value
        self.current_owner.plan_activated_users = list(range(11))
        self.current_owner.save()
    
        desired_plans = [
            {"value": PlanName.TEAM_MONTHLY.value, "quantity": 10},
            {"value": PlanName.TEAM_YEARLY.value, "quantity": 10},
        ]
    
        for desired_plan in desired_plans:
            response = self._update(
                kwargs={
                    "service": self.current_owner.service,
                    "owner_username": self.current_owner.username,
                },
                data={"plan": desired_plan},
            )
    
            assert response.status_code == status.HTTP_400_BAD_REQUEST
>           assert response.json() == {
                "plan": {
                    "value": [
                        f"Invalid value for plan: {desired_plan['value']}; must be one of ['users-pr-inappm', '{DEFAULT_FREE_PLAN}', 'users-pr-inappy']"
                    ]
                }
            }
E           assert {'plan': {'va...r-inappm']"]}} == {'plan': {'va...r-inappy']"]}}
E             
E             Differing items:
E             {'plan': {'value': ["Invalid value for plan: users-teamm; must be one of ['users-pr-inappy', 'users-developer', 'users-pr-inappm']"]}} != {'plan': {'value': ["Invalid value for plan: users-teamm; must be one of ['users-pr-inappm', 'users-developer', 'users-pr-inappy']"]}}
E             Use -v to get more diff

.../tests/views/test_account_viewset.py:1008: AssertionError

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

free_plan = Plan.objects.select_related("tier").get(
name=PlanName.BASIC_PLAN_NAME.value
)
free_plan = Plan.objects.select_related("tier").get(name=DEFAULT_FREE_PLAN)
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: rename this to default_plan = ...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2025

This PR includes changes to shared. Please review them here: codecov/shared@c8dca74...b7bb750

@ajay-sentry ajay-sentry added this pull request to the merge queue Feb 4, 2025
Merged via the queue into main with commit dfb161f Feb 4, 2025
16 of 19 checks passed
@ajay-sentry ajay-sentry deleted the update-with-developer branch February 4, 2025 17:56
@sentry
Copy link

sentry bot commented Feb 5, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ GraphQLError: Plan matching query does not exist. /graphql/{service} View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Plan Service Logic to use new Free Plan in API

4 participants