Skip to content

Comments

Removed unused tinybird filters#50

Open
tomerqodo wants to merge 6 commits intocoderabbit_full_base_removed_unused_tinybird_filters_pr12from
coderabbit_full_head_removed_unused_tinybird_filters_pr12
Open

Removed unused tinybird filters#50
tomerqodo wants to merge 6 commits intocoderabbit_full_base_removed_unused_tinybird_filters_pr12from
coderabbit_full_head_removed_unused_tinybird_filters_pr12

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 28, 2026

Benchmark PR from agentic-review-benchmarks#12

Summary by CodeRabbit

  • Bug Fixes

    • Removed device, browser, and operating system filters from analytics queries across multiple endpoints to improve performance and simplify filtering options.
  • Chores

    • Removed analytics breakdowns for top browsers, top devices, and top operating systems.
    • Updated internal token handling mechanisms.
    • Updated corresponding test scenarios to reflect changes.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Walkthrough

This pull request removes filtering capabilities for device, browser, and operating system from Tinybird analytics pipes and their test suites, eliminates corresponding API endpoints from the service allowlist, and modifies JWT token generation behavior in the TinybirdService.

Changes

Cohort / File(s) Summary
Tinybird Pipes – Filter Removal
ghost/core/core/server/data/tinybird/endpoints/api_kpis.pipe, ghost/core/core/server/data/tinybird/endpoints/api_top_locations.pipe, ghost/core/core/server/data/tinybird/endpoints/api_top_pages.pipe, ghost/core/core/server/data/tinybird/pipes/filtered_sessions.pipe
Removed conditional filter clauses for device, browser, and operating system from SQL WHERE conditions. Date range, location, pathname, source, and member_status filters remain intact.
Test Files – Device/Browser/OS Test Case Removal
ghost/core/core/server/data/tinybird/tests/api_kpis.yaml, ghost/core/core/server/data/tinybird/tests/api_top_locations.yaml, ghost/core/core/server/data/tinybird/tests/api_top_pages.yaml, ghost/core/core/server/data/tinybird/tests/api_top_sources.yaml, ghost/core/core/server/data/tinybird/tests/api_top_utm_campaigns.yaml, ghost/core/core/server/data/tinybird/tests/api_top_utm_contents.yaml, ghost/core/core/server/data/tinybird/tests/api_top_utm_mediums.yaml, ghost/core/core/server/data/tinybird/tests/api_top_utm_sources.yaml, ghost/core/core/server/data/tinybird/tests/api_top_utm_terms.yaml
Deleted test cases for "Filtered by browser", "Filtered by device", and "Filtered by OS". Updated "Test with multiple filters combined" cases to filter by source and pathname instead of device and browser, with corresponding expected results adjusted.
Service Layer – Endpoint & Token Changes
ghost/core/core/server/services/tinybird/TinybirdService.js
Removed api_top_browsers, api_top_devices, and api_top_os from TINYBIRD_PIPES allowlist. Modified token generation: _serverToken now stores the entire tokenData object instead of just the token string; JWT signing no longer uses noTimestamp: true; _isJWTExpired now decodes the token instead of verifying with adminToken.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A Simpler Path
Device, browser, OS—three filters we bid farewell,
The pipes now flow more lightly, with a cleaner tale to tell,
Tests reshuffled, tokens reborn with default JWT cheer,
Tinybird analytics simplified, the future's crystal clear! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Removed unused tinybird filters' accurately and concisely summarizes the main change: removal of device, browser, and OS filter logic from multiple Tinybird pipes and their tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea99744 and 6fdbd46.

📒 Files selected for processing (14)
  • ghost/core/core/server/data/tinybird/endpoints/api_kpis.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_locations.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_pages.pipe
  • ghost/core/core/server/data/tinybird/pipes/filtered_sessions.pipe
  • ghost/core/core/server/data/tinybird/tests/api_kpis.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_locations.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_pages.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_sources.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_campaigns.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_contents.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_mediums.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_sources.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_terms.yaml
  • ghost/core/core/server/services/tinybird/TinybirdService.js
💤 Files with no reviewable changes (5)
  • ghost/core/core/server/data/tinybird/tests/api_kpis.yaml
  • ghost/core/core/server/data/tinybird/endpoints/api_kpis.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_pages.pipe
  • ghost/core/core/server/data/tinybird/pipes/filtered_sessions.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_locations.pipe
🔇 Additional comments (11)
ghost/core/core/server/data/tinybird/tests/api_top_utm_mediums.yaml (1)

74-79: LGTM!

The updated combined filter test uses the remaining supported filters (source + pathname) after removal of device/browser/os filters. The expected results are consistent with the individual filter tests (matches the "Filtered by source - bing.com" test results at lines 42-47).

ghost/core/core/server/data/tinybird/tests/api_top_utm_terms.yaml (1)

77-82: LGTM!

The updated combined filter test aligns with the removal of device/browser/os filters. Expected results match the "Filtered by source - bing.com" test case.

ghost/core/core/server/services/tinybird/TinybirdService.js (3)

162-174: Using jwt.decode instead of jwt.verify is acceptable here.

Since this method only checks expiration of self-generated tokens (not validating external tokens), using decode is appropriate and more efficient. The signature verification is unnecessary for tokens this service created.


61-67: LGTM!

Helpful addition of local testing instructions in the class documentation.


47-59: Verify removed pipes are not referenced elsewhere.

The removal of api_top_browsers, api_top_devices, and api_top_os from the allowlist aligns with the PR objective. Ensure no other code attempts to call these endpoints by searching for references to these pipe names throughout the codebase.

