OpenZeppelin / OpenZeppelin/docs

link-validation.ts misses several anchors and never fails CI

Open
#238 0 comments 0 reactions 1 assignee View on GitHub

@stevep0z is already working on this.

Since Sep 4, 2026.

Dominant language
MDX
Stars
6
Forks
23
Avg merge
1d 13h
Merged PRs (30d)
4

Description

Problem

scripts/link-validation.ts runs on every PR (via lint.yml → pnpm run check) but doesn't actually catch broken links, for two reasons:

  • It only recognizes anchors from real Markdown headings and literal <a id="..."> tags. Most anchors on API reference pages come from <APIItem id="...">, which it doesn't parse, so it can't tell if those are broken or fine.
  • It never sets a non-zero exit code, so even when it does find a broken link, the CI step still reports success. Confirmed live: the "Lint and Format Check" run on PR #233 merged commit passed despite 85 broken anchors in that commit.
    On top of that, main has no branch protection (protected: false, no required status checks), so even a correctly-failing check wouldn't block a merge today.
Proposed fix, staged (not a single flip to hard-fail):
  • Extend anchor detection to recognize <APIItem id="..."> (and similar components). Keep it non-blocking for now.
  • Let that surface the real, sitewide baseline of broken links (there are known pre-existing ones outside Cairo 4.x too), and clean those up or snapshot them.
  • Only then add the non-zero exit code.
  • Add branch protection on main requiring the lint job, once step 3 is trustworthy.
  • Doing 3–4 before 1–2 would fail unrelated PRs on pre-existing debt they didn't introduce; hence the order.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.