Repository navigation
fix: preserve event timestamps and flag request defaults - #253
Conversation
posthog-elixir Compliance ReportDate: 2026-11-18T10:16:32.371112+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
dustinbyrne
left a comment
There was a problem hiding this comment.
The timestamp and canonical-request fixes are well covered, but the new defaults can invalidate previously accepted raw flag requests using legacy group aliases. Consider preserving those request shapes before approval.
AI-assisted review.
…1.1-20261115 # Conflicts: # .github/workflows/sdk-compliance.yml
There was a problem hiding this comment.
Not approved — this change needs a human reviewer.
Re-adding the stamphog label gives the same result unless the changed files change.
stamphog can't clear this pull request because two gates refused it. The deny-list gate matched the infra/CI-CD category, most likely because of the change to .github/workflows/sdk-compliance.yml (the pinned reusable workflow and harness version). The tier gate classified the change as T2-never: a cross-cutting fix touching 13 files and 490 lines, including lib/posthog.ex, lib/posthog/feature_flags.ex, and the compliance adapter.
The author should ask a human reviewer to look at it. Splitting the workflow and harness pin into its own pull request, separate from the timestamp and flag-request fixes, would also make each piece easier to review.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✗ | matches: infra_cicd |
| every_file_attested | ✓ | not a bot PR |
| size | ✓ | 84L, 5F substantive, 490L/13F incl. docs/generated/snapshots — within ceiling |
| tier | ✗ | classified as T2-never: T2-never (490L, 13F, cross-cutting, fix) |
| stamphog 2.9.1 | .stamphog/policy.yml @ unknown · reviewed head 71999b3 |
💡 Motivation and Context
Event timestamps changed by
before_sendcould reach the wire with a non-UTC offset. The compliance adapter also ignored timestamp overrides. Flag requests omitted empty group objects and the existing backend-effective GeoIP default.This fixes those paths without adding public API or restoring legacy flag parsing:
before_send, preserving every fractional digit, including beyond microseconds. Leave timestamp-like properties and invalid/non-string hook values unchanged. Generated timestamps bypass parsing.groups: {},group_properties: {}andgeoip_disable: falsewhen omitted. Preserve explicit atom-keyed and string-keyed wire options. This makes existing defaults explicit without changing effective GeoIP behavior.before_sendhook and clear the override after capture.dde638562d33572b5c8ac3a2eafc98b92ffa2261. Update local image examples to 1.32.0 as well.The timestamp behavior follows the canonical capture and before-send-hook contracts. No divergence is intended in the behavior changed here.
Harness 1.32.0 includes the corrected flag fixtures, with rich v2
flagsalongside legacyfeatureFlags. This SDK still requests/flags?v=2and requires rich responses. The earlier fixture dependency is resolved by the published release, not a local patched image. The published V1 image digest issha256:7eb6c62e2241ddd48a2dfb326652e7933cd2fe26e0ffcad98cd385d603b4eb82.💚 How did you test it?
Fresh checks on
12d1ba8e788b8ca5c7cdcb27dfcbad4f7d0ab383:Native: 1036 passed, 18 existing integration exclusions. Focused regressions: 242 passed. Adapter: 7 passed. Formatting, compilation, public API snapshot, Credo and workflow lint passed. Local tools were Elixir 1.20.4 / OTP 29. Production-credential integration tests were not run locally.
The authoring test audit retained all changed tests and exact wire assertions. Temporarily running current tests against the pre-fix SDK and router from
origin/mainreproduced 36 native failures for non-UTC timestamps and absent request defaults, plus two adapter failures for timestamp forwarding and defaults. Restoring the fixes made the same suites pass. Coverage includes UTC, both offset signs, date crossings, nine fractional digits, unchanged properties, malformed/native timestamps, explicit context, string-keyed wire options and override cleanup.A fresh isolated autoreview covered the full committed branch against
origin/main(febb4c67ab9cf8892bcafbe3ce179162d375c98e). Its mandatory TruffleHog scan was clean and it reported no actionable findings.All 29 hosted checks passed on this head, including all 12 supported Elixir/OTP test combinations, Format, Credo, warnings-as-errors/public API checks, Hex packaging, adapter regressions, compliance, CodeQL, Semgrep, Wiz and PR title validation.
dde638562d33572b5c8ac3a2eafc98b92ffa2261.capture_v0/encoding_gzip. No tests were removed or skipped, and no retry settings changed to make the run pass.Compliance remains advisory in the reusable workflow. The passing result above comes from the actual complete report and test logs, not just a green workflow status.
📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Manoel directed the work. A Codex implementation agent used local files, shell, Git and GitHub CLI. Pi ran the fresh isolated autoreview through its Claude Code provider with reviewer tools disabled and a mandatory secret scan. No MCP tools were used. There is no public session link. Human review is required.
The SDK owns normalization and request defaults. The adapter only forwards raw timestamps through the existing hook. Legacy response parsing remains unchanged. Capabilities and the documented single-sender, timer-based flush limitations remain unchanged.
Related PRs
The fixture corrections are now published in harness 1.32.0. This PR uses that release and its immutable reusable workflow SHA.