ghost/core/core/server/data/tinybird/tests/api_top_locations.yaml (1)

71-77: LGTM!

The updated combined filter test is consistent with the removal of device/browser/os filters. Expected results match the "Filtered by source - bing.com" test case.

ghost/core/core/server/data/tinybird/tests/api_top_utm_campaigns.yaml (1)

74-79: LGTM!

The combined filter test update follows the same pattern as other test files, using source and pathname filters after removing device/browser/os support.

ghost/core/core/server/data/tinybird/tests/api_top_utm_contents.yaml (1)

76-81: LGTM!

The combined filter test update is consistent with other test file changes in this PR.

ghost/core/core/server/data/tinybird/tests/api_top_sources.yaml (1)

84-88: Combined filter update looks consistent with new filter surface.
The new source+pathname combo and narrowed expected result align with the removal of device/browser/os filters.

ghost/core/core/server/data/tinybird/tests/api_top_utm_sources.yaml (1)

83-88: Updated multi-filter expectations match the new source+pathname filters.
Looks consistent with the PR’s removal of device/browser/os filter paths.

ghost/core/core/server/data/tinybird/tests/api_top_pages.yaml (1)

65-69: Multi-filter test updated appropriately for source+pathname.
No issues spotted with the revised parameters/expected result.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ghost/core/core/server/services/tinybird/TinybirdService.js (1)

96-104: Critical bug: Token object stored instead of token string.

The code stores the entire tokenData object (which has {token, exp}) in this._serverToken, but:

  1. _isJWTExpired(this._serverToken) at line 96 passes this object to jwt.decode() which expects a string
  2. The return at line 102 returns {token: {token, exp}, exp} instead of the expected {token: string, exp}

This breaks on the second call when this._serverToken is already an object.

🐛 Proposed fix
 if (!this._serverToken || this._isJWTExpired(this._serverToken)) {
     const tokenData = this._generateToken({name, expiresInMinutes});
-    this._serverToken = tokenData;
+    this._serverToken = tokenData.token;
     this._serverTokenExp = tokenData.exp;
 }
 return {
     token: this._serverToken,
     exp: this._serverTokenExp
 };
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea99744 and 6fdbd46.

📒 Files selected for processing (14)
  • ghost/core/core/server/data/tinybird/endpoints/api_kpis.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_locations.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_pages.pipe
  • ghost/core/core/server/data/tinybird/pipes/filtered_sessions.pipe
  • ghost/core/core/server/data/tinybird/tests/api_kpis.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_locations.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_pages.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_sources.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_campaigns.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_contents.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_mediums.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_sources.yaml
  • ghost/core/core/server/data/tinybird/tests/api_top_utm_terms.yaml
  • ghost/core/core/server/services/tinybird/TinybirdService.js
💤 Files with no reviewable changes (5)
  • ghost/core/core/server/data/tinybird/tests/api_kpis.yaml
  • ghost/core/core/server/data/tinybird/endpoints/api_kpis.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_pages.pipe
  • ghost/core/core/server/data/tinybird/pipes/filtered_sessions.pipe
  • ghost/core/core/server/data/tinybird/endpoints/api_top_locations.pipe
🔇 Additional comments (11)
ghost/core/core/server/data/tinybird/tests/api_top_utm_mediums.yaml (1)

74-79: LGTM!

The updated combined filter test uses the remaining supported filters (source + pathname) after removal of device/browser/os filters. The expected results are consistent with the individual filter tests (matches the "Filtered by source - bing.com" test results at lines 42-47).

ghost/core/core/server/data/tinybird/tests/api_top_utm_terms.yaml (1)

77-82: LGTM!

The updated combined filter test aligns with the removal of device/browser/os filters. Expected results match the "Filtered by source - bing.com" test case.

ghost/core/core/server/services/tinybird/TinybirdService.js (3)

162-174: Using jwt.decode instead of jwt.verify is acceptable here.

Since this method only checks expiration of self-generated tokens (not validating external tokens), using decode is appropriate and more efficient. The signature verification is unnecessary for tokens this service created.


61-67: LGTM!

Helpful addition of local testing instructions in the class documentation.


47-59: Verify removed pipes are not referenced elsewhere.

The removal of api_top_browsers, api_top_devices, and api_top_os from the allowlist aligns with the PR objective. Ensure no other code attempts to call these endpoints by searching for references to these pipe names throughout the codebase.

ghost/core/core/server/data/tinybird/tests/api_top_locations.yaml (1)

71-77: LGTM!

The updated combined filter test is consistent with the removal of device/browser/os filters. Expected results match the "Filtered by source - bing.com" test case.

ghost/core/core/server/data/tinybird/tests/api_top_utm_campaigns.yaml (1)

74-79: LGTM!

The combined filter test update follows the same pattern as other test files, using source and pathname filters after removing device/browser/os support.

ghost/core/core/server/data/tinybird/tests/api_top_utm_contents.yaml (1)

76-81: LGTM!

The combined filter test update is consistent with other test file changes in this PR.

ghost/core/core/server/data/tinybird/tests/api_top_sources.yaml (1)

84-88: Combined filter update looks consistent with new filter surface.
The new source+pathname combo and narrowed expected result align with the removal of device/browser/os filters.

ghost/core/core/server/data/tinybird/tests/api_top_utm_sources.yaml (1)

83-88: Updated multi-filter expectations match the new source+pathname filters.
Looks consistent with the PR’s removal of device/browser/os filter paths.

ghost/core/core/server/data/tinybird/tests/api_top_pages.yaml (1)

65-69: Multi-filter test updated appropriately for source+pathname.
No issues spotted with the revised parameters/expected result.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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