Repository navigation
fix(reports): rank prompt/topic performance by visibility rate, not diluted average - #568
Merged
Merged
Conversation
…iluted average getPromptPerformance and getTopicPerformance averaged visibility_score over all runs, letting zero-visibility runs dilute heavily-mentioned prompts/topics into misleading single digits — the same defect ansvisor#562 already fixed for the All Prompts tab. Both now rank/report by visibility rate (share of runs with a mention or citation), matching getPromptVisibilitySummaries' rounding. Both scans were also un-paginated, so PostgREST silently capped them at 1000 rows on busy brands (the ansvisor#430/ansvisor#464 defect family); they now page in 1000-row batches like the existing citation-evidence scan. Rendering (detail page + PDF) shows the rate with a % sign, falling back to the legacy avgVisibility/100 cell for reports generated before this shipped — mirroring the competitor table's existing visibilityRate fallback. The AI executive-summary prompt is updated with the same distinction so generated prose doesn't misquote avgVisibility as a percentage. Closes ansvisor#564 Co-Authored-By: Claude Sonnet 5 <[email protected]>
gkhngyk
approved these changes
Jul 31, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Thanks — recipe followed to the letter, and updating the LLM summary prompt so it quotes the rate correctly was a genuinely sharp catch beyond the issue's scope. 🙌
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
getPromptPerformanceandgetTopicPerformancenow rank/report by prompt-level Visibility Rate (share of runs with a mention or citation) instead of an all-runs averagevisibility_score, which let zero-visibility runs dilute heavily-mentioned prompts/topics into misleading single digits — the same class of bug#562fixed for the All Prompts tab. Rate uses the same rounding asgetPromptVisibilitySummaries.#430/#464defect family). Both now page in 1000-row batches, same pattern as the existing citation-evidence scan.%sign, but fall back to the legacyavgVisibility/100cell for reports generated before this shipped (reports are immutable snapshots) — mirroring the competitor table's existingvisibilityRatefallback dance.avgVisibilityas a raw score, not a percentage, and prefersvisibilityRatewhen present.Closes #564
Test plan
yarn lintpassesyarn typecheckpassesyarn format:checkpasses%NN/100(no%) for legacy payloads