Skip to content

fix(android): prevent date offset overflow - #714

Merged
marandaneto merged 1 commit into
mainfrom
fix/android-date-overflow
Aug 24, 2026
Merged

fix(android): prevent date offset overflow#714
marandaneto merged 1 commit into
mainfrom
fix/android-date-overflow

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

PostHogAndroidDateProvider multiplied second offsets as an Int before adding them to a millisecond timestamp. Large offsets could overflow before being converted to Long, producing the wrong date.

This changes the multiplication to use Long arithmetic. It preserves the existing behavior for normal offsets and supports the full Int range accepted by the API.

💚 How did you test it?

  • ./gradlew :posthog-android:testDebugUnitTest --tests "com.posthog.android.internal.PostHogAndroidDateProviderTest"
  • make checkFormat
  • Pi autoreview against 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)

Pi implemented the focused arithmetic fix and regression tests after a human-directed Slopo duplication review. Pi autoreview checked the committed branch and reported no actionable findings. The implementation keeps the existing Int API and changes only the intermediate multiplication type.

@marandaneto marandaneto self-assigned this Aug 22, 2026
@marandaneto
marandaneto marked this pull request as ready for review August 22, 2026 13:05
@marandaneto
marandaneto requested a review from a team as a code owner August 22, 2026 13:05
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(android): prevent date offset overfl..." | Re-trigger Greptile

@marandaneto
marandaneto merged commit 42dcb3d into main Aug 24, 2026
16 checks passed
@marandaneto
marandaneto deleted the fix/android-date-overflow branch August 24, 2026 12:10
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