Skip to content

feat(action-center): say what sets the brand's winning pages apart from its other pages (learning C4) - #1742

Merged
gkhngyk merged 20 commits into
ansvisor:mainfrom
cihan-gyk:feature/winning-page-features
Oct 29, 2026
Merged

gkhngyk merged 20 commits into
ansvisor:mainfrom
cihan-gyk:feature/winning-page-features

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Learning roadmap C4: say what sets the brand's winning pages apart from its other pages, so "scale what works" has something concrete to scale.

Stacked on #1720 (C1 UI: competitor page features, itself on #1718). Review the last commit; merge after #1720.

G14 (AI landing pages converting well) and G10 (prompts rising) point at pages that already work, but nothing said what those pages have that the brand's other pages don't. A new automatic task, analyze_winning_pages ("Find what sets your winning pages apart"), compares them through Site Audit's own checks (page-features.js):

  • Winning pages (at most 3): G14's landing pages (an Analytics path resolved on the brand's primary domain), or G10's own pages that its prompts' answers cited in the last two weeks (citedPages gains an own flag).
  • The brand's other pages: read from their Site Audits only (audit_signal_results), never fetched. Up to 30 audited in the last 90 days, newest first.
  • A winning page without a recent audit is read like a page AI answers cite. It uses C1's reader, now readPages in competitor-pages.js and shared with C1, so it counts toward the same perBrandPerDay limit (12 reads a day), as action-engine.js' winningPages comment says. Only the check results are stored (cited_page_features, own = true); page text never is.
  • Result:
    • the checks at least half the winners pass and at most half the other pages do, widest gap first (na results don't count);
    • up to five other pages missing the most of them.
  • Not enough to compare: with fewer than three other pages audited, the task stays a person's with the reason ("audit more pages") and retries after seven days (too_few_audited; also no_winner and winner_unreadable).
  • Who gets it: the task requires site_audits, so a brand without audits doesn't get it. G10 and G14 move to version 2. Tasks are planned when an action opens, so actions already open keep their tasks and only new ones get this one. The task library holds 63 primitives (the spec's 62 and this one).
  • Drawer: the findings show on the task, in the same design as C1's (WinningFindingsView). Strings are in en.json; only theme tokens are used.

No migration. Learning stays within the brand: the comparison uses only the brand's own pages (privacy rule).

Related issue

None (learning roadmap C4).

Type of change

  • feat — New feature

How to test

  1. On a brand with Site Audits of at least 3 pages in the last 90 days, open a new "Scale Proven AI Landing Pages" (G14) or "Strengthen Emerging Content" (G10) action.
  2. After the night engine runs, open the action's drawer › "Find what sets your winning pages apart". You should see the patterns (e.g. "FAQ schema — winning pages 2 of 2, your other pages 1 of 12"), the winning pages (from their Site Audit or read for this task), and the other pages missing most of them.
  3. With fewer than 3 audited pages: the task says to audit more pages and stays open.
  4. An action opened before this change keeps its old task list.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • Server: npm run format, npm run lint, npm test pass (282/282 files)
  • Web: yarn format, yarn lint (0 errors), yarn typecheck, yarn test (557/557 files) and yarn build pass
  • Tests added (winning-pages.test.js, winning-findings.test.ts, task-detail.test.tsx)
  • The embed guard from test(web): fail on an embed between twice-joined tables that doesn't name its foreign key #1714 passes on this branch
  • Docs updated (docs/guides/action-center.mdx)
  • Browser check: needs a G10/G14 action carrying this task's output on a database; left for the batched local test

🤖 Generated with Claude Code

cihan-gyk and others added 16 commits October 28, 2026 10:15
…y what they have that the brand's page doesn't

Learning C1, part 1 (server). "Analyze competitor content" was a step for
a person: nothing looked at the pages AI engines cite where the brand isn't
named, so "why do they win?" went unanswered.

- competitor-pages.js: from the brand's own tracked answers for the
  action's prompts over 14 days, the competitors' most cited pages, then
  pages cited where the brand isn't named (3 an action), and the brand's
  own page cited there. Each is read free (safe-fetch, public addresses
  only, never Scrape.do) and run through Site Audit's checks that read the
  page alone (15: structure, FAQ, schema, statistics, dates, length…). The
  result: each page's passing checks and the checks at least half the
  competitor pages pass that the brand's page doesn't.
- 00369 cited_page_features: the checks' statuses and word count per brand
  and page, never the page's text; reused for 14 days; a brand reads at
  most 12 pages a day (config competitorPages). Service role only; applied
  on the dev DB.
- The task gets the tool competitor_page_features, so the nightly runner
  carries it out (reading a public page changes nothing, no approval). A
  run with every read for the day spent leaves the task for the next night
  (retryLater: recorded as blocked, task untouched).
- No AI summary, no paid scraping (user decision 2). The guide says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…etitor pages AI cites have that yours doesn't

Learning C1, part 2 (web). The task now carries what the nightly read found
(part 1); the action drawer shows it when the task is opened.

- Task rows read `output`; Analyze competitor content's is parsed
  defensively (competitor-findings.ts: pages read, the brand's page, the
  gaps, pages left for tomorrow, why nothing was compared).
- TaskDetailView shows "What the pages AI cites instead of yours have":
  each gap as "FAQ schema — on 2 of 3 of their pages, not on yours" (the
  check's name as Site Audit's rubric gives it), the pages read with their
  words and how many answers cited them, the brand's page, and a note that
  only what the checks found is kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… there is nothing to compare, and read every page of an action the same night

Review fixes before the PR (learning C1, server):

- An action that names no prompts (8 of the 9 plans with this task) reads
  its topics' prompts (topicPromptIds, shared with basket-metrics), else
  the brand's tracked prompts (at most 50), instead of ending on
  "no_prompts".
- No prompts, no page cited, or none readable no longer completes the
  task: ReadLaterError carries why as the task's output and retryDays (7);
  runTask keeps it on the open task with retryAfter, and the nightly sweep
  passes the task over until then without it taking a place under the
  ceiling.
- An action's pages are all read the same night or none: with fewer reads
  left than pages to read, nothing is read and the task waits for the next
  night. No more partial runs ("capped" is gone).
- yourPageStatus says whether the brand's page was read, not cited, or
  couldn't be read.
- A page with under 500 characters of text (a consent wall, a page drawn
  by script) is unreadable.
- An unreadable page is kept as { unreadable: true }: it counts against the
  day's reads and isn't read again while fresh. A row that can't be written
  is logged, not counted as unreadable.
- Gaps need at least two competitor pages ("compared"); a check is a gap on
  at least half of them.
- robots.txt: a site whose robots.txt shuts AnsvisorBot (or every crawler)
  out of the whole site isn't read, nor one whose robots.txt can't be read
  (RFC 9309); path rules aren't read yet (robotsGroups).
- 00369: the unreadable row shape in a comment (no schema change).
- The guide: the task is carried out by Ansvisor, not waiting for
  approval; what it reads, the two-page minimum, robots.txt and the weekly
  retry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…f theirs is too few, or yours couldn't be read

Review fixes before the PR (learning C1, web), after the server's:

- The "N more pages wait for tomorrow's reads" line is gone: an action's
  pages are now read the same night or not at all, so nothing is capped.
- With one competitor page read, the task says it takes at least two to
  compare, instead of "Your page passes…".
- The brand's page that couldn't be read says so, rather than "None of
  your pages was cited".
- "at least half of their pages" in the no-gap line, as the server counts;
  the no-prompts and none-cited reasons say what they now mean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s without Supabase

FEATURE_CHECKS, pageContext, pageFeatures, featureGaps and
MIN_PAGE_CHARACTERS move from competitor-pages.js to page-features.js,
which reads no database. competitor-pages.js loads the supabase admin
client, whose config exits when the SUPABASE_* env is absent (as in CI),
so a pure module that needs only the checks (the brief, Improve) would
take every test file reaching it down with it. competitor-pages.js
re-exports them, so its imports keep working; their tests move next to
the new module, with no supabase mock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…page-features

# Conflicts:
#	supabase/schema.sql
…om its other pages (learning C4)

G14 (AI landing pages converting well) and G10 (prompts rising) point at
pages that already work; nothing said what they have that the brand's
other pages don't. A new automatic task, analyze_winning_pages ("Find
what sets your winning pages apart"), compares them through Site Audit's
own checks (page-features.js) with the brand's other pages audited in the
last 90 days:

- winning pages: G14's landing pages (an Analytics path on the brand's
  primary domain), or G10's own pages its prompts' answers cited in the
  last two weeks; at most three;
- the other pages are read from their audits only (audit_signal_results),
  never fetched; at most 30, newest audit first;
- a winning page without a recent audit is read like a page AI answers
  cite: competitor-pages.js's reader, now readPages, shared with C1 and
  within the same perBrandPerDay (12) reads a day;
- the result: the checks most winners pass and most other pages don't,
  widest gap first, and up to five other pages missing the most of them.
  Fewer than three other pages audited: the task stays a person's with
  the reason and tries again after seven days.

The task requires site_audits, so a brand without audits doesn't get it.
G10 and G14 move to version 2: tasks are planned when an action opens,
so actions already open keep theirs and new ones get the task. The task
library holds 63 primitives (the spec's 62 and this one). No migration.
The Action Center drawer shows the findings on the task, as C1's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 384f504.

Approve preview

@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 29, 2026
A page of tens of thousands of empty elements held the server for a
minute: removing scripts and styles before reading the text spliced
each out of its parent, and readability's block find was quadratic in
the elements it started from. Both are now one walk over the page,
with the same words and blocks as before.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This PR's own diff needs no change. take-1742 (753a5b6) is this head da95831 with take-1720 merged in (#1718's fix). Merge it after #1720. It doesn't depend on #1723/#1724, and the two lines merge clean together.

What I checked:

  • Reads. The brand's other pages come from their completed Site Audits only (site_audits → audit_signal_results), never fetched. A winning page without an audit is read through readPages, within the same 12 reads a day, with robots.txt and safe-fetch as in #1718. At most 3 winners, 30 others and 300 audits are read. The in over audit ids holds at most 33 ids, and the rows they return (at most 33 × 15) stay under the 1,000-row cap.
  • Refactor. readPages and scopePromptIds moved out of analyzeCompetitorPages without changing its behaviour. The competitor-pages tests are unchanged and pass.
  • Task registry. G10 and G14 gain analyze_winning_pages, so only new actions get it, as the docs say. plan.test.js covers it.
  • No AI, no page text. The findings are check keys, counts and URLs.
  • Web. parseWinningFindings keeps only http(s) URLs for links, and every reason code has its English line.
  • Embeds. None added.
  • Tests. winning-pages.test.js and plan.test.js pass in the full server run on main merged with the stack. task-detail.test.tsx and winning-findings.test.ts pass, web tsc is clean, and subscription-guard-coverage.test.ts passes.
  • Merge. Clean on main 72f602f.

Follow-up:

  1. "Find what sets your winning pages apart" (the docs and the task title) and "Analyze your winning pages" (the config comment) name one task two ways. Worth one name.

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 29, 2026
@gkhngyk
gkhngyk merged commit e71d2c7 into ansvisor:main Oct 29, 2026
5 of 6 checks passed
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