Skip to content

Fix diagram anchor check false positives (EDUENG-677)#23185

Open
ebembi-crdb wants to merge 1 commit intomainfrom
edueng-677-fix-diagram-anchor-false-positives
Open

Fix diagram anchor check false positives (EDUENG-677)#23185
ebembi-crdb wants to merge 1 commit intomainfrom
edueng-677-fix-diagram-anchor-false-positives

Conversation

@ebembi-crdb
Copy link
Copy Markdown
Contributor

Summary

  • Collect <a name="..."> anchors in _IDCollector, not just id= attributes. stmt_block.html defines all ~800 anchors via <a name="...">, so the check was finding 0 anchors and reporting every cross-page reference as broken.
  • Check stub anchors in sql-grammar.md alongside stmt_block.html. The grammar pages define stub anchors (e.g. col_label, column_constraints) for nonterminals that diagrams reference but that don't exist in stmt_block.html.
  • Update error message to mention both stmt_block.html and sql-grammar.md.

Fixes false failures on PRs like #23181 (RESTORE docs), which reported 6 "broken" anchors that actually resolve correctly on the rendered site.

Test plan

  • python3 .github/scripts/validate_diagram_anchors.py src/current/v26.2/restore.md — passes (0 broken anchors, was 6 false positives before)
  • Full scan in CI with GITHUB_TOKEN set

Two fixes to eliminate false failures on PRs touching SQL pages with diagrams:

1. Collect <a name="..."> attributes in addition to id= attributes.
   stmt_block.html defines all ~800 anchors using <a name="...">, not id=,
   so the script was finding 0 anchors and reporting every reference as broken.

2. Also check stub anchors defined in sql-grammar.md. These files define
   stub anchors (e.g. col_label) for missing nonterminals that diagrams
   reference but that don't exist in stmt_block.html.
@ebembi-crdb ebembi-crdb requested a review from a team as a code owner April 16, 2026 16:00
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 16, 2026

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit e43b5b2
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-interactivetutorials-docs/deploys/69e1079674a7db000884f92a

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 16, 2026

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit e43b5b2
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-api-docs/deploys/69e10796f72e210008e5e0c1

@github-actions
Copy link
Copy Markdown

Files changed:

  • .github/scripts/validate_diagram_anchors.py

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 16, 2026

Deploy Preview for cockroachdb-docs canceled.

Name Link
🔨 Latest commit e43b5b2
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/69e10796ad528a0008d9374c

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