You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(telemetry): count plugin installs from Orca's public catalogs - #36132
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)
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: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
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 checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: counting plugin installs from Orca's public catalogs through telemetry.
Description check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
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)
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.
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)
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)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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)
The reason will be displayed to describe this comment to others. Learn more.
Follow-up Comments
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.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
plugin_installed: the plugin's public name (publisher.id), its version, the catalog (officialorcommunity), what kind of install it was (install,updateorreinstall), and what started it (catalog,deep_linkorauto_update).plugin_uninstalled: the plugin name and the catalog.publisher.id, and every other field is a fixed value.auto_update.fromInstallLink, when the plugin page it installs from was opened by anorca://plugins/...link. It does not change how the install itself works.docs/site/content/docs/telemetry.mdxnow 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
plugin-install-telemetry.test.tscovers 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, adevcatalog and extra fields.fromInstallLinkmaps todeep_link.pnpm tc, the plugin, telemetry and IPC test suites (463 tests), andpnpm run check:code-quality:changed.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)