Skip to content

feat: publish posthog with posthog-rs compatibility crate - #183

Open
dustinbyrne wants to merge 1 commit into
v1from
feat/mirror-posthog-crate
Open

feat: publish posthog with posthog-rs compatibility crate#183
dustinbyrne wants to merge 1 commit into
v1from
feat/mirror-posthog-crate

Conversation

@dustinbyrne

@dustinbyrne dustinbyrne commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Publish the official Rust SDK under the canonical posthog package and import name without shipping two independent copies of the implementation.

The repository root is now the posthog implementation crate. A small posthog-rs workspace package preserves compatibility for existing users by depending on posthog, forwarding every feature, and re-exporting its public API. Applications using both names therefore share the same underlying SDK types and implementation. Runtime and wire telemetry identity intentionally remains posthog-rs.

Sampo keeps both package versions synchronized. Releases publish posthog before the dependent compatibility crate, independently skip versions already present on crates.io, and can resume the exact release commit through Re-run failed jobs after a partial failure.

Both crates need crates.io Trusted Publishing configured for this repository, release.yml, and the Release environment before the first release.

💚 How did you test it?

  • cargo fmt --all -- --check
  • cargo clippy -- -D warnings
  • Full workspace and async/blocking feature-matrix tests
  • scripts/check-compatibility-crate.sh
  • Compatibility crate tests with all features, no default features, and legacy implicit features
  • cargo publish --workspace --dry-run --locked --package posthog --package posthog-rs
  • Inspected both generated archives: the implementation is present only in posthog; the compatibility archive contains seven small facade files
  • Compiled an external consumer using both names and verified their Event types are identical with one implementation in the dependency graph
  • Ran a Sampo 0.19 release fixture and verified both versions and the internal dependency advance together
  • Built workspace rustdoc with warnings denied and checked the public API snapshot
  • Parsed/actionlint-validated workflows and exercised interleaved release-retry and SemVer guard scenarios

📝 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 sampo add to generate a changeset file

@dustinbyrne
dustinbyrne requested a review from a team as a code owner July 21, 2026 19:05
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
scripts/publish-crate-mirror.sh:56
**Renamed Crate Breaks Packaged Targets**

Changing the default library name to `posthog` leaves the packaged examples, integration tests, and doctests importing `posthog_rs`. The publish dry run can build the library without compiling all of these targets, so the release can succeed even though consumers running the included examples or `cargo test --all-targets` receive unresolved-crate errors.

Reviews (1): Last reviewed commit: "feat: mirror releases to posthog crate" | Re-trigger Greptile

Comment thread scripts/publish-crate-mirror.sh Outdated
@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@marandaneto

Copy link
Copy Markdown
Member

Closes #178

@dustinbyrne
dustinbyrne force-pushed the feat/mirror-posthog-crate branch 2 times, most recently from 20c4daf to a147434 Compare August 11, 2026 18:39
@dustinbyrne dustinbyrne changed the title feat: publish releases as posthog and posthog-rs feat: publish posthog with posthog-rs compatibility crate Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

posthog-rs-v0 Compliance Report

Date: 2026-08-11 18:42:38 UTC
Duration: 15498ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 130ms
Format Validation.Event Has Uuid 137ms
Format Validation.Event Has Lib Properties 145ms
Format Validation.Distinct Id Is String 139ms
Format Validation.Token Is Present 135ms
Format Validation.Custom Properties Preserved 135ms
Format Validation.Event Has Timestamp 139ms
Retry Behavior.Retries On 503 5147ms
Retry Behavior.Does Not Retry On 400 2136ms
Retry Behavior.Does Not Retry On 401 2145ms
Retry Behavior.Respects Retry After Header 5103ms
Retry Behavior.Implements Backoff 15098ms
Retry Behavior.Retries On 500 5100ms
Retry Behavior.Retries On 502 5100ms
Retry Behavior.Retries On 504 5098ms
Retry Behavior.Max Retries Respected 15096ms
Deduplication.Generates Unique Uuids 99ms
Deduplication.Preserves Uuid On Retry 5024ms
Deduplication.Preserves Uuid And Timestamp On Retry 10033ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5034ms
Deduplication.No Duplicate Events In Batch 26ms
Deduplication.Different Events Have Different Uuids 24ms
Compression.Sends Gzip When Enabled 23ms
Batch Format.Uses Proper Batch Structure 30ms
Batch Format.Flush With No Events Sends Nothing 25ms
Batch Format.Multiple Events Batched Together 113ms
Error Handling.Does Not Retry On 403 2081ms
Error Handling.Does Not Retry On 413 2080ms
Error Handling.Retries On 408 5083ms

