Skip to content

More logging 0831#1433

Merged
duckduckhero merged 3 commits intomainfrom
more-logging-0831
Sep 1, 2025
Merged

More logging 0831#1433
duckduckhero merged 3 commits intomainfrom
more-logging-0831

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

📝 Walkthrough

Walkthrough

Adds analytics events across editor interactions: template selection in FloatingButton (requires new userId prop), Ask AI click in TextSelectionPopover, and selecting Custom STT provider in settings. EditorArea passes userId to FloatingButton. Functional flows remain the same after emitting analytics.

Changes

Cohort / File(s) Summary
EditorArea: FloatingButton analytics + prop wiring
apps/desktop/src/components/editor-area/floating-button.tsx, apps/desktop/src/components/editor-area/index.tsx
Introduces required prop userId to FloatingButton and passes it from EditorArea. Adds analytics event on template selection for non-default-auto templates; errors are caught and logged.
EditorArea: Ask AI click analytics
apps/desktop/src/components/editor-area/text-selection-popover.tsx
Emits ask_ai_clicked analytics event with distinct_id before existing Ask AI handling. No signature changes.
Settings: STT provider analytics
apps/desktop/src/components/settings/views/ai-stt.tsx
On selecting Custom STT, emits custom_stt_selected analytics event with distinct_id; refactors handler accordingly. No public API changes.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant FB as FloatingButton
  participant ANA as analyticsCommands
  participant APP as Editor logic

  U->>FB: Select template (templateId)
  alt templateId is built-in (not "auto")
    FB->>ANA: event({event: "template_<id>_selected", distinct_id: userId, template_id})
    ANA-->>FB: resolve/reject (errors caught)
  else default/auto
    Note over FB: No analytics emitted
  end
  FB->>APP: handleEnhanceWithTemplate(templateId)
  APP-->>U: Enhancement proceeds
Loading
sequenceDiagram
  participant U as User
  participant P as TextSelectionPopover
  participant ANA as analyticsCommands
  participant TT as TipTap/Editor

  U->>P: Click "Ask AI"
  P->>ANA: event({event: "ask_ai_clicked", distinct_id: userId})
  ANA-->>P: resolve/reject (ignored)
  P->>TT: Compute positions and proceed with Ask AI flow
Loading
sequenceDiagram
  participant U as User
  participant STT as STT Settings View
  participant ANA as analyticsCommands
  participant CFG as Settings Store

  U->>STT: Select provider "Custom"
  STT->>ANA: event({event: "custom_stt_selected", distinct_id: userId})
  ANA-->>STT: resolve/reject (ignored)
  STT->>CFG: Set provider = "Custom"
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Template Selector Merge  #1089 — Prior work on FloatingButton template selection; this PR augments it with userId prop and analytics.
  • Redemption settings hotfix #1270 — Touches the same FloatingButton file but removes analytics/userId; likely conflicts with this PR’s additions.
  • Text popover #1308 — Modifies TextSelectionPopover and EditorArea; overlaps with the new Ask AI analytics and prop wiring here.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch more-logging-0831

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
apps/desktop/src/components/editor-area/text-selection-popover.tsx (1)

178-181: Include session_id in analytics for consistency with other events.

Keeps your analytics schema aligned with index.tsx events that send session_id.

     analyticsCommands.event({
       event: "ask_ai_clicked",
       distinct_id: userId,
+      session_id: sessionId,
     });
apps/desktop/src/components/settings/views/ai-stt.tsx (1)

49-55: Track provider in the analytics payload for clarity.

Small payload enrichment; no behavior change.

   const setProviderToCustom = () => {
     setProviderMutation.mutate("Custom");
     analyticsCommands.event({
       event: "custom_stt_selected",
       distinct_id: userId,
+      provider: "Custom",
     });
   };
apps/desktop/src/components/editor-area/floating-button.tsx (1)

151-168: Close popover and trigger enhance before awaiting analytics to keep UI snappy.

Avoid blocking UI on the analytics call; fire it after UI actions. Behavior remains the same.

-const handleTemplateSelect = async (templateId: string) => {
-  if (templateId !== "auto" && isDefaultTemplate(templateId)) {
-    try {
-      const templateName = templateId.replace("default-", "").replace(/-/g, "_");
-      const eventName = `${templateName}_builtin_selected`;
-
-      await analyticsCommands.event({
-        event: eventName,
-        distinct_id: userId,
-        template_id: templateId,
-      });
-    } catch (error) {
-      console.error("Failed to track template selection:", error);
-    }
-  }
-  setShowTemplatePopover(false);
-  handleEnhanceWithTemplate(templateId);
-};
+const handleTemplateSelect = async (templateId: string) => {
+  // Update UI immediately
+  setShowTemplatePopover(false);
+  handleEnhanceWithTemplate(templateId);
+
+  if (templateId !== "auto" && isDefaultTemplate(templateId)) {
+    try {
+      const templateName = templateId.replace("default-", "").replace(/-/g, "_");
+      const eventName = `${templateName}_builtin_selected`;
+      await analyticsCommands.event({
+        event: eventName,
+        distinct_id: userId,
+        template_id: templateId,
+      });
+    } catch (error) {
+      console.error("Failed to track template selection:", error);
+    }
+  }
+};

Optional: consider a stable event name (e.g., "builtin_template_selected") with template_id as a property to simplify downstream analytics.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7e39f36 and ac4a034.

⛔ Files ignored due to path filters (2)
  • apps/desktop/src/locales/en/messages.po is excluded by !**/*.po
  • apps/desktop/src/locales/ko/messages.po is excluded by !**/*.po
📒 Files selected for processing (4)
  • apps/desktop/src/components/editor-area/floating-button.tsx (4 hunks)
  • apps/desktop/src/components/editor-area/index.tsx (1 hunks)
  • apps/desktop/src/components/editor-area/text-selection-popover.tsx (1 hunks)
  • apps/desktop/src/components/settings/views/ai-stt.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit configuration file

**/*.{js,ts,tsx,rs}: 1. Do not add any error handling. Keep the existing one.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • apps/desktop/src/components/editor-area/text-selection-popover.tsx
  • apps/desktop/src/components/editor-area/floating-button.tsx
  • apps/desktop/src/components/editor-area/index.tsx
  • apps/desktop/src/components/settings/views/ai-stt.tsx
🧬 Code graph analysis (2)
apps/desktop/src/components/editor-area/floating-button.tsx (1)
apps/desktop/src/utils/default-templates.ts (1)
  • isDefaultTemplate (211-213)
apps/desktop/src/components/settings/views/ai-stt.tsx (1)
apps/desktop/src/contexts/hypr.tsx (1)
  • useHypr (63-69)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (macos, macos-latest)
  • GitHub Check: ci (windows, windows-latest)
🔇 Additional comments (1)
apps/desktop/src/components/editor-area/floating-button.tsx (1)

54-55: New required prop userId: looks good; confirm all invocations updated.

Props/type changes are correct here. Please double-check other call sites (if any) to avoid TS errors at build time.

Use the same search as suggested in EditorArea to catch any missing userId props.

Also applies to: 65-66

isError={enhance.status === "error" && !isCancelled}
progress={progress}
showProgress={llmConnectionQuery.data?.type === "HyprLocal" && sessionId !== onboardingSessionId}
userId={userId}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Passing userId to FloatingButton: LGTM; please verify all call sites.

Prop plumb is correct. Ensure no other usages of FloatingButton are missing the new required prop.

Run to find any usages without userId:


🏁 Script executed:

#!/bin/bash
rg -nP --type tsx '<FloatingButton(?![^>]*\buserId=)' -C2

Length of output: 87


🏁 Script executed:

#!/bin/bash
# Search all .tsx files for FloatingButton usages missing the userId prop
rg -n --glob '*.tsx' -P '<FloatingButton(?![^>]*\buserId=)' -C2

Length of output: 521


Add missing userId prop to FloatingButton in editor-area
apps/desktop/src/components/editor-area/index.tsx (line 327): the <FloatingButton …> invocation there lacks userId={userId}—please add it.

🤖 Prompt for AI Agents
In apps/desktop/src/components/editor-area/index.tsx around line 336, the
FloatingButton JSX is missing the userId prop; add userId={userId} to the
FloatingButton invocation so the component receives the current userId prop
(ensure userId is in scope or passed into the parent component).

@duckduckhero duckduckhero merged commit a5b2724 into main Sep 1, 2025
11 of 13 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 3, 2025
@ComputelessComputer ComputelessComputer deleted the more-logging-0831 branch December 14, 2025 15:20
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

Comments