: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { CyclotronJobInputSchemaType } from '~/types'
import { getHogFunctionDeliveryType, redactSecretHogFunctionInputs } from './hog-function-utils'
// The diff-builder test covers schema-marked secrets end to end; this covers the entry-marked branch
// (a saved secret carries `secret: true` on the input entry itself, with no schema flag needed).
describe('redactSecretHogFunctionInputs', () => {
it('redacts entry-marked secrets and leaves plain inputs untouched', () => {
const redacted = redactSecretHogFunctionInputs(
{
token: { value: 'tok-cleartext', secret: true },
url: { value: 'https://example.com' },
},
[] as CyclotronJobInputSchemaType[]
)
expect(redacted.token.value).toBe('[secret]')
expect(redacted.url.value).toBe('https://example.com')
})
})
describe('getHogFunctionDeliveryType', () => {
it.each([
['batch-export-9', 'batch'],
['batch-export-AwsS3', 'batch'],
['plugin-7', 'realtime'],
['abc123', 'realtime'],
['template-slack', 'realtime'],
])('classifies %s as %s', (id, expected) => {
expect(getHogFunctionDeliveryType({ id })).toBe(expected)
})
})