Skip to content

Conversation

@carols10cents
Copy link
Member

Don't show the link if there aren't any docs.rs builds as clicking on the link won't work then, but do still show the source link even if a non-docs.rs documentation link has been specified to enable review of the source exactly as crates.io serves it.


get docsRsSourceLink() {
if (this.hasDocsRsLink) {
return `https://docs.rs/crate/${this.crateName}/${this.num}/source/`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can show the link more often.

from what I see, hasDocsRsLink is based on our status-json result (doc_status in there).

But we also have & host the source when:

  • it's a binary crate, or
  • the if the doc-build failed
  • when the build is in progress

The only edge cases here would be when the build is queued, or we didn't get the update from the registry yet.

I think you're good in just checking if you have a result from our status endpoint, no matter what you see in doc_status

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also rust-lang/docs.rs#2762 where we would try to serve a nice page even for just queued releases

@Turbo87 Turbo87 added the C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works label Dec 19, 2025
@carols10cents carols10cents moved this to For next meeting in crates.io team meetings Dec 19, 2025
@carols10cents carols10cents force-pushed the source-link branch 2 times, most recently from c583304 to bf6d458 Compare December 23, 2025 16:41
Don't show the link if there aren't any docs.rs builds as clicking on
the link won't work then, but do still show the source link even if a
non-docs.rs documentation link has been specified to enable review of
the source exactly as crates.io serves it.
@carols10cents
Copy link
Member Author

@Turbo87 i quit. I can't figure out why the remaining one qunit and one e2e tests are failing; i added the mock docs.rs requests exactly like in the other tests that are passing, but the source link isn't showing up and I don't understand why.

The source link is showing up in some of the percy screenshots as expected, but it also looks like the main baseline in percy has some 404 pages saved?

I also can't get the frontend working locally proxying to the live crates.io; when I run the frontend everything looks fine:

❯ pnpm start:live

> [email protected] start:live /Users/carolnichols/rust/crates.io
> ember serve --proxy https://crates.io

WARNING: ember-cli-typescript requires ember-cli-babel ^7.17.0, but you have version 8.2.0 installed; your TypeScript files may not be transpiled correctly.
The setting 'staticEmberSource' will default to true in the next version of Embroider and can't be turned off. To prepare for this you should set 'staticEmberSource: true' in your Embroider config.
Proxying to https://crates.io

Build successful (8867ms) – Serving on http://localhost:4200/

Slowest Nodes (totalTime >= 5%)                                     | Total (avg)
--------------------------------------------------------------------+-----------------
@embroider/webpack (1)                                              | 8124ms

but when i visit localhost:4200/crates/rand for example, it shows the "Failed to load crate data" generic javascript error message (in both firefox and chrome).

In firefox, there aren't any errors showing up in the web development tools console, but if i open tools -> browser tools -> browser console, i see:

13:15:05.957 Unable to find target with innerWindowId:1726576852995 watcher.js:196:13
    getWindowGlobalTargetByInnerWindowId resource://devtools/client/fronts/watcher.js:196
    _getTargetForWatcherResource resource://devtools/shared/commands/resource/resource-command.js:984
    _onResourceUpdated resource://devtools/shared/commands/resource/resource-command.js:843
    _onResourceUpdatedArray resource://devtools/shared/commands/resource/resource-command.js:767
    _emit resource://devtools/shared/event-emitter.js:215
    emit resource://devtools/shared/event-emitter.js:152
    onPacket resource://devtools/shared/protocol/Front.js:370
    onPacket resource://devtools/client/devtools-client.js:511
    send resource://devtools/shared/transport/local-transport.js:73
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103

and in chrome i don't see any console errors:

Screenshot 2025-12-23 at 1 19 04 PM

if I make this change in app/routes/crate.js:

    } catch (error) {
      if (error instanceof NotFoundError) {
        let title = `Crate "${crateName}" not found`;
        this.router.replaceWith('catch-all', { transition, error, title });
      } else {
        console.log(error);
        let title = `Failed to load crate data`;
        this.router.replaceWith('catch-all', { transition, error, title, tryAgain: true });
      }
    }

THEN i see:

13:21:07.998 Error: Could not find module `@ember-data/private-build-infra/src/addon-build-config-for-data-package` imported from `(require)`
    missingModule loader.js:247
    findModule loader.js:258
    requireModule loader.js:24
    Ember 2
    __webpack_require__ chunk.1af291960aa7c517d83b.js:37
    <anonymous> crate.js:10
    js chunk.a49f0f1516ee6450233a.js:11357
    __webpack_require__ chunk.1af291960aa7c517d83b.js:37
    <anonymous> crates-io.js:68
    exports loader.js:106
    requireModule loader.js:27
    get Ember
crate.js:52:17

which... wtf????? what am i doing wrong?????????

@carols10cents
Copy link
Member Author

oh ffs nevermind... i did the good old "blow away node_modules" and now i can load a local page proxying to crates.io.

@carols10cents
Copy link
Member Author

ok yeah even with getting this running locally i still dont understand why this code isn't working.

if i go to a crate like rand that doesn't have crate.documentation set, this code works fine.

if i go to a crate like ripgrep that does have crate.documentation set, this.loadDocsStatusTask is just... undefined and i have no idea why 😢

@Turbo87
Copy link
Member

Turbo87 commented Dec 23, 2025

I'll take a look once I'm back at a computer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works

Projects

Status: For next meeting

Development

Successfully merging this pull request may close these issues.

4 participants