Repository navigation
feat(prompts): break the per-prompt health columns down by location - #784
Merged
Merged
Conversation
Multi-location tracking (#691) produced data no page could read at the level that made it worth buying. "What is our visibility in Germany?" was answerable brand-wide from Visibility's region filter, but "…for this prompt?" was not: the All Prompts health columns averaged every location a prompt runs in into one figure, so a prompt that is strong at home and invisible abroad looked merely mediocre, with no way to split the two. prompt_visibility_summaries gains p_region (00072, applied). NULL keeps the blended whole-brand behaviour exactly, so nothing changes for callers that don't pass it. The 3-argument signature is dropped rather than kept alongside: with both installed a 3-argument call matches the old function and the new one through its default, which Postgres rejects as ambiguous. Dropping is safe across the deploy window because PostgREST binds arguments by name. The Prompts page gets the Location control next to the date range — same shape and vocabulary as Visibility, fed by the same whole-brand filter-options RPC so the two pages cannot disagree about where a brand is tracked. It only appears when a brand has produced results in more than one location; a filter with one option is noise. A location that stops producing results falls back to the blended view rather than filtering the table to nothing. The prompt detail page's per-run groups now render their location through formatRegionDisplay. It printed the raw code, which was harmless while every code was a country and actively confusing the moment states arrived: "DE" and "US-DE" side by side are Germany and Delaware.
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
Multi-location tracking (#691) started producing data that no page could read at the level that made it worth buying. "What is our visibility in Germany?" was answerable brand-wide from Visibility's region filter. "…for this prompt?" was not: the All Prompts health columns blended every location a prompt runs in into a single figure, so a prompt that is strong at home and invisible abroad looked merely mediocre, with nothing on screen to split the two.
prompt_visibility_summariesgainsp_region(migration00072, already applied to the hosted DB).NULLkeeps the blended whole-brand behaviour exactly, so callers that don't pass it are unchanged. The 3-argument signature is dropped rather than left alongside the new one: with both installed, a 3-argument call matches the old function and the new one through its default, which Postgres rejects as ambiguous. Dropping is safe across the deploy window because PostgREST binds arguments by name — the running app's 3-name call takes the default.The Prompts page gets a Location control beside the date range — same shape and vocabulary as Visibility, fed by the same whole-brand
insights_filter_optionsRPC so the two pages cannot disagree about where a brand is tracked. Two deliberate behaviours:The prompt detail page renders its per-run group locations through
formatRegionDisplay. It printed the raw code, which was harmless while every code was a country and actively confusing the moment states arrived:DEandUS-DEside by side are Germany and Delaware.Verified against production: for a brand whose results are all one location, filtering by that location returns figures identical to unfiltered, and filtering by any other returns empty. No brand has multi-location results yet — targeting only became possible in #783 — so cross-location behaviour is exercised by construction rather than by existing data.
Related issue
Follow-up to #691 (closed by #783), from the discovery gap found while reviewing what shipped.
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
cd web && yarn test— 134 pass.DE/US-DE.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)