Skip to content

feat(tracking): namespace PostHog events with cli: prefix#465

Merged
robinjhuang merged 1 commit into
mainfrom
tracking/posthog-cli-prefix
May 29, 2026
Merged

feat(tracking): namespace PostHog events with cli: prefix#465
robinjhuang merged 1 commit into
mainfrom
tracking/posthog-cli-prefix

Conversation

@robinjhuang
Copy link
Copy Markdown
Member

Applies a cli: prefix to event names sent to PostHog only, so CLI events stay distinct from other surfaces (app:/hub:/registry:) in the shared project. Mixpanel continues to receive the bare legacy event names, preserving continuity for its existing streams.

Apply a "cli:" prefix to event names sent to PostHog only, so CLI events
are distinct from other surfaces (app:/hub:/registry:) in the shared
project. Mixpanel keeps the bare legacy names for stream continuity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels May 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 74e661f7-e5e9-4589-a32c-4459a7fc013b

📥 Commits

Reviewing files that changed from the base of the PR and between 72ec7a8 and af51ffb.

📒 Files selected for processing (2)
  • comfy_cli/tracking.py
  • tests/comfy_cli/test_tracking_providers.py

📝 Walkthrough

Walkthrough

PostHog event names are now prefixed with cli: at capture time, while Mixpanel preserves legacy bare names. A new constant enables the prefix behavior, and test coverage validates the prefixing across provider scenarios including colon-delimited sub-namespaced events—you might say the events are cli-ng together perfectly.

Changes

PostHog Event Prefixing

Layer / File(s) Summary
PostHog event prefix constant and provider implementation
comfy_cli/tracking.py
Introduces POSTHOG_EVENT_PREFIX = "cli:" constant and updates PostHogProvider.track to capture events under the prefixed name while preserving the existing workflow_run_id logic from tracing_id.
Test coverage for PostHog event prefixing
tests/comfy_cli/test_tracking_providers.py
Extends TestMixpanelLegacyNameAlias with assertions that PostHog receives prefixed canonical event names; adds new TestPostHogEventPrefix class verifying that top-level and colon-delimited sub-namespaced events are correctly prefixed (e.g., node:install becomes cli:node:install).

Possibly related PRs

  • Comfy-Org/comfy-cli#461: Introduced PostHog dual-send logic and canonical event naming; this PR builds directly on that refactoring to add cli: prefixing for PostHog events.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tracking/posthog-cli-prefix
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch tracking/posthog-cli-prefix

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

@robinjhuang robinjhuang requested a review from bigcat88 May 29, 2026 03:33
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@           Coverage Diff           @@
##             main     #465   +/-   ##
=======================================
  Coverage   83.25%   83.25%           
=======================================
  Files          45       45           
  Lines        6801     6802    +1     
=======================================
+ Hits         5662     5663    +1     
  Misses       1139     1139           
Files with missing lines Coverage Δ
comfy_cli/tracking.py 94.07% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 29, 2026
@robinjhuang robinjhuang merged commit c9e3df2 into main May 29, 2026
15 checks passed
@robinjhuang robinjhuang deleted the tracking/posthog-cli-prefix branch May 29, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants