Repository navigation
build(docs): fail docs:check on dead internal links, dead #anchors, missing required anchors and broken Options rows (#322, #649, #319) - #876
Conversation
|
Reviewed the diff. I found no blocking problems. The checker is well scoped, the tests cover the main cases, and the quadratic-backtracking guard on the bracket scan is a nice touch. I did not run the tests or the checker against the real docs tree.
|
287205a to
ca0ee22
Compare
… redirect patterns, strips every angle bracket (#322, #649) Review follow-ups on #876: a docs section named scripts deeper down is checked; _redirects sources with * or :name placeholders match as patterns; heading text drops every < and > after tag removal (also clears the CodeQL incomplete-sanitization alert); comments on JSX-expression targets, explicit ids and where the required anchors come from. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review triage, fixed in ca0ee22 (rebased on main 8024e29):
|
|
Reviewed the diff (checker, tests, required-anchors, docs fixes). The design is sound and the tests cover the edge cases well. I didn't run the tests or the checker, so this is from reading only. No blocking issues.
Test coverage is good: 17 cases cover dead links, anchors, fences, comments, redirects and the Options rows. |
…Default Options cells; tanglyignore anchors /scripts/ (#322, #649, #319) Second review round on #876: the heading-text tag strip is a small scanner, which clears the CodeQL incomplete-sanitization alert the regex kept raising; the Options check reads the Type and Default columns by header, so a description mentioning unknown is not flagged; a malformed docs.json reports docs.json: <error>; .tanglyignore uses /scripts/ so a nested docs section named scripts is still published (scripts/ matched at any depth); the bracket-scan time bound is 5 s. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Round-2 triage, fixed in the new head:
|
|
Reviewed the diff: the new No blocking problems.
Test coverage is strong. Slug edge cases, code fences, MDX comments, redirects, the required-anchor and Options-row checks, and a bracket-run performance guard are all covered. The three corrected anchors ( 🤖 Generated with Claude Code |
…issing required anchors and broken Options rows (#322, #649, #319) tangly 0.5 check --strict passes all of these. docs/scripts/check-links.ts runs after it in docs:check and make validate: internal links must reach a page, redirect or file; anchors must be an id the target page renders (github-slugger, explicit {#id}, id=, <a name>), matching the live site on all 435 pages; anchors the cloud links to are listed in required-anchors.json; rule Options rows may not print unknown/undefined. Fixes the three dead anchors it found. scripts/ is tanglyignored so the check is not published. Signed-off-by: Nik Cubrilovic <[email protected]>
… redirect patterns, strips every angle bracket (#322, #649) Review follow-ups on #876: a docs section named scripts deeper down is checked; _redirects sources with * or :name placeholders match as patterns; heading text drops every < and > after tag removal (also clears the CodeQL incomplete-sanitization alert); comments on JSX-expression targets, explicit ids and where the required anchors come from. Signed-off-by: Nik Cubrilovic <[email protected]>
…Default Options cells; tanglyignore anchors /scripts/ (#322, #649, #319) Second review round on #876: the heading-text tag strip is a small scanner, which clears the CodeQL incomplete-sanitization alert the regex kept raising; the Options check reads the Type and Default columns by header, so a description mentioning unknown is not flagged; a malformed docs.json reports docs.json: <error>; .tanglyignore uses /scripts/ so a nested docs section named scripts is still published (scripts/ matched at any depth); the bracket-scan time bound is 5 s. Signed-off-by: Nik Cubrilovic <[email protected]>
02f7cb1 to
87b9566
Compare
|
Third-round triage. No code change, rebased on main 6b8406b:
|
|
Review of #876 (docs link/anchor checker). I read the diff and did not run the tests or the script. The CI checks were still pending when I looked. No blocking issues. The checker logic reads correctly. In particular, the repeat-slug counting matches github-slugger, and explicit
Test coverage is thorough: 18 tests covering the edge cases above, plus the linear-time regression. The three dead-anchor fixes in |
make validateandbun run docs:checkused to pass with dead internal links and dead#anchorsin the docs.tangly check --strict(0.5.0, and 0.5.2) does not check either: a probe docs tree with a dead page link, a dead/rules/performance/...link and a dead#anchorpassed it, and tangly has no flag or config for it. This PR adds the check.Closes #322, closes #649. Closes #319 (its last open criterion, AC2).
What it does
docs/scripts/check-links.tsruns aftertangly check --strictindocs:check(the CI "Docs check and build" job runs it, no workflow change) and inmake validate. It fails, printingfile:line: message, on:href, whether absolute, relative or same-page, are resolved the way a browser resolves them from the page URL. The target must be a page (<route>.mdx,.mdor<route>/index.mdx;/x/indexand/x.mdcount as/x), a redirect source indocs.jsonor_redirects, or a file. External links, code (fenced blocks and code spans) and MDX comments are skipped.#idmust be one the target page renders. The checker computes ids the way the site does: tangly's renderer takes a{#id}marker at the end of a heading (written\{#id\}in MDX), and otherwise rehype-slug runs github-slugger over the rendered heading text, after Astro's smartypants has turned--into a dash. It also countsid="..."attributes and<a name>. Checked against the live site, the computed ids match on all 435 pages.docs/scripts/required-anchors.jsonlists theguides/failed-auditsandcloud/firewallsections the cloud's failure explanations link to (run page, email, bell, MCP). Removing or renaming one fails CI. Renaming a heading's text is fine as long as its{#id}stays.## Optionstable row printingunknownor`undefined`fails, so the generator defect cannot come back.It found three dead anchors on main, fixed here: two links to
/configuration/storage#content-store-max-bytes(the id iscontent_store_max_bytes) and one to/configuration/crawler#max-pages(max_pages).docs/.tanglyignoregains/scripts/(top level only):tangly buildcopies every file in the docs root into the site, so without it the script would have been published.CONTRIBUTING.mdsays whatdocs:checknow checks, and to keep a heading's{#id}when renaming it.Known limits
The checker reads the source line by line, not through the MDX parser. An inline link whose
(target)spans lines is not checked, and a letter written as a named HTML entity in a heading (é) would slug wrong. The docs have neither, and both are written down in the script.Checks
bun test docs/scripts/check-links.test.ts: 18 pass. Fixtures in a temp dir: dead absolute and relative links, dead cross-page and same-page anchors, valid explicit and heading-derived ids, repeats, code spans, smartypants dashes, longer fences, MDX comments, reference links,<a name>vsdata-id, required anchors, Options rows (Type and Default columns only), a nestedscriptssection,_redirectspatterns (*,:name), and a 50k-bracket line (linear scan). It lands in the CIrestsuite (scripts/test-suites.ts).bun docs/scripts/check-links.tson the docs: passes (it failed on the three dead anchors before the fix).tangly check --strictonce at the final sha (rebased on main 8024e29): passes.noUncheckedIndexedAccess(docs has no tsconfig of its own). Formatted with the CLI's oxfmt config. docs has no lint step.href, MDX comments, fence lengths,<a name>,data-id, entities, github-slugger's exact repeat order, multi-backtick code spans, and the quadratic link regex. Its CI-wiring point was retracted afterplanSuitesshoweddocsinrest. The only open point is the named-entity letter case above.Docs: this is the docs gate. Agent skill: no change needed.