Skip to content

links/anchor-mismatch: valid German compound and article-list navigation labels warn in v0.0.172 #1626

Closed

Description

@deniskern

Summary

links/anchor-mismatch warns on meaningful German navigation labels because no whitespace token equals a target word:

Inline reproduction

The exact navigation markup/title pairs below were tested as part of a deterministic 20-page multi-rule loopback fixture on both checksum-verified binaries, each with a fresh HOME and 20 audited pages. This standalone server extracts those three pages; it is not a claim that an entire live-site group is false positive.

Save as navigation-repro.mjs:

import http from 'node:http';
const origin = 'http://127.0.0.1:18772';
http.createServer((req, res) => {
  const path = new URL(req.url, origin).pathname;
  if (path === '/robots.txt') return res.end('User-agent: *\nAllow: /');
  const pages = {
    '/': ['Navigation', '<a href="/gloves">Handschuhe</a><a href="/articles">Alle Artikel</a>'],
    '/gloves': ['Fahrradhandschuhe', ''],
    '/articles': ['Tipps & Tricks rund ums Radfahren', ''],
  };
  const page = pages[path];
  if (!page) { res.statusCode = 404; return res.end('Not found'); }
  const [title, links] = page;
  res.setHeader('content-type', 'text/html; charset=utf-8');
  res.end(`<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${title}</title><link rel="canonical" href="${origin}${path}"></head><body><main><h1>${title}</h1><p>${('A detailed collection of comfortable cycling products and business services for everyday journeys. ').repeat(12)}</p>${links}</main></body></html>`);
}).listen(18772, '127.0.0.1');

Run node navigation-repro.mjs, then audit with each version in a fresh HOME:

SQUIRREL_NO_UPDATE=1 SQUIRREL_UPDATE_REEXEC=1 "$BIN" audit http://127.0.0.1:18772/ --http --offline --no-publish --refresh --passive --disable-discovery-probes --level full -m 30 --rule-include links/anchor-mismatch -f json -o "$OUT"

The measured multi-case invocation used the same flags and included this rule alongside schema/entity-conflicts, links/broken-anchors, content/mojibake, a11y/image-redundant-alt, a11y/aria-labels, a11y/button-name and a11y/aria-required-parent. The standalone extraction above has not been separately rerun here.

Measured version comparison

Version Handschuhe → Fahrradhandschuhe Alle Artikel → cycling tips blog
v0.0.171 warns warns
v0.0.172 warns warns

Expected

Do not present these pairs as proven misleading anchors solely because they share no whitespace token. Recognize a meaningful compound constituent or report lexical uncertainty, and distinguish generic listing/navigation context from genuinely unrelated text. Keep genuinely misleading labels actionable, with a positive control for an unrelated visible anchor. No local suppression or content rewrite was added.

Triage

Confirmed against current code. tokensMatch in packages/rules/src/links/anchor-mismatch.ts matches two tokens only when they are equal or one is a prefix of the other (3+ shared characters, at most 3 left over). "handschuhe" is a suffix of "fahrradhandschuhe", so it never matches. The glue check (sharesInsideGlue) only looks for a target word inside an anchor word, not the reverse. Generic listing labels such as "Alle Artikel" have no lexical link to the target title, so the pair is judged unrelated. #1598 fixed the hyphenated vs closed form case only; this is a separate gap (suffix compounds and generic listing context).

Acceptance Criteria

  • "Handschuhe" linking to a page titled "Fahrradhandschuhe" does not produce a links/anchor-mismatch warning.
  • A generic listing or navigation label (for example "Alle Artikel") pointing at an article listing page is not reported as a misleading anchor, or is reported as not judged rather than as a mismatch.
  • A genuinely unrelated visible anchor (positive control) still warns.
  • Unit tests in packages/rules/tests/anchor-mismatch.test.ts cover the compound suffix case, the listing label case and the positive control.
  • docs/rules/links/anchor-mismatch.mdx describes the new compound and generic label handling.

Generated by Claude Code

Activity

  1. added
    bug
    rules
    size: S
    on Nov 7, 2026
  2. added theissue type on Nov 7, 2026
  3. nc9 commented on Nov 7, 2026

    @nc9
    Contributor

    Fixed on main in 4b12d9f (compound head nouns and generic listing labels, tests for the compound case, the listing label and the positive control) and 048a089 (a listing is the last path segment only, so one article under /blog/ still warns), docs and changelog in 105d545. One known limitation is documented in the rule: the compound match is not gated by page language. It ships in the next release.

    nik

  4. deniskern commented on Nov 8, 2026

    @deniskern
    Author

    Thank you for the .173 fix. The compound and /articles listing controls now pass as intended, while an unrelated anchor still warns. One original local case remains: <a href="/blogs/tipps-und-tricks">Alle Artikel</a> pointing at a genuine blog index titled Tipps & Tricks rund ums Radfahren still warns on both .172 and .173. The .173 isListingTarget checks only the final segment against listing nouns, so a named Shopify blog index is indistinguishable from an article without additional page-purpose evidence. Please retain unrelated article-target controls and consider an evidence-based listing classification or an explicitly unconfirmed verdict for this case; do not exempt every /blogs/* descendant. Reproduction below includes the exact URL, a generic /articles control and an unrelated target; same HTTP/offline/passive flags, 16 audited pages per version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions