Skip to content

fix(rails): attribute events and requests to posthog-rails - #265

Merged
marandaneto merged 2 commits into
mainfrom
fix/rails-lib-property
Sep 4, 2026
Merged

fix(rails): attribute events and requests to posthog-rails#265
marandaneto merged 2 commits into
mainfrom
fix/rails-lib-property

Conversation

@marandaneto

@marandaneto marandaneto commented Sep 3, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

Events and HTTP requests from the Rails integration currently identify themselves as posthog-ruby with the core gem version. This prevents Rails integration usage from being attributed to posthog-rails.

The core client now accepts internal library metadata and applies it to capture, identify, alias, and group identify events. It also uses the same metadata for event ingestion and feature flag request User-Agent headers. The Rails facade supplies posthog-rails and the Rails gem version when it creates the client.

💚 How did you test it?

  • bundle exec rspec
  • bundle exec rubocop
  • bundle exec rake public_api:check
  • git diff --check

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with the Pi coding agent and checked with the autoreview skill. The Rails facade passes internal library metadata into the core client. Direct posthog-ruby clients keep their existing event properties and User-Agent headers.

@marandaneto marandaneto self-assigned this Sep 3, 2026
@marandaneto
marandaneto marked this pull request as ready for review September 3, 2026 07:36
@marandaneto
marandaneto requested a review from a team as a code owner September 3, 2026 07:36
@marandaneto

Copy link
Copy Markdown
Member Author

needs PostHog/posthog#93911

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(rails): attribute events to posthog-..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

posthog-ruby Compliance Report

Date: 2026-09-03 10:14:43 UTC
Duration: 98489ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 108ms
Format Validation.Event Has Uuid 106ms
Format Validation.Event Has Lib Properties 109ms
Format Validation.Distinct Id Is String 107ms
Format Validation.Token Is Present 106ms
Format Validation.Custom Properties Preserved 107ms
Format Validation.Event Has Timestamp 107ms
Retry Behavior.Retries On 503 5314ms
Retry Behavior.Does Not Retry On 400 2109ms
Retry Behavior.Does Not Retry On 401 2109ms
Retry Behavior.Respects Retry After Header 8115ms
Retry Behavior.Implements Backoff 15708ms
Retry Behavior.Retries On 500 5212ms
Retry Behavior.Retries On 502 5211ms
Retry Behavior.Retries On 504 5213ms
Retry Behavior.Max Retries Respected 15622ms
Deduplication.Generates Unique Uuids 112ms
Deduplication.Preserves Uuid On Retry 5211ms
Deduplication.Preserves Uuid And Timestamp On Retry 10418ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5217ms
Deduplication.No Duplicate Events In Batch 112ms
Deduplication.Different Events Have Different Uuids 107ms
Compression.Sends Gzip When Enabled 106ms
Batch Format.Uses Proper Batch Structure 106ms
Batch Format.Flush With No Events Sends Nothing 4ms
Batch Format.Multiple Events Batched Together 111ms
Error Handling.Does Not Retry On 403 2108ms
Error Handling.Does Not Retry On 413 2109ms
Error Handling.Retries On 408 5211ms

Feature_Flags Tests

17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 108ms
Request Payload.Flags Request Uses V2 Query Param 107ms
Request Payload.Flags Request Hits Flags Path Not Decide 107ms
Request Payload.Flags Request Omits Authorization Header 109ms
Request Payload.Token In Flags Body Matches Init 109ms
Request Payload.Groups Round Trip 108ms
Request Payload.Groups Default To Empty Object 107ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 107ms
Request Payload.Disable Geoip Omitted Defaults To False 107ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 107ms
Request Lifecycle.No Flags Request On Init Alone 3ms
Request Lifecycle.No Flags Request On Normal Capture 105ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 111ms
Request Lifecycle.Mock Response Value Is Returned To Caller 107ms
Retry Behavior.Retries Flags On 502 210ms
Retry Behavior.Retries Flags On 504 210ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 109ms

@marandaneto marandaneto changed the title fix(rails): attribute captured events to posthog-rails fix(rails): attribute events and requests to posthog-rails Sep 3, 2026
@marandaneto
marandaneto merged commit e23b9f6 into main Sep 4, 2026
21 checks passed
@marandaneto
marandaneto deleted the fix/rails-lib-property branch September 4, 2026 14:48
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.

2 participants