Skip to content

feat(content): check a page's prices against approved brand facts in Trust, with an Approve to-do (CE-047, part d) - #1465

Merged
gkhngyk merged 40 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-brand-facts-check
Oct 25, 2026
Merged

gkhngyk merged 40 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-brand-facts-check

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Quality Phase 2, CE-047 "Brand facts", part d: the check in the editor. It builds on #1458 (CE-045b) and part c (#1464), which are merged into it. Review those first.

Trust: "Consistent with brand facts" (10 points)

  • The page's prices, trial and founding year are compared with the brand's approved facts that are still on its site.
  • It is read so as never to cry wolf. A wrong warning on a right page is worse than none, so when in doubt it stays silent:
    • Plan prices. A price is compared with the plan named nearest it in the sentence, as the page writes the plan's name (case included).
      • A plan named with an everyday word ("Pro", "Team", "Free", "Growth") counts only beside "plan" or "tier", or in a sentence that names the brand. So "Pro tip: budget $100 a month" and "Our team spent $5,000" aren't read.
      • Any of the plan's approved prices counts, so "$39 billed annually" against "$49 monthly" is fine. "billed monthly/annually" narrows the comparison to that billing.
    • No plan named. Only a sentence that names the brand and says what it costs is read ("Ledgerly costs $29 a month"). There's no "we/our" path, so blog copy about ad budgets isn't read.
    • Currency and period. Same currency only, and the same period when the page gives one. Free ($0) is never compared.
    • Sentences left out. A sentence isn't read for prices when it has an old price, a saving, a discount, credits, tax or a team's bill ("was $49", "incl. VAT", "5 users pay $245"), or when it names a competitor. Scales ("$2M") and ranges ("$10–$20", "de 49 € à 99 €", "49 TL ile 99 TL") aren't prices.
    • Trial. Compared only where it is the brand's ("your free trial", "every plan", the brand's name), with its days right beside the trial. A "30-day money-back guarantee" or a clinical trial isn't read.
    • Founding year. Compared only right after "founded", with the brand named or "we were founded".
    • Each sentence is read once.
    • The review's false positives are pinned as "no mismatch" tests (20 sentences).
  • Like working links, this check doesn't score Trust on its own.

What the person sees

  • A mismatch is a suggestion: "Price differs from brand facts · Page $39 · pricing page $49" (the spec's line), with Show on its sentence. It is listed before Trust is scored too, like a broken link.
  • "Approve {n} brand facts" is the person's to-do while facts wait. It comes last, because it is the brand's and worth no points on its own. Review links to Brand settings › Brand facts, from the to-do row and the next-step nudge (which used to send any unknown action to Settings › Authors).
  • useBrandFacts reads the facts once with phase 2, and again when the tab comes back from Brand settings. The next-step reads wait for it.

Related issue

Quality spec (Drive), Phase 2, CE-047 (part d). Builds on #1458 and #1464.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. With parts a–c and phase 2 on, approve "Pro $49 per month" for a brand in Brand settings › Brand facts.
  2. In a draft of that brand, write "The Pro plan costs $59 per month." Quality › Trust says "Price differs from brand facts · Page $59 · pricing page $49", and Show goes to the sentence.
  3. Write "Northwind Pro costs $29 per month." (a competitor) or "€45 per month": no mismatch.
  4. With a fact still waiting, Your to-dos says "Approve 1 brand fact". Review opens Brand settings › Brand facts.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Web: yarn format, yarn lint, yarn typecheck, yarn test (3,620 tests) and yarn build pass. A pre-push review's points are in. A browser check is owed and batched.

Follow-up: the competitor guard reads competitors' domains only. Passing their names too (e.g. "Profound" for tryprofound.com) needs the sources read to carry them.

🤖 Generated with Claude Code

cihan-gyk and others added 30 commits October 24, 2026 13:18
…he weak ones (CE-046, part a)

Quality phase 2 (NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2), by rules only:

- sourceClass(): primary (official, research, standards), secondary (news,
  reviews, Wikipedia), weak (forums, social posts, uploaded papers), a
  competitor's page (primary on a comparison) or the brand's own; an
  address the rules can't place is left out (an AI read comes in part b)
- Trust's primarySources (15) and noWeakSources (10); two placed sources
  score Trust on their own
- Quality suggests replacing weak sources (Show, Keep) and adding a
  primary one, once Trust is scored; the editor underlines weak sources
  in amber (a decoration: never exported)
- 00263: content_drafts.kept_sources (≤ 50) and content_draft_keep_source()
- byUrl keeps a link's first place, so Show goes there

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… with AI (CE-046, part b)

Quality phase 2 (web NEXT_PUBLIC_CONTENT_QUALITY_PHASE and server
CONTENT_QUALITY_PHASE at 2):

- POST /api/content-pages/source-classes reads the sites a draft links
  (as saved) that the editor's rules can't place: the model sees each
  site's address alone and answers primary, secondary or weak; each read
  is kept for every workspace 90 days (00264 content_source_classes); 20
  sites a read, 30 reads a draft a day, its own rate limit
- the reads draw on the AI budget as their own feature, "quality" (00264
  widens prompt_improve_usage.feature): a small hold (holdUsd), left out
  of the median that sizes other calls' holds and the Improve tab's
  estimate; a read cut off by its timeout keeps its hold; Billing lists it
- the editor asks 3 s after a save (useSourceClasses), Trust takes the
  reads for sites the rules can't place, the weak-sources suggestion is
  tagged "AI check", and a spent budget pauses the reads with a note

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rce-classes-ai

# Conflicts:
#	supabase/schema.sql
#	web/messages/en.json
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
#	web/src/lib/actions/content-drafts.test.ts
#	web/src/lib/content/quality-checks.test.ts
#	web/src/lib/content/quality-checks.ts
#	web/src/lib/content/source-class.ts
#	web/src/types/supabase.ts
…a day, and skip kept sources (CE-046, part b review)

- SITE_NAME (LDH, a dot, a letter TLD; no IP, no single label) in
  keptSite/linkedSites, the editor's unplacedSites and 00264's check; a
  label that reads as words isn't asked about either
- the model may answer unknown, which Trust leaves out; it, and a site
  the model left out, is kept a day, so it isn't asked again (and
  charged) after every save
