fix(web): count canonical MCP sources in analytics - #1651
Conversation
This comment has been minimized.
This comment has been minimized.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe change centralizes MCP source labels and updates analytics classification for canonical and legacy MCP activity. Tests execute the analytics query against PGlite and verify aggregate metrics. ChangesMCP analytics source classification
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to MCP activity is classified consistently for canonical and legacy audit sources, with aggregate analytics coverage added. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
License Audit
Weak Copyleft Packages (informational)
Resolved Packages (26)
|
Summary
sourcebot-mcp-serversource and legacymcpsource as MCP analytics activityask_codebaseon the canonical MCP sourceRegression
MCP analytics was introduced in #950 on March 4, 2026 using the
mcpsource. The shared MCP tool refactor in #1014 on March 22, 2026 changed tool audit metadata tosourcebot-mcp-serverwithout updating the analytics query, which still required an exactmcpmatch.Testing
yarn workspace @sourcebot/web eslint src/ee/features/analytics/actions.ts src/ee/features/analytics/actions.test.ts src/ee/features/mcp/constants.ts src/ee/features/mcp/server.tsyarn workspace @sourcebot/web test src/app/api/(server)/ee/mcp/route.test.ts src/features/tools/adapters.test.ts src/ee/features/analytics/actions.test.ts --runyarn workspace @sourcebot/web tsc --noEmit(blocked by existing generated.next/typeserrors in unrelated settings pages)Note
Low Risk
Changes are limited to EE analytics classification and MCP audit/telemetry source strings, with PGlite regression tests and no auth or data-migration impact.
Overview
Fixes EE analytics undercounting MCP usage after audit metadata moved from the legacy
mcplabel tosourcebot-mcp-server. The analytics SQL now derives asource_category(mcp,api, orsourcebot) so both labels roll into MCP metrics, and MCP/API/non-web active-user counts use that column instead of one-offmetadata->>'source'checks.MCP server labeling is centralized on shared constants (
MCP_SERVER_SOURCE,LEGACY_MCP_SERVER_SOURCE), includingask_codebase, which still wrotemcp. Regression coverage runs the real aggregation query against PGlite via a new dev dependency.Reviewed by Cursor Bugbot for commit 710bcb1. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes MCP analytics so both the canonical
sourcebot-mcp-serverand legacymcpaudit sources are classified as MCP activity, preventing MCP usage from being undercounted after the shared MCP tool refactor.ask_codebaseto use the canonical MCP source.Written for commit 710bcb1. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Consistency