Skip to content

Commit

Permalink
Merge branch 'master' into feat/dead-clicks-server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Oct 31, 2024
2 parents 7e54bf3 + 8b4387c commit 073b194
Show file tree
Hide file tree
Showing 202 changed files with 13,115 additions and 10,988 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,20 @@ jobs:
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 1
concurrency: 3
group: 1
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 3
group: 2
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 3
group: 3

steps:
# The first step is the only one that should run if `needs.changes.outputs.backend == 'false'`.
Expand Down
1,946 changes: 1,222 additions & 724 deletions .test_durations

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ services:
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
image: temporalio/ui:2.10.3
- TEMPORAL_CSRF_COOKIE_INSECURE=true
image: temporalio/ui:2.31.2
ports:
- 8081:8080
temporal-django-worker:
Expand Down
12 changes: 6 additions & 6 deletions ee/api/test/__snapshots__/test_organization_resource_access.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"posthog_user"."events_column_config",
"posthog_user"."email_opt_in"
FROM "posthog_user"
WHERE "posthog_user"."id" = 2
WHERE "posthog_user"."id" = 99999
LIMIT 21
'''
# ---
Expand Down Expand Up @@ -62,7 +62,7 @@
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
AND "posthog_organizationmembership"."user_id" = 99999)
LIMIT 1
'''
# ---
Expand All @@ -76,7 +76,7 @@
"posthog_organizationmembership"."updated_at"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
AND "posthog_organizationmembership"."user_id" = 99999)
LIMIT 21
'''
# ---
Expand Down Expand Up @@ -146,7 +146,7 @@
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
AND "posthog_organizationmembership"."user_id" = 99999)
LIMIT 1
'''
# ---
Expand All @@ -160,7 +160,7 @@
"posthog_organizationmembership"."updated_at"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
AND "posthog_organizationmembership"."user_id" = 99999)
LIMIT 21
'''
# ---
Expand Down Expand Up @@ -213,7 +213,7 @@
"posthog_user"."events_column_config",
"posthog_user"."email_opt_in"
FROM "posthog_user"
WHERE "posthog_user"."id" = 2
WHERE "posthog_user"."id" = 99999
LIMIT 21
'''
# ---
Expand Down
1 change: 1 addition & 0 deletions ee/billing/billing_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def update_billing_organization_users(self, organization: Organization) -> None:
"distinct_id",
"organization_membership__level",
)
.order_by("email") # Deterministic order for tests
.annotate(role=F("organization_membership__level"))
.filter(role__gte=OrganizationMembership.Level.ADMIN)
.values(
Expand Down
76 changes: 38 additions & 38 deletions ee/clickhouse/models/test/__snapshots__/test_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
/* cohort_calculation: */
INSERT INTO cohortpeople
SELECT id,
2 as cohort_id,
2 as team_id,
99999 as cohort_id,
99999 as team_id,
1 AS sign,
0 AS version
FROM
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND id IN
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND ((((has(['something'], replaceRegexpAll(JSONExtractRaw(properties, '$some_prop'), '^"|"$', ''))))
AND ((has(['something'], replaceRegexpAll(JSONExtractRaw(properties, '$another_prop'), '^"|"$', '')))))) )
GROUP BY id
Expand All @@ -29,8 +29,8 @@
-1,
version
FROM cohortpeople
WHERE team_id = 2
AND cohort_id = 2
WHERE team_id = 99999
AND cohort_id = 99999
AND version < 0
AND sign = 1 SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
Expand All @@ -41,18 +41,18 @@
/* cohort_calculation: */
INSERT INTO cohortpeople
SELECT id,
2 as cohort_id,
2 as team_id,
99999 as cohort_id,
99999 as team_id,
1 AS sign,
0 AS version
FROM
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND id IN
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND ((has(['something1'], replaceRegexpAll(JSONExtractRaw(properties, '$some_prop'), '^"|"$', '')))) )
GROUP BY id
HAVING max(is_deleted) = 0
Expand All @@ -64,8 +64,8 @@
-1,
version
FROM cohortpeople
WHERE team_id = 2
AND cohort_id = 2
WHERE team_id = 99999
AND cohort_id = 99999
AND version < 0
AND sign = 1 SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
Expand All @@ -76,8 +76,8 @@
/* cohort_calculation: */
INSERT INTO cohortpeople
SELECT id,
2 as cohort_id,
2 as team_id,
99999 as cohort_id,
99999 as team_id,
1 AS sign,
0 AS version
FROM
Expand All @@ -93,10 +93,10 @@
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
WHERE team_id = 99999
AND event IN ['$pageview']
AND timestamp <= now()
AND timestamp >= now() - INTERVAL 2 year
Expand All @@ -107,11 +107,11 @@
FROM
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND id IN
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND (((((NOT has(['something1'], replaceRegexpAll(JSONExtractRaw(properties, '$some_prop'), '^"|"$', ''))))))) )
GROUP BY id
HAVING max(is_deleted) = 0
Expand All @@ -126,8 +126,8 @@
-1,
version
FROM cohortpeople
WHERE team_id = 2
AND cohort_id = 2
WHERE team_id = 99999
AND cohort_id = 99999
AND version < 0
AND sign = 1 SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
Expand All @@ -138,14 +138,14 @@
SELECT uuid,
distinct_id
FROM events
WHERE team_id = 2
WHERE team_id = 99999
AND (distinct_id IN
(SELECT distinct_id
FROM
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0)
WHERE person_id IN
Expand All @@ -161,10 +161,10 @@
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
WHERE team_id = 99999
AND event IN ['$pageview']
AND timestamp <= now()
AND timestamp >= now() - INTERVAL 2 year
Expand All @@ -175,11 +175,11 @@
FROM
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND id IN
(SELECT id
FROM person
WHERE team_id = 2
WHERE team_id = 99999
AND (((((NOT has(['something1'], replaceRegexpAll(JSONExtractRaw(properties, '$some_prop'), '^"|"$', ''))))))) )
GROUP BY id
HAVING max(is_deleted) = 0
Expand All @@ -194,8 +194,8 @@
/* cohort_calculation: */
INSERT INTO cohortpeople
SELECT id,
2 as cohort_id,
2 as team_id,
99999 as cohort_id,
99999 as team_id,
1 AS sign,
0 AS version
FROM
Expand All @@ -209,10 +209,10 @@
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
WHERE team_id = 99999
AND event IN ['signup']
GROUP BY person_id) behavior_query
WHERE 1 = 1
Expand All @@ -225,8 +225,8 @@
-1,
version
FROM cohortpeople
WHERE team_id = 2
AND cohort_id = 2
WHERE team_id = 99999
AND cohort_id = 99999
AND version < 0
AND sign = 1 SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
Expand All @@ -237,8 +237,8 @@
/* cohort_calculation: */
INSERT INTO cohortpeople
SELECT id,
2 as cohort_id,
2 as team_id,
99999 as cohort_id,
99999 as team_id,
1 AS sign,
0 AS version
FROM
Expand All @@ -256,10 +256,10 @@
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
WHERE team_id = 99999
AND event IN ['$pageview', 'signup']
GROUP BY person_id) behavior_query
WHERE 1 = 1
Expand All @@ -273,8 +273,8 @@
-1,
version
FROM cohortpeople
WHERE team_id = 2
AND cohort_id = 2
WHERE team_id = 99999
AND cohort_id = 99999
AND version < 0
AND sign = 1 SETTINGS optimize_aggregation_in_order = 1,
join_algorithm = 'auto'
Expand Down
12 changes: 6 additions & 6 deletions ee/clickhouse/models/test/__snapshots__/test_property.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'''
SELECT uuid
FROM events
WHERE team_id = 2
WHERE team_id = 99999
AND ((has(['val_1'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_1'), '^"|"$', ''))
AND has(['val_2'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_2'), '^"|"$', '')))
OR (has(['val_2'], replaceRegexpAll(JSONExtractRaw(properties, 'attr_1'), '^"|"$', ''))))
Expand All @@ -13,14 +13,14 @@
'''
SELECT uuid
FROM events
WHERE team_id = 2
WHERE team_id = 99999
AND ((distinct_id IN
(SELECT distinct_id
FROM
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0)
WHERE person_id IN
Expand All @@ -30,7 +30,7 @@
argMax(properties, person._timestamp) as properties,
max(is_deleted) as is_deleted
FROM person
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY id
HAVING is_deleted = 0)
WHERE has(['[email protected]'], replaceRegexpAll(JSONExtractRaw(properties, 'email'), '^"|"$', '')) ) ))
Expand All @@ -40,7 +40,7 @@
(SELECT distinct_id,
argMax(person_id, version) as person_id
FROM person_distinct_id2
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY distinct_id
HAVING argMax(is_deleted, version) = 0)
WHERE person_id IN
Expand All @@ -50,7 +50,7 @@
argMax(properties, person._timestamp) as properties,
max(is_deleted) as is_deleted
FROM person
WHERE team_id = 2
WHERE team_id = 99999
GROUP BY id
HAVING is_deleted = 0)
WHERE has(['[email protected]'], replaceRegexpAll(JSONExtractRaw(properties, 'email'), '^"|"$', '')) ) )))
Expand Down
Loading

0 comments on commit 073b194

Please sign in to comment.