Repository navigation
fix: keep $lib and $lib_version on capture v1 events - #942
Merged
Merged
Conversation
An event queued before an SDK upgrade keeps the version that captured it instead of getting the running version from PostHog-Sdk-Info.
Contributor
posthog-android Compliance ReportDate: 2026-11-05T19:23:33.941125+00:00 ✅ All Tests Passed!232/232 tests passed Capture_V1 Tests✅ 105/105 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
turnipdabeets
marked this pull request as ready for review
November 5, 2026 19:26
This was referenced Nov 5, 2026
dustinbyrne
approved these changes
Nov 5, 2026
This was referenced Nov 6, 2026
gewenyu99
added a commit
that referenced
this pull request
Nov 6, 2026
Rebuilt from docs/migration-3.x-to-4.0.md on chore/v4-remove-deprecated, which dropped the SDK identity section (#942) and added the custom httpClient paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gewenyu99
added a commit
that referenced
this pull request
Nov 11, 2026
) * docs: generate the SDK reference for 3.x Generated by bin/docs_scripts/generate_markdown.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs: generate the experimental SDK reference for 4.x Generated by bin/docs_scripts/generate_markdown.py --major 4 --experimental from feat/v4-capture-v1 (PRs #871 and #881), with the capability tags applied on top. Adds the 3.x to 4.0 migration guide page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs: regenerate the Android references from Dokka's HTML The 4.x page and migration guide come from chore/v4-remove-deprecated (the 4.0 branch) with the capability tags and getting-started applied. Both still need to land there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references with braces kept in code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references from docs/capabilities.json The 3.x pages lose only the blank line the stripped capability tags left behind. The 4.x page also moves captureAi to Capture AI and onFeatureFlags to On feature flags, which the map's "next" entries add. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references after review fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android migration page from the current 4.0 guide Rebuilt from docs/migration-3.x-to-4.0.md on chore/v4-remove-deprecated, which dropped the SDK identity section (#942) and added the custom httpClient paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android migration page from the current 4.0 guide Rebuilt from docs/migration-3.x-to-4.0.md on chore/v4-remove-deprecated, which now covers the missing-flag response, posthog-server 2.25 and retry scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android 4.x page from chore/v4-remove-deprecated Picks up the branch's feature flag doc comment fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the references with the getting-started intro Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
8 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Capture v1 currently deletes
$lib/$lib_versionfrom each event before sending, and PostHog fills them from thePostHog-Sdk-Infoheader. That header carries the SDK version running at send time, so an event queued offline and sent after an app update gets the new version. 4.0 also sends events 3.x left on disk, so those get labeled 4.0.Per the capture v1 thread, we're keeping per-event
$lib/$lib_versionand having ingestion store them as sent. This PR stops deleting them incaptureV1Json(PostHogApi.kt), so 4.0 sends them like 3.x did. They stay visible and changeable inbeforeSend.Until capture-rs stops overwriting them from the header, PostHog stores the same values as before this PR. The behavior changes once that backend change lands.
Docs: removed the breaking-change entry from the changeset and the "SDK identity" section and checklist line from
docs/migration-3.x-to-4.0.md, since 3.x behavior is back.💚 How did you test it?
PostHogCaptureV1Test: the event queued on disk by 3.x now keeps$lib_version: 3.20.0when sent; the root-fields test keeps the event's own values. The minimal$feature_flag_calledkey set gains$lib/$lib_version.batch-request.json: all 5 events now carry$lib/$lib_version(the rest of that diff is lines moving)../gradlew apiCheck spotlessCheck :posthog:test :posthog-android:testReleaseUnitTest :posthog-server:testpasses.📝 Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
$lib/$lib_versionat capture time, so no new injection point.🤖 Generated with Claude Code