Skip to content

Fix broken link checker workflow#1147

Merged
alexdewar merged 3 commits intomainfrom
fix-broken-links
Feb 26, 2026
Merged

Fix broken link checker workflow#1147
alexdewar merged 3 commits intomainfrom
fix-broken-links

Conversation

@alexdewar
Copy link
Collaborator

@alexdewar alexdewar commented Feb 25, 2026

Description

The link checker workflow is currently not working, which is causing other open PRs to fail CI checks.

There are a few reasons:

  • A couple of broken links in docs/model/investment.md
  • We're getting really weird 404 errors for parts of the docs for the erased-serde crate that are linked to from our API docs, even though it should be generated automatically. Not sure what the problem is, but I've just ignored these for now.
  • A new weird error in the book/404.html file, which is also autogenerated, so I'm just ignoring the file now

The link checker workflow doesn't actually run on pushes to main. We are checking that the docs build ok, as part of the docs deployment workflow, but maybe we should also check links here too.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

It seems the magic which converts `README.md` paths to `index.html` doesn't work here, because the generated path is to a non-existent `README.html`.
@alexdewar alexdewar force-pushed the fix-broken-links branch 2 times, most recently from 86743c2 to 4505241 Compare February 25, 2026 15:27
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.52%. Comparing base (3d4b209) to head (237de2b).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1147   +/-   ##
=======================================
  Coverage   87.52%   87.52%           
=======================================
  Files          55       55           
  Lines        7626     7626           
  Branches     7626     7626           
=======================================
  Hits         6675     6675           
  Misses        649      649           
  Partials      302      302           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexdewar alexdewar added this to MUSE Feb 25, 2026
@alexdewar alexdewar moved this to 👀 In review in MUSE Feb 25, 2026
\\( \sum_t act_t \\).

[overall MUSE2 workflow]: ./README.md#framework-overview
[framework-overview]: https://energysystemsmodellinglab.github.io/MUSE2/model/index.html#framework-overview
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we have to use a URL here rather than an internal link?

Copy link
Collaborator

@Aurashk Aurashk left a comment

Choose a reason for hiding this comment

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

thanks!

@alexdewar alexdewar marked this pull request as ready for review February 26, 2026 11:53
Copilot AI review requested due to automatic review settings February 26, 2026 11:53
@alexdewar alexdewar merged commit e4b1990 into main Feb 26, 2026
9 checks passed
@alexdewar alexdewar deleted the fix-broken-links branch February 26, 2026 11:54
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in MUSE Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes issues with the link checker workflow that were causing CI failures. The changes address broken internal documentation links, spurious external link failures, and add exclusions for problematic auto-generated files.

Changes:

  • Fixed two broken internal links in docs/model/investment.md by converting them to absolute URLs pointing to the published documentation
  • Added .lycheeignore entry to skip erased-serde documentation links that incorrectly return 404s
  • Extended the link checker workflow to exclude the auto-generated book/404.html file

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
docs/model/investment.md Consolidated and converted two relative links to README section into a single absolute URL reference
.lycheeignore Added pattern to ignore problematic erased-serde docs.rs links
.github/workflows/check-docs.yml Added exclusion pattern for auto-generated 404.html file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

\\( \sum_t act_t \\).

[overall MUSE2 workflow]: ./README.md#framework-overview
[framework-overview]: https://energysystemsmodellinglab.github.io/MUSE2/model/index.html#framework-overview
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

Using an absolute URL to the published documentation creates a hard dependency on the documentation hosting location and won't work for local builds or forks.

The better approach would be to use a relative path that works with mdBook's build system. Since model/README.md becomes model/index.html when built, you could try:

  • ./README.md#framework-overview (should work in raw markdown and mdBook)
  • Or configure the link checker to understand mdBook's README→index.html transformation

The current absolute URL will break if the documentation is ever moved to a different domain or viewed locally, and it creates an external dependency where an internal link would suffice.

Suggested change
[framework-overview]: https://energysystemsmodellinglab.github.io/MUSE2/model/index.html#framework-overview
[framework-overview]: ./README.md#framework-overview

Copilot uses AI. Check for mistakes.
uses: lycheeverse/lychee-action@v2
with:
args: "--verbose --no-progress --accept 200,203,503 --exclude-path ^target './**/*.md' './**/*.html'"
args: "--verbose --no-progress --accept 200,203,503 --exclude-path ^target --exclude-path ^book/404.html$ './**/*.md' './**/*.html'"
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The pattern ^book/404.html$ might not match the file path as lychee sees it. The existing pattern ^target is a prefix match (no $ anchor), while your new pattern anchors to both start and end.

Depending on how lychee resolves paths, you might need ^book/404\.html$ (with escaped dot), or ^.*book/404\.html$ to allow for any prefix. Consider testing this locally to ensure it actually excludes the intended file. If it doesn't work, you might need to use .lycheeignore instead of --exclude-path.

Suggested change
args: "--verbose --no-progress --accept 200,203,503 --exclude-path ^target --exclude-path ^book/404.html$ './**/*.md' './**/*.html'"
args: "--verbose --no-progress --accept 200,203,503 --exclude-path ^target --exclude-path ^.*book/404\.html$ './**/*.md' './**/*.html'"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants