Repository navigation
feat(audit): show the score's range from the page's own audits (customer priorities item 1) - #2131
Merged
Merged
Conversation
…mer priorities item 1) Customer priorities plan, item 1, part 2 (part 1: ansvisor#1919). A Site Audit score now shows its range, such as "64 ± 2". It's worked out from the page's latest 5 complete audits: half the gap between the lowest and highest score, in whole points, rounded up. It shows from 3 audits. Partial audits aren't counted. The rule sits in SCORE_RANGE (web/src/lib/audit/score-range.ts). - Report: the gauge reads "64 ± 2", and a line beside it gives the lowest and highest score. GET /api/audits/:id sends the page's trend up to the audit (pageTrend) from the history it already reads, so there's no new query. findPreviousCompletedAudit and pageTrendUpTo share one walk of that history. - Pages tab: "± 2" after the current score, from the row's trend, with the same sentence on hover and for screen readers. - Pages export: a last column, score_range. - Help: "Read a site audit report" gets "Score range"; the overview article mentions it on the Pages tab and in the export. approved-articles.json refreshed. docs/guides/site-audit.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 |
Merged
8 of 13 tasks
8 of 13 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 5, 2026
…ard and Reports (#2143) 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. Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 Co-authored-by: Claude <[email protected]>
8 of 13 tasks
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
Customer priorities plan, P0 item 1 (score stability), PR 2 of 2: the range. Part 1 (#1919) pinned the model and kept each AI verdict by its input, so an unchanged page keeps its score. This PR shows the score with a range worked out from the page's own audits, such as "64 ± 2". It makes no AI call and no extra query.
The plan (Customer Priorities ›
CUSTOMER-PRIORITIES-plan.md, item 1) says: "Show a range next to the score (e.g. "64 ± 2"), worked out from that page's own audit history. This is free, with no extra AI calls." The owner's decision of 2026-10-31 says the same: "The score is shown with its parts and a range." The plan doesn't say how to work out the range, so this PR uses the simplest rule. The numbers sit in one constant,SCORE_RANGEinweb/src/lib/audit/score-range.ts.The rule
Where it shows
score_range/ "Range (±)". It's empty when the page has too few audits. The columns before it keep their places.How
GET /api/audits/:idnow sendspageTrend. These are the page's complete scores up to the audit, oldest first, the same shape as a Pages row'strend.findPreviousCompletedAuditand the newpageTrendUpToshare one walk of the history (comparableAuditsUpTo).scoreRange(trend)works out the range from either trend, andScoreRangeMarkdraws it.audit.range.*andaudit.export.scoreRangeinen.json.approved-articles.jsonis refreshed.No migration.
Open points for the owner
SCORE_RANGE/scoreRange.get_site_audit, and the Agent's audit card. They read the audit straight from the database, without the page's history or the previous score.total_scoreon its 0–1 scale, rounded to one decimal ("0.6" for 64). Its "previous" score can also be another page's. This PR doesn't touch it.Related issue
None. Customer priorities plan, P0 item 1 (score stability), part 2. Part 1 is #1919.
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
score_range.cd server && npx vitest run src/lib/audit/history.test.js src/routes/audits-pages.test.jscd web && npx vitest run src/lib/audit src/components/audit/audit-report.test.tsx "src/app/[locale]/(dashboard)/dashboard/audit/_pages-table.test.tsx" src/lib/audit-export.test.ts 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 this branch (34b2a86), built on main 8be573d:
format:checkandtypecheckpass.linthas 0 errors; its 7 warnings are old ones in files this PR doesn't touch.yarn testpasses 975 files (10,407 tests, 1 skipped).yarn buildpasses with CI's placeholder env.format:checkandlintpass.npm testpasses 415 files (5,712 tests, 4 skipped).Generated by Claude Code