Skip to content

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

Merged

Conversation

bryanburgers
Copy link
Contributor

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

@@ -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';
Copy link
Contributor

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?

Copy link
Contributor Author

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!

@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch from 8da72e5 to 2ac226b Compare March 1, 2019 13:31
@bryanburgers
Copy link
Contributor Author

bryanburgers commented Mar 1, 2019

Note: CI failures are because it's after 2019-02-28 and #1630 hasn't landed yet.


Edit: Rebased after that PR landed.

@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch from 2ac226b to 08ebb4b Compare March 2, 2019 13:38
@bors
Copy link
Contributor

bors commented Mar 20, 2019

☔ The latest upstream changes (presumably #1668) made this pull request unmergeable. Please resolve the merge conflicts.

@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch 2 times, most recently from 0e01147 to bcb4590 Compare April 5, 2019 19:34
@bors
Copy link
Contributor

bors commented Apr 24, 2019

☔ The latest upstream changes (presumably #1560) made this pull request unmergeable. Please resolve the merge conflicts.

@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch from bcb4590 to 4be4d4d Compare May 13, 2019 13:29
@sgrif
Copy link
Contributor

sgrif commented May 22, 2019

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+

@bryanburgers
Copy link
Contributor Author

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?

@sgrif
Copy link
Contributor

sgrif commented May 22, 2019

Ah you're right, I missed that this only affects the user page by default

@sgrif
Copy link
Contributor

sgrif commented May 22, 2019

@bors r+

@sgrif
Copy link
Contributor

sgrif commented May 22, 2019

Looks like GH is having an outage that's breaking bors right now

@bors
Copy link
Contributor

bors commented May 22, 2019

📌 Commit 4be4d4d has been approved by sgrif

1 similar comment
@bors
Copy link
Contributor

bors commented May 22, 2019

📌 Commit 4be4d4d has been approved by sgrif

@bors
Copy link
Contributor

bors commented May 22, 2019

⌛ Testing commit 4be4d4d with merge 3bf715c...

bors added a commit that referenced this pull request May 22, 2019
…-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
@bors
Copy link
Contributor

bors commented May 22, 2019

⌛ Testing commit 4be4d4d with merge fc2c933...

bors added a commit that referenced this pull request May 22, 2019
…-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
@bors
Copy link
Contributor

bors commented May 22, 2019

💔 Test failed - checks-travis

@sgrif
Copy link
Contributor

sgrif commented May 22, 2019

Looks like beta broke the build, I'll fix it shortly

@sgrif
Copy link
Contributor

sgrif commented Jun 13, 2019

@bors retry

@bors
Copy link
Contributor

bors commented Jun 13, 2019

⌛ Testing commit 4be4d4d with merge dee30cb...

bors added a commit that referenced this pull request Jun 13, 2019
…-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
@bors
Copy link
Contributor

bors commented Jun 13, 2019

💔 Test failed - checks-travis

@bryanburgers
Copy link
Contributor Author

Boo! I cab look into the failure in a week or two.

@sgrif
Copy link
Contributor

sgrif commented Jun 13, 2019

I think you might just need to rebase

@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch from 4be4d4d to be0a1e7 Compare June 20, 2019 20:34
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.
@bryanburgers bryanburgers force-pushed the exclude-yanked-crates-on-user-team-pages branch from be0a1e7 to 7b4e10e Compare June 20, 2019 20:59
@bryanburgers
Copy link
Contributor Author

@sgrif Rebased and fixed.

@sgrif
Copy link
Contributor

sgrif commented Jun 20, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 20, 2019

📌 Commit 7b4e10e has been approved by sgrif

bors added a commit that referenced this pull request Jun 20, 2019
…-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
@bors
Copy link
Contributor

bors commented Jun 20, 2019

⌛ Testing commit 7b4e10e with merge 60019d9...

@bors
Copy link
Contributor

bors commented Jun 20, 2019

☀️ Test successful - checks-travis
Approved by: sgrif
Pushing 60019d9 to master...

@bors bors merged commit 7b4e10e into rust-lang:master Jun 20, 2019
@bryanburgers bryanburgers deleted the exclude-yanked-crates-on-user-team-pages branch June 21, 2019 11:38
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.

Yanked crates shouldn't be displayed on user/team pages
4 participants