Skip to content

fix: use uuid v7 for personless ids#581

Draft
marandaneto wants to merge 1 commit into
mainfrom
fix/use-uuid-v7
Draft

fix: use uuid v7 for personless ids#581
marandaneto wants to merge 1 commit into
mainfrom
fix/use-uuid-v7

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

SDK-generated IDs should use UUID v7 where possible for time-ordered identifiers. A couple of personless distinct ID fallback paths still used random UUID v4 generation, and the event UUID documentation still referred to v4 even though event UUIDs are already v7.

💚 How did you test it?

./gradlew :posthog:test --tests com.posthog.PostHogStatelessTest --tests com.posthog.vendor.uuid.UUIDTest :posthog-server:test --tests com.posthog.server.PostHogRequestContextTest
pnpm changeset status --since origin/main

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

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented the requested UUID v7 migration for the remaining runtime SDK-generated personless distinct IDs. Reused the existing TimeBasedEpochGenerator.generate() helper instead of adding a new dependency, and kept test-only arbitrary UUID.randomUUID() usages unchanged.

@marandaneto marandaneto self-assigned this Jun 19, 2026
@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "fix: use uuid v7 for personless ids" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

posthog-android Compliance Report

Date: 2026-06-19 10:44:43 UTC
Duration: 119799ms

⚠️ Some Tests Failed

38/45 tests passed, 7 failed


Capture Tests

⚠️ 28/29 tests passed, 1 failed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 381ms
Format Validation.Event Has Uuid 38ms
Format Validation.Event Has Lib Properties 39ms
Format Validation.Distinct Id Is String 29ms
Format Validation.Token Is Present 29ms
Format Validation.Custom Properties Preserved 28ms
Format Validation.Event Has Timestamp 33ms
Retry Behavior.Retries On 503 7027ms
Retry Behavior.Does Not Retry On 400 4023ms
Retry Behavior.Does Not Retry On 401 4025ms
Retry Behavior.Respects Retry After Header 7026ms
Retry Behavior.Implements Backoff 17035ms
Retry Behavior.Retries On 500 7018ms
Retry Behavior.Retries On 502 7023ms
Retry Behavior.Retries On 504 7019ms
Retry Behavior.Max Retries Respected 17036ms
Deduplication.Generates Unique Uuids 44ms
Deduplication.Preserves Uuid On Retry 7018ms
Deduplication.Preserves Uuid And Timestamp On Retry 12022ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 7019ms
Deduplication.No Duplicate Events In Batch 37ms
Deduplication.Different Events Have Different Uuids 27ms
Compression.Sends Gzip When Enabled 18ms
Batch Format.Uses Proper Batch Structure 19ms
Batch Format.Flush With No Events Sends Nothing 12ms
Batch Format.Multiple Events Batched Together 32ms
Error Handling.Does Not Retry On 403 4018ms
Error Handling.Does Not Retry On 413 4016ms
Error Handling.Retries On 408 5028ms

Failures

error_handling.does_not_retry_on_413

Expected 1 requests, got 2

Feature_Flags Tests

⚠️ 10/16 tests passed, 6 failed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 31ms
Request Payload.Flags Request Uses V2 Query Param 20ms
Request Payload.Flags Request Hits Flags Path Not Decide 23ms
Request Payload.Flags Request Omits Authorization Header 23ms
Request Payload.Token In Flags Body Matches Init 19ms
Request Payload.Groups Round Trip 19ms
Request Payload.Groups Default To Empty Object 27ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 29ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 29ms
Request Payload.Disable Geoip Omitted Defaults To False 26ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 37ms
Request Lifecycle.No Flags Request On Init Alone 13ms
Request Lifecycle.No Flags Request On Normal Capture 41ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 2034ms
Request Lifecycle.Mock Response Value Is Returned To Caller 25ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 22ms

Failures

request_payload.request_with_person_properties_device_id

Expected distinct_id='test_user_123', got '019edf7b-9e34-7d06-af4d-9601e118635d'

request_payload.groups_default_to_empty_object

Field 'groups' not found in /flags request body at path 'groups'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']

request_payload.person_properties_distinct_id_auto_populated_when_caller_omits_it

Field 'distinct_id' not found in /flags request body at path 'person_properties.distinct_id'. Available keys: ['$lib', '$lib_version', 'email']

request_payload.disable_geoip_false_propagates_as_geoip_disable_false

Field 'geoip_disable' not found in /flags request body at path 'geoip_disable'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']

request_payload.disable_geoip_omitted_defaults_to_false

Field 'geoip_disable' not found in /flags request body at path 'geoip_disable'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']

request_payload.flag_keys_to_evaluate_contains_only_requested_key

Field 'flag_keys_to_evaluate' not found in /flags request body at path 'flag_keys_to_evaluate'. Available keys: ['$anon_distinct_id', '$device_id', 'api_key', 'distinct_id', 'timezone', 'person_properties']

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