-
Notifications
You must be signed in to change notification settings - Fork 30
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: Add tokenless mutation and field in owner #826
Conversation
@@ -37,4 +37,5 @@ type Owner { | |||
): RepositoryConnection! @cost(complexity: 25, multipliers: ["first", "last"]) | |||
username: String | |||
yaml: String | |||
tokensRequierd: Boolean |
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.
Typo
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.
Also, when would this field be set to Null instead of true/false?
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.
yep, when user is not part of the org (decorator rules)
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.
Fixed 👍
|
||
self.validate(owner_obj) | ||
|
||
owner_obj.tokens_required = typed_input.tokens_required |
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.
Thoughts on this being token_required? And even to be more explicit, upload_token
required?
We use the github/providers token for other things, so differentiating this as the "codecov_token" or "upload_token" would make more sense. I also don't know if this exclusively a coverage token or if it also applies to bundle_analysis/test_results, so I'd confirm what's the expected behavior, and if it is exclusively for coverage (and we don't intend to do it for BA/TR), then I'd call it coverage_token
or upload_coverage_token
or something like that
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.
This is just a draft PR not the final code, just put tokens_required
as it's the suggested name by Trent for Nora, so i will change the name according to what it's called in the DB to avoid any confusion
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.
Sounds good! 👌
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.
changed to upload_token_required!
a029513
to
252707b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #826 +/- ##
==========================================
+ Coverage 96.33% 96.34% +0.01%
==========================================
Files 820 823 +3
Lines 19102 19157 +55
==========================================
+ Hits 18402 18457 +55
Misses 700 700
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
if not current_user_part_of_org(self.current_owner, owner_obj): | ||
raise Unauthorized() | ||
if not owner_obj.is_admin(self.current_owner): | ||
raise Unauthorized("Admin authorization required") |
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.
Can upload_token_required be null? If not maybe do some validation here too
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.
on it
self.owner_with_admins.refresh_from_db() | ||
assert self.owner_with_admins.upload_token_required_for_public_repos == True | ||
|
||
def test_set_upload_token_required_to_false(self): |
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.
I'd add a test here for the null case based on the above
} | ||
|
||
input SetUploadTokenRequiredInput { | ||
org_username: String! |
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.
Why is this snake and the below camel 👀 could we follow the camel convention pls?
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.
Great catch
@@ -39,4 +39,5 @@ type Owner { | |||
yaml: String | |||
aiFeaturesEnabled: Boolean! | |||
aiEnabledRepos: [String] | |||
uploadTokenRequired: Boolean |
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.
Is it intentional for this to be null? Seems the interactor only expects bool, and afaik we were going to backfill/default everyone to have false
weren't we? That's what I recall from Nora
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 decorator @require_part_of_org
should return null if user is not part of the org!
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 2569 tests with View the full list of failed testspytest
|
Purpose/Motivation
What is the feature? Why is this being done?
The user will set tokenless to either true or false. We need tokens_required to reflect the current status of tokenless within the organization, and we need a mutation to set tokenless to either required or not
this PR depends on:
Links to relevant tickets
[API] Expose new tokens_required field via graphql
[API] Add new require token mutation
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.