Skip to content

feat(content): check a page's quality and brand facts on the server before an agent takes it live - #1979

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feature/content-go-live-gate
Nov 2, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feature/content-go-live-gate

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

AUTONOMOUS-GO-LIVE PR 2b-2: the server checks a page's quality and brand facts before an agent takes it live on its own (§6.2; main's decision A, the owner's 2026-11-02 decisions). Stacked on #1971 (qualityState); it calls #GOLIVE2B1's endpoint by URL. No migration. Nothing calls the gate yet; PR 5's go-live step will.

What changes

  • lib/content/go-live-gate.ts goLiveGate(input) decides, with no one's session, whether a page passes. In order, the first that fails holds the page for a click, with why:
    1. quality_off: Content Quality isn't on.
    2. placeholders / fields: the page as Send to CMS would send it (getContentDraftPackageFor, i.e. bulkCmsItems' problem).
    3. suggestions: suggestions on the draft still wait for review (status = 'open').
    4. quality_unread: a read the scores need couldn't be made. That covers an AI read that failed or hit the run's cap or the month's budget, claims or sources' kinds not all read, a paused or limited page read, or a database read failure. What can't be counted never passes (main's rule).
    5. facts: a price, trial or founding year that differs from an approved brand fact. facts_unchecked: no approved facts, and the page states one of those (read wide, the safe side).
    6. qualityLow: E-E-A-T, Trust or Readability under 60 (the lowest is named). quality: their average under 75. A score with nothing to judge on the page (no check applies) is left out, as the editor's Quality average leaves it. No score at all can't pass.
  • The reads, as the editor makes them:
    • from the database: draft, authors, inputs, sources (content_draft_sources, which allows the service role), My rules, confirmations, own images, the catalog product;
    • from #GOLIVE2B1's endpoint: links, claims, page read, the kinds of the sites the rules can't place, brand facts and site trust. A new AI read there is the agent run's own step.
    • The scores come from the editor's own qualityState.
    • The page type's page rules come from the same rules engine (ruleSet, activeRules, checkRule), counted with pageTextLength (its type rules don't read the length).
    • Visual proof spots are counted in the editor's own document. pageDoc() parses the page with the editor's StarterKit options, tables, images, JSON-LD and HTML block nodes.
  • To make this possible:
    • catalog-match.ts catalogMatchFor(client, …). The editor's action calls it with the person's session, the gate with the service role.
    • The editor's StarterKit options (EDITOR_STARTER_KIT) and the HTML block's node schema (HtmlBlockNode) move to lib, and the editor uses the same.
    • textRanges and openSpotPlaces move to lib/content/doc-text.ts; the editor files re-export them.

Related issue

None. AUTONOMOUS-GO-LIVE spec, PR 2 (2b, web part).

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

Unit tests:

  • go-live-gate (13):
    • the thresholds (60 each, 75 average), the lowest named;
    • a score with nothing to judge left out;
    • facts and unchecked facts;
    • Quality off, placeholders and fields, suggestions;
    • the request to the server (ids, sites);
    • each unread case (run cap, claims not all read, page read paused, server error);
    • the visual proof spots in the editor's document.
  • doc-text: the editor's nodes, and the open spots counted as the editor counts them.
  • The editor's own tests pass unchanged: proof spots, claim marks, HTML block, page.test.tsx.

No visible change, no Help article, no AI call in tests.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

CI passed on this branch (fedd283), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41362908270): schema is up to date; web format:check, lint, typecheck, all tests and yarn build pass; server lint, format:check and all tests pass.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits November 2, 2026 00:42
…function

AUTONOMOUS-GO-LIVE PR 2a. lib/content/quality-inputs.ts qualityState()
computes E-E-A-T, Trust and Readability and what the editor shows beside
them from the reads the editor holds, so PR 2b's server gate for an agent
going live on its own computes them exactly as the editor does. The
editor's two dozen memos become one call after its reads; nothing on
screen changes. quality-inputs.test.ts keeps the editor's code from before
the move and shows both give the same values for four page types in each
phase, for every read still pending, and with Quality off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…efore an agent takes it live

AUTONOMOUS-GO-LIVE PR 2b-2. lib/content/go-live-gate.ts goLiveGate()
gathers, with no one's session, every read the Content Editor's scores
take (the draft, its authors, inputs, sources, rules, confirmations, own
images and catalog product; its links, claims, page read, sources' kinds,
brand facts and site trust from the server's go-live reads, made on the
agent run's budget when none is kept) and scores the page with the
editor's own qualityState. It holds the page for a click, with why: with
Content Quality off, placeholders or fields a CMS won't take, suggestions
waiting, a read that couldn't be made, a fact that differs from an
approved one or one stated with none approved, a score under 60 or an
average under 75. A score with nothing to judge is left out, as the
editor's average leaves it.

To read the page as the editor does on the server: the catalog match takes
a client (catalog-match.ts), the editor's StarterKit options and the HTML
block's node schema move to lib (the editor uses the same), and textRanges
and openSpotPlaces move to lib/content/doc-text.ts with pageDoc(), which
parses a page into the editor's document. Nothing calls the gate yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
gkhngyk previously approved these changes Nov 2, 2026

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

LGTM

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/lib/content/quality-inputs.test.ts
#	web/src/lib/content/quality-inputs.ts

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

LGTM

@gkhngyk
gkhngyk merged commit 5c440df into ansvisor:main Nov 2, 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