feat(web): add PostHog event for askgh repo index trigger#936
feat(web): add PostHog event for askgh repo index trigger#936
Conversation
Fires `wa_askgh_repo_index_triggered` with owner, repo, and repoId when a user triggers a new repository to be indexed in the Ask GitHub flow (i.e., when `addGithubRepo` is called for a repo that doesn't yet exist). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThe PR adds PostHog event tracking for when a repository is newly triggered for indexing in Ask GitHub. It introduces a new event definition ( Changes
Sequence DiagramsequenceDiagram
participant Page
participant RepoIndexedGuard
participant PostHog
Page->>Page: Lookup or create repo
Note over Page: Determine repoId and isNewlyTriggered
Page->>RepoIndexedGuard: Render with isNewlyTriggered=true/false
alt isNewlyTriggered = true
RepoIndexedGuard->>RepoIndexedGuard: useEffect detects trigger
RepoIndexedGuard->>PostHog: captureEvent(wa_askgh_repo_index_triggered)
PostHog-->>RepoIndexedGuard: Event recorded
else isNewlyTriggered = false
Note over RepoIndexedGuard: No event fired
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dex-triggered-event # Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/web/src/app/[domain]/askgh/[owner]/[repo]/page.tsx (1)
25-25: Extract the duplicated`${owner}/${repo}`string.
displayNameon line 25 and the inlinerepoFullNameprop on line 54 compute the same string. Hoist it to a shared variable.♻️ Proposed refactor
- const displayName = `${owner}/${repo}`; + const repoFullName = `${owner}/${repo}`; const existingRepo = await prisma.repo.findFirst({ where: { orgId: SINGLE_TENANT_ORG_ID, - displayName: displayName, + displayName: repoFullName, external_codeHostType: 'github', external_codeHostUrl: 'https://github.com', }, });- <RepoIndexedGuard initialRepoInfo={repoInfo} isNewlyTriggered={isNewlyTriggered} repoFullName={`${owner}/${repo}`}> + <RepoIndexedGuard initialRepoInfo={repoInfo} isNewlyTriggered={isNewlyTriggered} repoFullName={repoFullName}>Also applies to: 54-54
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/web/src/app/`[domain]/askgh/[owner]/[repo]/page.tsx at line 25, The string interpolation `${owner}/${repo}` is computed twice; consolidate it by creating a single shared variable (e.g., displayName) and use that variable wherever the full repo name is needed (replace the inline repoFullName prop value and any other occurrences), update the existing const displayName = `${owner}/${repo}` and pass displayName into the component props instead of recomputing the template string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/web/src/app/`[domain]/askgh/[owner]/[repo]/page.tsx:
- Line 25: The string interpolation `${owner}/${repo}` is computed twice;
consolidate it by creating a single shared variable (e.g., displayName) and use
that variable wherever the full repo name is needed (replace the inline
repoFullName prop value and any other occurrences), update the existing const
displayName = `${owner}/${repo}` and pass displayName into the component props
instead of recomputing the template string.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CHANGELOG.mdpackages/web/src/app/[domain]/askgh/[owner]/[repo]/components/repoIndexedGuard.tsxpackages/web/src/app/[domain]/askgh/[owner]/[repo]/page.tsxpackages/web/src/lib/posthogEvents.ts
| wa_askgh_login_wall_prompted: {}, | ||
| wa_askgh_repo_index_triggered: { | ||
| repo: string, | ||
| repoId: number, |
There was a problem hiding this comment.
nit: I would use repo name instead of the repo's id since it is opaque
Summary
wa_askgh_repo_index_triggeredPostHog event that fires when a user triggers a new repository to be indexed in the Ask GitHub flowowner,repo, andrepoIdpropertiesTest plan
wa_askgh_repo_index_triggeredevent appears in PostHog🤖 Generated with Claude Code
Summary by CodeRabbit