Skip to content

feat(telemetry): count plugin installs from Orca's public catalogs - #36132

Merged
nwparker merged 2 commits into
mainfrom
nwparker/plugin-install-telemetry
Oct 29, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/plugin-install-telemetry

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​154
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​188 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161

ELI5

The plugin directory wants to show "how many people installed this plugin". Orca already sends anonymous usage events to PostHog for users who opted in. This PR adds two more of those events: one when a plugin is installed or updated, one when it is removed. Only plugins from Orca's two public catalogs are reported.

What Changed

  • Before: installing or removing a plugin sent nothing, so the directory had no install numbers.
  • After: for users who share usage data, Orca sends:
    • plugin_installed: the plugin's public name (publisher.id), its version, the catalog (official or community), what kind of install it was (install, update or reinstall), and what started it (catalog, deep_link or auto_update).
    • plugin_uninstalled: the plugin name and the catalog.
  • Nothing is sent for plugins from a catalog the user added themselves, from a Git URL, or from a local or development folder. Those never pass through this code path, or they are dropped because their catalog isn't one of the two public ones.
  • How it works:
    • The two events are registered next to the other telemetry events, with strict schemas: the plugin key must be a valid publisher.id, and every other field is a fixed value.
    • They are "main-owned", so the renderer cannot send them itself.
    • The install is reported inside the catalog installer after a successful install. The installer reads the previous lock entry first, which tells it whether this is a first install, an update or a reinstall.
    • The automatic updater passes auto_update.
    • The renderer adds one optional flag, fromInstallLink, when the plugin page it installs from was opened by an orca://plugins/... link. It does not change how the install itself works.
  • docs/site/content/docs/telemetry.mdx now describes the new events.

Why

The directory needs install counts, and we didn't want to add a new ingest endpoint just for that. Reusing the existing telemetry pipeline means consent, the official-build-only gate, the burst cap, schema validation, anonymous IDs and PostHog's IP handling all carry over unchanged. Counts will be a lower bound, because users who opted out are not counted, and the directory's copy will say so.

We also considered sending events for every catalog. We didn't, because a private catalog's plugin names could reveal something about an organisation. Both public catalogs are already public repositories, so their plugin names give nothing away.

Linked Issue

Maintainer PR. Design: plugin popularity (install counts + likes).

Visual Proof

N/A. There is no UI change. This only adds analytics events behind the existing consent toggle.

Testing

  • Automated tests added/updated
    • plugin-install-telemetry.test.ts covers catalog classification (official, community, private, wrong host), install vs. reinstall vs. update, that uninstall reports only for public-catalog plugins, that a telemetry failure never breaks an install, and that the strict schemas reject paths, non-keys, a dev catalog and extra fields.
    • The installer test checks the real install → reinstall → update sequence from the community catalog, with each trigger, and that a private catalog sends nothing.
    • The IPC test checks that fromInstallLink maps to deep_link.
    • The renderer test checks that the flag is sent only for the page a link opened.
  • Manual testing: not done. Dev builds never transmit telemetry, so this is covered by the unit tests.
  • Ran pnpm tc, the plugin, telemetry and IPC test suites (463 tests), and pnpm run check:code-quality:changed.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security and privacy: no paths, URLs or private-catalog identifiers are sent, and the schemas reject them.
  • Cross-platform: the logic is platform-independent.
  • SSH: plugin installs happen in the local main process, so there is no remote host involved.
  • Backwards compatibility: the new IPC field is optional, and the renderer and main process ship together.
  • Performance: it reuses a lockfile read the installer was already doing.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@nwparker
nwparker force-pushed the nwparker/plugin-install-telemetry branch from 69ac875 to b71a69b Compare October 29, 2026 22:43
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22c50252-d8b3-4fe8-98a9-3700d8f81b43
Commits

Reviewing files that changed from the base of the PR and between c58045c and 84f1ee6.

Files selected for processing: 18
  • docs/site/content/docs/telemetry.mdx
  • src/main/ipc/plugin-marketplaces.test.ts
  • src/main/ipc/plugin-marketplaces.ts
  • src/main/ipc/plugins.ts
  • src/main/ipc/telemetry.ts
  • src/main/plugins/catalog/plugin-auto-updater.test.ts
  • src/main/plugins/catalog/plugin-auto-updater.ts
  • src/main/plugins/catalog/plugin-marketplace-install-origin.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.test.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.ts
  • src/main/telemetry/plugin-install-telemetry.test.ts
  • src/main/telemetry/plugin-install-telemetry.ts
  • src/preload/api/plugin-host-api.ts
  • src/renderer/src/components/plugins/list/PluginManager.tsx
  • src/renderer/src/components/plugins/state/use-plugin-install-action.test.tsx
  • src/renderer/src/components/plugins/state/use-plugin-install-action.ts
  • src/shared/telemetry-event-registry.ts
  • src/shared/telemetry-plugin-event-schemas.ts
Walkthrough

The change adds schemas and tracking for plugin install and uninstall events from official and community catalogs. Install flows pass a trigger that distinguishes catalog, deep-link, and automatic-update installs. Removal handling reports the plugin source. The telemetry IPC handler rejects renderer submissions for these main-owned events.

Priority: Low

Merge Risk: Moderate · previous review c5804

Plugin telemetry counts and attribution remain inaccurate for several valid install scenarios; resolve these before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: counting plugin installs from Orca's public catalogs through telemetry.
Description check Passed The description is comprehensive and follows the required template. It explains the user impact, implementation, rationale, exclusions, testing, privacy, compatibility, and performance considerations.…
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.
Full details: Description check

Explanation

The description is comprehensive and follows the required template. It explains the user impact, implementation, rationale, exclusions, testing, privacy, compatibility, and performance considerations. The maintainer-specific linked-issue exception is addressed by identifying this as a maintainer PR.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 17 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19533020-7884-4244-924d-62a73ea08d17
Commits

Reviewing files that changed from the base of the PR and between 6c6e629 and 69ac875.

Files selected for processing: 17
  • docs/site/content/docs/telemetry.mdx
  • src/main/ipc/plugin-marketplaces.test.ts
  • src/main/ipc/plugin-marketplaces.ts
  • src/main/ipc/plugins.ts
  • src/main/ipc/telemetry.ts
  • src/main/plugins/catalog/plugin-auto-updater.test.ts
  • src/main/plugins/catalog/plugin-auto-updater.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.test.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.ts
  • src/main/telemetry/plugin-install-telemetry.test.ts
  • src/main/telemetry/plugin-install-telemetry.ts
  • src/preload/api/plugin-host-api.ts
  • src/renderer/src/components/plugins/list/PluginManager.tsx
  • src/renderer/src/components/plugins/state/use-plugin-install-action.test.tsx
  • src/renderer/src/components/plugins/state/use-plugin-install-action.ts
  • src/shared/telemetry-event-registry.ts
  • src/shared/telemetry-plugin-event-schemas.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

marketplaceUrl: sourceState.source.url,
plugin_key: result.pluginKey,
version: result.version,
kind: pluginInstallKind(priorEntry?.version ?? null, result.version),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Data Integrity & Integration · Quick win

Treat a first public-catalog install as an install.

When a plugin with the same key was installed from a Git URL or local path, priorEntry?.version makes its first catalog install an update or reinstall. Marketplace installation permits that replacement. Since directory totals count only install events, the catalog install is omitted from the total. Derive the prior version from the prior marketplace install, not from every lockfile entry. (raw.githubusercontent.com)

