Skip to content

V1 release - DO NOT MERGE - #231

Draft
marandaneto wants to merge 35 commits into
mainfrom
v1
Draft

V1 release - DO NOT MERGE#231
marandaneto wants to merge 35 commits into
mainfrom
v1

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

Closes #207

💚 How did you test it?

📝 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

eli-r-ph and others added 11 commits August 20, 2026 13:01
Deletes the V0 capture implementation and the `capture-v1` Cargo feature.
Capture V1 (`POST /i/v1/analytics/events`) is now the only capture path and
compiles unconditionally. No V1 logic, retry policy, buffering, or
option-extraction behavior changes — the V1 code is byte-identical, it just
stops being `#[cfg]`-gated.

- Delete `src/client/v0_capture.rs`, the V0 transport pipeline, the V0 retry
  decisions (`should_retry_v0` and friends), the V0 wire format's
  `BatchRequest`, and both `send_immediate` V0 bodies.
- Drop the `capture-v1` feature; `brotli` and `zstd` become unconditional
  dependencies. All four codecs the endpoint accepts (gzip/deflate/br/zstd)
  now work by default instead of silently degrading to uncompressed.
- Compliance adapter advertises `capture_v1` unconditionally and reports as
  `posthog-rs`; delete the V0 adapter image and its workflow. The
  `capture_v1` capability string is a frozen harness contract key.
- Collapse the CI build/test matrices, whose V0 and V1 entries became
  duplicates, and drop `--features capture-v1` from `check-public-api.sh`.

`Event::prepare_for_v0` and `InnerEvent` are retained temporarily as test-only
scaffolding; the tests that depend on them are ported to the V1 builder in the
next commit, which then deletes them.

Verified against a pre-change baseline: 379/316/356 tests pass for the default,
blocking, and blocking+error-tracking configs — identical counts to the same
suites under `--features capture-v1` before this change. Public API snapshot
unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Rewrites the tests that depended on the V0 serialization scaffolding, then
deletes that scaffolding, so nothing V0 remains in the tree.

- `src/error_tracking.rs`: `built_event_json` now serializes through
  `V1Event::from_event`, so all 33 tests assert the shape actually sent. Two
  assertions move `$process_person_profile` from `properties` to the typed
  `options` object and additionally pin that it is stripped from `properties`.
- `src/event.rs`: 10 `v0_*` tests ported to assert the V1 shape and renamed
  without the version marker. `v0_adds_lib_properties` and
  `v0_preserves_existing_lib_properties` are dropped instead — the V1 builder
  never touches `$lib`/`$lib_version`, which now travel in the
  `posthog-sdk-info` header and are covered by
  `build_headers_sdk_info_is_canonical_lib_slash_version`.
- Delete `Event::prepare_for_v0`, `Event::apply_minimal_flag_called_allowlist`,
  and `InnerEvent`. The shared `is_minimal_flag_called_property` predicate is
  kept — the V1 path uses it. `semver` was only used by `prepare_for_v0`, so it
  is dropped as a dependency.
- Port the orphaned integration assertions that had no V1 twin, in both the
  async and blocking variants: `Event::with_flags` attaching flag properties
  without a second `/flags` fetch, `$is_server` on `$feature_flag_called`,
  client-level `ErrorTrackingOptions` applying to `capture_exception`, and the
  blank/whitespace API-key noop path.

Test totals move 379/316/356 -> 381/317/358 for the default, blocking, and
blocking+error-tracking configs: four ported tests added per applicable config,
less the two `$lib` tests whose behavior moved to the header. Public API
snapshot unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `V1` markers existed only to scope the new pipeline during the dual-use
period. With V0 gone they are noise, so this adopts plain capture names —
including the pre-existing public `Endpoint::Capture`. Mechanical rename only:
no logic, retry, buffering, or option-extraction behavior changes, and no
existing test's assertions were altered.

Breaking:
- `V1ErrorResponse` -> `CaptureErrorResponse`, which also re-signatures the
  public `CaptureFailure::error_response()`.
