Repository navigation
chore(gates): check docs internal links and heading anchors - #3401
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
At 72d3dac the code looks sound and all 23 checks pass, but I have not run the checker, its tests, or an rspress build. The claims that 226 heading IDs from a real build match and that #3396-#3399 pass are unverified on my side, and I only compared against the @rspress/core 2.0.12 sources, not the @callstack/rspress-preset plugins. Please show the checker output from a real build, then this is ready to merge. I have no code changes to require. Not blocking, and you can take or leave these: parsePage parses without the GFM extension that rspress applies first, so a bare published URL with a bad anchor in README or a docs page is never checked, and one test with such a URL would cover it. Relative links resolve against the route in sitePath, while rspress joins from the source file's directory, so Is a standalone checker the smallest design? rspress already fails a production build on dead page links, and pr-preview.yml runs that build on every website PR. A rehype plugin in The five cubic-dev-ai threads (CI job inputs, URL boundary, per-page slugger, website/package.json input, MDX parsing) are fixed at this head, so you can resolve them. |
|
72d3dac now conflicts with main after today's merges, so it needs a rebase. The code verdict and the open question from my earlier comment are unchanged. |
72d3dac to
a58fc4c
Compare
|
Thanks. I took the design question further: the checker now reads the built site instead of re-deriving rspress, in a58fc4c (rebased onto main and squashed).
|
Add `pnpm check:doc-links` (gate `docs-links`): it builds the site and reads website/doc_build, so rspress's own slugger, link rewriting, and clean URLs are what get checked. Every internal href must name a built page, and its fragment an ID that page renders; a heading ID rendered twice on one page fails, and README.md's links into the published docs are checked against the same build. External URLs are skipped. The base is read from the build (rspress emits its entry script under the base), not restated. The selector routes docs pages, README, and the website manifest and config to the gate, and a Docs Links workflow runs it, since ci.yml ignores docs paths. website/doc_build is now gitignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a58fc4c to
ea62cf2
Compare
|
The PR is ready at ea62cf2. The earlier conflict is resolved, and all 23 checks pass, including the docs-links job, which ran on this head. Not blocking, and fine to take or leave: The five earlier cubic-dev-ai P2 threads are fixed at this head, so they can be resolved: the rspress config in both workflow filters (#3401 (comment)), the I did not run the rspress build, |
Summary
Adds
pnpm check:doc-linksand adocs-linksgate. They fail when a link on the docs site, or a README link into it, points to a page or heading that rspress didn't render, or when a page renders the same heading ID twice. rspress's production build already fails on links to missing pages, but it builds#fragmentlinks to missing headings without complaint. Pages moving between files (#3397, #3399) and dedup passes like #3295 can break those silently.Design: check the built site. The gate runs
pnpm --dir website build(about 3 s warm), thenscripts/check-doc-links.ts, which readswebsite/doc_build/**/*.html:assetPrefix, which defaults tobase). The script also checks the home link, so a misread base fails instead of making every link look external. It doesn't force a base withRSPRESS_BASE, because rspack's build cache ignores that variable and would serve stale output.https://oss.callstack.com/agent-device/docs/...URLs (Markdown links and bare URLs) are checked against the same build.docs/quick-start: link "/agent-device/docs/sessions#find-a-session-logs" → no heading "find-a-session-logs" (website/docs/docs/quick-start.md).Why not an rspress plugin: a rehype or
afterBuildplugin would read the same rendered IDs. But it would have to collect links across pages inside rspress hooks, couple the gate to the website config, and still leave README to a separate script. Scanning the HTML after the build checks the same output with less coupling.Wiring: registered in
check-affected(checks.ts/model.ts). Changes to website docs,website/package.json,rspress.config.tsorREADME.mdselect it. It's also part ofcheck:tooling, and thedocs-links.ymlworkflow runs it becauseci.ymlignores docs paths.website/doc_build/is added to.gitignore.Validation
pnpm check:affected --runpassed on ea62cf2.pnpm check:doc-linkspasses on current main docs, which include docs(agent-setup): keep one canonical agent rule #3396–docs: split integrator material into a Build an integration page #3399.quick-start.mdand one in a README bare URL each failed and were named.🤖 Generated with Claude Code