Skip to content

feat(rules): schema/expected-type, breadcrumb reads classified links (2/3 of #926) - #1180

Merged
nc9 merged 2 commits into
mainfrom
split/926-c-schema
Oct 27, 2026
Merged

nc9 merged 2 commits into
mainfrom
split/926-c-schema

Conversation

@nc9

@nc9 nc9 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Layer 2 of 3, split from #926. Depends on #1179 (the classifier): until it merges this diff includes its commit; review the last commit only.

  • schema/expected-type flags a page the classifier is sure about that declares none of the structured data its type should carry (Product, Article or BlogPosting, ContactPage, AboutPage, and so on).
  • schema/breadcrumb fails a page that shows a breadcrumb trail (links the classifier places in the breadcrumbs section) and declares no BreadcrumbList.
  • Rule count 311 to 312; README, docs index, rule hub and golden pins updated.

Docs: docs/rules/schema (expected-type, breadcrumb, index), glossary rich-results block. Skill: no change.

Hold: do not merge before v0.0.137 is tagged.

@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review of #1180 (reviewed the last commit only, per the description).

  • (high) packages/rules/tests/fixtures/template-invariance-measured.json: schema/expected-type is a new page rule but is not added to varyingRules in either corpus (AGENTS.md "Adding a rule", step 3). rule-verdict-scope.test.ts:96 asserts constantRules.length + varyingRules.length equals the page-rule count, so it will fail. Add the id to both corpora, keeping the arrays sorted.
  • (medium) packages/rules/src/schema/breadcrumb.ts: severity goes from info to warning for the whole rule. The no-schema-and-no-trail path still emits info, so this only matters for the new fail. Please confirm it is intended, because it moves scores for existing users. It also needs a CHANGELOG "Changed" line, if the diff does not already have one.
  • (low) expected-type.ts isOrganizationType: it accepts any name ending in business or organization. That is loose, but it only prevents false fails.
  • (low) expected-type.ts isArticleType: endsWith("article") also matches custom types such as NotAnArticle. It is harmless, but a comment would help.
  • (nit) markup-types.ts: the MAX_* bounds are exported but appear to be used only inside the file.
  • (nit) breadcrumb.ts: the break after finding a BreadcrumbList only exits the inner loop. The outer loop keeps iterating, but it is harmless.

Positives: the bounded iterative scans, the complete flag that avoids claiming absence when a scan was truncated, and the model-only gating that avoids circular verdicts.

Not verified: I did not run the tests. Please run the registry-wide tests from step 7 and the golden suite.

@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Reviewed the last commit (rules, docs and tests). I read the diff only and did not run the tests. CI was still pending when I looked.

  • (medium) expected-type.ts (contact and about families): any Organization or LocalBusiness type counts as a pass, and sites usually declare Organization sitewide. A contact page with only the sitewide Organization therefore passes, so the rule rarely fires for these two types. The message asks for "ContactPage or Organization", so this matches the docs, but it is a weak signal. Consider requiring ContactPage or AboutPage, or at least say so in the docs.
  • (low) breadcrumb.ts: severity goes from info to warning for the whole rule, not only the new fail path. The no-schema and no-trail path stays info, so it should not score. Please confirm the no-schema and no-trail path is still excluded from scoring and the health score, and note the severity change in the CHANGELOG under Changed.
  • (low) expected-type.ts: the topLevel veto reads ctx.parsed.schemas.types, which may include the types of nested nodes depending on the parser. The comment says it covers top-level and @graph only. A test with a nested isPartOf: Blog on a post would pin this. I did not see one in the diff.
  • (nit) markup-types.ts: jsonLdTypes sets complete: false for any node deeper than 8 levels. Deep, valid JSON-LD (large @graph entries with nested offers) will downgrade to the "markup too large" info check, which is the safe direction.
  • (nit) The MIN_TRAIL_LINKS = 1 constant is a sensible, measured choice. A one-link trail on a small site is still a trail. Its evidence (14 docs pages on one site) is small, so keep the comment's wording.

Good points: the bounds on every scan, the iterative walks, !(x >= y) for NaN confidence, the model-only label (which avoids circularity with rules-sourced labels), skipOnSoft404, and the golden pins (perRuleTally 312, findings +500) with their comments updated.

Reminder: the PR says it depends on #1179 and is on hold until v0.0.137, so do not merge before then.

nc9 added 2 commits October 27, 2026 21:01
…fied breadcrumb links #2307

Layer 3 of 3 (split of #926); needs the classifier layer. Docs: docs/rules/schema. Skill: no change.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the split/926-c-schema branch from 5517a87 to 5df8410 Compare October 27, 2026 10:01
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Review of the new `schema/expected-type` rule and the `schema/breadcrumb` change. I read the diff, the rule code and the shared `markup-types.ts` helper. I did not run the tests.

  • (medium) `packages/rules/src/schema/breadcrumb.ts`: `schema/breadcrumb` goes from `info` to `warning` severity, but the no-trail path still emits an `info` check. Please confirm the severity change only affects the new `fail` and doesn't alter scoring for the existing pass and info results. The golden test only pins `expected-type`, so a breadcrumb scoring change would not show up there.
  • (low) `expected-type.ts`: `isOrganizationType` accepts any name ending in `organization` or `business`, and `isArticleType` accepts anything ending in `article`. These are broad and could match unrelated or site-defined types. They only suppress findings, so they err toward false negatives, but they are worth a test pin.
  • (low) `packages/rules/src/schema/markup-types.ts`: the microdata and RDFa walk visits up to 50k elements on every page where the rule reaches the schema check. For `schema/breadcrumb` it only runs after a trail link is found, which is good. `expected-type` runs it on every confidently-classified page. It is bounded and iterative, so this is acceptable. If it shows up in rule-time profiles, a cheap `querySelector` pre-check would help.
  • (nit) `CHANGELOG.md`: the diff also moves two existing bullets out of a second `### Changed` block and adds a blank line before `### Security`. That is fine. Check that `git diff origin/main -- CHANGELOG.md` shows only your lines, as AGENTS.md asks.
  • (nit) `expected-type.ts`: `FAMILIES` is keyed by raw classifier label strings. A shared constant or type for the classifier labels would catch drift if the model renames a label.

The structure otherwise follows the repo conventions:

  • The rule is registered in `src/schema/index.ts`.
  • It is recorded as `varyingRules` in both corpora of the template-invariance fixture.
  • The golden pins are bumped, with comments.
  • Docs pages are added.
  • The `pageType.source === "model"` and `!(confidence >= min)` guards are sound.
  • The scans are bounded, and the code reports `complete: false` instead of claiming absence.

@nc9
nc9 merged commit 5bb47ae into main Oct 27, 2026
15 checks passed
@nc9
nc9 deleted the split/926-c-schema branch October 27, 2026 10:18
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