- `Endpoint::Batch` removed; `Endpoint` is now `#[non_exhaustive]`.
- `Endpoint::Capture` re-points from `/i/v0/e/` to `/i/v1/analytics/events`.
  Callers of `Endpoint::Capture.path()` compile unchanged but see a different
  URL — the one change here with no compile-time signal.

Internal:
- `V1Event` -> `CaptureEvent` (not `Event`, which is taken by the public input
  type), `V1BatchRequest{,Ref}` -> `BatchRequest{,Ref}`, `PreparedV1` ->
  `Prepared`.
- `src/event_v1.rs` -> `src/capture_event.rs`, `src/client/v1_capture.rs` ->
  `src/client/capture.rs`. The former cannot be `event.rs` — the public `Event`
  lives there.
- `V1_CAPTURE_PATH` is deleted; both call sites now go through
  `build_url(Endpoint::Capture)`, which is byte-identical output since
  `build_custom_url` only normalized a leading slash that was already present.
- Tests renamed to match: `test_v1_capture.rs` -> `test_capture.rs`,
  `test_v1_blocking.rs` -> `test_capture_blocking.rs` (not `test_blocking.rs`,
  which survives), `test_error_tracking_v1.rs` -> `test_error_tracking.rs`.
- `compliance/v1/` -> `compliance/harness/`, and the compliance workflow drops
  its `-v1` suffixes.

The harness contract keys are deliberately untouched: the `capture_v1`
capability advertised by the adapter and the `--suite capture_v1` argument are
external strings the test harness matches on.

Adds the major-release changeset. Test counts are unchanged from the previous
commit (381/317/358), and the public API diff is exactly the three intended
items with nothing else moving.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`compliance/harness/Dockerfile` does `COPY . .` from the repo root, so with no
.dockerignore the build context included the whole local `target/` tree — 33GB
after a few cargo runs here — and the build died with ResourceExhausted while
hardlinking incremental artifacts. CI never hit this because a fresh checkout
has no `target/`, which is why the documented local compose path was quietly
broken for anyone who had built the crate.

Excluding target/, .git/, and .github/ drops the context from 33GB to 1.14MB,
which also trims the CI build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Porting the V0 tests left `event.rs` asserting the capture wire shape, which
`capture_event.rs` already owns — six were straight duplicates (timestamp
normalization, the anon/group/explicit `$process_person_profile` cases, and
`$groups`).

Wire-shape assertions now live only in `capture_event.rs`, next to the builder
they exercise; `event.rs` keeps just its `Event`-level timestamp tests. The four
assertions that were genuinely unique moved across rather than being dropped:
`distinct_id` at the root (with no legacy `$distinct_id` and no duplicate in
properties), auto-generated and caller-overridden `uuid`, and
`$process_person_profile` being absent from *both* options and properties when
unset. The `$lib`-coverage note moved with them.

Net -6 tests per config (375/311/352) — the duplicates, nothing else.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…h exists

The v0/v1 split left scaffolding that no longer earns its keep.

- Drop `--suite capture_v1` from the local compose. That filter existed only to
  pick v0 and v1 apart; with one capture path the harness selects suites from
  the adapter's advertised /health capabilities, which is what CI already does
  (it passes no --suite). Local runs were silently narrower than CI as a result
  — 94 tests instead of 111, skipping feature_flags entirely.
- Flatten `compliance/harness/` back to `compliance/`. The extra directory level
  only existed to hold the two per-mode variants.

Verified from the new layout: 111/111, capabilities `capture_v1, encoding_gzip`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor!: remove deprecated APIs

* refactor!: rename local evaluation secret key field

* fix local evaluation API fallback

* preserve local-only evaluation privacy
* feat!: mark evaluate flags options as non-exhaustive

* fix non-exhaustive options call sites
# Conflicts:
#	.github/workflows/sdk-compliance-tests-v1.yml
#	.github/workflows/sdk-compliance-tests.yml
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

posthog-rs Compliance Report

Date: 2026-08-31 08:00:38 UTC
Duration: 22994ms

