diff --git a/ee/api/test/test_hooks.py b/ee/api/test/test_hooks.py index 0017079f4a77d..3cfa9595ce1c8 100644 --- a/ee/api/test/test_hooks.py +++ b/ee/api/test/test_hooks.py @@ -139,8 +139,9 @@ def test_create_hog_function_via_hook(self): "target": "https://hooks.zapier.com/{inputs.hook}", }, }, + "order": 2, }, - "debug": {}, + "debug": {"order": 1}, "hook": { "bytecode": [ "_H", @@ -149,6 +150,7 @@ def test_create_hog_function_via_hook(self): "hooks/standard/1234/abcd", ], "value": "hooks/standard/1234/abcd", + "order": 0, }, } diff --git a/posthog/api/hog_function.py b/posthog/api/hog_function.py index 4549f4f3a8bb5..9fa2296e95f32 100644 --- a/posthog/api/hog_function.py +++ b/posthog/api/hog_function.py @@ -79,7 +79,7 @@ class HogFunctionMaskingSerializer(serializers.Serializer): bytecode = serializers.JSONField(required=False, allow_null=True) def validate(self, attrs): - attrs["bytecode"] = generate_template_bytecode(attrs["hash"]) + attrs["bytecode"] = generate_template_bytecode(attrs["hash"], input_collector=set()) return super().validate(attrs) diff --git a/posthog/api/test/test_hog_function.py b/posthog/api/test/test_hog_function.py index b988b53fdbbfb..88bdb7d61e744 100644 --- a/posthog/api/test/test_hog_function.py +++ b/posthog/api/test/test_hog_function.py @@ -456,6 +456,7 @@ def test_secret_inputs_not_returned(self, *args): "I AM SECRET", ], "value": "I AM SECRET", + "order": 0, }, } @@ -619,6 +620,7 @@ def test_generates_inputs_bytecode(self, *args): 32, "http://localhost:2080/0e02d917-563f-4050-9725-aad881b69937", ], + "order": 0, }, "payload": { "value": { @@ -628,6 +630,7 @@ def test_generates_inputs_bytecode(self, *args): "person": "{person}", "event_url": "{f'{event.url}-test'}", }, + "order": 1, "bytecode": { "event": ["_H", HOGQL_BYTECODE_VERSION, 32, "event", 1, 1], "groups": ["_H", HOGQL_BYTECODE_VERSION, 32, "groups", 1, 1], @@ -650,7 +653,7 @@ def test_generates_inputs_bytecode(self, *args): ], }, }, - "method": {"value": "POST"}, + "method": {"value": "POST", "order": 2}, "headers": { "value": {"version": "v={event.properties.$lib_version}"}, "bytecode": { @@ -672,6 +675,7 @@ def test_generates_inputs_bytecode(self, *args): 2, ] }, + "order": 3, }, } @@ -1141,6 +1145,7 @@ def test_create_typescript_destination_with_inputs(self): inputs["message"]["transpiled"]["stl"].sort() assert result["inputs"] == { "message": { + "order": 0, "transpiled": { "code": 'concat("Hello, TypeScript ", arrayMap(__lambda((a) => a), [1, 2, 3]), "!")', "lang": "ts", diff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.py index 142f7710248f0..6484c3eb23f33 100644 --- a/posthog/cdp/validation.py +++ b/posthog/cdp/validation.py @@ -24,9 +24,7 @@ def visit_field(self, node: ast.Field): super().visit_field(node) if node.chain[0] == "inputs": if len(node.chain) > 1: - self.inputs.add(node.chain[1]) - else: - self.inputs.add("") + self.inputs.add(str(node.chain[1])) def collect_inputs(node: ast.Expr) -> set[str]: