Fix broken links in docs - #1473
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1473 +/- ##
=======================================
Coverage 89.78% 89.78%
=======================================
Files 60 60
Lines 8439 8439
Branches 8439 8439
=======================================
Hits 7577 7577
Misses 545 545
Partials 317 317 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
81c8cf1 to
f01eaaf
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates documentation URL generation and link-checking to address broken links in the generated docs (including rustdoc pages) and to make CI’s link checker operate against the built documentation output.
Changes:
- Update
docs_url!to support an explicit documentation “version segment” (e.g.dev) when composing documentation URLs. - Fix an in-code rustdoc link to point at the dev docs location.
- Update the docs link-checking workflow to resolve absolute paths against the built
book/output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/simulation/prices.rs | Adjust rustdoc link to use the dev docs URL segment. |
| src/lib.rs | Extend docs_url! macro to accept an explicit version segment for URL construction. |
| docs/api/muse2/README.md | Update the published API-docs URL to the dev docs location. |
| .github/workflows/check-docs.yml | Configure Lychee to resolve absolute links relative to the built book/ output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| //! Code for calculating commodity prices used by the simulation. | ||
| //! | ||
| #![doc = concat!("See <", crate::docs_url!("/model/prices.html"), ">")] | ||
| #![doc = concat!("See <", crate::docs_url!("dev", "model/prices.html"), ">")] |
There was a problem hiding this comment.
Am I right in thinking that the "dev" needs to be here because this page didn't exist when we made the last release? Whereas the dispatch optimisation page did exist hence why we don't need it there.
If so, when we make the next release, will we have to come back and remove this?
Seems a bit inconsistent anyway if the API docs sometimes link to the latest release docs and sometimes to the dev docs (although I appreciate that this is annoyingly fiddly and we've probably had this conversation already!)
There was a problem hiding this comment.
Yes, that's precisely it. We could instead make them always link to the dev version of the docs, so they're consistent?
We're never going to get a nice consistent behaviour here. We're at the mercy of how it's being deployed. MDBook builds the docs expecting to be the only thing deployed at that URL, and we're then changing where it is and building old versions of docs so we have (currently) three copies of it, none of which are at the base url. Any new pages we reference will only exist under dev until we make a release. A cleaner way to do all of this would be to only build docs on release, instead of merging to main. Then we will never have the problem of the latest release not having certain pages. But that's not helpful for people that are using the latest version of the code.
| ) | ||
| docs_url!(concat!("v", env!("CARGO_PKG_VERSION")), $suffix) | ||
| }; | ||
| ($version:expr, $suffix:literal) => { |
Description
There are some broken links in the docs. Some are causing PR failures, but they don't necessarily line up with the broken links in the deployed docs. This PR will address these broken links.
Opening in draft because the CI workflow needs to be updated so the link checker is actually checking against the equivalent of the deployed docs.Edit: Ignoring broken links in old versions of the docs. These would be very difficult to continue to keep up to date. One problem is that this means the most recent release will include some broken links.Fixes #1408
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks