Skip to content

Add git sync to import_project analytics event#1327

Open
chiang-daniel wants to merge 2 commits intomainfrom
KIL-598/sign-up-analytics
Open

Add git sync to import_project analytics event#1327
chiang-daniel wants to merge 2 commits intomainfrom
KIL-598/sign-up-analytics

Conversation

@chiang-daniel
Copy link
Copy Markdown
Contributor

@chiang-daniel chiang-daniel commented Apr 22, 2026

What does this PR do?

Add git sync to import_project analytics event which fires on any successful project import. We added git sync specific properties this time.

Added 3 new props

  • method
  • git_host
  • auth_mode

Sample:

  Local import:
  { "method": "local" }

  Git sync import:
  {
    "method": "git_sync",
    "git_host": "github", 
    "auth_mode": "github_oauth"
  }

Verified by adding temp console logs.

Contributor License Agreement

I, @, confirm that I have read and agree to the Contributors License Agreement.

Checklists

  • Tests have been run locally and passed
  • New tests have been added to any work in /lib

Summary by CodeRabbit

  • Chores
    • Enhanced analytics for project imports: import events now include explicit method (method: "local" or method: "git_sync") and include detected git host and selected auth mode.
  • New Features
    • Captures a "git_sync_setup_start" analytics event when the Git Auto Sync entry is selected before opening the wizard.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

UI now emits PostHog analytics during the import workflow: import_project events include explicit method (local or git_sync) and auth_mode, the git host is derived from the provided URL, and a git_sync_setup_start event is sent when starting the Git Auto Sync flow.

Changes

Cohort / File(s) Summary
Import UI — entry & local imports
app/web_ui/src/lib/components/import/import_project.svelte
Send import_project event with { method: "local" } for local imports; emit git_sync_setup_start when the user clicks the Git Auto Sync entry point before advancing the wizard.
Import UI — git wizard completion
app/web_ui/src/lib/components/import/step_complete.svelte
On save, emit import_project with method: "git_sync", include derived git_host (GitHub/GitLab/other) and selected auth_mode; existing rename/save/clear/refresh/done-or-error flow preserved.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through dialogs, swift and neat,
I marked each import with a cheerful beat,
Local hops labeled, git hosts found,
Auth modes noted, events abound,
A tiny rabbit tracking every feat.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly describes the main change: adding git sync information to the import_project analytics event.
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.
Description check ✅ Passed The PR description comprehensively covers the changes, provides clear examples of the new event properties, and includes all required CLA and checklist sections.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch KIL-598/sign-up-analytics

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 and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces PostHog analytics tracking for the project import workflow, specifically for Git Auto Sync and local import methods. It adds logic to identify git hosts and captures metadata such as authentication modes. A critical issue was identified where the analytics event in the wizard completion step may capture incorrect data because the underlying store is cleared in a sub-component before the event is triggered. Additionally, a redundant store-clearing call was noted.

Comment thread app/web_ui/src/lib/components/import/import_project.svelte
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

📊 Coverage Report

Overall Coverage: 92%

Diff: origin/main...HEAD

No lines with coverage information in this diff.


Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
app/web_ui/src/lib/components/import/step_complete.svelte (1)

38-42: Optional: consider co-locating git_host_label with the other URL helpers.

Since isGitHubUrl/isGitLabUrl already live in $lib/git_sync/api.ts, moving git_host_label (or an equivalent gitHostLabel) there would keep host-classification logic in one place and make it reusable if other analytics call sites need the same "github" | "gitlab" | "other" label (e.g. future git-sync events). No change in behavior required for this PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/web_ui/src/lib/components/import/step_complete.svelte` around lines 38 -
42, Move the git_host_label logic into the shared URL helpers file where
isGitHubUrl and isGitLabUrl live (e.g., add a new exported function gitHostLabel
or export git_host_label from $lib/git_sync/api.ts) so host-classification is
colocated; keep the same behavior returning "github" | "gitlab" | "other",
export it, and then replace the local git_host_label in step_complete.svelte
with an import of the new exported function (update any call sites to use the
exported name).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/web_ui/src/lib/components/import/step_complete.svelte`:
- Around line 38-42: Move the git_host_label logic into the shared URL helpers
file where isGitHubUrl and isGitLabUrl live (e.g., add a new exported function
gitHostLabel or export git_host_label from $lib/git_sync/api.ts) so
host-classification is colocated; keep the same behavior returning "github" |
"gitlab" | "other", export it, and then replace the local git_host_label in
step_complete.svelte with an import of the new exported function (update any
call sites to use the exported name).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e64360d4-5720-4323-9457-10010179e0ea

📥 Commits

Reviewing files that changed from the base of the PR and between 7efe720 and 9158f4d.

📒 Files selected for processing (2)
  • app/web_ui/src/lib/components/import/import_project.svelte
  • app/web_ui/src/lib/components/import/step_complete.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/web_ui/src/lib/components/import/import_project.svelte

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