Repository navigation
fix(reports): lead the KPI section with the visibility rate, with a fallback for old snapshots - #515
Merged
Conversation
…allback for old snapshots
gkhngyk
approved these changes
Jul 23, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Excellent work — snapshot sourced from the same RPC pair as the Insights KPI so the numbers match by construction, the runtime field-check for pre-#490 competitor snapshots is exactly the right call over trusting the type, and the no-fabricated-delta instruction in the summary prompt shows real care. Thanks!
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
Reports still snapshotted and rendered the old all-rows
avgVisibilityScoreafter the Insights dashboard moved to the prompt-level Visibility Rate in #490, so a report's KPI section could show a wildly different number than the Insights page for the identical period (e.g. 59.7% vs. 100%). This snapshots the Visibility Rate at report-generation time and leads the KPI row and competitors table with it in both the on-screen viewer and the PDF export — the score average stays as a secondary stat. Reports generated before this change keep rendering exactly as before (novisibilityRatein their stored payload → automatic fallback to the old display). Also tightens the AI executive-summary prompt so its prose narrates the rate, not the score, as the headline number, and doesn't fabricate a delta for a metric that has no previous-period value in the snapshot.Related issue
Closes #492
Type of change
fix— Bug fixChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)