:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(mcp-analytics): keep muted text readable inside quill subtrees (#64898)
Sam Pennington7d121dfa2e06
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex ebff97d5eb2c..9e64028a3e45 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2297,9 +2297,9 @@ snapshots:filters-taxonomic-filter--three-groups-default-layout--light:hash: v1.k794b7964.7d03de4d736f21437d1009fc19719734175f0c0822cd2ccdbc380ffa8f5e627c.lGDn7Z4UhsMOqLuuLQ9_TO9FuIbd45s3RKUs7A69z7sfilters-taxonomic-filter-menu-rebuild--data-warehouse-config--dark:- hash: v1.k794b7964.569842a2260c8d733d246dfe531215ef3a3d43693476adb54c851cbf8d17da7b.Ca6MIi6JxgqrWDq997ImIvtzWdbiYL0qzUS2-tXZC-I+ hash: v1.k794b7964.081cc00ac1a8aa163d450f048dc7feda95a0476571f8658cf9aa599fd63091b4.f725rpCD6SirD7BBjM4as-0beK7wMfFKKe851kF6m_8filters-taxonomic-filter-menu-rebuild--data-warehouse-config--light:- hash: v1.k794b7964.7013ab5215c8ea2feebb430426dd7e01e528ccdee53ede68f596c50eca150998.wbsgCZgLFEkmJXYwEdUGz33ABZ1t20TDbI-HtrE35Qo+ hash: v1.k794b7964.01d4497a46a5e3aabbfe60d93d111b6740cff833009ce5dd82cad109f0a1e970.fZbwT3a3pYi-AbLXab7IL0WpoHpUpsuxqW51MMzaPDgfilters-taxonomic-filter-menu-rebuild--events-and-actions--dark:hash: v1.k794b7964.658adcb2dd4233e9fbfe4a8c62759a6e8fe9619fe22141e691b8ab7e421ebce8.JXXooKz-3MXbjt8D2MNdWnb9xYSJD_ZglAdj1gZbZc4filters-taxonomic-filter-menu-rebuild--events-and-actions--light:@@ -4109,17 +4109,17 @@ snapshots:mcp-apps-error-tracking--active--light:hash: v1.k794b7964.3c4efa7c47d8f2863f3cec2c180dbf617b7a9b4253892f83900241929ab831b4.PQds2YnDLqkVbifI_HkTi1Uh7fkqL_P_ptcsfpXAwdAmcp-apps-error-tracking--chained-exceptions--light:- hash: v1.k794b7964.2d8d072c53d90abafcfe6cd8b8e65c308c9db771db6a30413acb7d8104439ea7.cYdlD4O4FAq28cL2Tr2_C-VUq8HIgZCiVt7mHae8McU+ hash: v1.k794b7964.3ea85511cb30cdb51f56c0948d5899e2f0f715760294e42a75c13b9310d42450.iAUDGmczM5zt3qLl4zAOjAcCzNIVcCI8CHArerH_0hAmcp-apps-error-tracking--error-details--light:- hash: v1.k794b7964.dce336af2844f1f3d4dafd4978b65b0c669a3802a260ce0e7b702506b9f21901.4AKvAX9KwpZJnwyVHUcG2SLWESoFGX9mbVyO4u0rTvI+ hash: v1.k794b7964.8ee3b6226ad1f401fc48aa2583b312f73013c093c46ddee3b9dc46472e731079.ZKE8Hc8oEny6YA-_0V4lb1WuQIBKhz0ab5ZIlRZE8QYmcp-apps-error-tracking--list--light:hash: v1.k794b7964.d63364a23688f1cbfbd4125311af21c5c944218f15855ebd5f1f3a42c57124de.urMEJeE8zDtt0lQb-cQh0ID1l6N3_4MONXn7Buvtincmcp-apps-error-tracking--python-stack-trace--light:- hash: v1.k794b7964.ac1c7fd3446c53d71ad4ad2b376368a1356d153b7fe5bd6f3fed5dbe031c0e5b.BdRSKxB_BpJepiFZBk4AHGCz5rK7AoKM-CdQb7GtMvQ+ hash: v1.k794b7964.d80733b9a543cc59a61a99b8515eaf35fa17b95a4d7d282c469c5ddf49be5cb5.2hXi52twI4RVs4FegK34kQf5bGN26uKyur7GeBeXuREmcp-apps-error-tracking--resolved--light:hash: v1.k794b7964.fde427a04a5be7d7bd22031125188c719c92e3cec3040de64e833259496836a4.tr8wf9B0D2VjRFAGVH8LpfHNiLuXIUBQkPcsRigf1MQmcp-apps-error-tracking--stack-trace--light:- hash: v1.k794b7964.8524bb4c05b5a9c8d6fe003f00af9761f5c69bc38f6b9c0107a957fbf3fd01eb.Y6lrgb37LtPPp5pMJtAk720dUy0D3hGbh5NK_9w5BvI+ hash: v1.k794b7964.ac8c39032175dc1563ddf768d6727f75f2390551e4f6439ab518c11ee6a94718.Vjv6MNSc8qI7fF_Ivipaas1J8MlaycHKDg3r4_8tXVwmcp-apps-error-tracking--with-external-links--light:hash: v1.k794b7964.1c438b81ddecf6cd51016c53d57b3a80c7a60aab20f69a4629f52d9366452c72.alkUqUY-JcNO_PquFIaJSqBh0hBs4BbMf4NNbwjkHI4mcp-apps-experiments--completed--light:@@ -5772,10 +5772,18 @@ snapshots:hash: v1.k794b7964.c25b8e1693844d8f9d2b6e8c08a06bea95ea0a6ff0575e468c03004eabcd41f4.kgv_UP8c-JuwxoLHEYC5xFD08QcECeL5ThgVof5i0VUscenes-app-mcp-analytics--dashboard--light:hash: v1.k794b7964.e80fca14f66bcb1dff0d8645f852c51d5b0131a676e246d52ee938ce8bf1205e.zUCTZ71CfSoVdfgE-isvw_ymFWq8OoRQ0y_lv_z2HWY+ scenes-app-mcp-analytics--intent-clustering--dark:+ hash: v1.k794b7964.81d4c896ec102bd79537c025cb4ee78b2feaaaf8401a3006086af07faeee8fce.yHdrL8SIGaWXnpRDQa2Z50wdyvKeIdckMceuGfyWd7Q+ scenes-app-mcp-analytics--intent-clustering--light:+ hash: v1.k794b7964.e8afe54e6c6ac3d0a18404a894e2c6be786c4bb58b3319cb4957248779d16512.7pPTDjFoPUJ9Qhle_VtMRf3WWNEnSqnx4NqhYII5u9Iscenes-app-mcp-analytics--sessions--dark:hash: v1.k794b7964.277463ad445565d14f2549a063a4f8c0c23a81af419bfafc9eefc65577fb0834.woelvjefGWPDW4Acae_sP2fA7YidrA7tkhfvC8u_AQ4scenes-app-mcp-analytics--sessions--light:hash: v1.k794b7964.bbe32ae76ef1ed9053d24d860933bc0bf1cca54ed3f601effaf515b8d9a6cd21.saYknnP-f1-BwcwRczq_p6CgUmnH8cmE8YJ_9XpN2Pk+ scenes-app-mcp-analytics--tool-quality--dark:+ hash: v1.k794b7964.d2757a520322fef89d0c9132c4e6674682d2412f7f53bd13408b1d9b2f695c8e.2STiQWuPVur5p9FeZeo2Hm8Ozc954bUiNhberVgEWaU+ scenes-app-mcp-analytics--tool-quality--light:+ hash: v1.k794b7964.edf70234f94442e3741467f5fd4bb7820914cbb2cd8482e0bfd24d1fa2a2864f.IpuKCVssCeT7n_iG8HH8ApmKEY_I4s85jEkYkrUDl1Uscenes-app-mcp-analytics-dashboard-cards--daily-calls-and-errors--dark:hash: v1.k794b7964.921f819d1e55f6b1df74b8d4990bba635aa6f7db8ab7a75a232009bbac5f2e43.qy4SEtXqEIFBeEw5gzgTLCCbKUL61bV7pvuMq_cdTzAscenes-app-mcp-analytics-dashboard-cards--daily-calls-and-errors--light:diff --git a/frontend/src/styles/quill-bridge.scss b/frontend/src/styles/quill-bridge.scssindex ac3d7cca6041..34cbf054b8b9 100644--- a/frontend/src/styles/quill-bridge.scss+++ b/frontend/src/styles/quill-bridge.scss@@ -61,8 +61,16 @@* Override #1: rebind PostHog vars that already-compiled `bg-*` /* `text-*` classes resolve at runtime, so the same class flips meaning* inside a quill subtree. Map LHS = PostHog name, RHS = quill name.+ *+ * NOTE: we deliberately do NOT rebind `--muted-3000` here. PostHog uses+ * the single `--muted-3000` token for both `bg-muted` (surface) and+ * `text-muted` (muted text), whereas quill splits these into `--muted`+ * (surface) and `--muted-foreground` (text). Pointing `--muted-3000` at+ * quill's surface token turned every PostHog `text-muted` inside a quill+ * subtree into a near-invisible surface colour (dark grey on the dark+ * background). We keep `--muted-3000` theme-aware and instead pin only+ * the `.bg-muted` class to quill's surface below.*/- --muted-3000: var(--muted);/** Inside `[data-quill]`, `bg-primary` means quill's BRAND colour, not@@ -107,6 +115,15 @@background-color: var(--card);}+/*+ * `bg-muted` collides: PostHog's compiled rule reads `--muted-3000`, quill's+ * reads `--muted`. Pin the class to quill's muted surface inside the subtree+ * without hijacking `--muted-3000` (which `text-muted` also depends on).+ */+[data-quill] .bg-muted {+ background-color: var(--muted);+}+[data-quill] .bg-popover {background-color: var(--popover);}diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsxindex 5954b8a2f513..9735cea3d1cd 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx@@ -124,6 +124,38 @@ const TOOL_CALL_LIST = {],}+// Tool quality tab — one row per tool: tool, total_calls, errors, error_rate_pct,+// p50, p95, p99, users, sessions, first_seen, last_seen.+const TOOL_QUALITY_ROWS = [+ ['execute-sql', 1480, 144, 9.7, 820, 3525, 9800, 210, 540, '2026-05-08T09:00:00Z', '2026-06-07T10:04:00Z'],+ ['read-data-schema', 760, 3, 0.4, 180, 1298, 2600, 160, 410, '2026-05-08T08:00:00Z', '2026-06-07T10:00:00Z'],+ ['query-trends', 540, 5, 1.0, 410, 2122, 4100, 120, 300, '2026-05-09T11:00:00Z', '2026-06-07T09:45:00Z'],+ ['insight-create', 410, 8, 2.0, 260, 727, 1500, 95, 210, '2026-05-10T14:00:00Z', '2026-06-06T18:00:00Z'],+ ['dashboard-create', 260, 2, 0.8, 300, 940, 1800, 70, 150, '2026-05-11T10:00:00Z', '2026-06-06T16:00:00Z'],+ ['cohort-create', 95, 6, 6.3, 480, 1620, 3100, 40, 80, '2026-05-12T13:00:00Z', '2026-06-05T12:00:00Z'],+]++// Tool quality daily stats (selected/aggregate): day, calls, errors, p50, p95, p99.+const DAILY_STATS = [+ ['2026-06-01', 480, 22, 800, 3400, 9200],+ ['2026-06-02', 510, 31, 840, 3520, 9600],+ ['2026-06-03', 495, 18, 790, 3300, 8900],+ ['2026-06-04', 530, 40, 870, 3700, 10200],+ ['2026-06-05', 560, 27, 810, 3450, 9400],+ ['2026-06-06', 540, 19, 800, 3380, 9100],+ ['2026-06-07', 575, 33, 830, 3500, 9700],+]++const CATEGORY_LIST = [['Data exploration'], ['Insights'], ['Dashboards'], ['Cohorts']]++const CATEGORY_COUNTS = [+ ['Data exploration', 2240],+ ['Insights', 950],+ ['Dashboards', 260],+ ['Cohorts', 95],+ ['', 410],+]+// Scoped to $mcp_tool_call via eventNames — these populate the property-filter picker.const MCP_PROPERTY_DEFINITIONS = {count: 5,@@ -148,22 +180,107 @@ const MCP_FEATURE_FLAG_DEFINITIONS = {],}+// Intent clustering tab. Matches MCPIntentClusterSnapshotApi — clusters carry a+// tool_distribution (heatmap), sample_intents, routing_entropy (badge variants),+// and a Sankey journey. The three entropy bands exercise every badge colour.const CLUSTER_SNAPSHOT = {- status: 'ready',+ status: 'idle',error_message: '',last_computed_at: '2026-06-07T06:00:00Z',last_computed_by_email: '[email protected]',- computed_with: null,- clusters: Array.from({ length: 6 }, (_, i) => ({- id: i + 1,- label: `Cluster ${i + 1}`,- summary: '',- session_count: 10 * (i + 1),- tool_call_count: 40 * (i + 1),- error_rate_pct: i,- sample_session_ids: [],- top_tools: [],- })),+ computed_with: {+ distance_threshold: 0.35,+ embedding_model: 'text-embedding-3-small',+ n_intents: 412,+ n_clusters: 3,+ },+ clusters: [+ {+ id: 1,+ label: 'Investigate slow dashboard queries and tune them',+ intent_count: 64,+ session_count: 48,+ call_count: 1820,+ error_count: 96,+ error_rate_pct: 5.3,+ routing_entropy: 0.24,+ tool_distribution: [+ { tool: 'execute-sql', count: 1480, pct: 81.3, errors: 92, error_rate_pct: 6.2 },+ { tool: 'read-data-schema', count: 260, pct: 14.3, errors: 2, error_rate_pct: 0.8 },+ { tool: 'query-trends', count: 80, pct: 4.4, errors: 2, error_rate_pct: 2.5 },+ ],+ sample_intents: [+ 'Find why the revenue dashboard takes 30s to load and rewrite the query.',+ 'EXPLAIN the slow funnel query and add an index hint.',+ 'Profile the top 5 slowest insights this week.',+ ],+ journey: {+ total_sessions: 48,+ paths: [+ {+ steps: ['read-data-schema', 'execute-sql', 'execute-sql', null],+ outcome: 'completed',+ count: 26,+ },+ { steps: ['execute-sql', 'execute-sql', null, null], outcome: 'error', count: 14 },+ { steps: ['read-data-schema', 'query-trends', null, null], outcome: 'completed', count: 8 },+ ],+ leak: { steps: ['execute-sql', 'execute-sql', null, null], outcome: 'error', count: 14 },+ },+ },+ {+ id: 2,+ label: 'Create and tweak insights from natural language',+ intent_count: 41,+ session_count: 33,+ call_count: 690,+ error_count: 14,+ error_rate_pct: 2.0,+ routing_entropy: 0.55,+ tool_distribution: [+ { tool: 'insight-create', count: 320, pct: 46.4, errors: 8, error_rate_pct: 2.5 },+ { tool: 'query-trends', count: 240, pct: 34.8, errors: 4, error_rate_pct: 1.7 },+ { tool: 'read-data-schema', count: 130, pct: 18.8, errors: 2, error_rate_pct: 1.5 },+ ],+ sample_intents: [+ 'Build a weekly active users trend split by plan.',+ 'Make a funnel from signup to first insight created.',+ ],+ journey: {+ total_sessions: 33,+ paths: [+ {+ steps: ['read-data-schema', 'query-trends', 'insight-create', null],+ outcome: 'completed',+ count: 21,+ },+ { steps: ['insight-create', null, null, null], outcome: 'completed', count: 9 },+ ],+ leak: null,+ },+ },+ {+ id: 3,+ label: 'Explore the event schema and available properties',+ intent_count: 29,+ session_count: 22,+ call_count: 410,+ error_count: 3,+ error_rate_pct: 0.7,+ routing_entropy: 0.82,+ tool_distribution: [+ { tool: 'read-data-schema', count: 150, pct: 36.6, errors: 1, error_rate_pct: 0.7 },+ { tool: 'execute-sql', count: 120, pct: 29.3, errors: 1, error_rate_pct: 0.8 },+ { tool: 'query-trends', count: 90, pct: 22.0, errors: 1, error_rate_pct: 1.1 },+ { tool: 'insight-create', count: 50, pct: 12.2, errors: 0, error_rate_pct: 0.0 },+ ],+ sample_intents: [+ 'What properties does the $pageview event have?',+ 'List all custom events captured in the last 30 days.',+ ],+ journey: null,+ },+ ],}const meta: Meta = {@@ -172,7 +289,7 @@ const meta: Meta = {decorators: [mswDecorator({get: {- '/api/environments/:team_id/mcp_analytics/intent_clusters/': CLUSTER_SNAPSHOT,+ '/api/projects/:team_id/mcp_analytics/intent_clusters/': CLUSTER_SNAPSHOT,'/api/environments/:team_id/mcp_analytics/sessions/': SESSION_LIST,'/api/environments/:team_id/mcp_analytics/sessions/:session_id/tool_calls/': TOOL_CALL_LIST,'/api/projects/:team_id/property_definitions': ({ request }) => {@@ -195,6 +312,20 @@ const meta: Meta = {if (query.includes('AS session_id')) {return [200, { results: SESSION_RESULTS }]}+ // Tool quality tab queries — checked before the dashboard's+ // p95 tool table so the more specific markers win.+ if (query.includes('toDate(timestamp) AS day')) {+ return [200, { results: DAILY_STATS }]+ }+ if (query.includes('p99_duration_ms')) {+ return [200, { results: TOOL_QUALITY_ROWS }]+ }+ if (query.includes('DISTINCT') && query.includes('AS category')) {+ return [200, { results: CATEGORY_LIST }]+ }+ if (query.includes('count() AS calls') && query.includes('GROUP BY category')) {+ return [200, { results: CATEGORY_COUNTS }]+ }if (query.includes('p95_duration_ms')) {return [200, { results: TOOL_RESULTS }]}@@ -225,3 +356,19 @@ export const Sessions: Story = {pageUrl: urls.mcpAnalyticsSessions(),},}++export const ToolQuality: Story = {+ parameters: {+ pageUrl: urls.mcpAnalyticsToolQuality(),+ // Quill charts paint to canvas asynchronously; skip the draw so the+ // snapshot stays deterministic. The surrounding layout/text — what+ // catches theme regressions — is still captured.+ testOptions: { skipCanvasDraw: true },+ },+}++export const IntentClustering: Story = {+ parameters: {+ pageUrl: urls.mcpAnalyticsIntentClustering(),+ },+}