ci: make doc-review link check case-sensitive per path segment - #139
Merged
Merged
Conversation
links.py now verifies every path segment (directories too, not just filenames) against on-disk casing, covers HTML <a href> in addition to <img src>, validates #fragment anchors against the target page's real heading slugs, and reports the corrected reference text to copy rather than pressuring authors to rename files. product_names.py now checks prose only, so lowercase image paths are no longer misreported as branding violations. Shared path/slug helpers extracted to _paths.py, which resolves .. segments before the case walk. Removed the unused PyGithub dependency and replaced stale entity source_of_truth/glossary references with comments. reviewer.py is unchanged, so the job remains non-blocking.
junlin-luo-spacemit
requested a review
from wanruo-yuan-spacemit
as a code owner
September 30, 2026 02:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The repo keeps finding the same bug class: a reference that resolves on case-insensitive Windows/macOS but 404s on Linux CI and the web host. PR #138 fixes the current instances by hand — this PR makes the linter actually catch them, so it stops recurring.
The existing
links.pywas too permissive in some ways and too strict in others:Static/) slipped through.<a href>, so anchor-style links were unchecked.#fragmentanchors entirely, so links to headings that no longer exist went unnoticed.product_names.pyscanned the whole line, including image paths, so a correct lowercase path likestatic/com260_model.pngwas reported as a branding violation.Changes
checks/links.py<a href>in addition to markdown links/images and HTML<img src>.#fragmentanchors against the target page's real heading slugs (both in-page andpage.md#frag)./...) paths.checks/product_names.pychecks/_paths.py(new)apply_case_fix, andslugify/heading_idsfor anchors...segments before the case walk. Without this a relative path escaped the check and produced false "missing file" reports — latent, since the production caller always passes absolute paths.Cleanup
PyGithubfromrequirements.txt— declared but never imported (the agent usesrequestsdirectly).source_of_truthentries inentities/{k1,k3,p1,p1s}.yamlwith comments; the paths pointed atkey_stone/andpower_stone/directories that never existed, and nothing reads them.glossary.yamlheader comments that referenced non-existent files.What this does not do
reviewer.pyis intentionally untouched, so the job remains non-blocking. This PR only changes what the checks report — it is a correctness improvement, not a policy change. Turning findings into a merge gate is a separate decision (see below).Verification
get_errorsclean on the changed modules.Follow-up (not in this PR)
If we want this to gate merges, three non-blocking mechanisms have to be removed (
continue-on-error: true, the|| true, andsys.exit(0)inreviewer.py) and the job marked required in branch protection. Worth noting that a full-repo measurement shows ~48 of 94 files currently trip at least one check, so a hard gate would fail most doc PRs until a baseline or diff-scoped enforcement is in place. Recommend starting withlinks+headingsonly, which are clean today.Risk
Low. Tooling only, no
.mdfiles touched — meaning thedoc-review.ymlworkflow (which triggers onpaths: "**/*.md") will not even run on this PR. No runtime behavior change for the site build.