feat(analytics): posthog audit — remove noise, add 10 new events#3960
feat(analytics): posthog audit — remove noise, add 10 new events#3960waleedlatif1 merged 4 commits intostagingfrom
Conversation
Remove task_marked_read (fires automatically on every task view). Add workspace_id to task_message_sent for group analytics. New events: - search_result_selected: block/tool/trigger/workflow/table/file/ knowledge_base/workspace/task/page/docs with query_length - workflow_imported: count + format (json/zip) - workflow_exported: count + format (json/zip) - folder_created / folder_deleted - logs_filter_applied: status/workflow/folder/trigger/time - knowledge_base_document_deleted - scheduled_task_created / scheduled_task_deleted
PR SummaryLow Risk Overview Reduces analytics noise by removing the Reviewed by Cursor Bugbot for commit 8858f57. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8858f57. Configure here.
| onOpenChangeRef.current(false) | ||
| }, | ||
| [workspaceId] | ||
| ) |
There was a problem hiding this comment.
Four identical handlers differ only by analytics string
Low Severity
handleTableSelect, handleFileSelect, and handleKbSelect are exact copies of handleTaskSelect, differing only in the result_type string. The same file already demonstrates a factory pattern via handleBlockSelect (which accepts a type parameter) with thin handleBlockSelectAsBlock/handleBlockSelectAsTool/handleBlockSelectAsTrigger wrappers. These four handlers could follow that same pattern with a single shared useCallback that takes a result_type parameter, reducing the risk of inconsistent future changes.
Reviewed by Cursor Bugbot for commit 8858f57. Configure here.
Greptile SummaryThis PR is a PostHog analytics audit that removes noisy events and adds 13 new, targeted event captures across server-side API routes and client-side components. The changes span folder lifecycle events, scheduled task CRUD, knowledge-base document deletion, task/chat operations, log filter interactions, search result selection, and workflow import/export. The event catalog ( Key changes:
Confidence Score: 5/5Safe to merge — all new analytics captures are fire-and-forget and cannot affect functional behavior. The sole finding is a P2 style inconsistency in home.tsx (useEffect vs. inline ref update). All event captures are correctly typed, guarded against missing session/workspace data, and consistent with the shared PostHogEventMap. No logic bugs, data-loss risks, or security issues identified. apps/sim/app/workspace/[workspaceId]/home/home.tsx — minor posthogRef update pattern inconsistency. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Server["Server-side API Routes"]
A["POST /api/folders"] -->|folder_created| PH
B["DELETE /api/folders/:id"] -->|folder_deleted| PH
C["DELETE /api/knowledge/:id/documents/:docId"] -->|knowledge_base_document_deleted| PH
D["POST /api/schedules"] -->|scheduled_task_created| PH
E["DELETE /api/schedules/:id"] -->|scheduled_task_deleted| PH
F["PATCH /api/mothership/chats/:chatId"] -->|task_renamed or task_marked_unread| PH
G["DELETE /api/mothership/chats/:chatId"] -->|task_deleted| PH
end
subgraph Client["Client-side Components and Hooks"]
H["home.tsx handleSubmit"] -->|task_message_sent| PH
I["logs-toolbar.tsx filter handlers"] -->|logs_filter_applied| PH
J["search-modal.tsx select handlers"] -->|search_result_selected| PH
K["use-export-workflow.ts"] -->|workflow_exported| PH
L["use-import-workflow.ts"] -->|workflow_imported| PH
end
PH["PostHog Analytics"]
|


Re-land of #3917 — cherry-picked onto clean staging after accidental branch deletion.