Skip to content

Check the links of the built docs site and the package READMEs in docs.yml - #330

Merged
electricessence merged 4 commits into
masterfrom
docs/link-check
Dec 6, 2026
Merged

electricessence merged 4 commits into
masterfrom
docs/link-check

Conversation

@electricessence

@electricessence electricessence commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Wave 2, PR 1 of 2: a link check over the built docs site and the six README files, run by docs.yml.

What it does

docsite/tools/check-links.ps1 reads every page of the built site (626 pages, 17,742 links today) and the root and five package READMEs.

  • Internal links must resolve, or the run fails: pages, files and anchors on the site. Slide links (#N) in the presentation are checked against the slide count.
  • README links must be absolute. One that points at this repository's master branch is checked against the checkout (so a file added in a pull request is found before it merges), and its #heading against GitHub's heading ids.
  • All lookups are case-sensitive, as on GitHub Pages and GitHub (the runner's disk is not).
  • External links fail the run only on a hard 404 or 410. A timeout, a 403, a 429 or a 5xx is listed in the job summary and never fails. Each request waits 10 seconds at most, a timeout or a 5xx is tried twice, and after 5 minutes in total the rest are listed as not checked.
  • Not links: preconnect and dns-prefetch hints. Skipped: API-page links to learn.microsoft.com (DocFX generates them from the framework's cross-reference map).
  • The step runs after the site build and before the upload, so a broken link stops a deploy and the previous site stays live. docsite/CONTRIBUTING-DOCS.md says so, with the local command.

Why a script and not an action such as lychee: no external dependency to pin and keep current, the same command runs locally and in CI, and the three site-specific cases above (slide numbers, case sensitivity, README links into this repository) need code a generic tool would not have.

What it found

One dead link: the root README sent "Trimming and native AOT" to Source/Core/README.md#trimming-and-native-aot, a heading that file does not have (it is a bullet). It now links to the article section, articles/mapping.html#trimming-and-native-aot. No other broken page, file, anchor or external link in the site or the six READMEs.

Evidence

  • Local run on the freshly built site (docfx 0 warnings, 0 errors): 0 broken internal links, 0 hard 404 on the 13 external links, exit 0. Before the README fix: 1 broken, exit 1.
  • Seeded breakage on a scratch copy is caught: missing page, missing anchor, wrong-case path and directory, missing repo file, wrong-case repo file, missing heading in a README, slide #40 of 39, a 404 external link. A repository-root link, an owner name in another case, an extensionless site URL, a URL with parentheses, an indented code fence and an angle-bracket reference definition are read correctly.
  • Review: three Haiku reviewers (script correctness, CI behavior, coverage gaps), arbitrated by me. Applied: case, root and extensionless handling, parentheses, fences, reference definitions, anchors only from id and <a name>, bounded external requests, README heading check. Not applied: README-like files outside the six (CONTRIBUTING.md, Benchmarks/RESULTS.md), index.json/sitemap.xml entries (they list the same pages), CSS/SVG url() (none today).

Second review (owner-requested swarm, run by the PM session: four Haiku lenses and a Sonnet arbiter), and the first CI run

  • Blocking, fixed: a linked image alt had its target never checked. Both halves are checked now. Proved by a README with a broken badge target: the run fails (before: it passed).
  • Fixed: a HEAD 404 followed by a GET timeout no longer turns into not-confirmed; _ inside a heading word stays in the GitHub anchor; single-quoted href/src in README HTML; git required, with a clear message (the disk fallback ignored case on Windows); the site address without its trailing slash; the script requires PowerShell 7.
  • First CI run found a real gap my local run could not: on a pull request DocFX writes its View source links with the ref the build ran on (�lob/330/merge/...), 69 of them 404 on the network. Links to this repository whose ref is master, /merge or /head are now looked up in the checkout.
  • Re-run on the built site after the fixes: 0 broken internal links, 0 hard 404 on 14 external links (exit 0). Links read in the READMEs, before to after (the nested badge targets now count): root 21 to 25, Core 20 to 21, MSSqlClient 11 to 12, Channel 11 to 12, Dataflow 10 to 11, Extensions 16 to 17.

Not covered

  • docs.yml has not run on GitHub with this step yet; it runs on this PR.
  • Only .html pages and the six READMEs are scanned (see not applied above).
  • External pages that return 200 for a moved page (a soft 404) pass.

🤖 Generated with Claude Code

electricessence and others added 4 commits December 5, 2026 19:36
…s.yml

docsite/tools/check-links.ps1 reads every page of the built site and the six README files. An internal page, file or anchor that does not resolve fails the run, as does a README link that is not absolute. A README link into this repository's master branch is checked against the checkout (so a file added in a pull request is found before it merges), and every lookup is case-sensitive, as on GitHub Pages. An external link fails the run only on a hard 404 or 410; a timeout or a refusal is listed and not failed. Slide links (#N) in the presentation are checked against the slide count, preconnect hints are not links, and API-page links to learn.microsoft.com (generated by DocFX) are skipped.

The check is a small PowerShell script rather than a third-party action: it needs no pinned external dependency, runs the same locally and in CI, and knows the three site-specific cases above. It found no broken link in the current tree (626 pages, 17742 links, 13 external).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e dead anchor found

The link check now also looks up the heading of a README link into this repository's master branch (GitHub's heading ids), and found one real dead link: the root README sent "Trimming and native AOT" to a heading that Source/Core/README.md does not have. It now links to the article that holds the section.

Review of the checker (three reviewers, arbitrated): a README link into the repository's root, a different case of the owner name, an extensionless published URL, a URL with parentheses, an indented code fence and an angle-bracket reference definition are read correctly; an id on a meta tag no longer counts as an anchor; external requests wait 10 seconds at most, retry only a timeout or a 5xx, and stop after 5 minutes in total, so a network fault cannot stall a deploy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…, not on the network

On a pull request DocFX writes its "View source" links with the ref the build ran on (github.com/.../blob/330/merge/Source/...), a ref that is not a branch, so the external check found 69 hard 404s on the first CI run. The local build has no such links. A link into this repository on GitHub whose ref is master, or <number>/merge, or <number>/head is now looked up among the files git tracks, as a link to master already was.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nked image, keep a HEAD 404, and five smaller fixes

- A linked image such as [![alt](image)](target) had its target never checked (the pattern needed a "[" before each "](...)"); both halves are checked now.
- A HEAD that answered 404 followed by a GET that timed out reported the link as not confirmed; the 404 now stays.
- A heading with an underscore inside a word (Pool_clearing) keeps it in its GitHub anchor.
- A README HTML tag with a single-quoted href or src is read.
- Without git on the PATH the script stops with a clear message (the files of the repository are the ones git tracks; the disk fallback ignored case on Windows).
- The published site's address without its trailing slash is the site, not an external link.
- The script requires PowerShell 7.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit ec41722 into master Dec 6, 2026
9 checks passed
@electricessence
electricessence deleted the docs/link-check branch December 6, 2026 04:22
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.

1 participant