Skip to content

fix(rules): in-page About and Contact sections work in the streaming engine #1236 - #1237

Merged
nc9 merged 2 commits into
mainfrom
fix/inpage-section-streaming-1236
Oct 28, 2026
Merged

nc9 merged 2 commits into
mainfrom
fix/inpage-section-streaming-1236

Conversation

@nc9

@nc9 nc9 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Closes #1236.

#1208 read ctx.site.pages[].parsed.document, which the streaming engine (CLI and cloud) does not give site rules, so a real audit still said 'No About page found'. The in-page section signal is now collected page-time while the DOM is live: CollectedPageSignal.inPageSections holds the first About and first Contact section per page (id, word count, page has mailto/tel/form), bounded like the other records (fragment anchors capped at 500, no DOM kept). findInPageSection(ctx, kind) reads ctx.collectedSignals when present and keeps the DOM path for v1 (both call the same buildInPageSectionSignal).

Engine-level test packages/audit-engine/tests/inpage-sections-streaming-golden.test.ts: a one-page crawl stored in SQLite, run through runStreamingRules and the v1 pipeline. Fixture passes both rules with the section messages; thin About is info; a stray id with no fragment link warns; crawl/single-page-site fires with 3 sections (it already did on main). Verified: on origin/main code the fixture and thin tests fail on the streaming path, with the fix all 4 pass.

Gates: --run rules 8090 pass; all 22 audit-engine *golden* tests pass by path in groups (the combined --run audit-engine died with exit 143 / 70 under the lock wrapper twice, with no failing test; golden-baseline passes alone, 6 pass); rules and audit-engine typecheck; make validate. Manual: CLI from this branch (bun run src/cli.ts) on the one-page fixture with the two rules: passed 2, warnings 0.

Squirrelscan agent skill: no change.

…e so the streaming engine sees them #1236

Signed-off-by: Nik Cubrilovic <[email protected]>
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown

Review of #1237. The fix is sound and the engine-level test is the right kind of test. I read the diff and the code around it; I did not run the tests.

  • (medium) packages/rules/src/shared/inpage-section.ts findInPageSection: a cached streaming snapshot from before this change has no inPageSections on any page, and rec.inPageSections?.[kind] treats that as "no section". eeat/about-page and eeat/contact-page then warn "No About page found" on a one-page site, which is the false positive this PR fixes. links/broken-anchors.ts:118 handles the same case: when every record's field is undefined, it reports "skipped" and asks for a re-run with --refresh. The JSDoc on the new field says an absent value reads as none, which is the opposite. Either do the same check here or confirm that old snapshots cannot reach the site pass. I did not trace how stored crawls are reloaded.
  • (low) packages/rules/src/collected-signals.ts: the extractor is timed under "eeat/about-page", but the record also serves eeat/contact-page. If it exceeds the budget, only the About rule is told it timed out. The Contact rule sees an empty value and reports a missing Contact page with no timeout note.
  • (low) buildInPageSectionSignal reruns the a[href^='#'] and [id] scans for every page. Fragment links are capped at 500, but the [id] scan over querySelectorAll is not capped. Bounded by the rule budget and probably fine, but a hostile page with a huge number of ids is worth a cap.
  • (nit) In about-page.ts and contact-page.ts, EEAT_PAGE_PATTERNS is still used elsewhere in both files, so the import stays. No action needed.
  • (nit) The tests cover pass, thin, and stray-id cases. Add a case for a page with no # links, and a case for a legacy record without inPageSections (see the first finding).

I also checked the following:

  • CHANGELOG entry present.
  • v1 and streaming paths share buildInPageSectionSignal.
  • No DOM retained.

I found no critical or high issues.

@nc9

nc9 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Round 1. Medium: a one-page site on a legacy collected snapshot (no inPageSections on any page) is now skipped with the --refresh hint, as links/broken-anchors does; multi-page sites keep the plain warning; unit tests for both. Low: a timeout is reported against both rules; the [id] scan is capped at 5000 elements. Nit: added a no-# links case and the legacy-record cases.

@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown

Reviewed the diff. The fix is sound: the section signal is collected while the DOM is live, v1 and streaming share buildInPageSectionSignal, and the engine-level test exercises both paths. The --refresh flag exists in the audit command.

  • (low) collected-signals.ts: when the in-page extractor times out, eeat/contact-page is added to timedOutRuleIds but timedOutElapsedMs only has an entry for eeat/about-page. Copy the elapsed value over if consumers expect one per id.
  • (nit) buildInPageSectionSignal checks out.about && out.contact after reading withIds[i]. Moving the check to the top of the loop body is slightly clearer.
  • (nit) inPageSectionsUnmeasured only skips when pages.length === 1, which is intentional. A short comment saying so would help, because a multi-page legacy cache still warns as before (the test covers this).
  • (nit) Per the AGENTS.md rule-change checklist, confirm template-verdict-inputs.test.ts and rule-verdict-scope.test.ts still pass. The PR description lists --run rules as passing, which should cover them.

No blocking issues.

@nc9
nc9 merged commit b107314 into main Oct 28, 2026
15 checks passed
@nc9
nc9 deleted the fix/inpage-section-streaming-1236 branch October 28, 2026 13:07
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.

eeat/about-page and contact-page: in-page section fix (#1208) has no effect in the streaming engine; site rules get no DOM

1 participant