: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
fix(signals): make the inbox guidance form copy fit each source (#129253)
posthog[bot]3c2cff9479ae
diff --git a/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx b/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsxindex e054799b1bf7..0898d5789422 100644--- a/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx+++ b/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx@@ -25,8 +25,13 @@ export function SourceSteeringModal({ sourceConfigs, sourceLabel, onClose }: Souconst formId = useId()const logicProps: SourceSteeringModalLogicProps = { sourceConfigs, onClose }const logic = sourceSteeringModalLogic(logicProps)- const { isSourceSteeringSubmitting, sourceSteeringChanged, sourceSteeringValidationErrors, steeringExamples } =- useValues(logic)+ const {+ isSourceSteeringSubmitting,+ sourceSteeringChanged,+ sourceSteeringValidationErrors,+ steeringExamples,+ steeringAppliesFrom,+ } = useValues(logic)const { setSourceSteeringValue } = useActions(logic)const handleClose = (): void => {@@ -87,7 +92,7 @@ export function SourceSteeringModal({ sourceConfigs, sourceLabel, onClose }: Sou)}<LemonFieldname="steering"- help="Applies from the next sync. Nothing already in your inbox changes."+ help={`Applies ${steeringAppliesFrom}. Nothing already in your inbox changes.`}><LemonTextAreaminRows={4}diff --git a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts b/products/signals/frontend/inbox/components/config/agentRosterMeta.tsindex 81cd481347fa..aeb32649fdb8 100644--- a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts+++ b/products/signals/frontend/inbox/components/config/agentRosterMeta.ts@@ -124,7 +124,7 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [sourceProduct: SignalSourceProduct.Analytics,label: 'Product analytics',watches: 'Unexpected shifts in your product metrics',- detail: 'Fires when an anomaly alert goes off, and only for the alerts where you turned the investigation agent on.',+ detail: 'Fires when an insight alert goes off. By default, only alerts with the investigation agent turned on count.',docsUrl: 'https://posthog.com/docs/product-analytics',docsLabel: 'Product analytics',steerable: true,diff --git a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.tsindex 9c59e6134a33..627004a77638 100644--- a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts+++ b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts@@ -83,6 +83,22 @@ describe('sourceSteeringModalLogic', () => {expect(onClose).toHaveBeenCalled()})+ it.each([+ [SignalSourceProduct.Conversations, 'from the next sync', 'Skip chores'],+ [SignalSourceProduct.ErrorTracking, 'to new signals from now on', 'Skip noise'],+ [SignalSourceProduct.Analytics, 'to new signals from now on', 'Skip small changes'],+ ])('fits the timing and starting points to %s', (sourceProduct, appliesFrom, firstExample) => {+ logic.unmount()+ logic = sourceSteeringModalLogic({+ sourceConfigs: [{ ...sourceConfig, source_product: sourceProduct }],+ onClose,+ })+ logic.mount()++ expect(logic.values.steeringAppliesFrom).toEqual(appliesFrom)+ expect(logic.values.steeringExamples[0].label).toEqual(firstExample)+ })+it('saves one card of guidance to every row behind it', async () => {// Error tracking is one card over three config rows. Writing only the first would leave// reopened and spiking issues unfiltered, so the rules would look ignored half the time.diff --git a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.tsindex c6a0973a0c24..d709603efc5e 100644--- a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts+++ b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts@@ -17,6 +17,7 @@ import {SOURCE_STEERING_KEY,SOURCE_STEERING_MAX_LENGTH,SignalSourceConfig,+ SignalSourceProduct,} from '../types'export interface SourceSteeringFormValues {@@ -24,12 +25,46 @@ export interface SourceSteeringFormValues {}/** A starting point offered in the modal: `label` is the chip, `line` is what it appends. */-const STEERING_EXAMPLES: { label: string; line: string }[] = [+interface SteeringExampleTemplate {+ label: string+ line: string+}++const DEFAULT_STEERING_EXAMPLES: SteeringExampleTemplate[] = [{ label: 'Skip chores', line: 'Skip anything labeled chore, internal, or dependencies.' },{ label: 'Billing only', line: 'Only report issues about billing, checkout, or payments.' },{ label: 'Crashes first', line: 'Anything mentioning a crash, outage, or data loss is worth reporting.' },]+/** Sources whose records have no labels or issue text, so the default examples would not apply. */+const SOURCE_STEERING_EXAMPLES: Partial<Record<SignalSourceProduct, SteeringExampleTemplate[]>> = {+ [SignalSourceProduct.ErrorTracking]: [+ { label: 'Skip noise', line: 'Skip errors from browser extensions, bots, or local development.' },+ { label: 'Checkout first', line: 'Errors on checkout or payment pages are always worth reporting.' },+ { label: 'Crashes first', line: 'Anything that crashes the app or loses data is worth reporting.' },+ ],+ [SignalSourceProduct.HealthChecks]: [+ { label: 'Skip SDK updates', line: 'Skip outdated SDK warnings.' },+ { label: 'Skip source maps', line: 'Skip missing source map warnings.' },+ { label: 'Data gaps first', line: 'Missing events and failed warehouse syncs are always worth reporting.' },+ ],+ [SignalSourceProduct.Analytics]: [+ {+ label: 'Skip small changes',+ line: 'Skip alerts where the metric moved only a little or recovered soon after.',+ },+ { label: 'Revenue first', line: 'Alerts on revenue, signups, or checkout metrics are always worth reporting.' },+ { label: 'Skip test insights', line: 'Skip alerts on insights with test or draft in the name.' },+ ],+}++/** Sources that emit each signal as it happens, so their guidance has no sync to wait for. */+const DIRECT_SOURCE_PRODUCTS: ReadonlySet<SignalSourceProduct> = new Set([+ SignalSourceProduct.ErrorTracking,+ SignalSourceProduct.HealthChecks,+ SignalSourceProduct.Analytics,+])+export interface SteeringExample {label: stringline: string@@ -97,6 +132,7 @@ export interface sourceSteeringModalLogicValues {sourceSteeringTouched: booleansourceSteeringTouches: Record<string, boolean>sourceSteeringValidationErrors: DeepPartialMap<SourceSteeringFormValues, ValidationErrorType>+ steeringAppliesFrom: stringsteeringExamples: SteeringExample[]}@@ -147,7 +183,11 @@ export interface sourceSteeringModalLogicActions {export interface sourceSteeringModalLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {- steeringExamples: (sourceSteering: SourceSteeringFormValues) => SteeringExample[]+ steeringExamples: (+ sourceSteering: SourceSteeringFormValues,+ sourceConfigs: SignalSourceConfig[]+ ) => SteeringExample[]+ steeringAppliesFrom: (sourceConfigs: SignalSourceConfig[]) => string}}@@ -228,7 +268,7 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicTypethrow firstError}captureSignalSourceSteeringChanged({ ...analyticsParams, success: true })- lemonToast.success('Guidance saved. It applies from the next sync.')+ lemonToast.success(`Guidance saved. It applies ${values.steeringAppliesFrom}.`)actions.loadSourceConfigs()logicProps.onClose()},@@ -239,13 +279,23 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicType// could push the value past the cap and leave the form unsavable with no edit of the// user's own. The view renders `result` and disables the chip when it does not fit.steeringExamples: [- (s) => [s.sourceSteering],- ({ steering }: SourceSteeringFormValues): SteeringExample[] =>- STEERING_EXAMPLES.map(({ label, line }) => {+ (s, p) => [s.sourceSteering, p.sourceConfigs],+ ({ steering }: SourceSteeringFormValues, sourceConfigs: SignalSourceConfig[]): SteeringExample[] =>+ (+ (sourceConfigs.length > 0 && SOURCE_STEERING_EXAMPLES[sourceConfigs[0].source_product]) ||+ DEFAULT_STEERING_EXAMPLES+ ).map(({ label, line }) => {const current = steering.trimEnd()const result = current ? `${current}\n${line}` : linereturn { label, line, result, fits: result.length <= SOURCE_STEERING_MAX_LENGTH }}),],+ steeringAppliesFrom: [+ (_, p) => [p.sourceConfigs],+ (sourceConfigs: SignalSourceConfig[]): string =>+ sourceConfigs.length > 0 && DIRECT_SOURCE_PRODUCTS.has(sourceConfigs[0].source_product)+ ? 'to new signals from now on'+ : 'from the next sync',+ ],}),])