Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-mcp-lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"posthog-ruby": patch
---

Fix instance tracking for client subclasses so `PostHog::MCP::Client` can initialize outside test mode and shut down without raising.
23 changes: 23 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@ jobs:
- name: Run RSpec tests
run: bundle exec rspec

logs-integration:
name: Logs integration (Ruby ${{ matrix.ruby-version }})
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.3, 3.4]
fail-fast: false
env:
BUNDLE_GEMFILE: gemfiles/otel.gemfile
RAILS_ENV: test
GH_ACTIONS_UNIT_TESTS: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ruby/setup-ruby@984c0c890880bbf811283d6f09c4607c62d210a4 # v1.323.0
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: 4.0.13
bundler-cache: true
- name: Require real OpenTelemetry dependencies
run: bundle exec ruby -e "require 'opentelemetry-sdk'; require 'opentelemetry-logs-sdk'; require 'opentelemetry/exporter/otlp_logs'"
- name: Run RSpec with real logs dependencies
run: bundle exec rspec

rubocop:
name: RuboCop
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ bundle exec rubocop
bundle exec rake public_api:check
```

The JSON compatibility specs run in separate Ruby processes as part of the default suite.
The real Rails logs export and fork tests require Ruby 3.3+ and the optional OpenTelemetry bundle:

```bash
BUNDLE_GEMFILE=gemfiles/otel.gemfile bundle install
BUNDLE_GEMFILE=gemfiles/otel.gemfile bundle exec rspec
```

Without that bundle, those two integration tests are reported as pending. CI runs both bundles.

The public API snapshot covers both `posthog-ruby` and `posthog-rails`. If you intentionally change either API, update the snapshot and review the diff:

```bash
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/otel.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

eval_gemfile '../Gemfile'

gem 'opentelemetry-exporter-otlp-logs'
gem 'opentelemetry-logs-sdk', '>= 0.6.0'
gem 'opentelemetry-sdk'
Loading
Loading