Skip to content

fix: unique event uuids, future timestamps, blank ids - #287

Merged
eli-r-ph merged 1 commit into
v1from
v1-event-uuid-timestamp-id
Oct 18, 2026
Merged

eli-r-ph merged 1 commit into
v1from
v1-event-uuid-timestamp-id

Conversation

@eli-r-ph

@eli-r-ph eli-r-ph commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Three event rules differed from the other PostHog SDKs, and two of them lost events.

Changes

  • The client assigns an event's uuid when it takes the event, not in Event::new.
    • Capturing a cloned or reused Event twice no longer sends one uuid twice, which PostHog rejects.
    • A uuid set with set_uuid is still sent as given.
  • set_timestamp accepts future timestamps; PostHog clamps far-future ones. Its signature is unchanged.
  • Event::new with an empty or whitespace-only distinct ID makes an anonymous event, like Event::new_anon. PostHog used to drop it.
  • Migration guide section and changeset.

💚 How did you test it?

  • A cloned event captured twice, queued and immediate, sends two different uuids.
  • Unit tests cover uuid assignment, future timestamps and blank IDs; fixing the uuid in Event::new again fails the new test.
  • fmt, clippy and tests pass in every feature set; the public API is unchanged.

🤖 Generated with Claude Code

…lank ids as anonymous

A cloned or reused Event no longer sends one uuid twice: the client assigns
the uuid when it takes the event, unless set_uuid was called. set_timestamp
no longer rejects future timestamps; PostHog clamps them. Event::new with an
empty or whitespace-only distinct id creates an anonymous event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eli-r-ph eli-r-ph self-assigned this Oct 13, 2026
@eli-r-ph
eli-r-ph marked this pull request as ready for review October 13, 2026 05:28
@eli-r-ph
eli-r-ph requested a review from a team as a code owner October 13, 2026 05:28
@eli-r-ph eli-r-ph changed the title fix: assign event uuids at capture, accept future timestamps, treat blank ids as anonymous fix: unique event uuids, future timestamps, blank ids Oct 13, 2026

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code looks good; no qualifying findings. Verdict: correct.

@eli-r-ph
eli-r-ph merged commit 5312521 into v1 Oct 18, 2026
29 checks passed
@eli-r-ph
eli-r-ph deleted the v1-event-uuid-timestamp-id branch October 18, 2026 16:55
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.

2 participants