Analytics: track export format selection, annotation downloads, and export triggered - #1774
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe export dialog now uses a ChangesExport tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ExportSamples
participant useExportTracking
participant ExportDialog
participant PostHog
ExportSamples->>useExportTracking: invoke tracking callback
useExportTracking->>ExportDialog: mark download clicked
useExportTracking->>PostHog: emit export event and properties
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
…-data-curation-and-export-export-dialog-interactions
❌ Fast Track: checks did not pass
To run the guardrails locally, from Reflects |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3340471b8e
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
lightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.test.ts (1)
121-139: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the
Errorobject normalization path.The failure test only passes a string. Add a case using
new Error('network timeout')and assert thaterror_messagecontains the error’s message.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.test.ts` around lines 121 - 139, Extend the failure coverage for useExportTracking’s trackExportTriggered to pass new Error('network timeout') instead of only a string, and assert the emitted export_triggered payload normalizes error_message to the Error message. Preserve the existing collection, format, sample count, tag, and success assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@lightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.test.ts`:
- Around line 3-12: Update the mock setup in the useExportTracking test so
mockTrackEvent and mockMarkDownloadClicked are created through vi.hoisted rather
than top-level const bindings, then reference the hoisted values inside the
vi.mock factory and rerun the workspace checks.
In
`@lightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.ts`:
- Around line 84-98: Update trackExportTriggered so error_message never contains
the raw error value sent to PostHog. Map export failures to an allowlisted error
category or code before populating the telemetry payload, while preserving
success reporting and null when no error exists.
---
Nitpick comments:
In
`@lightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.test.ts`:
- Around line 121-139: Extend the failure coverage for useExportTracking’s
trackExportTriggered to pass new Error('network timeout') instead of only a
string, and assert the emitted export_triggered payload normalizes error_message
to the Error message. Preserve the existing collection, format, sample count,
tag, and success assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6538ef2e-838b-4b91-8703-0b27958acaf4
📒 Files selected for processing (3)
lightly_studio_view/src/lib/components/ExportSamples/ExportSamples.sveltelightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.test.tslightly_studio_view/src/lib/components/ExportSamples/useExportTracking/useExportTracking.ts
|
/review |
What has changed and why?
Instruments all export-dialog events via a new
useExportTrackinghook.Events added:
export_dialog_default_format_set- fires in the$effectthat resetsexportTypewhen the dialog opens; captures the auto-selected format.export_format_select_opened- fires when the format dropdown opens; captures the current format so intent vs. commit can be measured.export_format_selected- fires inonValueChange; captures the chosen format.export_download_clicked- fires for all six annotation (href) download buttons; also callsmarkDownloadClickedto suppressexport_dialog_dismissed.export_download_clicked+export_triggered- fire around the asynchandleExportcall for samples export;successis snapshotted before the await so they are stable regardless of state changes during the request.How has it been tested?
Unit tests + manual tests
Did you update CHANGELOG.md?
Summary by CodeRabbit
Summary by CodeRabbit
Improvements
Tests