Skip to content

Conversation

@syphar
Copy link
Member

@syphar syphar commented Jan 13, 2026

fixes a production edge case that would have lead to wrong cache headers when someone locally deletes files from the static or vendor directories that were there at built-time.

Also we're fixing a bug when you were locally running the docs.rs webserver from the repository-root. In this case the static assets weren't found, because they don't live in the repo root any more. We fallback to CARGO_MANIFEST_DIR now.

I added a unit-test for the wrong cache headers in this edge-case, and a first "real" integration test at the repo root that just so happens to test the static asset fetching in development. More integration tests will be added.

@syphar syphar requested a review from a team as a code owner January 13, 2026 17:50
@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Jan 13, 2026
@syphar syphar self-assigned this Jan 13, 2026
@GuillaumeGomez
Copy link
Member

Write a unit test which starts the server from top level and query a static resource?

@syphar
Copy link
Member Author

syphar commented Jan 14, 2026

Write a unit test which starts the server from top level and query a static resource?

now after having slept, I can see it.

starting a test from the top level would either mean re-introducing the top-level crate,

but perhaps I can change the CWD for a single test-case

@GuillaumeGomez
Copy link
Member

Yep, changing the cwd was what I had in mind.

@syphar
Copy link
Member Author

syphar commented Jan 14, 2026

Yep, changing the cwd was what I had in mind.

but cwd is always per-process, so with parallel test execution you might break stuff, or we have to set threads=1.

But I have another, cleaner idea.

I'll inject the root dir into the router builder, and write a test on a "broken" router.

@GuillaumeGomez
Copy link
Member

No I mean, when you use Command, you can give it a cwd. That's what I had in mind.

@syphar syphar force-pushed the fix-statics branch 5 times, most recently from 985c109 to 9dbc7f5 Compare January 16, 2026 00:44
@syphar
Copy link
Member Author

syphar commented Jan 16, 2026

@GuillaumeGomez added some tests, I think this is the better approach.

@GuillaumeGomez
Copy link
Member

Does that mean it works wherever we start the server?

@syphar
Copy link
Member Author

syphar commented Jan 16, 2026

Does that mean it works wherever we start the server?

in a dev project, yes.

in the built binary, or docker container, no.

the fallback is CARGO_MANIFEST_DIR, which is the path on the developer machine making the build.

So it might work whereever you try in this repo :

@GuillaumeGomez
Copy link
Member

Awesome! Then please update docs as well then I'll approve. :)

@syphar
Copy link
Member Author

syphar commented Jan 16, 2026

@GuillaumeGomez like this?

@GuillaumeGomez
Copy link
Member

Yes exactly, thanks!

@syphar syphar merged commit 70ee01e into rust-lang:main Jan 16, 2026
13 checks passed
@syphar syphar deleted the fix-statics branch January 16, 2026 13:37
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Jan 16, 2026
@syphar syphar removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Jan 16, 2026
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.

2 participants