-
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
[feat] Enable pagination for AI enabled repos #1101
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❌ We are unable to process any of the uploaded JUnit XML files. Please ensure your files are in the right format.
Additional details and impacted files@@ Coverage Diff @@
## main #1101 +/- ##
==========================================
- Coverage 96.09% 96.05% -0.04%
==========================================
Files 829 829
Lines 19384 19394 +10
==========================================
+ Hits 18627 18629 +2
- Misses 757 765 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
@codecov-ai-reviewer review2 |
On it! We are reviewing the PR and will provide feedback shortly. |
@codecov-ai-reviewer review2 |
On it! We are reviewing the PR and will provide feedback shortly. |
|
||
@patch("services.self_hosted.get_config") | ||
def test_ai_enabled_repositories(self, get_config_mock): | ||
current_org = OwnerFactory( | ||
username="random-plan-user", | ||
service="github", | ||
) | ||
|
||
get_config_mock.return_value = [ | ||
{"service": "github", "ai_features_app_id": 12345}, | ||
] | ||
|
||
query = """{ | ||
owner(username: "%s") { | ||
aiEnabledRepos | ||
} | ||
} | ||
|
||
""" % (current_org.username) | ||
data = self.gql_request(query, owner=current_org) | ||
assert data["owner"]["aiEnabledRepos"] is None | ||
|
||
|
||
@patch("services.self_hosted.get_config") | ||
def test_ai_enabled_repositories_app_not_configured(self, get_config_mock): | ||
current_org = OwnerFactory( | ||
username="random-plan-user", | ||
service="github", | ||
) | ||
|
||
get_config_mock.return_value = [ | ||
{"service": "github", "ai_features_app_id": 12345}, | ||
] | ||
|
||
query = """{ | ||
owner(username: "%s") { | ||
aiEnabledRepos | ||
} | ||
} | ||
|
||
""" % (current_org.username) | ||
data = self.gql_request(query, owner=current_org) | ||
assert data["owner"]["aiEnabledRepos"] is 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.
The new test cases for aiEnabledRepos
are well-structured and cover different scenarios. However, it would be beneficial to add a test case for when the ai_features_app_id
is not present in the config. This will ensure that the feature behaves correctly when AI features are not configured.
|
||
@patch("services.self_hosted.get_config") | ||
def test_ai_enabled_repositories(self, get_config_mock): | ||
current_org = OwnerFactory( | ||
username="random-plan-user", | ||
service="github", | ||
) | ||
|
||
get_config_mock.return_value = [ | ||
{"service": "github", "ai_features_app_id": 12345}, | ||
] | ||
|
||
query = """{ | ||
owner(username: "%s") { | ||
aiEnabledRepos | ||
} | ||
} | ||
|
||
""" % (current_org.username) | ||
data = self.gql_request(query, owner=current_org) | ||
assert data["owner"]["aiEnabledRepos"] is None | ||
|
||
|
||
@patch("services.self_hosted.get_config") | ||
def test_ai_enabled_repositories_app_not_configured(self, get_config_mock): | ||
current_org = OwnerFactory( | ||
username="random-plan-user", | ||
service="github", | ||
) | ||
|
||
get_config_mock.return_value = [ | ||
{"service": "github", "ai_features_app_id": 12345}, | ||
] | ||
|
||
query = """{ | ||
owner(username: "%s") { | ||
aiEnabledRepos | ||
} | ||
} | ||
|
||
""" % (current_org.username) | ||
data = self.gql_request(query, owner=current_org) | ||
assert data["owner"]["aiEnabledRepos"] is 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.
Consider adding assertions to check the type of the returned value. For example, assert that data['owner']['aiEnabledRepos']
is a list when it's not None.
aiEnabledRepositories( | ||
ordering: RepositoryOrdering | ||
orderingDirection: OrderingDirection | ||
first: Int | ||
after: String | ||
last: Int | ||
before: String | ||
): RepositoryConnection! @cost(complexity: 25, multipliers: ["first", "last"]) | ||
uploadTokenRequired: Boolean | ||
activatedUserCount: Int | ||
} |
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 new aiEnabledRepositories
field is well-defined with appropriate parameters. However, consider adding a description for this field to provide more context about its purpose and usage.
aiEnabledRepositories( | |
ordering: RepositoryOrdering | |
orderingDirection: OrderingDirection | |
first: Int | |
after: String | |
last: Int | |
before: String | |
): RepositoryConnection! @cost(complexity: 25, multipliers: ["first", "last"]) | |
uploadTokenRequired: Boolean | |
activatedUserCount: Int | |
} | |
aiEnabledRepositories( | |
ordering: RepositoryOrdering | |
orderingDirection: OrderingDirection | |
first: Int | |
after: String | |
last: Int | |
before: String | |
): RepositoryConnection! @cost(complexity: 25, multipliers: ["first", "last"]) @description("Returns a connection of repositories with AI features enabled for this owner.") |
Purpose/Motivation
What is the feature? Why is this being done?
Links to relevant tickets
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.