Skip to content

feat(classifier): page types, link sections and component-aware findings (#2307, #837, #846) - #926

Closed
nc9 wants to merge 2 commits into
mainfrom
nc9/link-section-findings-rebased
Closed

nc9 wants to merge 2 commits into
mainfrom
nc9/link-section-findings-rebased

Conversation

@nc9

@nc9 nc9 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The bundled page classifier, the link findings and report changes that read it, and the component-aware findings, on top of main v0.0.132. Two commits, both signed off.

What it does

  • Page classifier. A small model bundled with squirrel (weights treetop-pagetype-v1, the file classifier-v2.json, about 9 MB, MIT like the rest of the repo, no network call) names the part of a page a link sits in where the markup says nothing, and gives each page a type. Markup landmarks and comment threads still win. Switch it off with --no-classifier or [classifier] enabled = false; squirrel self doctor shows the artifact and its load time.
  • Link findings that say where. Link rules record the section of the offending element. Items list each source page once with its links and sections (from: /about (2 links, in the footer)), a finding in a region every page repeats names the region instead of listing pages, and a finding on every page of one page type says so. links/broken-links, links/broken-external-links and links/broken-anchors are in the Reliability category.
  • New checks. schema/expected-type flags a page the classifier is sure about that declares none of the structured data its type should carry. schema/breadcrumb fails a page that shows a breadcrumb trail and declares no BreadcrumbList.
  • Page structure. Reports carry a Page structure block: where the links on the audited pages sit, and how many pages the classifier calls product pages, blog posts and so on. Informational, never scored.
  • Component-aware findings. One defect in one shared component, N pages, reads as one "fix once" line and one card instead of N page rows, in every format. Source maps shared across pages are grouped the same way. Evidence is stored with the audit (local sqlite schema 36 and 37, additive and nullable) and carried through publish and report -i.
  • Bounded work. The evidence builder reads crawled markup, so its regex and ancestry work is bounded: a 200,000 character aria-label no longer costs seconds, and a deep or nested page costs a capped amount instead of the square of its size.

What changed in the HTML report

The new report design from main is kept. The fix cards, region lines, item source rows and a Page structure section are ported onto it, with their classes added to the report stylesheet (regenerated, REPORT_HTML_VERSION is 21). The page keeps its own dismissible notices at the top.

Merge notes

main shipped #838, #839 and #981 on its own while this branch was open. The conflicts were resolved so main's hidden-control reader and page-language phrases stay in a11y/link-text, with link sections and evidence on top; the larger label table in shared/conventional-link-labels.ts is kept (main's two exports are unchanged). Main's noindex skip in content/word-count moves the golden SEO pass count from 28796 to 28786 (10 pages); the pin is updated.

Docs

User-facing pages are updated in this PR: report output (page structure, source pages, scope fields, meta and structure in JSON), rule pages (link-text, the Reliability link rules, schema/expected-type, no-contextual-inbound), the classifier page, and the CLI flag list. The glossary hub pages are regenerated. make validate in docs/ passes.

Agent skill

Yes, a small change: the skill's OUTPUT-FORMAT.md (squirrelscan/skills, audit-website/references) describes the LLM format, and this PR adds <fix-once>, <likely-shared-block>, <report-detail> and <page-structure> elements and item lines that carry source pages and scope. A private issue with the skills label tracks it.

Checks run locally

  • Bun 1.4.0, bun install --frozen-lockfile, tsgo --noEmit in each touched package (core-contracts, utils, config, crawler, rules, report, audit-engine, page-classifier, parser, cli).
  • All test files of those packages, five per call: report 922, rules 5449, crawler 767, audit-engine 1494, cli 3090, parser 178, page-classifier 217, core-contracts 168, config 71. The cli suite has one failure that needs a 127.0.0.2 loopback alias (not configured on a Mac) and is unrelated to this change, and one audit-engine rule-timeout test is load-sensitive and passes when run alone.
  • Golden baseline: 518 pages, 102243 findings, 310 rules, health score 51.
  • make validate in docs/, format:check and oxlint in apps/cli, the report stylesheet check, notices:check, and the detect-secrets hook.
  • A compiled binary runs squirrel self doctor with the classifier loaded, and an audit of a local fixture site renders the HTML report.

const hasDigit = DIGIT.test(text);
if (hasDigit) {
if (PATTERNS.year.test(text)) walk.yearHits[i] = 1;
if (PATTERNS.price.test(text)) walk.priceHits[i] = 1;
if (PATTERNS.copyright.test(text)) walk.copyrightHits[i] = 1;
}
if (CURRENCY.test(text) && !walk.priceHits[i]) {
if (PATTERNS.price.test(text)) walk.priceHits[i] = 1;
nc9 added a commit that referenced this pull request Oct 22, 2026
…s, not page links (#838) (#1009)

tel-mailto counts the link as a mailto and checks the decoded address; nofollow-internal and https-downgrade skip it; the crawler never queues the path from sitemaps or carried findings. Re-applies one commit from draft #926.

Closes #838.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added 2 commits October 24, 2026 12:04
…ngs, on main v0.0.132 #2307

One tree on top of origin/main (6abe3a8): the bundled page classifier and
its link-section findings and report changes (#836, #837, #838, #839, #843,

- rule_results migrations are 36 and 37 (main owns 35, the crawl lease)
- link-text keeps main's hidden-control reader and page-language phrases, with
  link sections and component evidence on top
- the HTML report keeps main's new design: fix cards, region lines, item
  source rows and a Page structure panel are ported onto it
- the golden pins follow main's noindex skip in content/word-count
- page-classifier tests: no pointer outside the repo, no machine path literal

Signed-off-by: Nik Cubrilovic <[email protected]>
…idence builder #2307

Crawled markup could make the evidence builder cost minutes on one page.

- hint text is cut to a 1,024-character read and a 256-character test before
  the sensitive-shape pattern runs, and its quantifiers are bounded: a
  200,000-character aria-label of "a." took 20 s, now 3 ms
- landmark slots, nesting and ancestor context come from one iterative pass
  per document instead of a querySelectorAll per distinct slot key; the
  ancestor context is cut at 64 roles, and a landmark under 64 landmarks is
  page-scoped
- the nearest landmark, the root and the ladder root are memoised per element
  (exact, each element resolved once), and locators keep at most 64 levels
- one page's subtree-sized evidence work (digests, text reads, hint searches)
  is capped; past the cap the remaining elements are page-scoped, so a deep
  chain or nested anchors no longer cost the square of the page

Output on ordinary pages is unchanged: 408 fixture and fuzzed documents
(43,596 elements) compared before and after with no difference.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the nc9/link-section-findings-rebased branch from bb11b0a to 9baaeee Compare October 24, 2026 01:10
@nc9 nc9 changed the title feat(rules,report): component-aware findings with Treetop, per-source rows and region scope (#837, #846) feat(classifier): page types, link sections and component-aware findings (#2307, #837, #846) Oct 24, 2026
@nc9
nc9 marked this pull request as ready for review October 24, 2026 01:10
@github-actions

Copy link
Copy Markdown
Contributor

PR too large for auto-review

This PR is 234 changed files (limit 80) and 30031 changed lines (limit 6000), so the automated reviewer was skipped: past that size it runs out of turns mid-session and posts nothing, which is worse than saying so.

Run it manually (/review, or a focused review per area) before merging, or split the PR.

Diff measured: 234 reviewable files, 30031 changed lines (2 generated files ignored).

@nc9

nc9 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: rebased onto main (v0.0.136 plus #856, sqlite migrations renumbered 37/38, both CodeQL ReDoS regexes fixed) and split into three PRs: #1179 (classifier), #1180 (schema rules), #1181 (report and rules). Closing this one. (Nik)

@nc9 nc9 closed this Oct 27, 2026
nc9 added a commit that referenced this pull request Oct 27, 2026
…nks, sqlite migrations 37/38, [classifier] config #2307

Layer 1 of 3 (split of #926). Rules, report and the schema rules follow.
Docs: docs/configuration/classifier.mdx, docs/cli. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…nks, sqlite migrations 37/38, [classifier] config #2307

Layer 1 of 3 (split of #926). Rules, report and the schema rules follow.
Docs: docs/configuration/classifier.mdx, docs/cli. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…nks, sqlite migrations 37/38 (#1179)

Layer 1 of 3 of the #926 split. A small bundled model (about 9 MB, no network call) names the section a link sits in where the markup says nothing, and a page type; off with --no-classifier or [classifier] enabled = false. Parser hook, contracts, additive sqlite migrations 37 and 38, engine and CLI wiring; bounded the price regex (2 CodeQL alerts). No rule or report change. Docs: configuration/classifier.mdx, cli. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.
nc9 added a commit that referenced this pull request Oct 27, 2026
…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 added a commit that referenced this pull request Oct 27, 2026
…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 added a commit that referenced this pull request Oct 27, 2026
…fied breadcrumb links (#1180)

Layer 2 of 3 of the #926 split. schema/expected-type flags a page the classifier is sure about that declares none of the structured data its type should carry; schema/breadcrumb fails a page that shows a breadcrumb trail without BreadcrumbList. 311 to 312 rules. Also moves two stray v0.0.137 CHANGELOG bullets (#1177, classifier) back to Unreleased and restores that section to the tag. Docs: docs/rules/schema. Skill: no change.
nc9 added a commit that referenced this pull request Oct 27, 2026
…ollups, page structure block #2307

Layer 2 of 3 (split of #926); needs the classifier and schema layers.
Docs: docs/reports.mdx, docs/configuration/output.mdx, docs/rules/links. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…ollups, page structure block #2307

Layer 2 of 3 (split of #926); needs the classifier and schema layers.
Docs: docs/reports.mdx, docs/configuration/output.mdx, docs/rules/links. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…ollups, page structure block #2307

Layer 2 of 3 (split of #926); needs the classifier and schema layers.
Docs: docs/reports.mdx, docs/configuration/output.mdx, docs/rules/links. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…ollups, page structure block #2307

Layer 2 of 3 (split of #926); needs the classifier and schema layers.
Docs: docs/reports.mdx, docs/configuration/output.mdx, docs/rules/links. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.

Signed-off-by: Nik Cubrilovic <[email protected]>
nc9 added a commit that referenced this pull request Oct 27, 2026
…ups, Page structure block (#1181)

Layer 3 of 3 of the #926 split. Link rules record the section of the offending element; items list each source page once with its links and sections; a finding in a region every page repeats, or on every page of one page type, says so; one defect in one shared component across N pages is one fix-once line and card; shared site resources (source maps) group the same way; reports carry an informational Page structure block. The new markdown lines go through markdown-escape (repo#3522) with hostile-URL tests. Docs: docs/reports.mdx, docs/configuration/output.mdx, docs/rules/links. Skill: OUTPUT-FORMAT.md note tracked in a private skills issue.
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.

2 participants