-
Notifications
You must be signed in to change notification settings - Fork 643
Exclude yanked crates on user/team pages #1642
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
Exclude yanked crates on user/team pages #1642
Conversation
@@ -15,6 +15,7 @@ export default Route.extend({ | |||
return this.store.queryRecord('user', { user_id }).then( | |||
user => { | |||
params.user_id = user.get('id'); | |||
params.include_yanked = 'n'; |
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.
Should we just make this the default and not specify it in the URL 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.
Here was my thinking. If it's not the direction we want to go, I can make changes.
There are situations where we want to show yanked crates: #958 (comment), #145 (comment).
Given the following two URLs:
/api/v1/crates?search=foo
/api/v1/crates?user_id=2576
One option would be to add conditional logic to the controller like "if user_id
is set, then don't show yanked crates; if search
is set, then show yanked crates".
I shied away from that option because I think it would be confusing. A contributor focused on the front end would have to keep in their head which rules apply to which parameters.
Given the following two URLs:
/api/v1/crates?search=foo&include_yanked=yes
/api/v1/crates?user_id=2576&include_yanked=no
It's much less surprising what will be returned from these endpoints.
However, I'm not sure we want to audit and edit every location where the front end calls the /api/v1/crates
endpoint – and we can't audit third-party crawlers. Beacuse /api/v1/crates
has historically defaulted to showing yanked crates, I opted to only add &include_yanked=no
to the specific front end code where we don't want to show yanked crates.
/api/v1/crates?search=foo
/api/v1/crates?user_id=2576&include_yanked=no
This makes the URLs for the API endpoint a little bit more ugly for these pages. However, this largely only shows up in developer tools. This change doesn't add a query parameter to the URL for a user/team page, e.g. a user page continues to be /users/sgrif
, not ./users/sgrif?include_yanked=no
Am I making any sense? Hopefully I didn't answer a question you weren't asking!
8da72e5
to
2ac226b
Compare
Note: CI failures are because it's after 2019-02-28 and #1630 hasn't landed yet. Edit: Rebased after that PR landed. |
2ac226b
to
08ebb4b
Compare
☔ The latest upstream changes (presumably #1668) made this pull request unmergeable. Please resolve the merge conflicts. |
0e01147
to
bcb4590
Compare
☔ The latest upstream changes (presumably #1560) made this pull request unmergeable. Please resolve the merge conflicts. |
bcb4590
to
4be4d4d
Compare
Just noting for the future -- this causes a roughly 30% performance regression on search, which brings us up to 265ms in the worst case (search for 's' ordered by relevance). I don't think it needs to be addressed in this PR, but I think we're pushing the limits on what's acceptable performance-wise. We probably want to start thinking about introducing a materialized view that includes this yanked calculation and has already done the join on recent_crate_downloads, which can bring us to 160ms in the worst case -- or we may just want to stop doing the like check on single letter searches, since this will only continue to deteriorate in the future. @bors: r+ |
Yikes. 30% is bad. I'm concerned about that. But we only pay that 30% when it's used, right? And right now, it won't get used on the search page? |
Ah you're right, I missed that this only affects the user page by default |
@bors r+ |
Looks like GH is having an outage that's breaking bors right now |
📌 Commit 4be4d4d has been approved by |
1 similar comment
📌 Commit 4be4d4d has been approved by |
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
💔 Test failed - checks-travis |
Looks like beta broke the build, I'll fix it shortly |
@bors retry |
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
💔 Test failed - checks-travis |
Boo! I cab look into the failure in a week or two. |
I think you might just need to rebase |
4be4d4d
to
be0a1e7
Compare
Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI, and is especially intended for the user and team pages to display only non-yanked crates.
Don't display crates that have been fully yanked - i.e., crates that where every version has been yanked - on user and team pages.
be0a1e7
to
7b4e10e
Compare
@sgrif Rebased and fixed. |
@bors: r+ |
📌 Commit 7b4e10e has been approved by |
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
☀️ Test successful - checks-travis |
Add a URL parameter to the
/api/v1/crates
endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked.If not specified, this defaults to
true
because we have typically always returned all matching crates, whether or not their versions have been yanked.This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code.
Use this from the user and team pages to exclude yanked crates from them.
Closes #958