Skip to content

fix: Generate personless IDs with UUID v7#181

Draft
marandaneto wants to merge 2 commits into
mainfrom
fix/use-uuid-v7
Draft

fix: Generate personless IDs with UUID v7#181
marandaneto wants to merge 2 commits into
mainfrom
fix/use-uuid-v7

Conversation

@marandaneto

@marandaneto marandaneto commented Jun 19, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

Generated personless identifiers should be time-ordered UUID v7 values. The PHP SDK still generated v4 values for personless capture distinct IDs and exception auto-capture fallback IDs.

This PR adds internal UUID v7 generation following the RFC 9562 Unix timestamp layout and uses it for SDK-generated personless distinct_id values. The helper is autoloaded internally without adding Uuid::v7() to the public API snapshot.

💚 How did you test it?

  • composer validate
  • composer api:check
  • vendor/bin/phpcs --warning-severity=0 lib/Uuid.php lib/Client.php lib/ExceptionCapture.php test/UuidTest.php
  • vendor/bin/phpunit --no-coverage test/UuidTest.php
  • vendor/bin/phpunit --no-coverage test/RequestContextTest.php --filter Personless
  • vendor/bin/phpunit --no-coverage test/ExceptionPayloadBuilderTest.php --filter testCaptureExceptionWithoutDistinctIdGeneratesUuidAndSetsNoProfile
  • vendor/bin/phpunit --no-coverage test/ExceptionCaptureTest.php --filter testExceptionHandlerUsesCurrentClientContextProperties

📝 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 by a coding agent from a human request to migrate SDK-generated UUID v4/random IDs to UUID v7. Follow-up review feedback made UUID v7 generation internal rather than public API and documented the RFC 9562 layout / no PHP core UUID v7 API in supported runtimes.

@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: generate personless ids with UUID v..." | Re-trigger Greptile

Comment thread lib/Uuid.php Outdated
Comment thread lib/Uuid.php Outdated
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