Skip to content

Added materialized view and duplicated v2 Tinybird endpoints#23

Open
tomerqodo wants to merge 13 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_added_materialized_view_and_duplicated_v2_tinybird_endpoints_pr232from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_added_materialized_view_and_duplicated_v2_tinybird_endpoints_pr232
Open

Added materialized view and duplicated v2 Tinybird endpoints#23
tomerqodo wants to merge 13 commits intocursor_combined_20260121_qodo_grep_cursor_copilot_1_base_added_materialized_view_and_duplicated_v2_tinybird_endpoints_pr232from
cursor_combined_20260121_qodo_grep_cursor_copilot_1_head_added_materialized_view_and_duplicated_v2_tinybird_endpoints_pr232

Conversation

@tomerqodo
Copy link
Copy Markdown

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#232


Note

Implements MV-backed analytics and config-driven endpoint versioning.

  • New materialized view + pipes: Adds _mv_session_data_v2 and mv_session_data_v2.pipe, plus filtered_sessions_v2.pipe to derive session-level attributes via *Merge combinators
  • Duplicated v2 endpoints: Adds api_kpis_v2, api_active_visitors_v2, api_post_visitor_counts_v2, api_top_{locations,pages,sources,utm_sources,utm_mediums,utm_campaigns,utm_contents,utm_terms,devices}_v2 and registers them in TinybirdService
  • Config-driven versioning: Introduces StatsConfig.version and updates request builders (stats-config.ts, server tinybird.js) to use pipe_vX naming; removes tb_version from server API/options and updates unit tests
  • Docs & tests: Updates Tinybird README and adds comprehensive fixtures for all v2 endpoints
  • Minor UI refactor: Simplifies FrameworkProvider context provider JSX

Written by Cursor Bugbot for commit 4bc9eeb. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

return `${baseUrl}/v0/pipes/${endpointName}.json?${params}`;

// Append version suffix if provided (e.g., "v2" -> "api_kpis_v2")
const finalEndpointName = config.version ? `${config.version}_${endpointName}` : endpointName;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Version suffix ordering produces incorrect endpoint URLs

High Severity

The version suffix is prepended instead of appended to the endpoint name. The code produces v2_api_kpis but the actual Tinybird endpoint files are named api_kpis_v2.pipe. The comment on line 17 even states the expected format "e.g., 'v2' -> 'api_kpis_v2'" but the implementation does the opposite. The server-side code in tinybird.js correctly uses ${pipeName}_${version}, creating an inconsistency between client and server URL construction that will cause 404 errors.

Fix in Cursor Fix in Web

if (options.source !== undefined) {
tinybirdOptions.source = options.source;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Source filter silently removed from top content API

Medium Severity

The source filter handling was removed from fetchRawTopContentData but source remains in the API options list in stats.js and is documented in the JSDoc at line 37. The Tinybird pipes (filtered_sessions.pipe and filtered_sessions_v2.pipe) still support source filtering via {% if defined(source) %}. Users can pass source parameters to filter by traffic source but the filter will be silently ignored since source is never added to tinybirdOptions.

Fix in Cursor Fix in Web

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.

2 participants