- a site whose every link the person kept isn't asked about (route and
  editor); a kept link counts in Trust with or without a read
- a failed classifyDraftSources call lets its sites go (.catch/.finally)
- .env.example: phase 2 turns the AI source reads on, from the AI budget

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rce-classes-ai

# Conflicts:
#	supabase/schema.sql
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
…ept by the paragraph (CE-045, part a)

Quality phase 2 (CONTENT_QUALITY_PHASE at 2), server side:

- POST /api/content-pages/claims reads the draft as saved: each paragraph
  and list item long enough to hold a claim; the model finds what a reader
  would want a source for (number, stat, superlative, fact), each claim in
  the paragraph's own words or dropped, five a paragraph at most
- 00266 content_quality_claims keeps the reads by draft and paragraph
  hash: an unchanged paragraph isn't read again, a removed one's row goes;
  the paragraph being written (skip) waits; 12 paragraphs a call, 2 calls
  an ask, one after the other
- the calls draw on the AI budget as "quality" (holdUsd 0.004), and share
  one day's cap per draft with the source kinds' reads
  (content-quality-calls.js, QUALITY_CALLS_PER_DAY 60)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s too, and keep a missed answer as read (CE-045, part a review)

- draftParagraphs reads p, li, blockquote, td and th as trustBlocks does,
  with ownText's spacing (a line break, sibling paragraphs): the answer is
  { paragraphs: [{ text, claims }] }, so the editor knows each claim's block
- blocks from 12 characters ("Award-winning support"); a call takes 12
  paragraphs or 6,000 characters, whichever comes first
- an answer billed that missed the schema is charged and its paragraphs
  read with none (not sent, and charged, on every save); a kind the editor
  doesn't know drops that claim only; a paragraph answered twice keeps both
- claims leave 10 of the day's Quality calls to the sources' kinds, and the
  route has its own limiter; the reading's version is in the hash; logs
  carry no page words

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…underline the unsourced ones (CE-045, part b)

The editor asks the API for the claims a few seconds after a save (never
with changes to save), leaving the block being written until the person
leaves it. Trust counts each claim in its own block as a figure, the
draft underlines the unsourced ones in their blocks, and Quality's
suggestion gets Add source (link dialog on the claim's words) and Remove.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… per site (CE-046, part b review)

One generateObject per site the rules can't place, run together with
Promise.allSettled: no site's name reaches another's read, and a failed
site keeps the others' reads. Each read holds $0.0005; the day's cap
counts sites (SOURCE_READS_PER_DAY = 40). An answer off the schema is
charged and kept as unknown for a day. The route logs an error's name
and message only.

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

# Conflicts:
#	server/src/lib/content-source-class.js
…tch claims across curly quotes, log no page words (CE-045, part a review)

- 00266 gets a `missed` column: an answer that missed the schema (cut
  short, or blocked by the provider's filter) keeps its paragraphs as read
  with no claims, and they're read again after MISSED_DAYS (1).
- keptClaims compares folded copies (’ ‘ → ', “ ” → ", ‐ ‑ – — → -),
  one character for one, and keeps the paragraph's own span.
- The claims route logs an error's name and message only: a provider's
  error carries the request, the page's paragraphs.
- QUALITY_CALLS_PER_DAY = 90, the claims leaving the sources'
  SOURCE_READS_PER_DAY (40) now that each site is a call: the claims keep
  their 50 calls a day.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d log no whole error (CE-046, part b review)

When no site is read, the error thrown is a spent budget's if any (429,
the editor pauses) rather than the first site's. An ask reads its sites
five at a time, so 20 holds and their queries don't go out at once. A
site's hold is $0.001 (the model's thinking is billed as output). The
route's error log keeps the stack, not the provider's request.

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

# Conflicts:
#	server/src/lib/content-source-class.js
…er the new ones, and fold more quote and dash forms (CE-045, part a review)

A paragraph whose answer missed the schema is read again after a day in
a call of its own, after the paragraphs not read yet: one the provider's
filter blocks no longer keeps its neighbours unread every day. The fold
also covers low quotes, primes, figure and horizontal-bar dashes and the
minus sign. The claims route keeps the error's stack in its log. Tests
pin the select's columns, both fold directions and the route's log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…roduct pages, kept for approval (00269, CE-047, part a)

Quality phase 2, CE-047: the brand's prices and plans, trial, founding
year and claims, read from its own site for Trust's "consistent with
brand facts" check. The model finds the facts and copies each one's
words; a fact is kept only when its words are on the page as written,
and its value (amount, currency, period, days, year) is read from them
by rule. A person approves each one.

- 00269: brand_facts (members read, and change only the status, as
  themselves) and brand_fact_pages (server-only: a hash of each page's
  text, so an unchanged page isn't read by the model again; no text
  kept).
- brand-facts.js: findFactPages (page list, Site trust's About page,
  else probes on the main domain; never Scrape.do), factText, keptFacts,
  refreshBrandFacts (new values pending, approved ones gone from the
  site marked gone, pending ones dropped), readBrandFacts (first ask
  reads, asking again every 10 minutes at most), setFactStatus.
- GET /api/brand-facts, POST /fetch, PATCH /:id behind phase 2, with
  their own limiter; logs carry no page text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…47, part c)

Brand settings › Brand facts, with Quality's phase 2: the facts the API
read from the brand's own pricing, About and product pages, each with
its words on the page, where it was read and the approved value it would
replace ("Was $59"). A member approves or rejects each one (no approve
all: the spec has each approved); approved facts no longer on the site
say so. Each page's read is listed (read, not found, turned our reader
away, didn't answer); Read again reads the site again once the API
allows it, and a spent AI budget says so. `?tab=facts` opens the tab,
for the editor's to-do to link to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… still has, and store no wrong price (CE-047, part a review)

- factText walks the page once and stops near MAX_TEXT_CHARS: a page of
  100k blocks reads in well under a second (was quadratic). Struck-through
  old prices (del, s, strike) are left out.
- A fact still on any page read (its words, a price's with its plan near
  them; across a card's lines too) stays; only facts whose page was read
  and has them no more are marked gone or dropped, written once.
- A plan's name is found on the folded text without lowering it (a
  Turkish "İ" lowers to two characters), and a quote only where it
  doesn't run into a number ("$49" in "$499", "$1,2").
- parsePrice reads one price only, no saving, discount or old price, a
  dollar named by its code after it ("$49 CAD"), and the period in the
  words right after it, the first named ("Lifetime access, monthly
  updates" is once). Magnitudes in any case; a trial needs a trial word,
  "started in" is no founding year.
- A page read after a wall or a failure says "ok" again; a missed
  answer's hash isn't kept past a failed read. A changed page goes to the
  model once an hour at most (MODEL_EVERY_MS). A page that failed (or a
  spent budget) is read again at the next ask after RECHECK_MS.
- Facts are written before the pages' hashes; source_url is cut to 2048.
- A listed page that no longer answers falls back to the usual
  addresses; a probe that is the home page again isn't read as one.
- readPage maps not-HTML, refused and redirect-loop reads to not_found;
  401/403/429 to blocked, 5xx to failed. setFactStatus answers 404 for a
  fact removed meanwhile.
- GET has no bucket of its own (the editor reads it as its tab comes
  back); POST /fetch keeps brandFactsLimiter.
- 00269: each kind's value checked (amount ≥ 0, currency, days, year),
  source_url http(s) only, a member's reviewed_at within a minute of now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Trust, with an Approve to-do (CE-047, part d)

Trust's "consistent with brand facts" (10 points, phase 2): the page's
prices, trial and founding year against the brand's approved facts still
on its site, read so as not to cry wolf: a price in its own currency
only, against a plan's prices (any of them: monthly and annual billing
both count) when the sentence names the plan, else only when it names
the brand (or "we") with a period; "from $29" against the lowest price;
no sentence naming a competitor; discounts, scales and ranges aren't
prices. Like a working link, it doesn't score Trust on its own.

