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] Enable pagination for AI enabled repos #1101

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

rohitvinnakota-codecov
Copy link
Contributor

@rohitvinnakota-codecov rohitvinnakota-codecov commented Jan 15, 2025

Updates the current repositories resolver that supports pagination for Codecov AI enabled repos. The UI will be updated to use this updated resolver(and support pagination), after which we can safely delete the old non-paginated resolver.

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.

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.05%. Comparing base (ade58e2) to head (82bbbc9).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
graphql_api/actions/repository.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1101      +/-   ##
==========================================
- Coverage   96.06%   96.05%   -0.01%     
==========================================
  Files         836      836              
  Lines       19733    19751      +18     
==========================================
+ Hits        18956    18972      +16     
- Misses        777      779       +2     
Flag Coverage Δ
unit 95.91% <90.90%> (-0.01%) ⬇️

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
Contributor

✅ All tests successful. No failed tests were found.

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

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 15, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
872 2 870 1
View the top 2 failed test(s) by shortest run time
graphql_api/tests/test_owner.py::TestOwnerType::test_fetch_available_plans_is_enterprise_plan
Stack Traces | 0.407s run time
self = <graphql_api.tests.test_owner.TestOwnerType testMethod=test_fetch_available_plans_is_enterprise_plan>

    def test_fetch_available_plans_is_enterprise_plan(self):
        current_org = OwnerFactory(
            username="random-plan-user",
            service="github",
            plan=DEFAULT_FREE_PLAN,
        )
    
        query = """{
            owner(username: "%s") {
                availablePlans {
                    value
                    isEnterprisePlan
                    isProPlan
                    isTeamPlan
                    isSentryPlan
                    isFreePlan
                    isTrialPlan
                }
            }
        }
        """ % (current_org.username)
        data = self.gql_request(query, owner=current_org)
>       assert data == {
            "owner": {
                "availablePlans": [
                    {
                        "value": "users-pr-inappm",
                        "isEnterprisePlan": False,
                        "isProPlan": True,
                        "isTeamPlan": False,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-pr-inappy",
                        "isEnterprisePlan": False,
                        "isProPlan": True,
                        "isTeamPlan": False,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-teamm",
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-teamy",
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": DEFAULT_FREE_PLAN,
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": True,
                        "isTrialPlan": False,
                    },
                ]
            }
        }
E       AssertionError: assert {'owner': {'a...False, ...}]}} == {'owner': {'a...False, ...}]}}
E         
E         Differing items:
E         {'owner': {'availablePlans': [{'isEnterprisePlan': False, 'isFreePlan': True, 'isProPlan': False, 'isSentryPlan': Fals...Plan': False, ...}, {'isEnterprisePlan': False, 'isFreePlan': False, 'isProPlan': False, 'isSentryPlan': False, ...}]}} != {'owner': {'availablePlans': [{'isEnterprisePlan': False, 'isFreePlan': False, 'isProPlan': True, 'isSentryPlan': Fals...yPlan': False, ...}, {'isEnterprisePlan': False, 'isFreePlan': True, 'isProPlan': False, 'isSentryPlan': False, ...}]}}
E         Use -v to get more diff

graphql_api/tests/test_owner.py:1145: AssertionError
graphql_api/tests/test_owner.py::TestOwnerType::test_owner_available_plans
Stack Traces | 0.503s run time
self = <graphql_api.tests.test_owner.TestOwnerType testMethod=test_owner_available_plans>

    @freeze_time("2023-06-19")
    def test_owner_available_plans(self):
        current_org = OwnerFactory(
            username="random-plan-user-123",
            service="github",
            plan=PlanName.CODECOV_PRO_MONTHLY.value,
            pretrial_users_count=123,
        )
        query = """{
            owner(username: "%s") {
                availablePlans {
                    value
                }
            }
        }
        """ % (current_org.username)
        data = self.gql_request(query, owner=current_org)
>       assert data["owner"]["availablePlans"] == [
            {"value": "users-pr-inappm"},
            {"value": "users-pr-inappy"},
            {"value": "users-teamm"},
            {"value": "users-teamy"},
            {"value": DEFAULT_FREE_PLAN},
        ]
E       AssertionError: assert [{'value': 'u...s-pr-inappy'}] == [{'value': 'u...s-developer'}]
E         
E         At index 0 diff: {'value': 'users-teamm'} != {'value': 'users-pr-inappm'}
E         Use -v to get more diff

graphql_api/tests/test_owner.py:688: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

Copy link
Contributor

On it! We are reviewing the PR and will provide feedback shortly.

@codecov codecov deleted a comment from sentry-autofix bot Jan 30, 2025
@codecov codecov deleted a comment from sentry-autofix bot Jan 30, 2025
@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

Copy link
Contributor

On it! We are reviewing the PR and will provide feedback shortly.

@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

Copy link
Contributor

sentry-autofix bot commented Feb 3, 2025

On it! We are reviewing the PR and will provide feedback shortly.

Copy link
Contributor

sentry-autofix bot commented Feb 3, 2025

No changes requiring review at this time.

1 similar comment
Copy link
Contributor

sentry-autofix bot commented Feb 3, 2025

No changes requiring review at this time.

@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

