Skip to content

[CI] (6b2dc8b) rails/fizzy - #3734

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-6b2dc8b-rails-fizzy
Closed

[CI] (6b2dc8b) rails/fizzy#3734
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-6b2dc8b-rails-fizzy

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 6b2dc8b
App: rails/fizzy
App directory: apps/rails/fizzy
Workbench branch: wizard-ci-6b2dc8b-rails-fizzy
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-01T15:56:10.895Z
Duration: 511.2s

YARA Scanner

✓ 211 tool calls scanned, 0 violations detected

No violations: ✓ 211 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Ruby on Rails app ("fizzy") by adding both posthog-ruby and posthog-rails gems, creating an initializer with automatic exception capture and ActiveJob instrumentation, adding PostHog.capture() calls across 10 controllers for key user actions, and implementing PostHog.identify() at sign-in and sign-up. A posthog_distinct_id method on the User model provides consistent identity resolution via identity_id.

Files changed Lines added Lines removed
14 +114 -1

Confidence score: 4/5 👍

  • posthog_distinct_id can return nil: The User#posthog_distinct_id method returns nil when identity_id is blank, which would pass distinct_id: nil to PostHog.capture(). This could cause orphaned/malformed events for users without an identity association. [MEDIUM]
  • .env.example not committed: The .env.example file with POSTHOG_PROJECT_TOKEN and POSTHOG_HOST exists locally but was not included in the committed PR files, meaning env var documentation is missing from the PR. [MEDIUM]

File changes

Filename Score Description
Gemfile 5/5 Adds posthog-ruby and posthog-rails gems with correct names
config/initializers/posthog.rb 5/5 Clean initializer with Rails-specific and core PostHog config, env-var-driven, dev guard
app/models/user.rb 4/5 Adds posthog_distinct_id and posthog_properties — but posthog_distinct_id can return nil
app/controllers/application_controller.rb 5/5 Adds current_user helper method needed by posthog-rails current_user_method config
app/controllers/sessions/magic_links_controller.rb 5/5 Identify + capture on sign-in with consistent distinct_id
app/controllers/signups/completions_controller.rb 5/5 Identify + capture on sign-up with person properties
app/controllers/account/cancellations_controller.rb 4/5 Captures account cancellation event
app/controllers/boards_controller.rb 5/5 Captures board creation with properties
app/controllers/cards_controller.rb 5/5 Captures card creation for both draft and published flows with creation_type
app/controllers/cards/comments_controller.rb 5/5 Captures comment creation
app/controllers/cards/publishes_controller.rb 5/5 Captures card published event
app/controllers/join_codes_controller.rb 5/5 Captures account joined event
app/controllers/account/exports_controller.rb 5/5 Captures export started event
app/controllers/account/imports_controller.rb 5/5 Captures import started event

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Valid Ruby syntax, correct gem names, proper initializer structure
Preserves existing env vars & configs Yes Existing controller logic preserved; only PostHog additions
No syntax or type errors Yes All Ruby syntax is valid
Correct imports/exports Yes require 'posthog' matches posthog-ruby gem convention; posthog-rails auto-loads
Minimal, focused changes Yes All changes directly support PostHog integration
Pre-existing issues .env file contains a real API key locally (not committed) Not introduced by this PR

Issues

  • .env.example not committed: The .env.example file was created locally with POSTHOG_PROJECT_TOKEN and POSTHOG_HOST placeholders but is not in the committed changeset. New developers cloning the repo won't know which env vars to set without reading the initializer. Should be committed. [MEDIUM]

Other completed criteria

  • Build configuration is valid — gems added to Gemfile with proper syntax
  • Existing app functionality preserved — Current.account.cancel call maintained, only PostHog capture added after it
  • current_user helper method properly delegates to Current.user for posthog-rails user context

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes Both posthog-ruby (~> 3.21) and posthog-rails gems added to Gemfile
PostHog client initialized Yes PostHog.init block in initializer with PostHog::Rails.configure for exception tracking, ActiveJob, and user context
capture() Yes 10 meaningful capture calls across controllers
identify() N/A Server-only app
Error tracking Yes auto_capture_exceptions: true, report_rescued_exceptions: true, auto_instrument_active_job: true
Reverse proxy N/A Server-only app

Issues

  • posthog_distinct_id can return nil: User#posthog_distinct_id returns nil when identity_id is blank. Multiple controllers call PostHog.capture(distinct_id: Current.user.posthog_distinct_id, ...) without a nil guard. This would pass nil as the distinct_id, potentially causing events to be dropped or orphaned. Add a fallback (e.g., identity_id.to_s without the if guard, or use id.to_s as fallback). [MEDIUM]

Other completed criteria

  • API key loaded from ENV["POSTHOG_PROJECT_TOKEN"] — not hardcoded
  • Host loaded from ENV["POSTHOG_HOST"] — configurable per environment
  • Uses PostHog.capture() and PostHog.identify() class-level methods as documented for Rails
  • posthog_distinct_id method on User model follows the documented pattern for automatic user association
  • user_id_method: :posthog_distinct_id correctly configured in Rails config
  • Identify calls at sign-in and sign-up correctly set person properties via properties: hash
  • Consistent distinct_id strategy using identity_id across both User model and direct identity references

PostHog insights and events ✅

Filename PostHog events Description
sessions/magic_links_controller.rb user_signed_in, identify Identifies user and captures sign-in with authentication method
signups/completions_controller.rb user_signed_up, identify Identifies user with email/name and captures sign-up with account_id
account/cancellations_controller.rb account_cancelled Captures account deletion with account_id
boards_controller.rb board_created Captures board creation with board_id and all_access flag
cards_controller.rb card_created Captures card creation with board_id and creation_type (draft/published)
cards/comments_controller.rb comment_created Captures comment creation with card_id and board_id
cards/publishes_controller.rb card_published Captures card publication with card_id and board_id
join_codes_controller.rb account_joined Captures join code redemption with account_id
account/exports_controller.rb account_export_started Captures data export initiation
account/imports_controller.rb account_import_started Captures data import initiation
Automatic (posthog-rails) capturedException Auto-captures controller exceptions, rescued exceptions, and ActiveJob failures

Issues

No issues — events are well-structured and enable clear funnels.

Other completed criteria

  • Events represent real user actions across the full product lifecycle (signup → create board → create card → publish → comment)
  • Events enable product insights: signup-to-activation funnel, content creation funnel, churn analysis via account_cancelled
  • All events include contextual properties (IDs, types, methods)
  • No PII in capture properties — email set only via identify() person properties
  • Consistent snake_case naming convention following [object]_[verb] pattern

Reviewed by wizard workbench PR evaluator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants