Track app-origin GitHub stars (#3310)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
+16
-1
@@ -92,6 +92,9 @@ import type {
|
||||
UpdateProjectItemFieldArgs,
|
||||
UpdatePullRequestBySlugArgs
|
||||
} from '../../shared/github-project-types'
|
||||
import { appStarSourceSchema } from '../../shared/gh-star-source'
|
||||
import { track } from '../telemetry/client'
|
||||
import { getCohortAtEmit } from '../telemetry/cohort-classifier'
|
||||
|
||||
// Why: notify every renderer (each window has its own SWR cache instance)
|
||||
// that a work item was mutated locally so they can drop their cached entry
|
||||
@@ -844,7 +847,19 @@ export function registerGitHubHandlers(store: Store, stats: StatsCollector): voi
|
||||
// Star operations target the Orca repo itself — no repoPath validation needed
|
||||
ipcMain.handle('gh:viewer', () => getAuthenticatedViewer())
|
||||
ipcMain.handle('gh:checkOrcaStarred', () => checkOrcaStarred())
|
||||
ipcMain.handle('gh:starOrca', () => starOrca())
|
||||
ipcMain.handle('gh:starOrca', async (_event, source: unknown) => {
|
||||
const sourceParse = appStarSourceSchema.safeParse(source)
|
||||
const starred = await starOrca()
|
||||
if (starred && sourceParse.success) {
|
||||
// Why: this main-owned event bypasses renderer telemetry IPC, so cohort
|
||||
// context must be attached here on the successful star path.
|
||||
track('app_starred_orca', {
|
||||
source: sourceParse.data,
|
||||
...getCohortAtEmit()
|
||||
})
|
||||
}
|
||||
return starred
|
||||
})
|
||||
|
||||
// Why: `rate_limit` is exempt from GitHub's rate-limit accounting, so
|
||||
// polling is cheap. A 30s in-process cache still avoids the gh subprocess
|
||||
|
||||
Reference in New Issue
Block a user