Skip to content

feat(propdefs): Stricter classification of DateTime values #30908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 8, 2025

Conversation

eli-r-ph
Copy link
Contributor

@eli-r-ph eli-r-ph commented Apr 8, 2025

Problem

We don't want to accidentally classify large numerical values as DateTime if they happen to match a UNIX timestamp in the last 6 month window.

Changes

Restrict numerical valued DateTime classifications to be both a valid UNIX timestamp in the last 6 months and include one of the "timestamp keywords" in the property name.

All other numerical valued props will be classified as Numeric

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Locally and in CI

…ludes date keyword AND number is also valid UNIX timestamp in the last 6mo
@eli-r-ph eli-r-ph requested review from benjackwhite and a team April 8, 2025 00:36
@eli-r-ph eli-r-ph self-assigned this Apr 8, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR refines the classification logic for numeric DateTime properties in the PostHog codebase, ensuring that numerical values are only classified as DateTime when paired with explicit timestamp keywords in their property names.

  • Modified logic in /rust/property-defs-rs/src/types.rs to require both a valid UNIX timestamp (within the last 6 months) and a timestamp keyword.
  • Prevents large numerical values from being misclassified as DateTime.
  • Ensures properties without proper naming conventions default to Numeric, avoiding edge-case misinterpretations.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@eli-r-ph eli-r-ph merged commit 052f4ea into master Apr 8, 2025
83 checks passed
@eli-r-ph eli-r-ph deleted the eli.r/propdefs-numeric-date-classification branch April 8, 2025 16:23
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