Repository navigation
feat(content): count the claims in the page's own words in Trust and underline the unsourced ones (CE-045, part b) - #1458
Merged
Conversation
…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
…fter ansvisor#1435 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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]>
# Conflicts: # supabase/schema.sql
gkhngyk
approved these changes
Oct 24, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
Checked on top of #1457: useClaims (one ask at a time, none while unsaved, skip read at ask time, blur recheck, pending retried 30 s apart and bounded by the server's daily cap, limited/paused/off stop it), Trust's claim lookup and page-order marks, textRanges (block-scoped, no headings or code, whitespace-insensitive), Remove's empty list item / list / quote cleanup (a table cell keeps its paragraph), the toolbar's one-shot linkRequest, and the i18n keys (all resolve in en.json). At phase 1, claims stays null, so trust() and the editor behave as before. Both merge commits carry no changes of their own.
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Quality Phase 2, CE-045 "Claim detection in user text", part b: the editor. Stacked on #1457 (part a, the server's
POST /claims), which sits on #1451; review those first. Everything sits behindNEXT_PUBLIC_CONTENT_QUALITY_PHASE=2. At phase 0/1 nothing is asked, nothing is underlined, there is no Add source / Remove, andtrust()comes out as before.When the editor asks (
useClaims)skip). That block's text is built the way Trust and the API read it (writingBlock: the cursor's paragraph, list item, quote or cell serialised and read withtrustBlocks), so the server's hash matches.pending) are asked about again 30 s later. Once the draft's day of reads is used up (limited), asks stop for the session and Quality says so. A spent AI budget pauses them (as feat(content): read the kind of a source's site the rules can't place with AI (CE-046, part b) #1451's source reads do), and an API with them off stops them silently. A failed ask waits for the next save.Trust (
trust({ claims }))TrustRead.marks: what the draft underlines, each with its block's text.aiClaims: unsourced sentences only the model found, so the Quality line says "claims" with the AI check tag.In the page
dark:colour) on each unsourced claim's words, and on the sentences of figures read by rule. It is looked for only inside that claim's block, never in a heading, ignoring the spacing differences between Trust's text and the page (( report),40 %, line breaks).Related issue
Quality spec (Drive), Phase 2, CE-045 (part b). Stacked on #1457.
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
CONTENT_QUALITY_PHASE=2(server) andNEXT_PUBLIC_CONTENT_QUALITY_PHASE=2(web).Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Web:
yarn format,yarn lint,yarn typecheck,yarn test(3,522 tests) andyarn buildpass.A pre-push review's points are in:
skipis the block as saved, not asked while unsaved;pendingis asked again, andlimitedshows a note;aria-labels on Add source / Remove;writingIn.The browser check (light/dark, 1024 px, focus in the link dialog after Add source) is owed and batched with #1446–#1457.
🤖 Generated with Claude Code