Skip to content

chore: user scripts v5#30248

Closed
lucasheriques wants to merge 1 commit intomasterfrom
feat/autogen-files-for-surveys-udf
Closed

chore: user scripts v5#30248
lucasheriques wants to merge 1 commit intomasterfrom
feat/autogen-files-for-surveys-udf

Conversation

@lucasheriques
Copy link
Contributor

@lucasheriques lucasheriques commented Mar 20, 2025

deploy before #30182

@posthog-bot
Copy link
Contributor

Hey @lucasheriques! 👋
This pull request seems to contain no description. Please add useful context, rationale, and/or any other information that will help make sense of this change now and in the distant Mars-based future.

@lucasheriques lucasheriques changed the title autogen files for new surveys UDF chore: user scripts v5 Mar 20, 2025
@lucasheriques lucasheriques force-pushed the feat/autogen-files-for-surveys-udf branch from 0c245fd to 6a178ad Compare March 20, 2025 18:46
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

Added new user-defined functions for survey response handling and upgraded funnel analysis functions from v4 to v5 in ClickHouse, with comprehensive test coverage for both old and new survey question formats.

  • Added get_survey_response_v5 UDF in /posthog/user_scripts/v5/get_survey_response.py to extract survey responses from event properties
  • Added architecture-specific binary selection in /posthog/user_scripts/v5/aggregate_funnel for aarch64 and x86_64 platforms
  • Added comprehensive test suite in /posthog/user_scripts/v5/test_get_survey_response.py with 8 test cases covering various survey response scenarios
  • Fixed duplicate num_steps argument in aggregate_funnel_trends_v4/v5 functions
  • Updated all funnel-related function commands from v4 to v5 paths in XML configurations

7 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Double JSON encoding of error message could make debugging more difficult. Consider using a cleaner error format.

Comment on lines +6 to +7
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: No error handling if binaries are missing or not executable. Add checks before execution.

Suggested change
aarch64) $DIR_NAME/aggregate_funnel_aarch64 "$@";;
*) $DIR_NAME/aggregate_funnel_x86_64 "$@";;
aarch64)
if [ ! -x "$DIR_NAME/aggregate_funnel_aarch64" ]; then
echo "Error: aggregate_funnel_aarch64 not found or not executable"
exit 1
fi
$DIR_NAME/aggregate_funnel_aarch64 "$@";;
*)
if [ ! -x "$DIR_NAME/aggregate_funnel_x86_64" ]; then
echo "Error: aggregate_funnel_x86_64 not found or not executable"
exit 1
fi
$DIR_NAME/aggregate_funnel_x86_64 "$@";;

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using * as default case could silently run x86_64 binary on unsupported architectures. Consider explicit architecture matching.

Copy link
Contributor

Choose a reason for hiding this comment

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

logic: parse_args function is referenced but not defined, and calculate_funnel_from_user_events is commented out without explanation

Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider adding structured error response format instead of concatenating error string with traceback

Comment on lines +183 to +184
<name>aggregate_funnel_array_trends_v4</name>

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Extra blank line after function name breaks XML formatting consistency

Comment on lines +222 to +223
<name>aggregate_funnel_cohort_trends_v4</name>

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Extra blank line after function name breaks XML formatting consistency

Comment on lines +472 to +473
<name>aggregate_funnel_array_trends_v5</name>

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Extra blank line after function name breaks XML formatting consistency

Comment on lines +511 to +512
<name>aggregate_funnel_cohort_trends_v5</name>

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Extra blank line after function name breaks XML formatting consistency

<command>v4/aggregate_funnel_array_trends_test.py</command>
<lifetime>600</lifetime>
</function>
<function>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Missing newline before v5 function definitions. Add empty line for better readability.

@lucasheriques lucasheriques requested a review from a team March 20, 2025 19:37
@@ -0,0 +1,121 @@
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

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

we already have this file here https://github.com/PostHog/posthog/pull/30182/files#diff-fffa98dc304d8240297bc8824c2dd21c12605991a6bc155197a33340975c4c2d
under the PR #30182
so I wonder why do we have 2 times? do we need them twice? how do we make sure they are in sync?

@marandaneto
Copy link
Member

close because of https://github.com/PostHog/posthog/pull/30288/files?

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.

4 participants