-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
Build trusted publisher filter #5237
base: master
Are you sure you want to change the base?
Build trusted publisher filter #5237
Conversation
e4377b6
to
831a27f
Compare
@@ -411,6 +411,10 @@ def gem_file_name | |||
"#{full_name}.gem" | |||
end | |||
|
|||
def pushed_by_trusted_publisher? | |||
pusher_api_key&.trusted_publisher? ? 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.
Doesn't trusted_publisher?
already return true/false? Is there any reason for explicit ? 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.
The safe navigator means a nil value can be returned if the version has no pusher_api_key
.
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.
Would pusher_api_key? && pusher_api_key.trusted_publisher?
work also?
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.
No, but pusher_api_key.present? && pusher_api_key.trusted_publisher?
would work. It is a matter of preference here.
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.
Or maybe pusher_api_key&.trusted_publisher? || false
. Yes, just a nitpick indeed.
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.
Am I the only one that prefers !!
to force boolean?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5237 +/- ##
==========================================
- Coverage 96.85% 94.19% -2.67%
==========================================
Files 456 456
Lines 9517 9578 +61
==========================================
- Hits 9218 9022 -196
- Misses 299 556 +257 ☔ View full report in Codecov by Sentry. |
Linked issue: #4807 |
CI seems unhappy about this test. rubygems.org/test/models/pusher_test.rb Lines 632 to 659 in 1143eba
|
@@ -25,7 +25,8 @@ module RubygemSearchable | |||
suggest: { type: "completion", contexts: { name: "yanked", type: "category" } }, | |||
yanked: { type: "boolean" }, | |||
downloads: { type: "long" }, | |||
updated: { type: "date" } | |||
updated: { type: "date" }, | |||
trusted_publisher: { type: "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.
Does this mapping change need full re-indexing?
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.
Good question. I would not think so, since there is no change to the database source schema, but I am not sure. It is my first time committing to this repo and I do not have full context, so I will wait for others to weigh in.
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.
Any new mappings do require a reindex, which is easy to do but needs some coordination when deployed.
831a27f
to
1e21932
Compare
@justinddaniel Thank you for contributing this! Pleasure working with you today. |
1e21932
to
8827009
Compare
8827009
to
ecb6a85
Compare
The coverage fail can be ignored. What's the harm in merging this without reindexing? Will it just ignore the option until we do? If that's all, can we merge and then run the reindexing at our convenience? |
No description provided.