- A mismatch is Quality's suggestion, "Price differs from brand facts ·
  Page $39 · pricing page $49", with Show on its sentence.
- "Approve {n} brand facts" is the person's to-do while facts wait, with
  Review linking to Brand settings › Brand facts (the to-do row and the
  next-step nudge, not Settings › Authors).
- useBrandFacts reads them once with phase 2 and again when the tab
  comes back from Brand settings; the next-step reads wait for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… after a review, and do one thing at a time (CE-047, part c review)

- settings/layout.tsx sets maxDuration 300: the first read and Read
  again wait while the API reads the site (pages, then the model).
- A review updates the list in place (no read that could read the whole
  site again); a failed one reads the list as kept, a fact a read
  removed meanwhile gone from it. Approve, Reject and Read again don't
  run at once; the row being saved says so (aria-busy).
- An API with brand facts off says they aren't available yet; a thrown
  action shows the failure instead of loading for ever.
- Page links read as the page's name; sections are labelled by their
  heading; the quote marks and the page status separator are messages;
  "missed" and the paused note say when the read comes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…after a price, and read brand facts once at a time (CE-047, part a review 2)

- A page under 200 characters (one its scripts write, a wall not told
  apart) leaves its facts as they are on every read, not only the first.
- A currency code or a scale right after a quote is read ("$49" then
  "CAD per month" is CAD; "$2" then "million" is no price); only "off"
  right after a price drops it (the next card's "Save 20%" doesn't). A
  period is named within 24 characters of the price, the first one
  named; "per active user" is per seat.
- A plan's name matches as whole words ("Pro" isn't in "Product"); a
  quote isn't taken inside another mark's dollar ("C$49") or a
  space-grouped number ("299 €" in "1 299 €").
- factText counts words toward its length, not indentation.
- A page whose model read failed waits MODEL_EVERY_MS like any other;
  a GET reads a failed page again behind its answer, not before it.
- New facts get the room the removed ones leave; a page whose new facts
  didn't fit keeps its old hash, to be read again. A kind no longer read
  (a shop's product page) loses its row.
- refreshOnce: one read per brand at a time, for the tab and the weekly
  read alike.
- 00269: a missing key is a check violation, and numbers compare as
  numeric (no cast error).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…de the price, the brand's own trial and founding year only (CE-047, part d review)

- A price is compared with the plan named nearest it, its name as the
  page writes it (case too); a plan that is an everyday word ("Pro",
  "Team", "Free", "Growth") only beside "plan"/"tier" or with the brand
  named. With no plan, only a sentence naming the brand and saying what
  it costs; no "we/our" path. Free ($0) is never compared; "from $19"
  matches any approved price.
- A sentence with an old price, a saving, a discount, credits, tax or a
  team's bill ("was $49", "incl. VAT", "5 users pay") isn't read for
  prices; "billed monthly/annually" narrows to that billing.
- Ranges need a number before the dash or word (French "à", Turkish
  "ile", "between … and"), so "Pro – $49" is a price again; an amount
  doesn't start inside a number.
- A trial is compared where it is the brand's ("your free trial",
  "every plan", its name), its days right beside the trial; a founding
  year right after "founded", with the brand named or "we were founded".
