Skip to content

feat: stamp product: failproofai-oss on all PostHog events#380

Merged
NiveditJain merged 2 commits into
mainfrom
luv-382
May 25, 2026
Merged

feat: stamp product: failproofai-oss on all PostHog events#380
NiveditJain merged 2 commits into
mainfrom
luv-382

Conversation

@NiveditJain
Copy link
Copy Markdown
Member

What

Adds a product: "failproofai-oss" property to every PostHog event, stamped at all four telemetry choke points so no event can be missed:

Channel File / fn Covers
Hooks / audit src/hooks/hook-telemetry.ts (trackHookEvent) all hook events + failproofai audit events
Server lib/telemetry.ts (trackEvent) app_started, etc.
Web UI lib/client-telemetry.ts (captureClientEvent) pageviews, all usePostHog().capture(...), client errors
npm lifecycle scripts/install-telemetry.mjs (trackInstallEvent) install / uninstall events

How

  • New single source of truth POSTHOG_PRODUCT = "failproofai-oss" in src/posthog-key.ts, reused by the three TypeScript channels.
  • The standalone scripts/install-telemetry.mjs inlines the same literal (with a comment) — it runs as a raw npm-lifecycle script and can't import the TS module at install time, mirroring how it already inlines its own API key.
  • Honors FAILPROOFAI_TELEMETRY_DISABLED=1 like all other telemetry (no behavior change there).

Tests

  • Updated the two existing real-payload tests (telemetry.test.ts, client-telemetry.test.ts) to assert product.
  • Added two new test files (__tests__/hooks/hook-telemetry.test.ts, __tests__/scripts/install-telemetry.test.ts) covering the hook + install channels that previously had no payload assertions.
  • All four channels now assert product: "failproofai-oss" on the actual emitted body.

Verified locally: lint (0 errors), tsc --noEmit clean, 1690 unit tests pass, 298 e2e tests pass.

🤖 Generated with Claude Code

Add a `product: "failproofai-oss"` property to every PostHog event across
all four telemetry channels — hooks/audit (trackHookEvent), server
(trackEvent), web UI (captureClientEvent), and npm lifecycle
(trackInstallEvent) — so OSS events stay distinguishable from any future
hosted surface.

The value lives in a single POSTHOG_PRODUCT constant in src/posthog-key.ts,
reused by the three TypeScript channels. The standalone
scripts/install-telemetry.mjs inlines the same literal because it runs as a
raw npm-lifecycle script and can't import the TS module at install time.

Adds real-payload test coverage for all four channels (two new test files
for the previously-uncovered hook and install channels).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@NiveditJain, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 16 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0dcf11bb-97a1-430e-a862-991e5dbd0dfb

📥 Commits

Reviewing files that changed from the base of the PR and between 2911b74 and 2e43f97.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • __tests__/hooks/hook-telemetry.test.ts
  • __tests__/lib/client-telemetry.test.ts
  • __tests__/lib/telemetry.test.ts
  • __tests__/scripts/install-telemetry.test.ts
  • lib/client-telemetry.ts
  • lib/telemetry.ts
  • scripts/install-telemetry.mjs
  • src/hooks/hook-telemetry.ts
  • src/posthog-key.ts

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@NiveditJain NiveditJain merged commit 7dd9598 into main May 25, 2026
9 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