Skip to content

fix(rules): count hreflang alternates as one og-image voter in asset-divergence - #953

Merged
nc9 merged 1 commit into
mainfrom
fix/937-asset-divergence-hreflang
Oct 20, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/937-asset-divergence-hreflang

Conversation

@nc9

@nc9 nc9 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

social/asset-divergence now treats pages that are hreflang alternates of each other as ONE voter on the og-image axis. A collection plus its 15 locale variants sharing an entity og:image no longer looks like a 16-page fallback by repetition.

How

  • Reciprocal alternates (any language) merge into a cluster, built from the parser's stored hreflangAlternates (no re-crawl). One-way claims do not merge. Pages with no og:image, or exempt types, still link clusters.
  • A cluster carrying one image casts one vote; a cluster alone on an image is dropped as a singleton. Cluster members still count as pages for the item labels, flagged pages and the fail share.
  • Same accumulator on the legacy and siteQuery paths; parity tests added for both, including a golden through page_features.
  • Favicon and theme-color unchanged (one vote per page).
  • collection exemption: not added. The classifier has no collection type (collection URLs classify as category), and category pages often fall back to the site default, which is what the rule should catch. Docs say so.

Docs and CHANGELOG updated. tangly check --strict passes.

Closes #937

skills: no change

@claude

claude Bot commented Oct 20, 2026

Copy link
Copy Markdown

Review of #953 (hreflang clusters as one og-image voter)

The change looks correct and well tested. I found no blocking issues. CI was still pending when I looked, so I did not see typecheck or test results.

  • (low) asset-divergence.ts judgeAxis: voters is now a page count, while agreeing and share still come from vote counts (one per cluster). This looks intentional, and the "counts every page toward severity" test covers it. Still, a short comment saying which fields are votes and which are pages would help the next reader.
  • (nit) clusterByHreflang mutates rollup.samples inside buildChecks. It is idempotent, so this is safe, but a pure helper that returns the cluster map would be easier to test.
  • (nit) Exporting identity from shared/region-variants widens that module's API. That is fine, but normalizePageUrl could be used directly instead.

What I checked:

  • Union-find: the root is the smallest url, so results don't depend on crawl order. Only reciprocal links merge.
  • Streaming and legacy paths: both feed hreflangAlternates, and the dual-path golden test covers them.
  • Performance: clustering is near-linear in the number of alternates.
  • Docs and changelog: both are updated.

@nc9
nc9 merged commit dd525d2 into main Oct 20, 2026
15 checks passed
@nc9
nc9 deleted the fix/937-asset-divergence-hreflang branch October 20, 2026 07:59
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.

social/asset-divergence: entity og:image shared by hreflang alternates reported as fallback

1 participant