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

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

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

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

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
skishore23 added a commit that referenced this pull request Jun 11, 2026
…nto the run/ package + single-client architecture

Upstream (dffa5c1..a392f55) carried five telemetry/tracking commits; most
of #461/#463 was already on this branch, so the merge mainly ports #465 and
#468 into our architecture:

- PostHog dual-send + lifecycle events (#461): already present in our
  tracking.py (_dispatch fan-out) and cmdline.py run lifecycle; conflicts
  resolved to our superset (keeps _ensure_user_id(persist=), submit_feedback,
  submit_agent_review, _consent_enabled).
- DO_NOT_TRACK / COMFY_NO_TELEMETRY (#463): already present; kept ours.
- cli: event prefix (#465): took upstream's POSTHOG_EVENT_PREFIX in
  tracking.py PostHogProvider.capture + upstream's prefix tests in
  tests/comfy_cli/test_tracking_providers.py.
- Comfy-Usage-Source header (#468): run.py was deleted here, so the header +
  extra_data.comfy_usage_source landed in comfy_cli/command/run/execution.py
  (WorkflowExecution.queue) and comfy_cli/comfy_client.py (Client._request
  header on every local/cloud request, submit_prompt extra_data);
  generate/client.py auto-merged upstream's header. Adapted
  tests/comfy_cli/cloud/test_client.py extra_data assertions accordingly.
- SOC2 unreviewed-merge detector (#464) + pytest.yml codecov bump: taken
  from upstream as-is.
- uv.lock: took upstream then regenerated with `uv lock` (posthog already a
  dependency here).
- Upstream's non-TTY auto-consent assertion in test_tracking.py kept at our
  deliberate behavior (non-interactive sessions do NOT auto-enable tracking).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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