Skip to content

feat!: use capture v1 by default - #209

Draft
marandaneto wants to merge 1 commit into
mainfrom
feat/capture-v1-default
Draft

feat!: use capture v1 by default#209
marandaneto wants to merge 1 commit into
mainfrom
feat/capture-v1-default

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

The V1 capture pipeline is ready to become the supported default as part of #207. Existing applications should still be able to remain on V0 while they prepare to migrate.

This adds capture-v1 to the default Cargo features and documents how to opt out by disabling default features. The CI matrix now tests the V1 default and an asynchronous V0 fallback. The compliance adapters disable dependency defaults so the V0 and V1 suites continue to build the intended pipeline.

💚 How did you test it?

  • cargo fmt -- --check
  • cargo build --verbose
  • cargo build --verbose --no-default-features --features async-client,error-tracking
  • cargo test
  • cargo test --workspace
  • cargo test --no-default-features --features async-client,error-tracking
  • cargo test --no-default-features --features capture-v1
  • cargo test --no-default-features --features error-tracking
  • cargo test --no-default-features --features error-tracking,capture-v1
  • cargo test --verbose --features e2e-test --no-default-features
  • cargo clippy -- -D warnings
  • cargo clippy --no-default-features --features async-client,error-tracking -- -D warnings
  • scripts/check-public-api.sh
  • cargo publish --dry-run --locked
  • Built the V0 and V1 compliance adapters in release mode with their Dockerfile Cargo commands and verified that only the V1 adapter enabled capture-v1.

📝 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

Comment thread README.md
Comment on lines +14 to +25
## Capture pipeline

The V1 capture pipeline is enabled by default. To continue using the legacy V0
pipeline, disable the default features and explicitly enable the other features
your application needs:

```toml
posthog-rs = { version = "1", default-features = false, features = ["async-client", "error-tracking"] }
```

This example retains the default asynchronous client and error tracking while
opting out of `capture-v1`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: if we remove the capture-v0 and v1 altogether and strip all capture v0 code as well

@marandaneto

Copy link
Copy Markdown
Member Author

do not merge because its a breaking change, i want to stack a few changes together before releasing v1
this PR will likely change its impl so not worth reviewing yet, we need to figure this out

@github-actions

Copy link
Copy Markdown
Contributor

posthog-rs-v1 Compliance Report

Date: 2026-08-10 19:03:28 UTC
Duration: 22980ms

✅ 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 132ms
Endpoint And Method.Does Not Use Legacy Endpoints 145ms
Required Headers.Has Authorization Bearer Header 144ms
Required Headers.Has Content Type Json 131ms
Required Headers.Has Posthog Sdk Info Format 142ms
Required Headers.Has Posthog Attempt Header 141ms
Required Headers.Has Posthog Request Id 132ms
Required Headers.Has Posthog Request Timestamp 143ms
Required Headers.Has User Agent 142ms
Body Format.Body Has Created At And Batch 142ms
Body Format.No Api Key In Body 142ms
Body Format.No Sent At In Body 152ms
Event Format.Event Has Required Root Fields 153ms
Event Format.Event Uuid Is Valid 143ms
Event Format.Event Timestamp Is Rfc3339 142ms
Event Format.Distinct Id Is String 141ms
Event Format.Distinct Id At Root Not Properties 142ms
Event Format.Custom Properties Preserved 145ms
Event Format.Set Properties Preserved 142ms
Event Format.Set Once Properties Preserved 142ms
Event Format.Groups Properties Preserved 127ms
Event Format.Sdk Generates Uuid If Not Provided 117ms
Event Format.Event Has Required Root Fields Batch 163ms
Event Format.Event Uuid Is Valid Batch 147ms
Event Format.Event Timestamp Is Rfc3339 Batch 137ms
Event Format.Distinct Id Is String Batch 163ms
Event Format.Distinct Id At Root Not Properties Batch 162ms
Event Format.Custom Properties Preserved Batch 162ms
Event Format.Set Properties Preserved Batch 145ms
Event Format.Set Once Properties Preserved Batch 164ms
Event Format.Groups Properties Preserved Batch 148ms
Event Format.Sdk Generates Uuid If Not Provided Batch 147ms
Batch Behavior.Multiple Events In Single Batch 221ms
Batch Behavior.Batch Envelope Smoke 166ms
Batch Behavior.Flush With No Events Sends Nothing 63ms
Batch Behavior.Flush At Triggers Batch 1150ms
Batch Behavior.Created At Reflects Batch Creation Time 118ms
Deduplication.Generates Unique Uuids 195ms
Deduplication.Different Events Same Content Different Uuids 138ms
Deduplication.Preserves Uuid On Retry 5124ms
Deduplication.Preserves Timestamp On Retry 5109ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5105ms
Deduplication.No Duplicate Events In Batch 142ms
Header Behavior On Retry.Attempt Header Starts At One 72ms
Header Behavior On Retry.Attempt Header Increments On Retry 10063ms
Header Behavior On Retry.Request Id Preserved On Retry 5054ms
Header Behavior On Retry.Different Requests Have Different Request Ids 2060ms
Header Behavior On Retry.Request Timestamp Changes On Retry 5050ms
Response Format Validation.Success Response Has Uuid Keyed Results 55ms
Response Format Validation.Success Response Has Ok For Each Event 34ms
Response Format Validation.Success No Retry After When All Ok 33ms
Response Format Validation.Success Retry After Present When Retry Events 30ms
Response Format Validation.Success No Retry After When Drop Only 32ms
Response Format Validation.Response Echoes Request Id 28ms
Retry Behavior.Retries On 408 5040ms
Retry Behavior.Retries On 500 5028ms
Retry Behavior.Retries On 503 5026ms
Retry Behavior.Retries On 504 5026ms
Retry Behavior.Retryable Errors Have Retry After 2027ms
Retry Behavior.Respects Retry After On Retryable Error 8025ms
Retry Behavior.Does Not Retry On 400 2031ms
Retry Behavior.Does Not Retry On 401 2039ms
Retry Behavior.Does Not Retry On 402 2024ms
Retry Behavior.Does Not Retry On 413 2032ms
Retry Behavior.Does Not Retry On 415 2031ms
Retry Behavior.Non Retryable Errors Have No Retry After 2026ms
Retry Behavior.Implements Backoff 15032ms
Retry Behavior.Max Retries Respected 15028ms
Partial Batch Handling.Handles 200 Full Success 2029ms
Partial Batch Handling.Handles 200 With All Ok 3035ms
Partial Batch Handling.Does Not Retry Dropped Events 3031ms
Partial Batch Handling.Does Not Retry Limited Events 3030ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 5032ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 5024ms
Partial Batch Handling.Retries Only Retry Events From Partial 5026ms
Partial Batch Handling.Partial Retry Preserves Uuids 5025ms
Partial Batch Handling.Partial Retry Attempt Header Increments 5033ms
Partial Batch Handling.Partial Retry Request Id Preserved 5035ms
Partial Batch Handling.Respects Retry After On Partial 5026ms
Partial Batch Handling.Unknown Result Treated As Terminal 3024ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 3026ms
Compression.Sends Gzip Content Encoding 24ms
Compression.No Content Encoding When Disabled 23ms
Compression.Compressed Body Is Decompressible 23ms
Error Handling.Does Not Retry On Unknown 4Xx 2024ms
Event Options.Cookieless Mode Override 24ms
Event Options.Disable Skew Correction Override 23ms
Event Options.Process Person Profile Override 23ms
Event Options.Product Tour Id Override 23ms
Event Options.Unset Options Omitted 23ms
Event Options.Options Override In Batch 24ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 22ms
Geoip And Historical Migration.Historical Migration Set In Body 23ms
Geoip And Historical Migration.Historical Migration Absent By Default 22ms

