Repository navigation
fix(audit): keep AI recommendations to page facts and 150-character copy - #1132
Conversation
Site Audit recommendations could invent customers, percentages and prices (e.g. "Join brands like TechFlow, which saw a 34% increase…"), which a user might paste onto their site as false claims. - The prompt now allows only facts from the page or the brand data (name, description, domains — sent only for pages on the brand's own domains) and asks for [placeholders] otherwise, a one-sentence explanation of at most 150 characters and draft sentences of at most 150 characters. - JSON-LD/HTML moves to its own `code` field, exempt from the length rule. - recommendation-guard.js checks the output before saving: numbers, percentages, prices, dates and company names the page and brand data don't contain become placeholders; over-long items get one rewrite, then a cut at a word boundary. Counts are logged per audit. - The report highlights placeholders, shows code in its own copy block and notes "Replace placeholders in [brackets] with your real data before publishing." Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@gkhngyk This is SA-001 from the Site Audit v2 spec: recommendations keep to page and brand facts (placeholders otherwise) and to 150 characters per sentence. The local install has no model or Scrape.do key, so it's covered by unit tests and a sample audit row only. Could you run one live audit of a pricing page on a configured environment and check the recommendations and the |
gkhngyk
left a comment
There was a problem hiding this comment.
Rebuilt on main: server tests (recommendation guard, recommendations, host), the audit report tests, typecheck, lint and format pass, and CI is green.
The rewrite of over-long items is one batched call per audit, and a failed rewrite falls back to the word-boundary cut, so it can't block an audit from completing. Brand facts reach the prompt only for pages on the brand's own domains (onBrandDomain), so a competitor page's recommendations can't borrow the brand's name or description.
Summary
Site Audit recommendations no longer invent facts, and their copy stays under 150 characters per sentence. This is SA-001 of the Site Audit v2 spec.
The bug: a pricing-page audit suggested "Join brands like TechFlow, which saw a 34% increase in 'Recommended' citations…" and Product schema with guessed prices. If a customer pasted that onto their site, it would publish false claims under their brand.
Prompt (
server/src/lib/audit/recommendations.js)[customer name],[real metric],[price],[date]or[source URL]instead.brandFactsFor,host.jsonBrandDomain).codefield. It is exempt from the length rule but uses the same placeholders.Validator (
server/src/lib/audit/recommendation-guard.js)The output is checked before it is saved.
Report (
web/src/components/audit/audit-report.tsx)code, render as before.Not changed
Known limit
The validator checks what the spec lists: numbers, percentages, prices, dates and company names. Invented people, quotes and awards (e.g. "Written by Jane Smith") are forbidden by the prompt but not caught by the validator.
Related issue
None. Site Audit v2 spec, task SA-001.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
[audit] recommendation guard changed the model outputwith the counts.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no errors; the 7 warnings are in files this PR does not touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
server:npm run format,npm run lintandnpm test(1473) pass.recommendation-guard.test.js:recommendations.test.js:brandFactsForfor own vs other sites.host.test.js:onBrandDomain.web:yarn test(1252) andyarn buildpass.audit-report.test.tsxcovers the highlighting, the code block and the note.🤖 Generated with Claude Code