Repository navigation
feat(rules): add schema/rating-scope, AggregateRating that is not about its page (#106) - #113
Merged
Merged
Conversation
…ut its page (#106) schema/review only validates the SHAPE of AggregateRating, so one sitewide rating block emitted by a template passes on every page of the site — the issue's evidence is 53 pages across four production sites, privacy policies, terms and 41 /news posts included. New page rule asks the two questions the shape check cannot: - rating-visible: is a rating visible anywhere in the rendered page text (star glyphs, "4.9 out of 5", "18 reviews", a decimal value in the copy, or the same wording in alt/aria-label/title)? A third-party review widget (Trustpilot, Yotpo, Judge.me, ...) clears the check, since its badge is injected client-side and a raw-HTML crawl cannot see it. - rating-subject: is the rated entity the subject of THIS page? Runs only on page types where a rating cannot apply — privacy, terms, article/blog — and on articles reports only a business/organization carrier, so a review article that rates its own Product stays silent. Repetition is deliberately NOT the signal: on a legitimate LocalBusiness site the badge really is on screen and the rating really is about the business the page is about. Both findings name the page type and the rated entity and frame the risk as a structured-data manual action, not a validation error. schema/review is untouched; its checks and messages are unchanged. Signed-off-by: Nik Cubrilovic <[email protected]>
10 tasks
nc9
added a commit
that referenced
this pull request
Aug 19, 2026
…sitemap-lastmod-churn-all-va * origin/main: feat(rules): add schema/rating-scope, AggregateRating that is not about its page (#106) (#113) Signed-off-by: Nik Cubrilovic <[email protected]> # Conflicts: # packages/audit-engine/tests/streaming-rules-canonical-golden.test.ts
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #106
schema/reviewvalidates only the shape of AggregateRating, so one sitewide rating block emitted by a template passes on every page of a site — including privacy policies, terms pages and blog posts (the issue's evidence: 53 pages across four production sites).New sibling rule
schema/rating-scope(page-scoped, warning, weight 4) asks the two questions the shape check cannot:rating-visible— is a rating visible anywhere in the rendered page text? Star glyphs, "4.9 out of 5", "18 reviews", a decimal value printed in the copy, or the same wording inalt/aria-label/title. A third-party review widget (Trustpilot, Yotpo, Judge.me, Elfsight, …) clears the check, because its badge is injected client-side and a raw-HTML crawl cannot see it.rating-subject— is the rated entity the subject of THIS page? Runs only where a rating cannot apply: privacy, terms and article/blog page types. On articles it reports only a business/organization carrier, so a review article rating its ownProductstays silent.Repetition is deliberately not the signal: on a legitimate LocalBusiness site the badge really is on screen and the rating really is about the business the page is about. Both findings name the page type and the rated entity, and frame the risk as a structured-data manual action rather than a validation error.
schema/reviewis untouched — same checks, same messages.Acceptance criteria
schema/reviewgains a scope check (or a new sibling ruleschema/rating-scope) registered in the rules catalog — new rule, registered inpackages/rules/src/schema/index.tstests/review-aggregate-rating.test.tsuntoucheddocs/rules/schema/rating-scope.mdx), nav + category index + rule counts updatedChanges
packages/rules/src/schema/rating-scope.ts— new rulepackages/rules/src/schema/index.ts— catalog registrationpackages/rules/tests/schema-rating-scope.test.ts— 16 tests, positive and negative casespackages/audit-engine/tests/streaming-rules-canonical-golden.test.ts— tally pin 272 → 273 (the canonical fixture emits no JSON-LD, so the rule adds a tally key and zero findings;findings.lengthstays 98216)docs/— rule page,docs.jsonnav, schema index card, rule counts 272 → 273 / Structured Data 11 → 12;README.mdlikewiseVerification
Tests and typecheck could not be executed in this sandbox (the runtime is not permitted here), so CI is the first run of
bun test,bun run typecheckandbun run docs:checkfor this branch.