Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into by/dont-drop-data-r…
Browse files Browse the repository at this point in the history
…etention
  • Loading branch information
Bianca Yang committed Jan 26, 2024
2 parents 5fd7783 + 7f79a26 commit b95d535
Show file tree
Hide file tree
Showing 461 changed files with 16,796 additions and 4,556 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
!plugin-transpiler/*.*
!test-runner-jest.config.js
!test-runner-jest-environment.js
!patches
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ module.exports = {
},
{
name: 'antd',
importNames: ['Card', 'Col', 'Row', 'Alert', 'Tooltip'],
importNames: ['Card', 'Col', 'Row', 'Alert', 'Tooltip', 'Progress'],
message: 'please use the Lemon equivalent instead',
},
],
Expand Down Expand Up @@ -169,6 +169,10 @@ module.exports = {
element: 'LemonButtonWithDropdown',
message: 'use <LemonMenu> with a <LemonButton> child instead',
},
{
element: 'Progress',
message: 'use <LemonProgress> instead',
},
],
},
],
Expand Down Expand Up @@ -204,6 +208,10 @@ module.exports = {
element: 'Collapse',
message: 'use <LemonCollapse> instead',
},
{
element: 'Slider',
message: 'use <LemonSlider> instead',
},
{
element: 'Checkbox',
message: 'use <LemonCheckbox> instead',
Expand Down Expand Up @@ -245,6 +253,7 @@ module.exports = {
'no-constant-condition': 'off',
'no-prototype-builtins': 'off',
'no-irregular-whitespace': 'off',
'no-useless-rename': 'error',
'import/no-restricted-paths': [
'error',
{
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/build-n-cache-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ outputs:
runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Depot CLI
uses: depot/setup-action@v1

Expand All @@ -32,6 +35,7 @@ runs:
id: build
uses: depot/build-push-action@v1
with:
context: .
buildx-fallback: false # buildx is so slow it's better to just fail
tags: ${{ steps.emit.outputs.tag }}
platforms: linux/amd64,linux/arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:

- name: Commit update for benchmark results
if: ${{ github.repository == 'PostHog/posthog' && github.ref == 'refs/heads/master' }}
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ee/benchmarks/results
branch: master
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:

- name: Create or update comment
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v1
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-hogql-parser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Check if hogql_parser/ has changed
id: changed-files
uses: tj-actions/changed-files@v39
uses: tj-actions/changed-files@v42
with:
since_last_remote_commit: true
files_yaml: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-backend-update-test-timing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- name: Save test durations
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Save backend test durations'
commit_user_name: PostHog Bot
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.10.10']
clickhouse-server-image:
['clickhouse/clickhouse-server:23.6.1.1524', 'clickhouse/clickhouse-server:23.11.2.11-alpine']
clickhouse-server-image: ['clickhouse/clickhouse-server:23.11.2.11-alpine']
segment: ['FOSS', 'EE']
person-on-events: [false, true]
# :NOTE: Keep concurrency and groups in sync
Expand Down Expand Up @@ -317,8 +316,7 @@ jobs:
strategy:
fail-fast: false
matrix:
clickhouse-server-image:
['clickhouse/clickhouse-server:23.6.1.1524', 'clickhouse/clickhouse-server:23.11.2.11-alpine']
clickhouse-server-image: ['clickhouse/clickhouse-server:23.11.2.11-alpine']
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
id: cypress-cache-dir
run: echo "CYPRESS_BIN_PATH=$(npx cypress cache path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
if: needs.changes.outputs.shouldTriggerCypress == 'true'
id: pnpm-cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
id: pnpm-cache-dir
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
if: needs.changes.outputs.frontend == 'true'
id: pnpm-cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codespaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ jobs:
with:
fetch-depth: 2

- name: Update git SHA
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
- name: Override git.py
run: >
echo "def get_git_commit(): return '${GITHUB_SHA}'" > posthog/git.py
echo "def get_git_branch(): return '${GITHUB_REF_NAME}'" >> posthog/git.py
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -46,7 +48,7 @@ jobs:
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container-images-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Check if any Dockerfile has changed
id: changed-files
uses: tj-actions/changed-files@v34
uses: tj-actions/changed-files@v42
with:
files: |
**/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/customer-data-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-new-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
FILTERED_BODY=$( \
sed -r -e \
'/^(\.\.\.)|(\*)|(#+ )|(- )|(<!--)|(👉)/d' \
'/^(\.\.\.)|(\*)|(#+ )|(<!--)|(👉)/d' \
<<< $RAW_BODY \
)
echo "::debug::Filtered PR body to $FILTERED_BODY"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down Expand Up @@ -59,6 +59,7 @@ jobs:
id: build
uses: depot/build-push-action@v1
with:
context: .
buildx-fallback: false # the fallback is so slow it's better to just fail
push: true
tags: ${{ steps.aws-ecr.outputs.registry }}/pr-test:${{ github.event.pull_request.head.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/storybook-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: echo "msg=Storybook build for ${{ github.sha }}" >> $GITHUB_OUTPUT

- name: Commit update
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: storybook-build
commit_message: ${{ steps.commit-message.outputs.msg }}
Expand Down
2 changes: 1 addition & 1 deletion .run/Celery.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/env/bin/celery" />
<option name="PARAMETERS" value="-A posthog worker -B --scheduler redbeat.RedBeatScheduler --without-heartbeat --without-gossip --without-mingle --loglevel=DEBUG" />
<option name="PARAMETERS" value="-A posthog worker -B --scheduler redbeat.RedBeatScheduler --without-heartbeat --without-mingle --loglevel=DEBUG" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/auth-password-reset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Password Reset', () => {
it('Shows validation error if passwords do not match', () => {
cy.visit('/reset/e2e_test_user/e2e_test_token')
cy.get('[data-attr="password"]').type('12345678')
cy.get('.ant-progress-bg').should('be.visible')
cy.get('.LemonProgress__track').should('be.visible')
cy.get('[data-attr="password-confirm"]').type('1234567A')
cy.get('button[type=submit]').click()
cy.get('.text-danger').should('contain', 'Passwords do not match')
Expand Down
79 changes: 79 additions & 0 deletions cypress/e2e/experiments.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
describe('Experiments', () => {
let randomNum
let experimentName
let featureFlagKey

beforeEach(() => {
cy.intercept('/api/users/@me/', {
fixture: 'api/experiments/user',
})

cy.intercept('/api/projects/1/experiments?limit=1000', {
fixture: 'api/experiments/experiments',
})

cy.intercept('/api/projects/1/experiments/1234/', {
fixture: 'api/experiments/new-experiment',
})

cy.intercept('POST', '/api/projects/1/experiments/', (req) => {
req.reply({ fixture: 'api/experiments/new-experiment' })
})

randomNum = Math.floor(Math.random() * 10000000)
experimentName = `Experiment ${randomNum}`
featureFlagKey = `experiment-${randomNum}`
cy.visit('/experiments')
})

it('create experiment', () => {
cy.get('[data-attr=top-bar-name]').should('contain', 'A/B testing')

// Name, flag key, description
cy.get('[data-attr=create-experiment]').first().click()
cy.get('[data-attr=experiment-name]').click().type(`${experimentName}`).should('have.value', experimentName)
cy.get('[data-attr=experiment-feature-flag-key]')
.click()
.type(`${featureFlagKey}`)
.should('have.value', featureFlagKey)
cy.get('[data-attr=experiment-description]')
.click()
.type('This is the description of the experiment')
.should('have.value', 'This is the description of the experiment')

// Edit variants
cy.get('[data-attr="add-test-variant"]').click()
cy.get('input[data-attr="experiment-variant-key"][data-key-index="1"]')
.clear()
.type('test-variant-1')
.should('have.value', 'test-variant-1')
cy.get('input[data-attr="experiment-variant-key"][data-key-index="2"]')
.clear()
.type('test-variant-2')
.should('have.value', 'test-variant-2')

// Select goal type
cy.get('[data-attr="experiment-goal-type-select"]').click()
cy.contains('Trend').should('be.visible')
cy.contains('Conversion funnel').should('be.visible')

// Add secondary metric
const secondaryMetricName = `Secondary metric ${Math.floor(Math.random() * 10000000)}`
cy.get('[data-attr="add-secondary-metric-btn"]').click()
cy.get('[data-attr=secondary-metric-name]')
.click()
.type(secondaryMetricName)
.should('have.value', secondaryMetricName)
cy.get('[data-attr="metrics-selector"]').click()
cy.contains('Trends').should('be.visible')
cy.contains('Funnels').should('be.visible')
cy.get('[data-attr="create-annotation-submit"]').click()
cy.contains(secondaryMetricName).should('exist')

// Edit minimum acceptable improvement
cy.get('input[data-attr="min-acceptable-improvement"]').type('{selectall}20').should('have.value', '20')

// Save experiment
cy.get('[data-attr="save-experiment"]').first().click()
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/invites.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Invite Signup', () => {
cy.get('.BridgePage__left').should('contain', "You've been invited to join")
cy.get('input[type="email"]').should('have.value', target_email)
cy.get('[data-attr="password"]').type('12345678')
cy.get('.ant-progress-bg').should('not.have.css', 'width', '0px') // Password strength indicator is working
cy.get('.LemonProgress__track').should('not.have.css', 'width', '0px') // Password strength indicator is working
cy.get('[data-attr="first_name"]').type(randomString('Bob'))
cy.get('[data-attr=signup-role-at-organization]').click()
cy.get('.Popover li:first-child').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/surveys.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Surveys', () => {
cy.get('[data-attr=prop-val] .ant-select-selector').click({ force: true })
cy.get('[data-attr=prop-val-0]').click({ force: true })

cy.get('[data-attr="rollout-percentage"]').type('{backspace}')
cy.get('[data-attr="rollout-percentage"]').type('100')

// save
cy.get('[data-attr="save-survey"]').click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/systemStatus.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('System Status', () => {
cy.location('pathname').should('eq', '/project/1/insights')
cy.wait(500)
cy.get('[data-attr=menu-item-me]').click()
cy.get('[data-attr=system-status-badge]').click()
cy.get('h1').should('contain', 'Instance status')
cy.get('[data-attr=top-menu-instance-panel]').click()
cy.get('h1').should('contain', 'Instance panel')
cy.get('table').should('contain', 'Events in ClickHouse')
})
})
6 changes: 6 additions & 0 deletions cypress/fixtures/api/experiments/experiments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"count": 1,
"next": null,
"previous": null,
"results": []
}
Loading

0 comments on commit b95d535

Please sign in to comment.