Fix rendered redirect-source link verification

Merged
KT
4mo ago
+72-13

Summary

  • parse rendered anchors with the existing pinned HTML parser instead of a quoted-attribute regex
  • cover quoted, unquoted, character-reference, duplicate-attribute, script/comment, and empty-scan boundaries
  • fail closed when no HTML files or no internal links are scanned

Validation

  • 14 focused rendered-link tests
  • 391 Vitest tests
  • 64 IndexNow tests
  • 4 C8 integration tests
  • exact Node 22.14.0/npm 10.9.2 production build
  • 821,342 internal links across 1,984 HTML files; zero redirect-source violations
  • zero noindex; RUM, redirect graph, title, H1, sitemap, and C8 gates pass

No generated documentation is included.


Summary by cubic

Fixes rendered redirect-source link verification by replacing a quoted-attribute regex with the pinned HTML parser. This removes false positives from scripts/comments, supports unquoted and character-reference hrefs, and now fails closed when no HTML files or no internal links are found.

  • Switches to parse5 and walks nodes to collect anchor hrefs; applies first-attribute semantics for duplicates; decodes character references; still ignores fragments and off-site URLs and normalizes pathnames.
  • Adds fail-closed errors for zero HTML files and zero internal links; previously these cases passed without checking.
  • Expands tests for quoted/unquoted/character-reference hrefs, duplicate attributes, and script/comment boundaries.