Skip to content

Commit

Permalink
Merge branch 'master' into export-get-content-for-personal-api-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes authored Apr 16, 2024
2 parents 029a35c + 7276e4d commit f0693bf
Show file tree
Hide file tree
Showing 290 changed files with 5,836 additions and 4,009 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module.exports = {
'error',
{
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: '^_$',
},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
Expand Down
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Bug report
description: Something not working as expected? Let us look into it.
labels: ['bug']
body:
- type: textarea
id: bug-description
attributes:
label: Bug Description
value: "## Bug description\n\n*Please describe.*\n*If this affects the front-end, screenshots would be of great help.*\n\n*If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.*\n\n## How to reproduce\n\n1. \n2.\n3. \n\n## Additional context\n\n"

- type: textarea
id: debug-info
attributes:
label: Debug info
value: "- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]\n- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]\n- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]\n"
render: shell

- type: markdown
attributes:
value: '#### *Thank you* for your bug report – we love squashing them!'
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Feature request
description: 'Suggest a feature for PostHog'
labels: ['enhancement, feature']
body:
- type: textarea
id: feature_request
attributes:
label: Feature request
value:
"## Is your feature request related to a problem?\n\n*Please describe.*\n\n## Describe the solution you'd like\n\n\n## Describe alternatives you've considered\n\n\n## Additional context\n\n\n
"
- type: textarea
id: debug-info
attributes:
label: Debug info
value: "- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]\n- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]\n- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]\n"
render: shell

- type: markdown
attributes:
value: '#### *Thank you* for your bug report – we love squashing them!'
80 changes: 40 additions & 40 deletions .github/actions/get-pr-labels/action.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
name: "Get merged pull request labels"
name: 'Get merged pull request labels'
shell: bash
description: "Get the labels of the PR that was merged to create this push event"
description: 'Get the labels of the PR that was merged to create this push event'
inputs:
token:
description: "GH token"
required: true
token:
description: 'GH token'
required: true
outputs:
labels:
description: "JSON array labels of the PR that was merged (if any)"
value: ${{ steps.labels.outputs.labels }}
labels:
description: 'JSON array labels of the PR that was merged (if any)'
value: ${{ steps.labels.outputs.labels }}
runs:
using: "composite"
steps:
- name: Get PR associated with the last commit
id: pr-info
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/commits/${{ github.sha }}/pulls
env:
GITHUB_TOKEN: ${{ inputs.token }}
using: 'composite'
steps:
- name: Get PR associated with the last commit
id: pr-info
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/commits/${{ github.sha }}/pulls
env:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Extract PR number
shell: bash
if: steps.pr-info.outputs.data
id: extract-pr
run: |
echo "PR_NUMBER=$(cat | jq -r '.[-1].number' <<EOF
${{ steps.pr-info.outputs.data }}
EOF
)" >> $GITHUB_OUTPUT
- name: Extract PR number
shell: bash
if: steps.pr-info.outputs.data
id: extract-pr
run: |
echo "PR_NUMBER=$(cat | jq -r '.[-1].number' <<EOF
${{ steps.pr-info.outputs.data }}
EOF
)" >> $GITHUB_OUTPUT
- name: Fetch PR Labels
shell: bash
if: steps.extract-pr.outputs.PR_NUMBER
id: labels
run: |
PR_NUMBER=${{ steps.extract-pr.outputs.PR_NUMBER }}
LABELS=$(curl \
-H "Authorization: Bearer ${{ inputs.token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels | jq -rc '[.[].name]')
echo "Labels of PR #$PR_NUMBER: $LABELS"
- name: Fetch PR Labels
shell: bash
if: steps.extract-pr.outputs.PR_NUMBER
id: labels
run: |
PR_NUMBER=${{ steps.extract-pr.outputs.PR_NUMBER }}
LABELS=$(curl \
-H "Authorization: Bearer ${{ inputs.token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels | jq -rc '[.[].name]')
echo "Labels of PR #$PR_NUMBER: $LABELS"
echo labels="$LABELS" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ inputs.token }}
echo labels="$LABELS" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ inputs.token }}
5 changes: 5 additions & 0 deletions .github/actions/run-backend-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,8 @@ runs:
pytest posthog/api/test/test_decide.py::TestDecideUsesReadReplica \
--durations=100 --durations-min=1.0 \
$PYTEST_ARGS
- name: Show docker compose logs on failure
if: failure()
shell: bash
run: docker compose -f docker-compose.dev.yml logs
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- name: Automerge
if: env.IS_POSTHOG_BOT_AVAILABLE == 'true'
uses: pascalgn/automerge-action@v0.15.5
uses: pascalgn/automerge-action@v0.16.3
env:
GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
- run: echo
23 changes: 8 additions & 15 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,29 +197,22 @@ jobs:
sudo apt-get update
sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
# First running migrations from master, to simulate the real-world scenario
- name: Install python dependencies
run: |
uv pip install --system -r requirements.txt -r requirements-dev.txt
- name: Checkout master
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: master