- Each sentence once. The to-do is last (the brand's, no points of the
  page's), "Review your brand facts" at 0 and "reviewed" when done.
- useBrandFacts fails instead of loading for ever when the action throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 24, 2026
…nd-facts-settings

# Conflicts:
#	web/messages/en.json
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
#	web/src/lib/actions/content-drafts.ts
#	web/src/lib/content/quality-checks.ts
…nd-facts-check

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx
#	web/src/lib/content/quality-checks.test.ts
#	web/src/lib/content/quality-checks.ts
…ity-brand-facts-check

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
#	web/src/lib/content/quality-checks.ts
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 24, 2026
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main forward after #1462's squash merge. The conflicting files are ones this PR doesn't change itself:

The diff against main is this PR's own files only. Web: yarn format, lint, typecheck, test (3,622 tests on #1465's tree, which includes #1464) and build pass.

🤖 Generated with Claude Code

@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.

A few fixes before merge. The check still cries wolf on some right pages:

  1. A figure in a sentence that names the brand is compared even when it isn't the brand's (web/src/lib/content/brand-facts.ts:384, :405–406, :424). With the test file's FACTS, each of these is flagged today:

    • "If you hire an agency, expect to pay $3,000 per month; with Ledgerly it is less." → "Page $3,000 · pricing page $19". This is the pinned no-mismatch sentence with the brand named. PRICED matches the bare "is", and with no plan named, any monthly amount in the sentence is compared with every plan.
    • "Ledgerly's data shows startups founded in 2020 grew faster." → founding year 2020 against 2015.
    • "Acme offers a free 15-day trial; Ledgerly's runs for 14 days." → "15-day" against "14-day", because the first trial in the sentence is taken.

    Fix: tie the figure to the brand, not just to the sentence.

    • Price, no plan named: read it only when the brand's name is followed within a few words by a pricing verb ("costs", "is priced at", "starts at", "pricing starts at") and then the price, with no other amount in between. Drop the bare "is" from PRICED.
    • Founding year: read it only when the brand, or "we" / "our company", comes right before "was founded" / "was established".
    • Trial: skip a sentence that gives two different trial lengths.

    Pin the three sentences as no-mismatch tests.

  2. Every price in a sentence goes to the plan named nearest it, however far away (brand-facts.ts:379–395). places holds only the plans the sentence names, so a second price with no plan beside it is compared with the one that is there. With the test FACTS:

    • "The Pro plan is $49 a month, and Business is $199 a month." → "Page $199 · pricing page $49", though Business at $199 is approved. Only Pro is found: "Business" isn't beside "plan", and the brand isn't named.
    • "The Pro plan is $49 per month, plus $10 per month for each extra seat." → "Page $10 · pricing page $49". This is an add-on, and the team-bill guard only fires with a number right before "seat".

    Fix: match each plan with the one price nearest it. Skip a price when another price sits between it and its plan, or when the sentence has more prices than named plans. Add add-on words ("extra", "additional", "add-on") to NOT_A_PRICE. Pin both sentences as tests.

  3. (Low, follow-up is fine) The next step waits for the brand's first site read (_draft-editor.tsx:1973). The first time a brand's draft is opened with phase 2, GET /api/brand-facts reads the pricing, About and product pages and asks the model before it answers. That can take up to a minute, going by the note in the settings layout. Next step waits for all of it, for a to-do that comes last and is worth no points. Consider not holding nextRead on the facts and letting the to-do join when they arrive.

Checked, no action needed:

  • Facts are read through the API, which checks the brand against the caller's workspace.
  • Only approved facts that are still on the site are compared, and free plans never are.
  • The check doesn't score Trust on its own.
  • Trust (and so the suggestion) waits for the sources read, so the competitor guard always has the brand's competitor domains.
  • The to-do's count and done state are correct, and its Review link, in both the to-do row and the nudge, opens Brand settings › Brand facts.

cihan-gyk and others added 5 commits October 24, 2026 23:43
…nd-facts-check

# Conflicts:
#	web/src/lib/content/brand-facts.test.ts
#	web/src/lib/content/brand-facts.ts
Review fixes on the brand-facts check (CE-047):
- a price with no plan named is read only right after the brand's name
  and a pricing verb; "was founded" needs the brand, "we" or "our
  company" right before it; a sentence with two trial lengths is skipped
- each named plan takes the one price nearest it, skipped when another
  price sits between; add-on words ("extra", "additional", "add-on")
  aren't prices
- the next step no longer waits for the brand's first site read; the
  brand facts' to-do joins when it lands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd's part of a sentence

Pre-push review fixes on the brand-facts check:
- each plan takes its nearest price, the closest pairs first; a sentence
  with more prices than plans named isn't read for prices
- setup, onboarding and one-time fees aren't a plan's price; with no plan
  named, only the plan or pricing may sit between the name and the verb
- a trial is read in the part of the sentence that is the brand's, and a
  length said of another ("Ledgerly's runs for 14 days") makes two
- "was founded" needs who at the start of its clause, and "we" outside
  quoted speech
- stale Next step skips wait for the brand facts again: only the dropping
  waits, and a proof skip's Trust can move when they land

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… one to one, a partner's trial apart

- prices are read only when the sentence has as many as plans named (one
  with none named): a plan beside another's price, or a monthly and an
  annual price with no plan, are unsure
- ", which/who/whose" turns to another subject: a partner's trial isn't
  the brand's
- "Ledgerly's trial runs for 30 days" is read as the brand's trial

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

Copy link
Copy Markdown
Collaborator Author

Thanks! Fixed in fb4d265, 8a70538 and 75d2387 (main merged forward first).

  1. A figure is tied to the brand, not only to a sentence that names it.

    • Price, no plan named: read only right after the brand's name and a pricing verb ("costs", "is priced at", "starts at", "pricing starts at"). Only the plan or pricing may sit between them ("Ledgerly setup costs $500" is another bill). The bare "is" is gone.
    • Founding year: read only when the brand, "we" or "our company" comes right before "was founded" / "was established", at the start of its clause. "The agency that built Ledgerly was founded in 2009" is the agency's. "We" isn't read inside quoted speech, which may be anyone's.
    • Trial: a sentence that gives two trial lengths is skipped. A length said of another counts as a second one: "…; Ledgerly's runs for 14 days". A trial is also read only in the part of the sentence that names the brand (or says "your trial", "every plan"). The sentence splits at ;, :, dashes, ", and/but/which/who" and "unlike/than/compared to". So "Acme offers a free 15-day trial; Ledgerly's is longer" and "Ledgerly integrates with Acme, which offers a 30-day free trial" aren't read.
    • Your three sentences are pinned as no-mismatch.
    • Still read: "Ledgerly's pricing starts at $25 per month.", "Ledgerly was founded in 2016.", "Since Ledgerly was founded in 2012, …", "Ledgerly's trial runs for 30 days."
  2. Each plan takes the one price nearest it. The closest pairs go first, and a pair with another price between is skipped.

    • Prices are read only when the sentence has as many as the plans it names (one when it names none). Otherwise which is whose isn't sure, and none is read. That covers your Business sentence, "Pro is $49/month or $39/month billed annually", and "The Pro plan, unlike the Starter plan, costs $49".
    • NOT_A_PRICE gains extra, additional, add-on(s), setup, onboarding, implementation, installation and one-time.
    • Both of your sentences are pinned.
  3. Next step and the brand facts. nextRead only gates the dropping of stale skips. The Next step itself shows straight away, because it holds each skip against its step's state as it is now.

    • I first took the facts out of nextRead. The pre-push review then found that this can lose a proof skip: the facts move Trust by up to 10 points, so a skip made at "Trust ≥ 60" could be dropped and saved as dropped before the facts land. It would then come back once they did.
    • So the wait stays, at no cost on screen. It applies only in phase 2, where useBrandFacts reads the facts (it answers off otherwise).
    • The brand facts' to-do is now left out of the proof step's state, so a skip made before they land holds when their to-do joins.
    • A page test covers both phases.

Checks: yarn format, lint (0 errors), typecheck, test (3,632 passed) and build pass.

@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.

A few fixes before merge.

Round-22 items:

  1. Done. The three sentences are pinned as no-mismatch and pass. A price with no plan named now needs the brand's name and a pricing verb right before it. The founding year needs the brand, "we" or "our company" right before "was founded", and a sentence with two trial lengths is skipped.
  2. Done. Plans and prices pair closest first, with no other price between them, and only when the counts match. Add-on and setup words are in NOT_A_PRICE. Both sentences are pinned.
  3. Answered. nextRead only holds the dropping of stale skips, and the Next step shows meanwhile. Leaving the facts' to-do out of the proof step's state keeps an earlier skip. Fine as it is.

Both merges of main are clean: the add/add conflict in brand-facts.ts and its test keeps both sides, and the second merge matches a plain re-merge.

New: the check still flags some right pages. Every example below uses the test file's FACTS, with Acme not among the brand's competitors.

  1. A named plan takes any single amount in its sentence, whatever the amount is for (web/src/lib/content/brand-facts.ts:446-462). The no-plan path now needs a pricing verb between the brand and the price. The plan path checks nothing between the plan and the price. Each of these is flagged today:

    • "The Pro plan costs $30 more than Starter." → "Page $30 · pricing page $49".
    • "Ledgerly Pro saves most teams $300 a month." → $300 against $49. save in NOT_A_PRICE (:152) is followed by (?!\p{L}), so "saves" and "saved" don't match it.
    • "Pro plan users invoice an average of $12,000 a month." → $12,000 against $49.
    • "Moving from Starter to the Pro plan adds $30 a month." → $30 against $49.
    • "Team leads at Ledgerly approve $40,000 a month in expenses." → $40,000 against $99. With the brand named, a "Team" at the start of the sentence counts as the plan.
    • No plan named: "Ledgerly costs $20 less per month than most bookkeeping apps." → $20 against $19. The verb rule passes, and the comparison comes after the price.

    Fix:

    • Read a named plan's price the same way as the brand's. Between the plan's name (with its "plan"/"tier" word) and the price, allow only nothing, "is", ":", a dash, "(" or a pricing verb ("costs", "is priced at", "starts at"), plus an optional "just", "only" or "from".
    • Skip a price that has a comparison ("more", "less", "cheaper", "than") within a few words after it.
    • Widen save to sav(?:e|es|ed|ing|ings).

    The existing "still read" sentences pass under these rules ("Ledgerly Pro costs $59 per month", "The Pro plan is $39/mo billed annually", "…and the Pro plan $49/month"). Pin the six sentences above.

  2. A trial length is taken from anywhere in the part that names the brand, and "free for N days" counts as a trial without the word "trial" (brand-facts.ts:299, :306, :502-507):

    • "Unlike Acme's 30-day trial, Ledgerly's needs no credit card." → "30-day · 14-day". The turn at "unlike" ends at a plain comma, so Acme's trial and the brand's name end up in one part.
    • "Unlike Acme, which offers a 30-day trial, Ledgerly gives you 14 days free." → the same.
    • "Ledgerly keeps your files free for 30 days after you cancel." → 30-day.
    • "Every plan includes priority support free for 30 days." → 30-day.

    Fix:

    • Within a part, take only a length that comes after the brand's name or the own-trial words ("your trial", "every plan").
    • Read "free for N days/weeks" only after "try"/"use" and the brand, or in a sentence that says "trial".

    "Try Ledgerly free for 2 weeks", "Every plan has a 30-day free trial" and "…your free trial lasts 30 days" are still read. Pin the four sentences.

  3. (Smaller) "we" after a colon is read as the brand (brand-facts.ts:342). For example, "Acme's CEO told us: we were founded in 2018 to fix bookkeeping." is flagged as 2018 against 2015. Customer stories often quote this way without quote marks. Fix: for "we" / "our company", take only the sentence start or "since/when/after/and" as the start of the clause, not a colon. Keep the colon for the brand's name.

  4. #1470 is on main now: when you merge main forward, add the brand facts to qualitySettled in phase 2 (factsState.status !== 'loading'), with a page test, as agreed.

Merging main forward: #1473 (author confirm) is on main too, and it conflicts with this stack in quality-todos.ts, quality-checks.ts, _quality-tab.tsx, _draft-editor.tsx and content-drafts.ts (and their tests). Keeping both sides works: eeat() and qualityTodos() take both visual and confirmed, the E-E-A-T memo passes both, and getContentDraft's select keeps author_real_at, author_profile_at, reviewer_id and archived_at. I merged the whole stack this way in a scratch tree, and tsc and the full web and server suites passed on it.

cihan-gyk and others added 2 commits October 25, 2026 10:13
…nd-facts-check

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx
#	web/src/lib/content/quality-todos.test.ts
#	web/src/lib/content/quality-todos.ts
…nd a trial only after the brand's (CE-047)

- A named plan's price is read as the brand's is: right after its name
  (with its plan or tier word), with nothing, "is", a colon, a dash, "("
  or a pricing verb between. A price compared within a few words after it
  ("$30 more than", "$20 less … than") is read for no one, and "saves",
  "saved", "saving" are a saving.
- In a part of the sentence that is the brand's, only a trial length after
  its name or "your trial", "every plan" is its own; "free for N days" is a
  trial only after "try"/"use" and the brand, or in a sentence that says
  "trial".
- "We were founded" starts its clause only at the sentence's start or after
  since/when/after/and, not after a colon (quoted speech).
- In phase 2, the Quality score also waits for the brand's facts.

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

Copy link
Copy Markdown
Collaborator Author

Fixed in dafb7e6. Main was merged forward first in 2df021e, keeping both sides as you described:

  • qualityTodos() takes brandFacts and confirmed;
  • the brand facts' to-do stays last;
  • the E-E-A-T memo passes confirmed;
  • the Quality tab has both props.
  1. A named plan's price. It's now read only right after the plan's name, as the brand's is (PRICED_AFTER_PLAN).
    • The price must come after the plan, with its "plan"/"tier" word optional.
    • What may sit between: nothing, "is", ":", a dash, "(" or a pricing verb, plus an optional "just"/"only"/"from".
    • A price followed within four words by a comparison word ("more", "less", "cheaper", "than", and their de/tr/fr/es forms) is skipped on both paths.
    • save is widened to sav(?:e|es|ed|ing|ings).
    • All six sentences are pinned as no-mismatch. "Ledgerly Pro: $59", "Ledgerly Pro – $59" and "Ledgerly Pro ($59/month)" are pinned as still read, and the existing "still read" sentences pass.
  2. Trial lengths.
    • In a part of the sentence, only a length after the brand's name or the own-trial words ("your trial", "every plan") is the brand's.
    • "free for N days/weeks" counts only in a sentence that says "trial", or after "try"/"use" and the brand.
    • The four sentences are pinned. "Try Ledgerly free for 3 weeks" and "Ledgerly is free for 30 days during the trial" are pinned as still read. "Every plan has a 30-day free trial" and "…your free trial lasts 30 days" still pass.
  3. "We" after a colon. For "we", "our company", "biz", "şirketimiz" and "wir", the clause starts only at the sentence start or after since/when/after/and (ve). The brand's name keeps the colon. Your sentence is pinned, plus "After years of planning, we were founded in 2018." (no match: a comma).
  4. qualitySettled now waits for the brand facts in phase 2 (factsState.status === 'loading'). A page test holds the facts read and checks that the chip says "reading…" until they land.

Web: format, lint, typecheck, yarn test (3,678 passed) and yarn build pass.

@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, with one fix to make in a follow-up before phase 2 goes on. Everything from round 23 is done:

  1. A named plan's price is read only right after the plan's name (PRICED_AFTER_PLAN). On both paths, a price followed within a few words by a comparison word is skipped, and save now covers "saves", "saved" and "saving". The six sentences are pinned, and the colon, dash and "(" forms are pinned as still read.

  2. Within a part of the sentence, a trial length counts only when it comes after the brand's name or the own-trial words. "Free for N days" now needs "trial" in the sentence, or "try"/"use" and the brand before it. The four sentences are pinned.

  3. "We" and "our company" start a clause only at the start of the sentence or after since/when/after/and. Pinned.

  4. In phase 2, qualitySettled waits for the brand facts, and a page test covers it. The wait always ends:

    • useBrandFacts always ends in ready, off or failed;
    • reading the facts again when the tab comes back doesn't put it back to loading;
    • the API's site read has a time limit on each page fetch and on the model call, and a spent budget gets an answer with paused set.

    So the chip can't stay on "reading…".

The merge of main (2df021e) keeps both sides in the four files that conflicted and changes nothing else.

New (merging now, since phase 2 is off; please fix these in a follow-up before it goes on):

  1. When another product's name comes right before a plan's name, the plan is read as the brand's (web/src/lib/content/brand-facts.ts:269-278, :529-538). The competitor guard only skips tracked competitors. Listicles and comparison pages name many more products, and plan names like Pro, Starter, Team and Business are shared by many of them. With the test file's FACTS (Acme is not a competitor), each of these is flagged:

    • "Acme's Pro plan costs $59 a month." → "Page $59 · pricing page $49".
    • "Acme's Starter plan costs $20 per month." → $20 against $19.
    • "While Acme Pro costs $59 a month, Ledgerly gives you more for less." → $59 against $49. The brand's name makes "Pro" a plan, and "more" is more than five words after the price.

    "Northwind Pro costs $29 per month" and "HubSpot Starter costs $20 per month per seat" are pinned as no-mismatch, but they pass only because Northwind is a competitor and "Starter" there has no "plan" after it. Passing competitors' names (the follow-up in the description) wouldn't cover products that aren't tracked.

    Fix: in planAt, skip a match when the word right before it (ignoring a trailing 's) starts with a capital letter and is neither the brand's name nor "The", "Our" or "Your". The following are still read: "Ledgerly Pro costs $59", "Ledgerly's Pro plan is $59", "The Pro plan is $39/mo billed annually" and "…and the Pro plan $49/month". Pin the three sentences above.

  2. (Low, follow-up) A comparison table's cell ("Pro plan: $59/mo" in Acme's column), or a sentence in a section about another product, names no product, so it is still read as the brand's. Fixing that needs context from outside the sentence (the table's header, or the section's heading).

@gkhngyk
gkhngyk merged commit 0628125 into ansvisor:main Oct 25, 2026
5 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