Repository navigation
fix(content-editor): hold the Quality score until the page's reads are in - #1470
Conversation
…e in The header's Quality chip showed the average of whatever was read first: Readability alone (90), then with E-E-A-T (45), then with Trust (59), within seven seconds of opening a page or after the agent's rewrite. It now says "Quality · reading…" until the authors, Your input, the site's trust, the sources, the links and (phase 2) the claims are read or failed, and keeps the last settled score while new reads land (a pulsing dot, aria-busy). Instructions › Quality's segment shows the same score. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the Quality score settles Pre-push review fixes: - a save the claims weren't asked about yet counts as still reading, so the score doesn't settle in the gap before the ask (phase 2); - useSourceClasses says when a site is still to be read; the score waits; - a link check call that fails on its own counts as a failed read (the chip could read forever); a claims ask that throws clears its pending; - the pulsing dots stop with reduced motion; aria-busy dropped (the screen reader text says it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
A few fixes before merge:
-
A link the API answers without reading keeps the chip on "reading…".
_use-link-checks.ts:87-91:pendingcounts a link until it has a read, is skipped, or its ask failed at this save. The links route leaves out the links past the member's hourly reads (checkLinks: "a link over it isn't in the answer"), and the hook asks about those again only after the next save. SincequalitySettlednow needslinksPending === 0(_draft-editor.tsx:821), a page someone opens to read without editing says "Quality · reading…" for the whole session. An href the saved page writes differently from the editor does the same.
Fix: after a successful answer, count each link asked at this save that the answer neither read nor skipped as answered for this save. For example, add it tofailedAtatsavedAt. It is then asked again after the next save, but it doesn't hold the score. Add a test with an answer that leaves a link out. -
Phase 2: an edit shows a partial score before its save.
useClaimsdoesn't count unsaved changes as reading (_use-claims.ts:137-142). The editor'sautosave.state !== 'saved'(_draft-editor.tsx:609) only holds the ask. Here is what happens after Accept on the agent's page, or any edit:pageHtmlupdates after 400 ms, and the save lands about 1.5 s later.- In between,
qualitySettledis true while the claims are still the old page's. Claims that no block has any more are left out of Trust, so the chip moves to that partial score. - After the save it pulses, then moves again when the claims are read.
That is the two-step jump this PR removes, after the agent's rewrite.
Fix: in phase 2, holdqualitySettledwhile a save is waiting or under way (autosave.state === 'unsaved' || autosave.state === 'saving'). PassuseClaimsthe same narrower flag asunsaved. Today the hook also getsfailed,conflictandtoo_largeas unsaved. If a save that the hook hasn't asked about is followed by one of those states,askedSave !== savedAtstays true and the ask stays held. The chip then pulses until the save recovers, or until a reload after a conflict. -
Two open PRs add reads that also move Trust: #1465 (the brand facts:
useBrandFacts, passed totrust()asbrandFacts) and #1468 (the page read's proofs:usePageRead, passed asproofs). Neither is on main yet.qualitySettleddoesn't wait for them, so once they're in, the chip settles in phase 2 before they land and moves again when they do. Whichever lands second should addfactsState.status !== 'loading'and the page read (pageRead.settled && !pageRead.reading) toqualitySettled, with a page test. -
(low) Sources left unasked after a failed ask (
_use-source-classes.ts:94). The effect reruns onkinds, andkindsonly changes on a successful answer. When an ask fails, two kinds of site stay unasked at this save whilereadingstill counts them:- the sites past the first
MAX_SOURCE_SITES; - a site whose ask was still out when a newer save came in. The new save skipped it because it was still in
asking.
The chip then waits for the next save. Adding
answeredto the effect's deps gets them asked at this save. - the sites past the first
-
(low) Long pages hold for a minute or more in phase 2. Each claims ask makes at most two calls, and asks are
CLAIMS_EVERY_MSapart. Sincepending > 0counts as reading, a long page that hasn't been read yet (an imported page, the agent's rewrite) says "reading…" for 30 s per further ask. If that's intended, the test plan's "about 3 s" should say so. If not, settle once the first ask is back and let the dot pulse for the rest.
Checked and fine: these all settle as they should:
- phase 1 (claims and site kinds off);
- the API answering
off,ai_budgetor the day's cap (limited); - a claims or sources ask that fails or throws;
- authors, site trust or sources that fail to load;
- an empty page;
- a page with no links or no unplaced sites.
A settled score of null hides both chips without looping.
… pending saves Review fixes on the settled Quality chip: - a link the links answer leaves out (over the hourly reads, or written differently on the saved page) counts as answered at this save: asked again after the next save, it doesn't hold the score - phase 2 holds the score while a save waits or is under way, and the claims hold their ask only then (not after a failed save, a conflict or a page too large, where no new save is coming) - each sites answer, a failed one too, lets the sites past the batch be asked at the same save Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ing the score again Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks! Fixed in 49f7240 and 77f6bca:
Checks: |
gkhngyk
left a comment
There was a problem hiding this comment.
All items done. Looks good.
- Done. Once an answer is in, any link that was asked at this save and left out of the answer is marked as answered at this save. An older ask that answers late can't overwrite a newer save's mark. Both cases have tests.
- Done. In phase 2 the score holds while a save is waiting or under way, and
useClaimsgets the same narrower flag. A failed save, a conflict or a page that is too large no longer holds the ask. A page test covers this. - Open, and it moves to the PRs that land after this one. No open head adds the brand facts or the page read to
qualitySettledyet. #1465 and #1468 should add them when they merge main forward after this PR. - Done.
answeredis now in the effect's deps, there's no re-ask loop, and a test covers it. - Answered. The long-page hold is intended, and the test plan now says so.
Summary
The Content Editor header's Quality chip showed the average of whatever had been read so far. On a production draft it went 90 → 45 → 59 within seven seconds of opening:
The same happened after the agent's rewrite. Users read the first number as the page's score.
Now
Hooks fixed on the way, found in the pre-push review
useClaims: a save whose claims weren't asked about yet counts as reading. Before, the score could settle in the 3–30 s before the ask. A claims ask that throws clears its pending count.useSourceClassesnow says when a site is still to be read.useLinkChecks: a call that fails on its own (network, a deploy meanwhile) counts as a failed read for that save. Before, the chip could read forever.authorsTried).Related issue
User report (tested on app.ansvisor.com): the score jumps while the page loads and after the agent's rewrite.
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
CLAIMS_EVERY_MS), and the chip waits for all of them, so a long page says "reading…" for a minute or more. That is intended: the number moves once, not after each ask.Browser check at 1024 px (the reading label is longer than "Quality 59") is still owed, batched with the other editor fixes.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Web:
yarn test(CHECK_TESTS) andyarn buildpass.🤖 Generated with Claude Code