Code Review Bench PR #25719 - Added materialized view and duplicated v2 Tinybird endpoints#14
Conversation
…re robust polling approach
Code Review 🚫 Blocked 0 resolved / 1 findingsWell-structured v2 analytics optimization with one critical bug: the frontend URL builder reverses the version suffix order ( 🚨 Bug: Frontend version prefix is reversed, producing wrong endpoint URLs📄 apps/admin-x-framework/src/utils/stats-config.ts:18 The frontend URL builder in This means when Suggested fixRules 🎸 1 action takenGitar Rules
5 rules not applicable. Show all rules by commenting OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
| 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; |
There was a problem hiding this comment.
🚨 Bug: Frontend version prefix is reversed, producing wrong endpoint URLs
The frontend URL builder in stats-config.ts constructs the versioned endpoint name as ${config.version}_${endpointName} (version prefix), which produces URLs like /v0/pipes/v2_api_kpis.json. However, the backend URL builder in tinybird.js uses ${pipeName}_${version} (version suffix), producing /v0/pipes/api_kpis_v2.json, which matches the actual Tinybird pipe names (e.g., api_kpis_v2.pipe).
This means when version: "v2" is configured, the admin frontend will request completely wrong endpoint names (e.g., v2_api_kpis instead of api_kpis_v2), causing all analytics API calls from the admin panel to fail with 404 errors.
Was this helpful? React with 👍 / 👎
| const finalEndpointName = config.version ? `${config.version}_${endpointName}` : endpointName; | |
| const finalEndpointName = config.version ? `${endpointName}_${config.version}` : endpointName; |
- Apply suggested fix
Code Review Bench PR TryGhost#25719 - Added materialized view and duplicated v2 Tinybird endpoints
Benchmark PR for Gitar evaluation
Original PR: agentic-review-benchmarks#13
Adds materialized view and duplicates v2 Tinybird endpoints for performance optimization.
Summary by Gitar
api_kpis_v2,api_active_visitors_v2,api_post_visitor_counts_v2,api_top_devices_v2,api_top_locations_v2,api_top_pages_v2,api_top_sources_v2, and 5 utm-related endpoints) using ClickHouse materialized views with AggregatingMergeTree for pre-computed session aggregation_mv_session_data_v2datasource with state/merge aggregator pattern (countState/countMerge, minState/minMerge, argMinState/argMinMerge) enabling distributed aggregation and optimized query performanceversionparameter in StatsConfig interface for runtime endpoint selection, allowing dynamic switching between v1 and v2 analytics endpoints via configuration