Feature_Flags Tests

17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 73ms
Request Payload.Flags Request Uses V2 Query Param 66ms
Request Payload.Flags Request Hits Flags Path Not Decide 30ms
Request Payload.Flags Request Omits Authorization Header 30ms
Request Payload.Token In Flags Body Matches Init 32ms
Request Payload.Groups Round Trip 41ms
Request Payload.Groups Default To Empty Object 56ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 49ms
Request Payload.Disable Geoip Omitted Defaults To False 44ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 39ms
Request Lifecycle.No Flags Request On Init Alone 26ms
Request Lifecycle.No Flags Request On Normal Capture 57ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 77ms
Request Lifecycle.Mock Response Value Is Returned To Caller 44ms
Retry Behavior.Retries Flags On 502 233ms
Retry Behavior.Retries Flags On 504 235ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 26ms

@github-actions

Copy link
Copy Markdown
Contributor

posthog-rs-v1 Compliance Report

Date: 2026-08-11 18:43:23 UTC
Duration: 23007ms

✅ All Tests Passed!

111/111 tests passed


Capture_V1 Tests

94/94 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint 150ms
Endpoint And Method.Does Not Use Legacy Endpoints 150ms
Required Headers.Has Authorization Bearer Header 147ms
Required Headers.Has Content Type Json 149ms
Required Headers.Has Posthog Sdk Info Format 148ms
Required Headers.Has Posthog Attempt Header 147ms
Required Headers.Has Posthog Request Id 146ms
Required Headers.Has Posthog Request Timestamp 146ms
Required Headers.Has User Agent 146ms
Body Format.Body Has Created At And Batch 148ms
Body Format.No Api Key In Body 130ms
Body Format.No Sent At In Body 129ms
Event Format.Event Has Required Root Fields 130ms
Event Format.Event Uuid Is Valid 128ms
Event Format.Event Timestamp Is Rfc3339 132ms
Event Format.Distinct Id Is String 129ms
Event Format.Distinct Id At Root Not Properties 128ms
Event Format.Custom Properties Preserved 128ms
Event Format.Set Properties Preserved 127ms
Event Format.Set Once Properties Preserved 128ms
Event Format.Groups Properties Preserved 131ms
Event Format.Sdk Generates Uuid If Not Provided 132ms
Event Format.Event Has Required Root Fields Batch 164ms
Event Format.Event Uuid Is Valid Batch 165ms
Event Format.Event Timestamp Is Rfc3339 Batch 162ms
Event Format.Distinct Id Is String Batch 163ms
Event Format.Distinct Id At Root Not Properties Batch 162ms
Event Format.Custom Properties Preserved Batch 163ms
Event Format.Set Properties Preserved Batch 162ms
Event Format.Set Once Properties Preserved Batch 180ms
Event Format.Groups Properties Preserved Batch 144ms
Event Format.Sdk Generates Uuid If Not Provided Batch 147ms
Batch Behavior.Multiple Events In Single Batch 190ms
Batch Behavior.Batch Envelope Smoke 170ms
Batch Behavior.Flush With No Events Sends Nothing 98ms
Batch Behavior.Flush At Triggers Batch 1132ms
Batch Behavior.Created At Reflects Batch Creation Time 110ms
Deduplication.Generates Unique Uuids 194ms
Deduplication.Different Events Same Content Different Uuids 123ms
Deduplication.Preserves Uuid On Retry 5123ms
Deduplication.Preserves Timestamp On Retry 5091ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5096ms
Deduplication.No Duplicate Events In Batch 138ms
Header Behavior On Retry.Attempt Header Starts At One 76ms
Header Behavior On Retry.Attempt Header Increments On Retry 10085ms
Header Behavior On Retry.Request Id Preserved On Retry 5081ms
Header Behavior On Retry.Different Requests Have Different Request Ids 2077ms
Header Behavior On Retry.Request Timestamp Changes On Retry 5063ms
Response Format Validation.Success Response Has Uuid Keyed Results 59ms
Response Format Validation.Success Response Has Ok For Each Event 35ms
Response Format Validation.Success No Retry After When All Ok 35ms
Response Format Validation.Success Retry After Present When Retry Events 30ms
Response Format Validation.Success No Retry After When Drop Only 33ms
Response Format Validation.Response Echoes Request Id 25ms
Retry Behavior.Retries On 408 5034ms
Retry Behavior.Retries On 500 5027ms
Retry Behavior.Retries On 503 5026ms
Retry Behavior.Retries On 504 5025ms
Retry Behavior.Retryable Errors Have Retry After 2026ms
Retry Behavior.Respects Retry After On Retryable Error 8026ms
Retry Behavior.Does Not Retry On 400 2025ms
Retry Behavior.Does Not Retry On 401 2033ms
Retry Behavior.Does Not Retry On 402 2037ms
Retry Behavior.Does Not Retry On 413 2029ms
Retry Behavior.Does Not Retry On 415 2028ms
Retry Behavior.Non Retryable Errors Have No Retry After 2024ms
Retry Behavior.Implements Backoff 15031ms
Retry Behavior.Max Retries Respected 15026ms
Partial Batch Handling.Handles 200 Full Success 2043ms
Partial Batch Handling.Handles 200 With All Ok 3044ms
Partial Batch Handling.Does Not Retry Dropped Events 3041ms
Partial Batch Handling.Does Not Retry Limited Events 3034ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 5034ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 5028ms
Partial Batch Handling.Retries Only Retry Events From Partial 5028ms
Partial Batch Handling.Partial Retry Preserves Uuids 5026ms
Partial Batch Handling.Partial Retry Attempt Header Increments 5031ms
Partial Batch Handling.Partial Retry Request Id Preserved 5036ms
Partial Batch Handling.Respects Retry After On Partial 5025ms
Partial Batch Handling.Unknown Result Treated As Terminal 3026ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 3038ms
Compression.Sends Gzip Content Encoding 39ms
Compression.No Content Encoding When Disabled 24ms
Compression.Compressed Body Is Decompressible 25ms
Error Handling.Does Not Retry On Unknown 4Xx 2027ms
Event Options.Cookieless Mode Override 24ms
Event Options.Disable Skew Correction Override 22ms
Event Options.Process Person Profile Override 24ms
Event Options.Product Tour Id Override 24ms
Event Options.Unset Options Omitted 24ms
Event Options.Options Override In Batch 23ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 24ms
Geoip And Historical Migration.Historical Migration Set In Body 24ms
Geoip And Historical Migration.Historical Migration Absent By Default 25ms

Feature_Flags Tests

17/17 tests passed

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

@arnohillen

Copy link
Copy Markdown

[arno's agent] The only approval predates the complete rework from the scripts/publish approach to the compatibility-crate design, so a fresh review of the current shape is needed before publishing.

@arnohillen

Copy link
Copy Markdown

[arno's agent] A stale third-party posthog 0.1.0 placeholder is still resolvable on crates.io; worth confirming ownership transfer completed before the workflow attempts the first publish under that name.

@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "feat: publish posthog with compatibility..." | Re-trigger Greptile

@dustinbyrne
dustinbyrne changed the base branch from main to v1 August 21, 2026 15:43
@dustinbyrne
dustinbyrne force-pushed the feat/mirror-posthog-crate branch 3 times, most recently from 779744d to 032b675 Compare August 26, 2026 19:13
@dustinbyrne
dustinbyrne force-pushed the feat/mirror-posthog-crate branch from 032b675 to 52801b6 Compare September 1, 2026 13:38
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.

4 participants