Skip to content

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

Merged
LeonardoRosaa merged 9 commits into
mainfrom
leonardo-lig-10227-analytics-track-workflows-filter-metadata-filter
Jul 28, 2026
Merged

Analytics: track metadata_filter_changed for chip toggles and range slider commits#1768
LeonardoRosaa merged 9 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, including enabled/disabled toggles and committed range updates.
    • Filter changes now report the field name plus selected minimum/maximum values across dimension, numeric metadata, video (width/height/FPS/duration), and frame-number filters.
  • Tests
    • Expanded coverage to verify emitted tracking events for disable/enable/clear actions and to confirm no tracking occurs when collection identifiers are missing.

@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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Filter components now expose committed range-change callbacks, and dataset layouts record those changes in PostHog. Metadata filter chip toggles and clearing also emit enabled or disabled tracking events, with tests covering payloads and missing collection IDs.

Changes

Metadata filter analytics

Layer / File(s) Summary
Filter change callback propagation
lightly_studio_view/src/lib/components/CombinedMetadataDimensionsFilters/CombinedMetadataDimensionsFilters.svelte, lightly_studio_view/src/lib/components/VideoFieldBoundsFilters/VideoFieldBoundsFilters.svelte, lightly_studio_view/src/lib/components/VideoFrameBoundsFilter/VideoFrameBoundsFilter.svelte
Filter components invoke optional callbacks with field names and committed minimum and maximum values for dimension, metadata, video, and frame ranges.
Metadata chip event tracking
lightly_studio_view/src/lib/components/MetadataFilterChips/useMetadataFilterChips.svelte.ts, lightly_studio_view/src/lib/components/MetadataFilterChips/useMetadataFilterChips.test.ts
Chip toggles and clearing emit metadata_filter_changed events with enabled or disabled actions; tests verify payloads and missing collection IDs.
Dataset route analytics wiring
lightly_studio_view/src/lib/hooks/index.ts, lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/+layout.svelte
The PostHog hook is re-exported, and the dataset layout passes a range-change callback to combined filters and records range changes with collection, field, action, and bounds data.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FilterComponents
  participant DatasetLayout
  participant PostHog
  User->>FilterComponents: commit range or toggle chip
  FilterComponents->>DatasetLayout: report field and range
  DatasetLayout->>PostHog: track metadata_filter_changed
Loading

Possibly related PRs

Suggested reviewers: igorsusmelj

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: tracking metadata_filter_changed for chip toggles and range slider commits.
Description check ✅ Passed The description includes the required sections and matches the PR scope, with a test note and changelog checkbox.
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:151 — 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:384 — 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 138 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/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 34ced25.

@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

@IgorSusmelj IgorSusmelj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@LeonardoRosaa
LeonardoRosaa added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2026
@LeonardoRosaa
LeonardoRosaa enabled auto-merge July 28, 2026 14:49
@LeonardoRosaa
LeonardoRosaa added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit efce863 Jul 28, 2026
21 checks passed
@LeonardoRosaa
LeonardoRosaa deleted the leonardo-lig-10227-analytics-track-workflows-filter-metadata-filter branch July 28, 2026 16:29
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.

3 participants