Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(action-center): leave what changes by itself out of a page's change, and take a bigger one to pass (#1679)

Cihane9d40217f802
diff --git a/docs/guides/action-center.mdx b/docs/guides/action-center.mdx
index 557937338..782b06875 100644
--- a/docs/guides/action-center.mdx
+++ b/docs/guides/action-center.mdx
@@ -89,7 +89,7 @@ A task checked **Automatic** is checked on its page, fetched again (up to 200 ta
- **Publishing:** the page answers where it wasn't before. A page already live at the first check passes once it changes.
- **Structured data:** the audit checks that raised the action now pass on the page, such as a FAQ schema with at least two questions. When the action was raised by another check (the brand's entity, say), the page's structured data must be valid, after a check found it wasn't: a page that had valid structured data all along says so, and you mark the task done once it's fixed.
- **Crawler access:** robots.txt lets the AI crawlers in, and the page isn't noindex. Only when the audit raised it; a page found uncrawled in the bot logs isn't checked here.
-- **Optimizing, refreshing:** the page has changed since it was first checked, by more than a date, a price or a rotating quote moving. On a short page that takes more than a few words.
+- **Optimizing, refreshing:** the page has changed since it was first checked, by more than a date, a price or a rotating quote moving. On a short page that takes more than a new short review: about a rewritten paragraph. A sidebar, testimonials, the latest or popular posts and similar blocks that change by themselves aren't counted.
- **A task written with its new text:** that text is on the page, and the text it replaces is gone.
Only pages on the brand's own site are read. One that passes is completed by itself, and History says so; one that doesn't shows **Last check** with what is still missing. A task you reopen after it passed stays open: its checks still show what they find, the nightly check leaves it, and the call is yours. Site Audit fixes are checked by your next audit.
diff --git a/server/src/lib/action-center/task-checks.js b/server/src/lib/action-center/task-checks.js
index 20922b821..387020baf 100644
--- a/server/src/lib/action-center/task-checks.js
+++ b/server/src/lib/action-center/task-checks.js
@@ -34,7 +34,7 @@ import supabaseAdmin from '../../config/supabase.js';
import { logger } from '../logger.js';
import { fetchPage } from '../safe-fetch.js';
import { checkShoppingDraft } from '../shopping-check.js';
-import { furnitureNamed } from '../page-content.js';
+import { classIdWords, furnitureNamed } from '../page-content.js';
import { onBrandDomain } from '../audit/host.js';
import { aiBotAccess } from '../audit/signals/trust.js';
import {
@@ -79,9 +79,53 @@ export const CHANGED_BELOW = 0.9;
/**
* …and at least this many of its runs changed: on a short page a date and
* a price moving are a large share, never this many runs (each word is in
- * up to four).
+ * up to four). A rotated 28-word testimonial or a new 50-word review is
+ * 41–66; a rewritten 60-word paragraph 117 or more, a 150-word FAQ 146.
*/
-export const MIN_CHANGED_RUNS = 40;
+export const MIN_CHANGED_RUNS = 80;
+/**
+ * Words in a block's class or id that name what changes by itself (a
+ * sidebar, testimonials, the latest posts): left out of the words a change
+ * is measured on, as furniture is, unless they hold most of the page. Not
+ * left out of the words a written task's text is looked for in. "widget"
+ * and "popular" alone aren't such words: Elementor and HubSpot name each of
+ * the page's blocks a widget, and a pricing page its "Most popular" plan.
+ */
+const SELF_CHANGING = new Set([
+ 'sidebar',
+ 'promo',
+ 'announcement',
+ 'pagination',
+ 'tags',
+ 'testimonial',
+ 'testimonials',
+ 'latest',
+ 'recent',
+ 'trending',
+]);
+/** …and two words, one after the other, that do: a theme's widget area, a popular posts list. */
+const SELF_CHANGING_PAIRS = new Set([
+ 'widget area',
+ 'widgets area',
+ 'footer widgets',
+ 'popular posts',
+ 'popular post',
+ 'popular articles',
+]);
+
+/** Whether an element's class or id names what changes by itself. */
+function selfChanging(attribs) {
+ const names = classIdWords(attribs);
+ return names.some(
+ (word, i) => SELF_CHANGING.has(word) || SELF_CHANGING_PAIRS.has(`${word} ${names[i + 1]}`),
+ );
+}
+/**
+ * The way a sketch reads a page. A first look kept by another (before
+ * SELF_CHANGING was left out, 2026-10-28) isn't compared: the page gets a
+ * new first look, so a block left out now doesn't read as the change.
+ */
+export const SKETCH_VERSION = 2;
/** The 4-word runs' hashes a sketch keeps, the smallest: about 2.5 KB. */
const SKETCH_SIZE = 256;
/** A page with fewer visible words than this isn't read: an empty shell, or bot protection's page. */
@@ -232,12 +276,14 @@ function textLengths(start) {
* A block left out as furniture, or a form, that holds most of the body's
* words is the page (an <article class="category-social-media">, a page in
* one <form>), and is read. Two passes over the body, as stacks: linear on
- * any page, never out of stack.
+ * any page, never out of stack. With `steady`, what changes by itself
+ * (selfChanging) is left out too: the words a change is measured on.
*
* @param {string} html
* @param {import('cheerio').CheerioAPI} [$] the page, when it is parsed already
+ * @param {{ steady?: boolean }} [opts]
*/
-export function visibleText(html, $ = loadPage(html)) {
+export function visibleText(html, $ = loadPage(html), { steady = false } = {}) {
const head = [$('title').first().text(), $('meta[name="description"]').attr('content')];
const start = $('body')[0] ?? $.root()[0];
if (!start) return head.filter(Boolean).join(' ');
@@ -252,7 +298,10 @@ export function visibleText(html, $ = loadPage(html)) {
continue;
}
if (node.type !== 'tag' || CODE.has(node.name)) continue;
- const aside = AROUND.has(node.name) || furnitureNamed(node.attribs);
+ const aside =
+ AROUND.has(node.name) ||
+ furnitureNamed(node.attribs) ||
+ (steady && selfChanging(node.attribs));
if (aside && (lengths.get(node) ?? 0) <= most) continue;
// A block's words start and end with it: "Pricing" and "Plans" never run together.
out.push(' ');
@@ -276,7 +325,7 @@ export function sketch(visible) {
const seen = new Set();
for (let i = 0; i + 4 <= w.length; i += 1)
seen.add(hash(`${w[i]} ${w[i + 1]} ${w[i + 2]} ${w[i + 3]}`));
- return { hashes: [...seen].sort().slice(0, SKETCH_SIZE), runs: seen.size };
+ return { hashes: [...seen].sort().slice(0, SKETCH_SIZE), runs: seen.size, v: SKETCH_VERSION };
}
/** The share two pages' 4-word runs have in common, estimated from their sketches. */
@@ -313,7 +362,12 @@ export function changedRuns(first, now) {
function changedSince(previous, url, visible) {
const now = sketch(visible);
const first = previous?.sketch;
- if (!Array.isArray(first?.hashes) || !Number.isFinite(first?.runs) || previous.url !== url) {
+ if (
+ !Array.isArray(first?.hashes) ||
+ !Number.isFinite(first?.runs) ||
+ first.v !== SKETCH_VERSION ||
+ previous.url !== url
+ ) {
return { passed: false, missing: ['first_look'], sketch: now };
}
const changed =
@@ -429,14 +483,16 @@ export async function checkPage(
}
return { passed: true, missing: [] };
}
+ // A change is measured without what changes by itself.
+ const steady = () => visibleText(page.html, $, { steady: true });
if (kind === 'published') {
// Not there before, never seen live, and answers now: published.
if (previous?.wasMissing && !previous.sketch && previous.url === url) {
return { passed: true, missing: [] };
}
- return changedSince(previous, url, visible);
+ return changedSince(previous, url, steady());
}
- if (kind === 'changed') return changedSince(previous, url, visible);
+ if (kind === 'changed') return changedSince(previous, url, steady());
return null;
}
diff --git a/server/src/lib/action-center/task-checks.test.js b/server/src/lib/action-center/task-checks.test.js
index bf99fcfea..7f40b2b22 100644
--- a/server/src/lib/action-center/task-checks.test.js
+++ b/server/src/lib/action-center/task-checks.test.js
@@ -56,6 +56,7 @@ vi.mock('../shopping-check.js', () => ({ checkShoppingDraft }));
const {
CHANGED_BELOW,
MIN_CHANGED_RUNS,
+ SKETCH_VERSION,
SWEEP_PER_BRAND,
changedRuns,
checkKind,
@@ -389,6 +390,96 @@ describe('checkPage', () => {
expect(moved).toMatchObject({ passed: false, missing: ['not_changed'] });
});
+ describe('what changes by itself (#1565 A)', () => {
+ const run = (prefix, n) => Array.from({ length: n }, (_, i) => `${prefix}${i}`).join(' ');
+ const block = (attrs, prefix, n) => `<div ${attrs}><p>${run(prefix, n)}</p></div>`;
+ /** A 200-word page, with its testimonials and its latest posts. */
+ const page = (quotes, posts, extra = '', body = essay(200)) =>
+ `<html><head><title>Pricing</title></head><body><main><h1>Pricing</h1><p>${body}</p>` +
+ `${block('class="testimonials"', quotes, 28)}${extra}</main>` +
+ `${block('id="sidebar" class="latest-posts"', posts, 30)}</body></html>`;
+ const look = (body, previous = null) =>
+ checkPage('changed', PAGE, { previous, fetch: fetchOf({ [PAGE]: body }) });
+
+ it('never passes a testimonial rotated, the latest posts moved on, or a new short review', async () => {
+ const first = await look(page('quoteA', 'postA'));
+ const kept = { ...first, url: PAGE };
+ expect(await look(page('quoteB', 'postB'), kept)).toMatchObject({
+ passed: false,
+ missing: ['not_changed'],
+ });
+ // A 50-word review in a block of its own: fewer than MIN_CHANGED_RUNS runs.
+ expect(
+ await look(page('quoteA', 'postA', `<p>${run('review', 50)}</p>`), kept),
+ ).toMatchObject({ passed: false, missing: ['not_changed'] });
+ });
+
+ it('passes a rewritten 60-word paragraph on the same short page', async () => {
+ const first = await look(page('quoteA', 'postA'));
+ const rewritten = essay(
+ 200,
+ Object.fromEntries(Array.from({ length: 60 }, (_, i) => [70 + i, `new${i}`])),
+ );
+ expect(
+ (await look(page('quoteA', 'postA', '', rewritten), { ...first, url: PAGE })).passed,
+ ).toBe(true);
+ });
+
+ it('still finds a written task’s text in a testimonial', async () => {
+ const fetch = fetchOf({ [PAGE]: page('quoteA', 'postA') });
+ expect(await checkPage('text', PAGE, { after: 'quoteA3 quoteA4', fetch })).toMatchObject({
+ passed: true,
+ });
+ });
+
+ it.each([
+ [
+ 'Elementor',
+ '<div class="elementor-widget-wrap">',
+ (text) =>
+ `<div class="elementor-element elementor-widget elementor-widget-text-editor">` +
+ `<div class="elementor-widget-container"><p>${text}</p></div></div>`,
+ ],
+ [
+ 'HubSpot',
+ '<div class="row-fluid">',
+ (text) =>
+ `<div class="span12 widget-span widget-type-rich_text">` +
+ `<div class="cell-wrapper"><p>${text}</p></div></div>`,
+ ],
+ ])('passes a %s page rewritten in its widgets', async (_, wrap, widget) => {
+ const built = (prefix) =>
+ `<html><head><title>Pricing</title></head><body>${wrap}` +
+ `${[0, 1, 2, 3].map((i) => widget(run(`${prefix}${i}x`, 50))).join('')}</div></body></html>`;
+ const first = await look(built('old'));
+ expect((await look(built('new'), { ...first, url: PAGE })).passed).toBe(true);
+ });
+
+ it('counts a pricing page’s “Most popular” plan, and still leaves out a sidebar', () => {
+ const read = visibleText(
+ `<html><body><main><h1>Pricing</h1><div class="plan popular"><p>Growth plan words</p></div>` +
+ `<p>${FILLER}</p></main><aside class="sidebar"><p>Sidebar words</p></aside>` +
+ `<div class="widget-area"><p>Widget area words</p></div>` +
+ `<div class="popular-posts"><p>Popular posts words</p></div></body></html>`,
+ undefined,
+ { steady: true },
+ );
+ expect(read).toContain('Growth plan words');
+ expect(read).not.toContain('Sidebar words');
+ expect(read).not.toContain('Widget area words');
+ expect(read).not.toContain('Popular posts words');
+ });
+
+ it('takes a new first look over one kept before these were left out', async () => {
+ const first = await look(page('quoteA', 'postA'));
+ expect(first.sketch.v).toBe(SKETCH_VERSION);
+ const { hashes, runs } = first.sketch;
+ const again = await look(page('quoteA', 'postA'), { url: PAGE, sketch: { hashes, runs } });
+ expect(again).toMatchObject({ passed: false, missing: ['first_look'] });
+ expect(again.sketch.v).toBe(SKETCH_VERSION);
+ });
+ });
+
it('reads a page with too few words as no answer: an empty shell, or bot protection’s', async () => {
const empty =
'<html><head><title>Just a moment</title></head><body><p>Checking your browser</p></body></html>';
diff --git a/server/src/lib/page-content.js b/server/src/lib/page-content.js
index 226859138..c92569a6e 100644
--- a/server/src/lib/page-content.js
+++ b/server/src/lib/page-content.js
@@ -173,13 +173,18 @@ function wordsOf($el) {
return nameWords($el.attr('class'), $el.attr('id'));
}
+/** An element's class and id, as lower-case words, from its attributes. */
+export function classIdWords(attribs = {}) {
+ return nameWords(attribs.class, attribs.id);
+}
+
/**
* Whether an element's class or id names furniture anywhere on a page
* (author box, share buttons, related posts, ads…), from its attributes:
* the Action Center's page checks read a page's words without it.
*/
export function furnitureNamed(attribs = {}) {
- return nameWords(attribs.class, attribs.id).some((word) => FURNITURE_WORDS.has(word));
+ return classIdWords(attribs).some((word) => FURNITURE_WORDS.has(word));
}
function named($el, words) {