✅ 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 145ms
Endpoint And Method.Does Not Use Legacy Endpoints 145ms
Required Headers.Has Authorization Bearer Header 144ms
Required Headers.Has Content Type Json 143ms
Required Headers.Has Posthog Sdk Info Format 143ms
Required Headers.Has Posthog Attempt Header 143ms
Required Headers.Has Posthog Request Id 143ms
Required Headers.Has Posthog Request Timestamp 144ms
Required Headers.Has User Agent 142ms
Body Format.Body Has Created At And Batch 144ms
Body Format.No Api Key In Body 131ms
Body Format.No Sent At In Body 132ms
Event Format.Event Has Required Root Fields 131ms
Event Format.Event Uuid Is Valid 132ms
Event Format.Event Timestamp Is Rfc3339 135ms
Event Format.Distinct Id Is String 130ms
Event Format.Distinct Id At Root Not Properties 130ms
Event Format.Custom Properties Preserved 131ms
Event Format.Set Properties Preserved 129ms
Event Format.Set Once Properties Preserved 130ms
Event Format.Groups Properties Preserved 125ms
Event Format.Sdk Generates Uuid If Not Provided 123ms
Event Format.Event Has Required Root Fields Batch 154ms
Event Format.Event Uuid Is Valid Batch 156ms
Event Format.Event Timestamp Is Rfc3339 Batch 156ms
Event Format.Distinct Id Is String Batch 167ms
Event Format.Distinct Id At Root Not Properties Batch 166ms
Event Format.Custom Properties Preserved Batch 167ms
Event Format.Set Properties Preserved Batch 154ms
Event Format.Set Once Properties Preserved Batch 151ms
Event Format.Groups Properties Preserved Batch 140ms
Event Format.Sdk Generates Uuid If Not Provided Batch 139ms
Batch Behavior.Multiple Events In Single Batch 168ms
Batch Behavior.Batch Envelope Smoke 164ms
Batch Behavior.Flush With No Events Sends Nothing 72ms
Batch Behavior.Flush At Triggers Batch 1122ms
Batch Behavior.Created At Reflects Batch Creation Time 92ms
Deduplication.Generates Unique Uuids 198ms
Deduplication.Different Events Same Content Different Uuids 143ms
Deduplication.Preserves Uuid On Retry 5116ms
Deduplication.Preserves Timestamp On Retry 5086ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5119ms
Deduplication.No Duplicate Events In Batch 135ms
Header Behavior On Retry.Attempt Header Starts At One 62ms
Header Behavior On Retry.Attempt Header Increments On Retry 10070ms
Header Behavior On Retry.Request Id Preserved On Retry 5074ms
Header Behavior On Retry.Different Requests Have Different Request Ids 2064ms
Header Behavior On Retry.Request Timestamp Changes On Retry 5068ms
Response Format Validation.Success Response Has Uuid Keyed Results 41ms
Response Format Validation.Success Response Has Ok For Each Event 30ms
Response Format Validation.Success No Retry After When All Ok 28ms
Response Format Validation.Success Retry After Present When Retry Events 30ms
Response Format Validation.Success No Retry After When Drop Only 31ms
Response Format Validation.Response Echoes Request Id 29ms
Retry Behavior.Retries On 408 5037ms
Retry Behavior.Retries On 500 5024ms
Retry Behavior.Retries On 503 5025ms
Retry Behavior.Retries On 504 5023ms
Retry Behavior.Retryable Errors Have Retry After 2026ms
Retry Behavior.Respects Retry After On Retryable Error 8024ms
Retry Behavior.Does Not Retry On 400 2030ms
Retry Behavior.Does Not Retry On 401 2035ms
Retry Behavior.Does Not Retry On 402 2027ms
Retry Behavior.Does Not Retry On 413 2028ms
Retry Behavior.Does Not Retry On 415 2027ms
Retry Behavior.Non Retryable Errors Have No Retry After 2025ms
Retry Behavior.Implements Backoff 15031ms
Retry Behavior.Max Retries Respected 15024ms
Partial Batch Handling.Handles 200 Full Success 2029ms
Partial Batch Handling.Handles 200 With All Ok 3036ms
Partial Batch Handling.Does Not Retry Dropped Events 3032ms
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 5025ms
Partial Batch Handling.Retries Only Retry Events From Partial 5028ms
Partial Batch Handling.Partial Retry Preserves Uuids 5024ms
Partial Batch Handling.Partial Retry Attempt Header Increments 5030ms
Partial Batch Handling.Partial Retry Request Id Preserved 5035ms
Partial Batch Handling.Respects Retry After On Partial 5024ms
Partial Batch Handling.Unknown Result Treated As Terminal 3024ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 3032ms
Compression.Sends Gzip Content Encoding 25ms
Compression.No Content Encoding When Disabled 22ms
Compression.Compressed Body Is Decompressible 22ms
Error Handling.Does Not Retry On Unknown 4Xx 2023ms
Event Options.Cookieless Mode Override 23ms
Event Options.Disable Skew Correction Override 23ms
Event Options.Process Person Profile Override 23ms
Event Options.Product Tour Id Override 22ms
Event Options.Unset Options Omitted 22ms
Event Options.Options Override In Batch 25ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 22ms
Geoip And Historical Migration.Historical Migration Set In Body 22ms
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 14ms
Request Payload.Flags Request Uses V2 Query Param 14ms
Request Payload.Flags Request Hits Flags Path Not Decide 14ms
Request Payload.Flags Request Omits Authorization Header 14ms
Request Payload.Token In Flags Body Matches Init 16ms
Request Payload.Groups Round Trip 15ms
Request Payload.Groups Default To Empty Object 14ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 14ms
Request Payload.Disable Geoip Omitted Defaults To False 14ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 14ms
Request Lifecycle.No Flags Request On Init Alone 11ms
Request Lifecycle.No Flags Request On Normal Capture 24ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 18ms
Request Lifecycle.Mock Response Value Is Returned To Caller 16ms
Retry Behavior.Retries Flags On 502 221ms
Retry Behavior.Retries Flags On 504 218ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 24ms

