-
Notifications
You must be signed in to change notification settings - Fork 601
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
docs.rs link is missing from search results #1484
Comments
I think this is a general bug (not just for crates that are missing a
(I'm not sure if any of these other fields show up on the results page. This may be the only missing field that is observable.) The search results code constructs the crate data by using the minimal_encodable function, and this defaults those fields to null in the JSON response. Once you click through to the full page for the crate, then a full response is received and cached for the crate. This is why the link shows up after navigating back to the results. |
When we added auto-linking to docs.rs in this PR, we discussed adding this to the search results page as well. However, we make a request to docs.rs to see if the docs were built successfully before adding the link to the page. We concluded that making a large number of requests to docs.rs wouldn't be a great user experience. Some other thoughts:
|
Hey, not to be a bother but I just wanted to mention that now that the auto linking to docs.rs has existed for a while, it has become very common for libraries to no longer include their own documentation key in Cargo.toml. This means it increasingly seems like most libraries don't have links to documentation on the search index. Sucks that this is such a big change, but if someone were looking for something to hack on in crates.io it would be very appreciated! |
I would be ok with adding an API for fetching many crates at once. I do think we should tailor the API for this use case a bit and only show the status, not the crate details, to make it cheaper. (Right now we show a bunch of metadata about the versions: https://docs.rs/crate/tokio/1.0.0/builds.json) |
In our team meeting we discussed that on the search results page it probably makes sense to just link to the crate on docs.rs without providing a version. Then docs.rs would redirect to the latest rendered version available. This might open small windows of inconsistency, such that if a new version was just published then the search results might show version |
@jtgeibel what if the build for the crate failed? Then crates.io will link to the docs, but they won't be there. This will also mean you get newer versions that the one currently published, which could be very confusing if they're different major versions. |
Oh wait, I guess crates.io search only shows the latest version. Never mind then. |
Perhaps docs.rs can provide a hook by which crates.io gets notified whenever a new doc build is completed? Then crates.io can update its metadata for that crate without having to make requests of docs.rs. |
Heh, docs.rs was actually hoping to get a hook from crates.io at some point: rust-lang/docs.rs#14. I guess it wouldn't hurt to have both. |
* Updates crate descriptions now that we have several crates. * Adjusts `repository` for the ancillary crates to deep link to their directory in the monorepo, rather than the repository root. This may help with tools like Dependabot, which parse these URLs to find out whether a dependency exists in a subdirectory or not. * Adds explicit `documentation` links since otherwise docs links are missing from search results, due to rust-lang/crates.io#1484. * Adds `keywords` for all user-facing crates (ie everything but the proc-macros crate, since that isn't really buildpacks/CNB specific).
* Updates crate descriptions now that we have several crates. * Adjusts `repository` for the ancillary crates to deep link to their directory in the monorepo, rather than the repository root. This may help with tools like Dependabot, which parse these URLs to find out whether a dependency exists in a subdirectory or not. * Adds explicit `documentation` links since otherwise docs links are missing from search results, due to rust-lang/crates.io#1484. * Adds `keywords` for all user-facing crates (ie everything but the proc-macros crate, since that isn't really buildpacks/CNB specific).
Related cargo issue: rust-lang/cargo#11777 I honestly thought that not setting I think adding the documentation link to the search results as-if it was set in the Cargo.toml would already be a good step forward, even without doing any kind of fancy status check. |
I agree with the idea of removing the check. I could see the publish process falling back to this when populating the database with a backfill (upto a specific date if docs.rs never had a backfill). Then the javascript could be removed. For cargo-info, we are taking the approach of always showing the link. |
For the gap between publish and built, some options
For build errors, docs.rs should post a page, saying it failed, linking to the error with a link to the previous successful build. |
I don't know if docs.rs ever had an actual backfill, but I'm currently working on some changes to docs.rs ( specifically rust-lang/docs.rs#1011, with some more things attached), which will enable us running the consistency check, which will take care of adding all missing releases.
This will be made possible after rust-lang/docs.rs#1011 is done, and I was planning something like this.
We're already doing this. So generally the question will be, just for search results, if you rather link to And, even when we show in-progress builds on docs.rs, there would be a delay between the publish on crates.io, and docs.rs picking up the new release. |
I think it should link to the version number that is shown in the search results. Then if that version is still building docs.rs can show a message saying "this is still in the queue" and offer a link to an earlier version that has already been built. |
rust-lang/cargo#13660 has now been closed because the cargo teams considers this to be a bug in crates.io. So the status quo is: we have docs saying
but these docs do not match reality: no such link appears in the search results. These docs make it sound like it's fine for crate authors to not set any docs URL, it won't make a difference if they have their docs on docs.rs -- but actually that's wrong. So clearly there is a bug somewhere, when we have docs that directly contradict reality. And yet, this issue is marked as "enhancement", not as "bug". Could we get some clarification from @rust-lang/crates-io on this? |
remove reference to incomplete crates.io feature from docs The cargo docs for the `documentation` field currently are written in a way that makes it sound like if I want to use docs.rs, I can just leave the field empty. However, that is not the case: leaving the field empty will never show a "Documentation" link in the search results, so there's always an unnecessary extra click to go from "type crate name into search" to reaching the docs. This crates.io limitation is tracked at rust-lang/crates.io#1484. It doesn't really matter whether this is a bug or a missing feature, the point is that cargo docs are misrepresenting what crates.io does in a way that leads to a suboptimal user experience (many crates without "Documentation" link in crates.io search results). Since the suggestion to document what crates.io actually does was rejected (#13660), I suggest we instead stop mentioning this feature at all -- that's still clearly better than mentioning it while it is not yet fully implemented / while it has some significant *undocumented* limitation.
The docs here are also bad advice right now due to this behavior. |
It feels to me like the right behaviour would be for the search results to implement the same fallback logic as the crate version page — basically, if there's no |
The crate version page uses a fallback to handle crates that don't define `documentation` keys in their manifests: if docs.rs has documentation for that crate version, that those docs are used. The search results do not implement the same logic, so crates that don't have `documentation` keys don't get the handy documentation link in the crate row. This copies the logic from the version model into the crate model, using the default crate version as the version to look for on docs.rs. I strongly suspect there is a better way to do this than copying a bunch of code, and would welcome suggestions from those more familiar with Ember. This would eventually fix rust-lang#1484.
@LawnGnome see #1484 (comment) rust-lang/docs.rs#2533 being implemented and crates.io always showing docs.rs links would be the ideal solution. The question is whether we need to block on rust-lang/docs.rs#2533 (and have broken links) or not. |
FWIW the reason why we've not implemented the same fallback for the search results is to avoid the resulting N+1 queries. we'd basically be sending 10 requests to docs.rs for every search result page, which I don't think makes a lot of sense. we could potentially redirect the requests through our own server and cache the results there, but that certainly needs a bit of design work. |
while this would improve the difference between versions on crates.io and on docs.rs, there are still some minutes of delay between between the release itself, and the build being started. Also the mentioned PR won't change behavior (yet) for queued builds, which you also would need to provide a stable URL for a certain version. A simpler approach could be to:
|
I would need to think it through, but we also could activate caching in the CDN for these requests, and then I even assume that the load isn't that big of an issue. edit: thinking about this, you're probably right that this it's a risk to do these N+1 queries. we could just provide an API that can fetch statuses for a list of releases (then we would have an N+1 in docs.rs on the db). |
For crates without a
documentation
key in theirCargo.toml
,crates.io
is supposed to generate aDocumentation
link todocs.rs
. However, thisDocumentation
link is sometimes missing on search results.Steps to reproduce:
chromium --user-data-dir="$(mktemp -d)"
on Arch Linux.)Documentation
link for thendarray-npy
crate. (It should be there, but it is missing. That's what this issue is about.)ndarray-npy
crate link (URL: https://crates.io/crates/ndarray-npy).Documentation
link has now appeared.I'm observing this behavior for crates that do not include a
documentation
key in theirCargo.toml
. Currently, examples of this include thendarray-npy
,py_literal
,aho-corasick
,unreachable
, andvoid
crates, among many others.The text was updated successfully, but these errors were encountered: