Skip to content

fix: whole-second timestamps and 8.0 migration guide gaps - #1168

Merged
eli-r-ph merged 6 commits into
v1from
eli/v1-guide-review-fixes
Nov 3, 2026
Merged

eli-r-ph merged 6 commits into
v1from
eli/v1-guide-review-fixes

Conversation

@eli-r-ph

@eli-r-ph eli-r-ph commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

A review of the 8.0 migration guide against the v1 code found upgrade risks it did not mention. The biggest one: person processing turned off in a context or in super_options now reaches alias and group_identify, so PostHog drops their $create_alias and $groupidentify events with no on_error report.

Changes

  • Every capture timestamp (event timestamp, created_at, PostHog-Request-Timestamp) now always has six fractional digits. isoformat() dropped the fraction on whole seconds, which breaks the at-least-milliseconds rule every v1 SDK follows.
  • Warn about the personless context or super_options setting on $create_alias and $groupidentify.
  • sync_mode now retries up to 4 attempts in the calling thread (7.x made one).
  • capture() does not move $ai_ events to the AI endpoint, and capture_ai with a non-$ai_ name is dropped as misrouted_event.
  • An unreadable option value is dropped as invalid_options.
  • Smaller fixes: CaptureMode in the removed imports, gzip= as a keyword, reason tags in the loss line, the removed Error in capture: sync line, the 7.x first retry wait, NaN in $set, and when trace ids are added.

💚 How did you test it?

New test_wire_timestamps_keep_fractional_digits_on_whole_seconds covers sync, background and async sends with whole-second clock and caller times; it fails without the fix. Guide lines were checked against the code on v1 and 7.x on main, and the sync_mode attempts were checked with a local stub server.

📝 Checklist

  • All commits are signed (see Commit signing)
  • 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

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

🤖 Generated with Claude Code

@eli-r-ph
eli-r-ph requested a review from a team as a code owner November 1, 2026 21:03
@eli-r-ph eli-r-ph changed the title docs: close review gaps in the 8.0 migration guide fix: whole-second timestamps and 8.0 migration guide gaps Nov 1, 2026
@eli-r-ph eli-r-ph mentioned this pull request Nov 1, 2026
4 of 6 tasks
eli-r-ph and others added 2 commits November 2, 2026 09:07
Event timestamp, batch created_at and PostHog-Request-Timestamp now
use one helper that writes six fractional digits in UTC, so whole
seconds no longer lose the fraction.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@eli-r-ph
eli-r-ph force-pushed the eli/v1-guide-review-fixes branch from ff0e820 to 57e9198 Compare November 2, 2026 17:10
@turnipdabeets

Copy link
Copy Markdown
Contributor

[suggestion] Targeted mutation tests fails on _rfc3339_timestamp: astimezone(None) survives, likely because the runner is on UTC. Could we add a case with a non-UTC TZ to test_rfc3339_timestamp_always_writes_the_fraction_in_utc? The rest looks good, and we can approve once that's green.

@eli-r-ph eli-r-ph self-assigned this Nov 2, 2026
@eli-r-ph

eli-r-ph commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

updated, thank you!

@eli-r-ph
eli-r-ph merged commit 4f2b004 into v1 Nov 3, 2026
41 checks passed
@eli-r-ph
eli-r-ph deleted the eli/v1-guide-review-fixes branch November 3, 2026 19:57
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