Repository navigation
fix(insights): don't floor the visibility score to 0 - #283
Merged
Merged
Conversation
The headline Visibility Score is the average score across all prompt runs (brand-mentioned or not). For a brand that appears in only a small fraction of AI answers, that average is a genuine sub-1 value (e.g. 0.4) — but it was passed through Math.round, collapsing it to a flat "0" that read as a broken metric next to non-zero mention/citation counts. Keep one decimal for the brand-level visibility score and its period-over-period delta via a small roundTo1 helper. The metric's meaning is unchanged (still an average over all runs); only the display precision is fixed so small-but-nonzero visibility is no longer shown as 0. Whole-number scores still render without a trailing .0.
gkhngyk
added a commit
that referenced
this pull request
Jul 6, 2026
Bump all packages + docker-compose image tags to 0.1.5 and write the CHANGELOG for everything merged since 0.1.4 (#283–#342): the Query Fan-out capture + tab, Citations Competitor Gaps, brand pause, Site Audit MCP tools, sortable All Prompts, structured logging Phase 2, the topic-detail perf refactor, the invite share-link fix, and more.
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
The Insights Visibility Score card could show 0 for a brand that clearly has mentions and citations (reported on a brand showing 67 mentions / 11 citations but a score of 0).
Root cause — not a calculation bug. The per-row visibility scores are correct (a row with a mention is always non-zero; verified
0rows with a mention-but-zero-score). The headline number is the average score across all prompt runs:total_resultsis every prompt × platform × region run, the vast majority of which don't mention the brand (score 0). For the reported brand:1370 / 3473 = 0.39, andMath.round(0.39) = 0. The brand genuinely appears in only ~23 of 3473 answers (~0.7%), so its average visibility is a real ~0.4/100 — but flooring it to0reads like the metric is broken.Fix (display only — metric meaning unchanged). Keep one decimal for the brand-level visibility score and its period-over-period delta, via a small
roundTo1helper. The denominator and semantics are untouched (still an average over all runs); small-but-nonzero visibility now shows as0.4instead of0. Whole-number scores still render cleanly (e.g.64, not64.0).Scope kept tight to the Insights summary headline + its delta. The same
Math.round(sum/count)pattern exists for per-platform/competitor/topic averages — happy to extend if you want full consistency, but left out here to keep the change focused on the reported card.Related issue
None — reported directly.
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
0.4instead of0; mentions/citations are unchanged.64).+0.1 pts).Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)