Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

ci(images): bind the experiments recalculation activity channel (#123469)

Stephen Schmidtc636770135a6
diff --git a/.depot/actions/paths-filter/__tests__/shared-image-policy.test.ts b/.depot/actions/paths-filter/__tests__/shared-image-policy.test.ts
index 1730771bb1db..a4790c5d533f 100644
--- a/.depot/actions/paths-filter/__tests__/shared-image-policy.test.ts
+++ b/.depot/actions/paths-filter/__tests__/shared-image-policy.test.ts
@@ -89,7 +89,7 @@ describe('shared-image policy and legacy projection', () => {
const inlineRules = yaml.load(inline!) as Record<string, Paths | null>
const policy = productionPolicy()
const projected = yaml.load(projectLegacyFilters(policy, inline!)) as Record<string, Paths>
- expect(Object.keys(projected)).toEqual(Object.keys(inlineRules))
+ expect(Object.keys(projected)).toEqual(Object.keys({...inlineRules, ...policy.filters}))
for (const [name, rule] of Object.entries(inlineRules)) {
expect({[name]: projected[name]}).toEqual({[name]: rule === null ? policy.filters[name] : rule})
}
@@ -131,6 +131,5 @@ describe('shared-image policy and legacy projection', () => {
const result = filter.match(files)
expect(result.dataWarehouseMetadata).toEqual([files[0]])
expect(result.dataWarehouse).toEqual(files)
- expect(current.images['posthog-cloud'].channels).toEqual({})
})
})
diff --git a/.github/actions/paths-filter/__tests__/shared-image-policy.test.ts b/.github/actions/paths-filter/__tests__/shared-image-policy.test.ts
index 1730771bb1db..a4790c5d533f 100644
--- a/.github/actions/paths-filter/__tests__/shared-image-policy.test.ts
+++ b/.github/actions/paths-filter/__tests__/shared-image-policy.test.ts
@@ -89,7 +89,7 @@ describe('shared-image policy and legacy projection', () => {
const inlineRules = yaml.load(inline!) as Record<string, Paths | null>
const policy = productionPolicy()
const projected = yaml.load(projectLegacyFilters(policy, inline!)) as Record<string, Paths>
- expect(Object.keys(projected)).toEqual(Object.keys(inlineRules))
+ expect(Object.keys(projected)).toEqual(Object.keys({...inlineRules, ...policy.filters}))
for (const [name, rule] of Object.entries(inlineRules)) {
expect({[name]: projected[name]}).toEqual({[name]: rule === null ? policy.filters[name] : rule})
}
@@ -131,6 +131,5 @@ describe('shared-image policy and legacy projection', () => {
const result = filter.match(files)
expect(result.dataWarehouseMetadata).toEqual([files[0]])
expect(result.dataWarehouse).toEqual(files)
- expect(current.images['posthog-cloud'].channels).toEqual({})
})
})
diff --git a/.github/actions/shared-image-releases/__tests__/inspect.test.ts b/.github/actions/shared-image-releases/__tests__/inspect.test.ts
index 2653a934ed4e..1c33bbaa6d4c 100644
--- a/.github/actions/shared-image-releases/__tests__/inspect.test.ts
+++ b/.github/actions/shared-image-releases/__tests__/inspect.test.ts
@@ -2,10 +2,11 @@ jest.mock('../src/shared-image-command')
import * as core from '@actions/core'
import * as path from 'path'
-import {mkdtempSync, rmSync, writeFileSync} from 'fs'
+import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'fs'
import {tmpdir} from 'os'
import {command} from '../src/shared-image-command'
import {run} from '../src/inspect'
+import {POLICY_PATH} from '../src/shared-image-releases'
import * as publisher from '../src/shared-image-publisher'
jest.mock('@actions/core', () => ({getInput: jest.fn(), setOutput: jest.fn(), setFailed: jest.fn()}))
@@ -42,15 +43,25 @@ describe('inspect action inputs and outputs', () => {
})
test('an empty configured channel set emits false and the resolved empty map', async () => {
- jest.mocked(core.getInput).mockImplementation(name => {
- if (name === 'working-directory') return path.join(__dirname, '../../../..')
- if (name === 'shared-image-policy') return ''
- return inputs[name] || ''
- })
- await run()
- expect(core.setFailed).not.toHaveBeenCalled()
- expect(core.setOutput).toHaveBeenCalledWith('channels', 'false')
- expect(core.setOutput).toHaveBeenCalledWith('bindings', '{"posthog-cloud":{}}')
+ const scratch = mkdtempSync(path.join(tmpdir(), 'shared-image-empty-'))
+ try {
+ const policyFile = path.join(scratch, POLICY_PATH)
+ mkdirSync(path.dirname(policyFile), {recursive: true})
+ writeFileSync(policyFile, JSON.stringify({
+ version: 1, filters: {}, images: {'posthog-cloud': {channels: {}}}
+ }))
+ jest.mocked(core.getInput).mockImplementation(name => {
+ if (name === 'working-directory') return scratch
+ if (name === 'shared-image-policy') return ''
+ return inputs[name] || ''
+ })
+ await run()
+ expect(core.setFailed).not.toHaveBeenCalled()
+ expect(core.setOutput).toHaveBeenCalledWith('channels', 'false')
+ expect(core.setOutput).toHaveBeenCalledWith('bindings', '{"posthog-cloud":{}}')
+ } finally {
+ rmSync(scratch, {recursive: true, force: true})
+ }
})
test.each([
diff --git a/.github/actions/shared-image-releases/__tests__/shared-image-releases.test.ts b/.github/actions/shared-image-releases/__tests__/shared-image-releases.test.ts
index 1c4868b6aa8a..8627779ce683 100644
--- a/.github/actions/shared-image-releases/__tests__/shared-image-releases.test.ts
+++ b/.github/actions/shared-image-releases/__tests__/shared-image-releases.test.ts
@@ -1,7 +1,7 @@
import {readFileSync} from 'fs'
import * as path from 'path'
import * as yaml from 'js-yaml'
-import {Paths, bindChannels, loadPolicy, policyDigest, serializePolicy} from '../src/shared-image'
+import {Paths, POLICY_PATH, bindChannels, loadPolicy, policyDigest, serializePolicy} from '../src/shared-image'
const destination = {repository: 'posthog-temporal-workers/data-warehouse-metadata'}
const source = 'posthog-cloud'
@@ -9,6 +9,16 @@ const fixture = readFileSync(path.join(__dirname, '../../paths-filter/__tests__/
const literal = JSON.parse(readFileSync(path.join(__dirname, 'fixtures/shared-image-fingerprints.json'), 'utf8')) as
{paths: Paths; bytes: string; sha256: string}[]
describe('shared-image publication bindings and fingerprints', () => {
+ test('binds every channel of the committed policy', () => {
+ const policy = loadPolicy(readFileSync(path.join(__dirname, '../../../..', POLICY_PATH), 'utf8'))
+ const channels = policy.images['posthog-cloud'].channels
+ const bindings = bindChannels(policy, 'posthog-cloud')['posthog-cloud']
+ expect(Object.keys(bindings).sort()).toEqual(Object.keys(channels).sort())
+ for (const [name, channel] of Object.entries(channels)) {
+ expect(bindings[name]).toEqual({repository: channel.repository})
+ }
+ })
+
test.each([
['unknown build', fixture.replace('posthog-cloud:', 'unknown-image:'), 'images.unknown-image: unknown build input'],
['prototype build', fixture.replace('posthog-cloud:', '__proto__:'), 'images.__proto__: unknown build input'],
diff --git a/.github/shared-image-releases.yaml b/.github/shared-image-releases.yaml
index 09e4011b0c42..5fea5235aefb 100644
--- a/.github/shared-image-releases.yaml
+++ b/.github/shared-image-releases.yaml
@@ -18,7 +18,34 @@ filters:
- pyproject.toml
- bin/temporal-django-worker
- 'posthog/clickhouse/migrations/**'
+ experimentsRecalculationActivity:
+ - 'products/experiments/backend/**'
+ - 'products/experiments/stats/**'
+ - 'posthog/hogql*/**'
+ - 'posthog/clickhouse/**'
+ - 'posthog/temporal/common/**'
+ - 'posthog/management/commands/start_temporal_worker.py'
+ - 'posthog/settings/temporal.py'
+ - posthog/schema.py
+ - 'posthog/models/**'
+ - 'posthog/migrations/**'
+ - 'products/*/backend/migrations/**'
+ - posthog/exceptions.py
+ - 'products/feature_flags/backend/**'
+ - 'products/cohorts/backend/**'
+ - 'products/analytics_platform/backend/lazy_computation/**'
+ - 'products/ai_observability/backend/facade/**'
+ - 'common/hogvm/**'
+ - pyproject.toml
+ - uv.lock
+ - bin/temporal-django-worker
+ - manage.py
+ - Dockerfile
images:
posthog-cloud:
- channels: {}
+ channels:
+ experiments-recalculation-activity:
+ repository: posthog-temporal-workers/experiments-recalculation-activity
+ filter: experimentsRecalculationActivity
+ bootstrapPolicyDigest: a06fc277bfb801b6da6406ac2a8d0ed82ac09c13e1ac37234c8a4e01b44b1313