Skip to content

fix: Issues with parsing group properties#30238

Merged
benjackwhite merged 4 commits intorevert/feat-lazy-loadfrom
feat/hog-function-lazy-fixes
Mar 21, 2025
Merged

fix: Issues with parsing group properties#30238
benjackwhite merged 4 commits intorevert/feat-lazy-loadfrom
feat/hog-function-lazy-fixes

Conversation

@benjackwhite
Copy link
Contributor

@benjackwhite benjackwhite commented Mar 20, 2025

Problem

Small PR to fix issues with the original loader

Changes

  • Fixes filtering list to check the length of the team functions
  • Fixes the global properties to be "unknown" record values to force type level warnings to validate
  • Fixes areas where this is an issue particularly in the groups loader
  • Adds tests to cover these kinds of issues

Follow up

  • Follow up PR to ingestion to forbid groups shape at ingestion level

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

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

How did you test this code?

@benjackwhite benjackwhite requested a review from a team March 21, 2025 08:23
@benjackwhite benjackwhite marked this pull request as ready for review March 21, 2025 08:24
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 focuses on improving type safety and validation in the PostHog plugin server's group properties handling. Here's a concise summary of the key changes:

  • Changed properties type from Record<string, any> to Record<string, unknown> in HogFunctionInvocationGlobals to enforce stricter type checking
  • Fixed team functions filtering to check array length (!teamHogFunctions.length) instead of falsy values
  • Added validation for $groups property to ensure correct object structure with string keys/values
  • Added type checking for $hog_function_execution_count in postHogCapture to properly handle numeric values
  • Added test coverage for invalid group properties handling and team filtering scenarios

The changes appear well-structured with good test coverage, focusing on improving data validation and type safety throughout the codebase.

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

@benjackwhite benjackwhite merged commit 60125fa into revert/feat-lazy-load Mar 21, 2025
90 checks passed
@benjackwhite benjackwhite deleted the feat/hog-function-lazy-fixes branch March 21, 2025 10:01
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