Skip to content

fix(reports): lead the KPI section with the visibility rate, with a fallback for old snapshots - #515

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/reports-visibility-rate-kpi
Jul 23, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/reports-visibility-rate-kpi

Conversation

@d180

@d180 d180 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Reports still snapshotted and rendered the old all-rows avgVisibilityScore after 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 (no visibilityRate in 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 fix

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@gkhngyk
gkhngyk merged commit daa874c into ansvisor:main Jul 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reports: lead the KPI section with the visibility rate, with a fallback for old snapshots

2 participants