@codecov codecov deleted a comment from sentry-autofix bot Feb 3, 2025
@codecov codecov deleted a comment from sentry-autofix bot Feb 3, 2025
Copy link
Contributor

sentry-autofix bot commented Feb 3, 2025

Sentry has generated a new PR with unit tests for this PR. View the new PR(#1126) to review the changes.

@sentry-autofix sentry-autofix bot mentioned this pull request Feb 3, 2025
@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

@codecov codecov deleted a comment from sentry-autofix bot Feb 3, 2025
Copy link
Contributor

sentry-autofix bot commented Feb 3, 2025

No changes requiring review at this time.

@rohitvinnakota-codecov
Copy link
Contributor Author

@codecov-ai-reviewer review2

Copy link

codecov-ai bot commented Feb 4, 2025

On it! We are reviewing the PR and will provide feedback shortly.

Copy link

codecov-ai bot commented Feb 13, 2025

No changes requiring review at this time.

@rohitvinnakota-codecov rohitvinnakota-codecov marked this pull request as ready for review February 18, 2025 18:16
@rohitvinnakota-codecov rohitvinnakota-codecov requested a review from a team as a code owner February 18, 2025 18:16
Copy link

codecov-public-qa bot commented Feb 18, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
872 2 870 1
View the top 2 failed tests by shortest run time
graphql_api/tests/test_owner.py::TestOwnerType::test_fetch_available_plans_is_enterprise_plan
Stack Traces | 0.407s run time
self = <graphql_api.tests.test_owner.TestOwnerType testMethod=test_fetch_available_plans_is_enterprise_plan>

    def test_fetch_available_plans_is_enterprise_plan(self):
        current_org = OwnerFactory(
            username="random-plan-user",
            service="github",
            plan=DEFAULT_FREE_PLAN,
        )
    
        query = """{
            owner(username: "%s") {
                availablePlans {
                    value
                    isEnterprisePlan
                    isProPlan
                    isTeamPlan
                    isSentryPlan
                    isFreePlan
                    isTrialPlan
                }
            }
        }
        """ % (current_org.username)
        data = self.gql_request(query, owner=current_org)
>       assert data == {
            "owner": {
                "availablePlans": [
                    {
                        "value": "users-pr-inappm",
                        "isEnterprisePlan": False,
                        "isProPlan": True,
                        "isTeamPlan": False,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-pr-inappy",
                        "isEnterprisePlan": False,
                        "isProPlan": True,
                        "isTeamPlan": False,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-teamm",
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": "users-teamy",
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": False,
                        "isTrialPlan": False,
                    },
                    {
                        "value": DEFAULT_FREE_PLAN,
                        "isEnterprisePlan": False,
                        "isProPlan": False,
                        "isTeamPlan": True,
                        "isSentryPlan": False,
                        "isFreePlan": True,
                        "isTrialPlan": False,
                    },
                ]
            }
        }
E       AssertionError: assert {'owner': {'a...False, ...}]}} == {'owner': {'a...False, ...}]}}
E         
E         Differing items:
E         {'owner': {'availablePlans': [{'isEnterprisePlan': False, 'isFreePlan': True, 'isProPlan': False, 'isSentryPlan': Fals...Plan': False, ...}, {'isEnterprisePlan': False, 'isFreePlan': False, 'isProPlan': False, 'isSentryPlan': False, ...}]}} != {'owner': {'availablePlans': [{'isEnterprisePlan': False, 'isFreePlan': False, 'isProPlan': True, 'isSentryPlan': Fals...yPlan': False, ...}, {'isEnterprisePlan': False, 'isFreePlan': True, 'isProPlan': False, 'isSentryPlan': False, ...}]}}
E         Use -v to get more diff

graphql_api/tests/test_owner.py:1145: AssertionError
graphql_api/tests/test_owner.py::TestOwnerType::test_owner_available_plans
Stack Traces | 0.503s run time
self = <graphql_api.tests.test_owner.TestOwnerType testMethod=test_owner_available_plans>

    @freeze_time("2023-06-19")
    def test_owner_available_plans(self):
        current_org = OwnerFactory(
            username="random-plan-user-123",
            service="github",
            plan=PlanName.CODECOV_PRO_MONTHLY.value,
            pretrial_users_count=123,
        )
        query = """{
            owner(username: "%s") {
                availablePlans {
                    value
                }
            }
        }
        """ % (current_org.username)
        data = self.gql_request(query, owner=current_org)
>       assert data["owner"]["availablePlans"] == [
            {"value": "users-pr-inappm"},
            {"value": "users-pr-inappy"},
            {"value": "users-teamm"},
            {"value": "users-teamy"},
            {"value": DEFAULT_FREE_PLAN},
        ]
E       AssertionError: assert [{'value': 'u...s-pr-inappy'}] == [{'value': 'u...s-developer'}]
E         
E         At index 0 diff: {'value': 'users-teamm'} != {'value': 'users-pr-inappm'}
E         Use -v to get more diff

graphql_api/tests/test_owner.py:688: AssertionError

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

@rohitvinnakota-codecov rohitvinnakota-codecov force-pushed the rvinnakota/update-ai-repo branch 2 times, most recently from de9135a to 051b12d Compare February 20, 2025 16:05
Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

lgtm thanks for fixing those weird tests

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.

2 participants