Comment on lines +18 to +26
/** The public catalog a marketplace URL names, or null for any other catalog. */
export function pluginTelemetryCatalog(marketplaceUrl: string): Catalog | null {
if (isOfficialMarketplaceGitSource(marketplaceUrl)) {
return 'official'
}
return isSameGitRepository(marketplaceUrl, COMMUNITY_MARKETPLACE_GIT_SOURCE.url)
? 'community'
: null
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Security & Privacy · Quick win

Supported by static analysis

Script executed:

sed -n '20,42p' docs/site/content/docs/telemetry.mdx
sed -n '70,110p' src/main/plugins/catalog/plugin-marketplace-service.ts
rg -n 'marketplaceSourceId|COMMUNITY_MARKETPLACE_GIT_SOURCE|isOfficialMarketplaceGitSource' src/shared/plugins/catalog src/main/plugins/catalog

Repository: stablyai/orca

Length of output: 13620


Script executed:

set -e
printf '%s\n' '--- telemetry implementation ---'
nl -ba src/main/telemetry/plugin-install-telemetry.ts | sed -n '1,180p'
printf '%s\n' '--- installer telemetry call sites ---'
rg -n -F --glob '*.ts' -e 'trackPluginInstalled' -e 'trackPluginUninstalled' src/main src/renderer
printf '%s\n' '--- installer/removal caller blocks ---'
nl -ba src/main/plugins/catalog/plugin-marketplace-installer.ts | sed -n '180,245p'
nl -ba src/main/plugins/catalog/plugin-marketplace-installer.ts | sed -n '245,345p'
printf '%s\n' '--- plugin uninstall call context ---'
rg -n -F --glob '*.ts' -e 'uninstallPlugin' -e 'removePlugin' src/main/plugins src/main/installation

Repository: stablyai/orca

Length of output: 13149


Classify the complete marketplace source, including its ref.

addSource treats a non-default ref as a separate user-added catalog, but telemetry receives only sourceState.source.url. A user-added community or official repository at another ref can therefore install or remove a plugin and enter the community or official telemetry path, contrary to the documentation's exclusion.

Comment on lines +124 to +126
const isFromInstallLink = useCallback(
(pluginKey: string) => pluginKey === linkedKey && openKey === linkedKey,
[linkedKey, openKey]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Clear the install-link origin when the linked page closes.

linkedKey remains set after back closes the page. If the user later opens the same plugin from the catalog, openKey === linkedKey becomes true again. The next install is incorrectly reported as deep_link. Clear the origin on back navigation and ordinary page opening, or bind it to a single page-opening instance. The install-link hook calls this component’s open callback when it opens a link. (raw.githubusercontent.com)

plugin_key: pluginKeySchema,
version: z
.string()
.max(64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Data Integrity & Integration · Quick win

Accept the full supported plugin-version length.

The install schema limits version to 64 characters. The plugin manifest accepts semver without that limit, and catalog release records accept 128 characters. If a valid installed version exceeds 64 characters, track() rejects the entire install event. Raise this limit to match the supported release contract and test a long valid prerelease version. (raw.githubusercontent.com)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45fad5da-0536-42c3-9285-a89148f887b3
Commits

Reviewing files that changed from the base of the PR and between 69ac875 and b71a69b.

Files selected for processing: 3
  • src/main/plugins/catalog/plugin-auto-updater.test.ts
  • src/main/plugins/catalog/plugin-auto-updater.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

}
// Why read first: the install rewrites the lock entry this comparison needs.
const installed = await this.readMarketplaceInstall(preview.pluginKey)
const priorEntry = await this.readLockEntry(preview.pluginKey)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Data Integrity & Integration · Quick win

Read the prior entry inside the install mutation.

If two installs for the same plugin overlap, both can read an absent entry before either install publishes it. The mutation queue then serializes both installs, but both events report kind: 'install', which inflates directory totals. installPluginFromMarketplace already reads the entry inside that queue; return that entry for telemetry classification. (raw.githubusercontent.com)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up Comments

Outside diff Document uninstall fields separately from install fields.

27-35: Minor · Data Integrity & Integration · Quick win

Document uninstall fields separately from install fields.

The Plugins section says that remove events record version, install kind, and trigger. The uninstall tracker sends only plugin_key and catalog, so the documentation gives users an incorrect account of uninstall telemetry.

Suggested fix
- **Plugins** — when you install, update or remove a plugin from Orca's official or community catalog. We record the plugin's public name (`publisher.id`), its version, which of those two catalogs it came from, whether it was a first install, an update or a reinstall, and whether you started it from the catalog, from an install link, or through automatic updates. These events power the public install counts on the plugin directory, which therefore count only users who share usage data. Plugins from a catalog you added yourself, from a Git URL, or from a local or development folder are never reported.
+ **Plugins** — when you install, update or remove a plugin from Orca's official or community catalog. For installs and updates, we record the plugin's public name (`publisher.id`), its version, which of those two catalogs it came from, whether it was a first install, an update or a reinstall, and whether you started it from the catalog, from an install link, or through automatic updates. For removals, we record only the plugin's public name and catalog. These events power the public install counts on the plugin directory, which therefore count only users who share usage data. Plugins from a catalog you added yourself, from a Git URL, or from a local or development folder are never reported.

Open the source location

Nitpick Cover both plugin events in the renderer IPC boundary test.

187-210: Trivial · Security & Privacy · Quick win

Cover both plugin events in the renderer IPC boundary test.

The main-owned set includes plugin_installed and plugin_uninstalled, but the test does not send either event. A regression that forwards either renderer event to track would pass this test and allow the renderer to spoof plugin telemetry.

Suggested fix
     handler({}, 'daemon_audit_eligibility', {})
     handler({}, 'agent_token_usage', {})
+    handler({}, 'plugin_installed', {})
+    handler({}, 'plugin_uninstalled', {})
     expect(trackMock).not.toHaveBeenCalled()

Open the source location


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c40549a8-b9b1-465f-8ab2-72346880dc3b
Commits

Reviewing files that changed from the base of the PR and between b71a69b and c58045c.

Files selected for processing: 2
  • src/main/plugins/catalog/plugin-marketplace-install-origin.ts
  • src/main/plugins/catalog/plugin-marketplace-installer.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@nwparker
nwparker force-pushed the nwparker/plugin-install-telemetry branch from c58045c to 84f1ee6 Compare October 29, 2026 23:17
@nwparker
nwparker merged commit 0426223 into main Oct 29, 2026
54 checks passed
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