- name: Install python dependencies for master
run: |
uv pip install --system -r requirements.txt -r requirements-dev.txt
- name: Run migrations up to master
run: |
# We need to ensure we have requirements for the master branch
# now also, so we can run migrations up to master.
uv pip install --system -r requirements.txt -r requirements-dev.txt
python manage.py migrate
# Now we can consider this PR's migrations

- name: Checkout this PR
uses: actions/checkout@v3

- name: Install python dependencies for this PR
run: |
uv pip install --system -r requirements.txt -r requirements-dev.txt
- uses: actions/checkout@v3

- name: Check migrations
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ on:
- master
workflow_dispatch:

concurrency: ${{ github.workflow }} # ensure only one of this runs at a time

jobs:
posthog_build:
name: Build and push PostHog
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ services:
kompose.volume.type: configMap
volumes:
- ./docker/temporal/dynamicconfig:/etc/temporal/config/dynamicconfig
depends_on:
- db
- elasticsearch
temporal-admin-tools:
environment:
- TEMPORAL_CLI_ADDRESS=temporal:7233
Expand Down
30 changes: 15 additions & 15 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"
FROM "posthog_user"
WHERE "posthog_user"."id" = 2
LIMIT 21 /**/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.1
Expand All @@ -53,7 +53,7 @@
"posthog_organization"."available_features"
FROM "posthog_organization"
WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.10
Expand All @@ -79,7 +79,7 @@
"posthog_organization"."available_features"
FROM "posthog_organization"
WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.11
Expand All @@ -88,7 +88,7 @@
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
LIMIT 1 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 1
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.12
Expand All @@ -102,14 +102,14 @@
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.13
'''
SELECT COUNT(*) AS "__count"
FROM "ee_organizationresourceaccess"
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.14
Expand All @@ -123,7 +123,7 @@
"ee_organizationresourceaccess"."updated_at"
FROM "ee_organizationresourceaccess"
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 100 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 100
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.2
Expand All @@ -149,7 +149,7 @@
"posthog_organization"."available_features"
FROM "posthog_organization"
WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.3
Expand All @@ -158,7 +158,7 @@
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
LIMIT 1 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 1
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.4
Expand All @@ -172,7 +172,7 @@
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.5
Expand All @@ -183,14 +183,14 @@
FROM "posthog_instancesetting"
WHERE "posthog_instancesetting"."key" = 'constance:posthog:RATE_LIMIT_ENABLED'
ORDER BY "posthog_instancesetting"."id" ASC
LIMIT 1 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 1
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.6
'''
SELECT COUNT(*) AS "__count"
FROM "ee_organizationresourceaccess"
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.7
Expand All @@ -204,7 +204,7 @@
"ee_organizationresourceaccess"."updated_at"
FROM "ee_organizationresourceaccess"
WHERE "ee_organizationresourceaccess"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 100 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 100
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.8
Expand Down Expand Up @@ -235,7 +235,7 @@
"posthog_user"."events_column_config"
FROM "posthog_user"
WHERE "posthog_user"."id" = 2
LIMIT 21 /**/
LIMIT 21
'''
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.9
Expand All @@ -261,6 +261,6 @@
"posthog_organization"."available_features"
FROM "posthog_organization"
WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
LIMIT 21 /*controller='organization_resource_access-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/resource_access/%3F%24'*/
LIMIT 21
'''
# ---
9 changes: 6 additions & 3 deletions ee/clickhouse/models/test/__snapshots__/test_cohort.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
(SELECT pdi.person_id AS person_id,
countIf(timestamp > now() - INTERVAL 2 year
AND timestamp < now()
AND event = '$pageview') > 0 AS performed_event_condition_15_level_level_0_level_0_level_0_0
AND event = '$pageview'
AND 1=1) > 0 AS performed_event_condition_15_level_level_0_level_0_level_0_0
FROM events e
INNER JOIN
(SELECT distinct_id,
Expand Down Expand Up @@ -149,7 +150,8 @@
(SELECT pdi.person_id AS person_id,
countIf(timestamp > now() - INTERVAL 2 year
AND timestamp < now()
AND event = '$pageview') > 0 AS performed_event_condition_17_level_level_0_level_0_level_0_0
AND event = '$pageview'
AND 1=1) > 0 AS performed_event_condition_17_level_level_0_level_0_level_0_0
FROM events e
INNER JOIN
(SELECT distinct_id,
Expand Down Expand Up @@ -238,7 +240,8 @@
(SELECT pdi.person_id AS person_id,
countIf(timestamp > now() - INTERVAL 2 year
AND timestamp < now()
AND event = '$pageview') > 0 AS performed_event_condition_19_level_level_0_level_0_level_0_0,
AND event = '$pageview'
AND 1=1) > 0 AS performed_event_condition_19_level_level_0_level_0_level_0_0,
minIf(timestamp, event = 'signup') >= now() - INTERVAL 15 day
AND minIf(timestamp, event = 'signup') < now() as first_time_condition_19_level_level_0_level_1_level_0_level_0_level_0_0
FROM events e
Expand Down
Loading

0 comments on commit f0693bf

Please sign in to comment.