Skip to content

Analytics: track metadata_filter_changed for chip toggles and range slider commits#1768

Open
LeonardoRosaa wants to merge 4 commits into
mainfrom
leonardo-lig-10227-analytics-track-workflows-filter-metadata-filter
Open

Analytics: track metadata_filter_changed for chip toggles and range slider commits#1768
LeonardoRosaa wants to merge 4 commits into
mainfrom
leonardo-lig-10227-analytics-track-workflows-filter-metadata-filter

Conversation

@LeonardoRosaa

@LeonardoRosaa LeonardoRosaa commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Instruments the metadata_filter_changed PostHog event for metadata chip toggles and range slider commits in the grid filter panel.

How has it been tested?

Unit tests.

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • New Features
    • Added analytics tracking for metadata filter interactions (enabled/disabled) and for range adjustments, including the affected field and selected min/max values.
    • Enhanced numeric/video filter components to notify consumers when users commit updated ranges.
  • Bug Fixes
    • Improved end-to-end propagation of committed filter changes from video dimensions and frame bounds, as well as combined metadata dimension sliders.
  • Tests
    • Extended coverage to verify analytics events fire (and don’t fire when missing a collection id), with updated mocks.

@LeonardoRosaa
LeonardoRosaa requested a review from a team as a code owner July 24, 2026 12:23
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@LeonardoRosaa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d565dcb5-1eef-473e-8482-6beaf0ef001a

📥 Commits

Reviewing files that changed from the base of the PR and between 3257f1d and 0bfee08.

📒 Files selected for processing (2)
  • lightly_studio_view/src/lib/components/MetadataFilterChips/useMetadataFilterChips.test.ts
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte
📝 Walkthrough

Walkthrough

Filter components now report committed range changes through callbacks. Metadata filter chips and dataset filter ranges emit metadata_filter_changed PostHog events, with tests covering chip toggle, clear, and missing-collection behavior.

Changes

Metadata filter analytics

Layer / File(s) Summary
Filter change callback propagation
lightly_studio_view/src/lib/components/CombinedMetadataDimensionsFilters/..., lightly_studio_view/src/lib/components/VideoFieldBoundsFilters/..., lightly_studio_view/src/lib/components/VideoFrameBoundsFilter/...
Filter components expose callbacks and report committed width, height, FPS, duration, frame-number, and numeric metadata ranges.
Metadata chip event tracking
lightly_studio_view/src/lib/components/MetadataFilterChips/...
Chip toggles and clearing emit enabled or disabled metadata_filter_changed events when collectionId is available, with corresponding tests.
Dataset route analytics wiring
lightly_studio_view/src/lib/hooks/index.ts, lightly_studio_view/src/routes/datasets/.../+layout.svelte
The dataset layout tracks range changes with collection, field, action, and min/max values, and the hooks barrel exports usePostHog.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FilterComponents
  participant DatasetLayout
  participant MetadataFilterChips
  participant PostHog
  User->>FilterComponents: Commit a filter range
  FilterComponents->>DatasetLayout: Send field name and min/max values
  DatasetLayout->>PostHog: Track metadata_filter_changed with range_changed
  User->>MetadataFilterChips: Toggle or clear a filter
  MetadataFilterChips->>PostHog: Track metadata_filter_changed with enabled or disabled
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: tracking metadata_filter_changed events for chip toggles and slider commits.
Description check ✅ Passed The description follows the template and includes the change summary, testing notes, and changelog status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch leonardo-lig-10227-analytics-track-workflows-filter-metadata-filter

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.

❤️ Share

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

@lightly-fast-track-bot

lightly-fast-track-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

❌  Fast Track: checks did not pass

Guardrail Result Message
dummy Always passes.
frontend/complexity lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte:150 — Function 'handleSelectAllKeydown' has a complexity of 11. Maximum allowed is 10. lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte:374 — Arrow function has a complexity of 11. Maximum allowed is 10.
backend/complexity 0 file(s) checked.
backend/coverage 0 file(s) checked.
diff-size PR adds 139 line(s) (limit: 215).
frontend/coverage [FAIL] lightly_studio_view/src/lib/components/CombinedMetadataDimensionsFilters/CombinedMetadataDimensionsFilters.svelte: no test file found [FAIL] lightly_studio_view/src/lib/components/VideoFieldBoundsFilters/VideoFieldBoundsFilters.svelte: no test file found [FAIL] lightly_studio_view/src/lib/components/VideoFrameBoundsFilter/VideoFrameBoundsFilter.svelte: no test file found [FAIL] lightly_studio_view/src/lib/hooks/index.ts: no test file found [FAIL] lightly_studio_view/src/lib/components/MetadataFilterChips/useMetadataFilterChips.svelte.ts: coverage data not found [FAIL] lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte: coverage data not found

View the guardrail run

To run the guardrails locally, from fast_track/ run make install once, then make run-guardrails (or GUARDRAILS=<name1>,<name2> make run-guardrails for some guardrails).

Reflects 0bfee08.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b0d8e15cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lightly_studio_view/src/lib/hooks/index.ts Outdated
@LeonardoRosaa

Copy link
Copy Markdown
Contributor Author

/review

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