marandaneto and others added 18 commits August 24, 2026 14:21
# Conflicts:
#	api/public-api.txt
#	src/event.rs
* refactor: unify feature flag evaluation engine

* test: consolidate feature evaluation cases
# Conflicts:
#	api/public-api.txt
#	src/event.rs
* refactor(error-tracking): centralize debug image filtering

* fix: avoid self-joining transport worker on drop

* refactor: unify feature flag evaluation engine

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* refactor: share feature flag evaluation state

* refactor: centralize capture enqueue policy

* test: consolidate malformed capture responses

* test: consolidate client runtime assertions

* test: consolidate feature evaluation cases

* fix: avoid async shutdown worker deadlock

* style: format shutdown regression test

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* refactor: share feature flag evaluation state

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* refactor: share feature flag evaluation state

* refactor: centralize capture enqueue policy

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* refactor: share feature flag evaluation state

* refactor: centralize capture enqueue policy

* test: consolidate client runtime assertions

* fix: avoid async shutdown worker deadlock
* fix: avoid self-joining transport worker on drop

* refactor: share feature flag retry classifier

* refactor: centralize capture preprocessing

* refactor: share feature flag event host

* refactor: share feature flag evaluation state

* refactor: centralize capture enqueue policy

* test: consolidate malformed capture responses

* fix: avoid async shutdown worker deadlock
# Conflicts:
#	src/client/async_client.rs
#	src/client/blocking.rs
#	tests/test_group_identify.rs
marandaneto and others added 6 commits August 26, 2026 17:23
* ci: test capture compliance across clients and encodings

* fix: scope compliance concurrency to matrix jobs
* docs!: audit and document the v1 public API

* docs: remove the standalone public API audit

* docs: narrow the v1 migration guide

* docs: clarify immediate capture durability checks
* feat!: make the TLS provider configurable

* chore: remove the TLS changeset
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.

Prepare and release posthog-rs| posthog v1.0

2 participants