test: verify PostHog timestamps use UTC - #21
Merged
Conversation
arnohillen
approved these changes
Aug 14, 2026
arnohillen
left a comment
There was a problem hiding this comment.
(created by claude code)
[arno's agent] Verified at 27b5451: test-only, drives the real plugin path through a local HTTP server and asserts the gzip batch carries the canonical UTC instant.
|
(created by claude code) [arno's agent] The PR body still mentions a changeset, but 27b5451 removed it and the diff is now test-only, so that sentence is stale. |
Member
Author
|
Fixed — I removed the stale changeset references from the PR description now that the diff is test-only. Thanks for catching that! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The plugin relies on
posthog-nodeto add timestamps when it sends events. We did not have regression coverage proving that these timestamps stay in UTC when OpenCode runs in a non-UTC timezone.Changes
This adds an integration test that runs the plugin with
TZ=America/Los_Angelesand freezes the clock at July 1, 2024 at 12:34:56.789 local time. The test sends an assistant message and a completed generation through the real plugin path, captures the compressed request with a local HTTP server, and verifies bothsent_atand the$ai_generationtimestamp are exactly2024-07-01T19:34:56.789Z.How did you test this code?
This change was prepared by an agent. I ran these automated checks:
pnpm test- 48 tests passed across 4 test files.pnpm lint- oxlint and oxfmt checks passed.pnpm typecheck- TypeScript type checking passed.Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
A Pi implementation agent prepared the test from a human-directed request. The test uses the real
posthog-noderequest path rather than mocking timestamp generation so it covers the serialized payload that PostHog receives. Pi autoreview checked the committed branch againstorigin/mainand reported no actionable findings.