Skip to content

feat: add sidebar filter telemetry for change detection#34481

Closed
valentinpalkovic wants to merge 6 commits into
nextfrom
worktree-snoopy-spinning-naur
Closed

feat: add sidebar filter telemetry for change detection#34481
valentinpalkovic wants to merge 6 commits into
nextfrom
worktree-snoopy-spinning-naur

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Apr 7, 2026

Summary

  • Adds a sidebar-filter telemetry event that tracks when users toggle built-in tag filters (_docs, _play, _test) or change detection status filters (new, modified, affected)
  • Tracks filter usage from both UI interactions and URL-hydrated filters (shared links/bookmarks)
  • Includes per-filter story counts in the payload so we can understand filter usage in context of project size
  • User-defined tag filters are explicitly excluded from telemetry

Changes

  • core-events/index.ts: Add SIDEBAR_FILTER_CHANGED channel event constant
  • telemetry/types.ts: Add 'sidebar-filter' to EventType union
  • telemetry-channel.ts: Handle SIDEBAR_FILTER_CHANGED and forward to telemetry backend
  • FilterPanel.tsx: Emit telemetry on built-in tag and status filter interactions
  • stories.ts: Emit telemetry on page load when filters are pre-set via URL params

Test plan

  • Added tests for telemetry channel handler (forwards payload, respects disableTelemetry)
  • Manual: Toggle status filters in sidebar → verify telemetry event emitted
  • Manual: Visit Storybook with ?statuses=new URL param → verify URL-trigger telemetry event
  • Manual: Toggle user-defined tag filter → verify no telemetry emitted

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Summary by CodeRabbit

  • New Features
    • Added comprehensive sidebar filter telemetry tracking
    • Captures details on active tag filters and status filters when modified through the UI or via URL parameters
    • Records story counts associated with each filter state change
    • Enables better understanding of user filtering behavior through analytics

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫

PR is not labeled with one of: ["ci:normal","ci:merged","ci:daily","ci:docs"]

🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"
🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.

Generated by 🚫 dangerJS against e3a4746

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d8665027-e3b3-4553-94e3-b418b340f85d

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb708b and e3a4746.

📒 Files selected for processing (6)
  • code/core/src/core-events/index.ts
  • code/core/src/core-server/server-channel/telemetry-channel.test.ts
  • code/core/src/core-server/server-channel/telemetry-channel.ts
  • code/core/src/manager-api/modules/stories.ts
  • code/core/src/manager/components/sidebar/FilterPanel.tsx
  • code/core/src/telemetry/types.ts

📝 Walkthrough

Walkthrough

This PR introduces telemetry tracking for sidebar filter changes. It adds a new SIDEBAR_FILTER_CHANGED event constant, extends the telemetry type system to support 'sidebar-filter' events, registers a telemetry channel listener, and emits the event when filters are applied via URL parameters or user interactions.

Changes

Cohort / File(s) Summary
Event Definition & Telemetry Types
code/core/src/core-events/index.ts, code/core/src/telemetry/types.ts
Added SIDEBAR_FILTER_CHANGED event constant and extended EventType union to include 'sidebar-filter' event type.
Telemetry Channel Handling
code/core/src/core-server/server-channel/telemetry-channel.ts, code/core/src/core-server/server-channel/telemetry-channel.test.ts
Registered listener for SIDEBAR_FILTER_CHANGED event that forwards payloads to telemetry service; added test cases covering both enabled and disabled telemetry scenarios.
Event Emission
code/core/src/manager-api/modules/stories.ts, code/core/src/manager/components/sidebar/FilterPanel.tsx
Added event emission on filter interactions: stories.ts emits when URL-derived filters are applied with computed story counts; FilterPanel.tsx emits on user-triggered filter changes (tag and status filter toggles/inversions) with active filter details.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

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.

1 participant