Skip to content

fix(referral-traffic): order Traffic Insights sources cdn-first#2655

Open
cwjwisse wants to merge 1 commit into
mainfrom
fix/referral-traffic-cdn-first-order
Open

fix(referral-traffic): order Traffic Insights sources cdn-first#2655
cwjwisse wants to merge 1 commit into
mainfrom
fix/referral-traffic-cdn-first-order

Conversation

@cwjwisse

Copy link
Copy Markdown
Contributor

What

Flips the Traffic Insights source-ordering so the has-data endpoint returns availableSources cdn-first instead of optel-first.

src/controllers/llmo/llmo-referral-traffic.js:

  • TRAFFIC_INSIGHTS_SOURCES = ['optel', 'cdn']['cdn', 'optel'] (the derived TRAFFIC_INSIGHTS_TABLES follows in lockstep).
  • Updated the rationale comment block and the has-data JSDoc to describe cdn as the preferred source.

Why

Referral Traffic Insights has two mutually-exclusive sources per site (optel & cdn). Product rule: always prefer cdn over optel. Clients (referral dashboard, agentic, url-inspector) read availableSources[0] as the active source, so ordering has-data cdn-first makes all of them seed cdn over optel for free.

AA / GA4 / CJA are unaffected — they live in the separate Business Impact tab and use their own DRS provider check. The has-data availableSources is type-locked to 'optel' | 'cdn' only.

Scope / not changed

  • The filter-dimensions availableSources path is untouched — it comes from the RPC row.available_sources, a different code path independent of this constant.

Merge order

⚠️ Merge this BEFORE the frontend PR. The frontend reads availableSources[0]; until this lands it degrades gracefully to optel.

Test

  • npx mocha test/controllers/llmo/llmo-referral-traffic.test.js → 89 passing (flipped the has-data both-records assertion to ['cdn', 'optel']).
  • eslint on changed files clean.

🤖 Generated with Claude Code

The has-data endpoint now returns availableSources ordered cdn-first
instead of optel-first. Clients (referral dashboard, agentic, url-inspector)
pick availableSources[0] as the active source, so this makes them all seed
cdn over optel for free, matching the product rule "always prefer cdn".

Flips the TRAFFIC_INSIGHTS_SOURCES constant (TRAFFIC_INSIGHTS_TABLES derives
from it and follows in lockstep) and the has-data both-records test assertion.
The filter-dimensions availableSources path is unaffected: it comes from the
RPC row.available_sources, a separate code path.

AA/GA4/CJA are unaffected — they live in the separate Business Impact tab and
have their own DRS provider check; has-data availableSources is type-locked to
'optel'|'cdn' only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cwjwisse cwjwisse requested a review from MysticatBot June 21, 2026 23:48
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @cwjwisse,

⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.

Verdict: Approve - clean, well-scoped config flip with matching test coverage.
Changes: reorders the Traffic Insights source priority array from optel-first to cdn-first so clients prefer cdn as the active data source (2 files).

No issues found. The constant reorder, derived table mapping, comment updates, and test assertion all move in lockstep. No logic paths are affected beyond output ordering since TRAFFIC_INSIGHTS_TABLES is derived via .map from the same array.


Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 0m 42s | Cost: $2.06 | Commit: ed451733b1b0a2d7ab518bb66de2eba4115dff2e
If this code review was useful, please react with 👍. Otherwise, react with 👎.

@MysticatBot MysticatBot added the ai-reviewed Reviewed by AI label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed Reviewed by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants