Repository navigation
feat(audit): show the score's range in Chat, MCP, the Agent's audit card and Reports - #2143
Merged
gkhngyk merged 1 commit intoNov 5, 2026
Conversation
…ard and Reports Follow-up to ansvisor#2131: the places it listed as not showing the range now do, by the same rule (scoreRange) and page grouping (auditPageKey). - get_site_audit (MCP, Chat's list_site_audit_issues, the Agent, and GET /api/mcp/site-audits/:id) returns scoreRange: { plusMinus, low, high, audits } in points, or null with fewer than 3 complete audits or for an audit that isn't compared. It's read alongside the signals; a failed read leaves it null. - A shared read, lib/audit/page-trend.ts, reads the page's complete audits before an audit from the brand's, newest first, a slice at a time, until it has the 4 the range needs: the audits GET /api/audits/:id reads for pageTrend. - The Agent's audit card shows "64 ± 2" with ScoreRangeMark and the audit.range sentence. render_audit takes scoreRange; asScoreRange keeps only a range the rule could give. - Reports › Site Audit Score, page and PDF: the range from the page's audits up to the end date, as a new optional payload field (range). Older reports show none. The snapshot reads the page's earlier audits with the shared read instead of the brand's latest 100, so the previous score and the range come from the same audits. The summary prompt says what auditScore.range is. - Help: Score range (read an audit report) and a Site Audit Score section in Generate visibility reports; approved-articles.json refreshed. docs/guides/site-audit.mdx and mcp-server.mdx updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 5, 2026
Main brought ansvisor#2137 (00480) and ansvisor#2143. schema.sql is rebuilt with build-schema.sh (00480 then 00481). help/chat/agents.md's front matter keeps both keyword and synonym lists (Agent work's and Onboarding's). approved-articles.json regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 5, 2026
gkhngyk
pushed a commit
that referenced
this pull request
Nov 5, 2026
…ge and "64 ± 2" (#2149) * feat(audit): show the score's range in Chat, MCP, the Agent's audit card and Reports Follow-up to #2131: the places it listed as not showing the range now do, by the same rule (scoreRange) and page grouping (auditPageKey). - get_site_audit (MCP, Chat's list_site_audit_issues, the Agent, and GET /api/mcp/site-audits/:id) returns scoreRange: { plusMinus, low, high, audits } in points, or null with fewer than 3 complete audits or for an audit that isn't compared. It's read alongside the signals; a failed read leaves it null. - A shared read, lib/audit/page-trend.ts, reads the page's complete audits before an audit from the brand's, newest first, a slice at a time, until it has the 4 the range needs: the audits GET /api/audits/:id reads for pageTrend. - The Agent's audit card shows "64 ± 2" with ScoreRangeMark and the audit.range sentence. render_audit takes scoreRange; asScoreRange keeps only a range the rule could give. - Reports › Site Audit Score, page and PDF: the range from the page's audits up to the end date, as a new optional payload field (range). Older reports show none. The snapshot reads the page's earlier audits with the shared read instead of the brand's latest 100, so the previous score and the range come from the same audits. The summary prompt says what auditScore.range is. - Help: Score range (read an audit report) and a Site Audit Score section in Generate visibility reports; approved-articles.json refreshed. docs/guides/site-audit.mdx and mcp-server.mdx updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 * feat(chat): show a Site Audit Chat reads as a card with its score gauge and range The owner asked for a Site Audit card in the new Chat, on top of #2143's scoreRange. After a list_site_audit_issues read, the engine builds the card from the read's own result and emits audit.ready, as What's new and Why do: the run state applies it, a reloaded chat reads it back from chat_run_events, and ChatThreadView draws it with the run's other cards. - The card: the page, its score on the report's ScoreGauge with ScoreRangeMark ("64 ± 2") and the audit.range sentence when scoreRange isn't null, "Audited …" with the change since the page's audit before (audit.scoreChange), and Open report. A partial audit shows the report's note and no range or change; a running, failed or unscored audit shows no card. - Never the model's numbers: a range is kept only if asScoreRange accepts it and the score is in it, on the server and again in the browser. One card per audit, 3 at most per answer. No id in the event but the report link. - get_site_audit (MCP, Chat, the Agent, the REST twin) returns partial, previousScore and previousCreatedAt, from the read the range already does (readPageComparison). The tool descriptions say what they mean. - Help: "A Site Audit in Chat" in Use Chat, and Score range in Read a site audit report; approved-articles.json refreshed. The Site Audit and MCP guides mention the card and the new fields. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 --------- Co-authored-by: Claude <[email protected]>
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
Follow-up to #2131. That PR shows a Site Audit page score with its range, such as "64 ± 2", in the audit report, the Pages tab and the Pages export, and it listed the places that didn't show the range yet. This PR adds the range to those places, with the rule the owner confirmed:
The rule is still
scoreRangeinweb/src/lib/audit/score-range.ts. Pages are still grouped byauditPageKey(web/src/lib/reports/audit-score.ts), which mirrors the server'spageKey. Nothing is copied.What each place shows now
get_site_auditin MCP, Chat (list_site_audit_issues) and the AgentscoreRange:{ plusMinus, low, high, audits }in points out of 100.GET /api/mcp/site-audits/:id, returns it too.render_audit,AuditResultCard)ScoreRangeMark.render_audittakesscoreRangeasget_site_auditreturns it, and the system prompt says to pass it on.scoreRangecould have produced it (asScoreRange), so a range a model altered isn't shown.ScoreRangeMarkand theaudit.range.*strings. The PDF writes the same sentences in English, as it does for the rest of its text.How
web/src/lib/audit/page-trend.ts). The web side had no page-trend read, andget_site_auditreads the database directly rather than through the API server's route.readEarlierPageAuditsreads the brand's complete audits from before the audit, newest first, 200 rows at a time, and keeps only that page's own.GET /api/audits/:idreads forpageTrend: completed, scored, not partial, created before the audit, and the same page.readScoreRangeturns them into the range.get_site_auditreads the range at the same time as the signals. If that read fails, the audit still comes back without a range, and a warning is logged.ReportAuditScoregets a new optional field,range?: ScoreRange | null.scale: 100payload and a 0–1 payload from before fix(reports): show the Site Audit score in points, compared with the same page's audit before #2133.AUDIT_SNAPSHOT_ROWSis removed.auditScore:rangeis the score's range, so itslowandhighmust not be described as a rise or fall. No other server change.approved-articles.jsonis refreshed.docs/guides/site-audit.mdxanddocs/guides/mcp-server.mdxmention the range.No migration.
Notes for review
scoreRange, notscore_range. It's camelCase like the rest of theget_site_auditresult (totalScore,finalUrl), and it's the sameScoreRangeshape the report and the card use. The Pages export column staysscore_range.get_site_auditresult isAuditResultCardon the Agent page. In Chat, the range reaches the answer as data, through the tool result and its description. The owner asked for a Chat audit card; it follows in a separate PR on top of this one.totalScorestays 0–1, as before.scoreRangeis in points out of 100, as the report shows it. The descriptions say so. ChangingtotalScorewould break MCP clients, so this PR leaves it alone.Related issue
None. Customer priorities plan, P0 item 1 (score stability): the places #2131 listed as not covered.
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
get_site_auditfor a completed audit of a page with three or more complete audits.scoreRangegivesplusMinus,low,highandaudits. For a page with one or two audits, or for a partial or running audit, it is null.list_site_audit_issues, whose result now hasscoreRange, and can give the range.cd web && npx vitest run src/lib/audit src/lib/mcp/site-audit-range.test.ts src/lib/agent/tools.test.ts src/components/audit src/lib/reports "src/app/[locale]/(dashboard)/dashboard/reports/[id]" src/lib/helpChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.mdFull checks on c09336f, built on main 29a2b6e. The branch still merges cleanly into current
main.format:checkandtypecheckpass.linthas 0 errors; its 7 warnings are old ones in files this PR doesn't touch.yarn testpasses 991 files (10,614 tests, 1 skipped).yarn buildpasses with CI's placeholder env.format:checkandlintpass.npm testpasses 419 files (5,773 tests, 4 skipped).Generated by Claude Code