Feature_Flags Tests

17/17 tests passed

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

@github-actions

Copy link
Copy Markdown
Contributor

posthog-rs-v0 Compliance Report

Date: 2026-08-10 19:03:33 UTC
Duration: 15518ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 138ms
Format Validation.Event Has Uuid 140ms
Format Validation.Event Has Lib Properties 149ms
Format Validation.Distinct Id Is String 143ms
Format Validation.Token Is Present 141ms
Format Validation.Custom Properties Preserved 139ms
Format Validation.Event Has Timestamp 145ms
Retry Behavior.Retries On 503 5151ms
Retry Behavior.Does Not Retry On 400 2145ms
Retry Behavior.Does Not Retry On 401 2148ms
Retry Behavior.Respects Retry After Header 5104ms
Retry Behavior.Implements Backoff 15107ms
Retry Behavior.Retries On 500 5102ms
Retry Behavior.Retries On 502 5100ms
Retry Behavior.Retries On 504 5099ms
Retry Behavior.Max Retries Respected 15100ms
Deduplication.Generates Unique Uuids 99ms
Deduplication.Preserves Uuid On Retry 5023ms
Deduplication.Preserves Uuid And Timestamp On Retry 10030ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5036ms
Deduplication.No Duplicate Events In Batch 27ms
Deduplication.Different Events Have Different Uuids 25ms
Compression.Sends Gzip When Enabled 25ms
Batch Format.Uses Proper Batch Structure 26ms
Batch Format.Flush With No Events Sends Nothing 53ms
Batch Format.Multiple Events Batched Together 104ms
Error Handling.Does Not Retry On 403 2083ms
Error Handling.Does Not Retry On 413 2060ms
Error Handling.Retries On 408 5086ms

Feature_Flags Tests

17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 66ms
Request Payload.Flags Request Uses V2 Query Param 44ms
Request Payload.Flags Request Hits Flags Path Not Decide 35ms
Request Payload.Flags Request Omits Authorization Header 44ms
Request Payload.Token In Flags Body Matches Init 42ms
Request Payload.Groups Round Trip 36ms
Request Payload.Groups Default To Empty Object 39ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 52ms
Request Payload.Disable Geoip Omitted Defaults To False 31ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 43ms
Request Lifecycle.No Flags Request On Init Alone 33ms
Request Lifecycle.No Flags Request On Normal Capture 39ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 51ms
Request Lifecycle.Mock Response Value Is Returned To Caller 34ms
Retry Behavior.Retries Flags On 502 245ms
Retry Behavior.Retries Flags On 504 243ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 38ms

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.

1 participant