Repository navigation
feat(traffic): show the pages AI engines aren't sending traffic to - #725
Merged
Merged
Conversation
…check
The generated types were last refreshed around migration 00049, so the three
Analytics tables and page_opportunities were missing and nothing could read
them from the web app.
Regenerating brought more than the tables. The previous file declared
`Functions: { [_ in never]: never }` — every `supabase.rpc()` call in the app
was untyped, and had been since the file was first generated. With real
signatures in place, 35 call sites stop compiling: they pass `null` for
optional RPC parameters the generator declares as `?: string`.
All 35 become `undefined`, which is behaviour-preserving. An omitted key lets
each function apply its own `DEFAULT NULL`, and the two forms were checked
against the live database: `ai_visibility_aggregates` and
`insights_aggregates` return byte-identical results whether the optional
arguments are passed as explicit NULLs or left out entirely.
`modelFilterArray` and the shared `baseArgs` / `rateArgs` objects return
`undefined` instead of `null` for the same reason — they exist only to be
spread into RPC arguments, where "no bound" is spelled `undefined`.
The detection engine has been writing findings since #724 and nobody could see them. This puts them on AI Traffic Analytics, below the tables that count the tracking snippet's own visits and clearly attributed to Analytics — the two origins describe different things and are never summed. The card reads the nightly run rather than computing anything. The ranking, the signal and the evidence were decided server-side, and recomputing them here would let the card disagree with what the engine stored. Its wording follows the signal the engine actually used. On a property with revenue the column reads Revenue and the rank is "by revenue"; on one with none it reads Engagement, says so, and points at Analytics key events as the way to rank by what pages earn instead. Calling an engagement rank "your most valuable page" would be a true sentence about the wrong thing, and the copy is where that promise is kept or broken. Nothing renders without findings, so the twenty-nine brands with no mapped property meet no empty card explaining a feature they have not connected.
This was referenced Aug 24, 2026
Merged
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 detection engine (#724) has been writing findings since it merged and nobody could see them. This puts them on AI Traffic Analytics, below the tables that count the tracking snippet's own visits and clearly attributed to Analytics — the two origins describe different things and are never summed, per the constraint #704 set.
The card reads the nightly run rather than computing anything. The ranking, the signal and the evidence were decided server-side; recomputing them here would let the card disagree with what the engine stored.
The wording follows the signal the engine actually used. On a property with revenue the column reads Revenue and the rank is "by revenue". On one with none it reads Engagement, says so, and points at Analytics key events as the way to rank by what pages earn instead. Calling an engagement rank "your most valuable page" would be a true sentence about the wrong thing, and the copy is where that promise is kept or broken.
Nothing renders without findings, so the twenty-nine brands with no mapped property meet no empty card explaining a feature they have not connected.
The types commit, and why it is here
The first commit regenerates
web/src/types/supabase.ts, which was last refreshed around migration 00049 — the three Analytics tables andpage_opportunitieswere missing, so nothing could read them from the web app. This PR cannot work without it.It brought more than the tables. The previous file declared
Functions: { [_ in never]: never }: everysupabase.rpc()call in the app was untyped, and had been since the file was first generated. With real signatures in place, 35 call sites stop compiling — they passnullfor optional parameters the generator declares as?: string.All 35 become
undefined, which is behaviour-preserving: an omitted key lets each function apply its ownDEFAULT NULL. Verified against the live database rather than assumed —Kept as a separate commit so the surface diff stays readable.
Related issue
Part of #719 — the surface for the detection layer. Clustering, LLM enrichment and the action/validation layers stay open.
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
Google Analytics · last 28 days; the rank column names the signal the engine used.yarn typecheck,yarn lint(6 pre-existing warnings, 0 errors),yarn format:check,yarn test(84 pass) andyarn buildall pass locally. The production build was run before committing —tscalone does not catch what CI'swebjob does.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)