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.

fix(signals): simplify source steering to a single free-text field (#83700)

Andrew Maguire4b075253acb0
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index f3c1bed8b2b0..f62a4fda2d19 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6179,7 +6179,7 @@ snapshots:
scenes-app-experiments--experiment-with-funnel-metric--dark:
hash: v1.k794b7964.fd0d0ad7569f50079a322a8901513f854823ce694796a2a24a1e6714ac9c5902.fBtAQkm1LZ7xYp6DTXoQSDqDFjsUkxMCP-aNAZJ1Fmc
scenes-app-experiments--experiment-with-funnel-metric--light:
- hash: v1.k794b7964.a608f24a82fc56569fb7029e98bab3121baa3fd6c5c63492fe9952aa6a43afc5.ZgTLiUZPjDNcaChht0ijSp2F7HoqRkdn__-6JKI7p4A
+ hash: v1.k794b7964.7b31570283b2f9dcb07ca30e6868c131003193c9084e2e96ad2af1e30647dc3c.CdVfMa3nRlO2awUSwS9T0P6PEh2x-dmAX8NSpCpgw94
scenes-app-experiments--experiment-with-legacy-funnels-query--dark:
hash: v1.k794b7964.6503cdfd33ae5f9d525d14dc8d43b047e8469beca7e5e489534347904efe1dec.2CtGz-wQvIwr_SQDthwlGJI5bVcJ7bFpetJricY-Lps
scenes-app-experiments--experiment-with-legacy-funnels-query--light:
@@ -6588,14 +6588,18 @@ snapshots:
hash: v1.k794b7964.748be85b9907181d7eb082c40e4d4f93429073c22a34fd3ad19f010006856b4d.m6AmUOQ3eZ_Le5wuOhR7RCAT_xVrzvZJSHptyYmtTpM
scenes-app-inbox-signalsourcespanel--tools-on-no-recent-data--light:
hash: v1.k794b7964.ace77adbc25963a6ba9f41c77744f726165855b31c0e4486bc5fbbeeec55250f.vWRUFUczQF3fmjvF_LizkGQaBK-ddzgEIjTB8sJEFro
+ scenes-app-inbox-sourcesteeringmodal--legacy-posture--dark:
+ hash: v1.k794b7964.d8a52379e95bb0cabff2ab1ad8a4620d0f3ac91394cc057577f9a5c69cafb4d2.H8ZYcq__eOG2AMAmV26hDVqVtTuDsPY5dzZN1CkuwQk
+ scenes-app-inbox-sourcesteeringmodal--legacy-posture--light:
+ hash: v1.k794b7964.bf6f6091990326ba00969cbad23e873bce5d3454c23111851dd88249c0d66388.qFVcrcxTGmorg5nQtAU773MYkXSNFjLIcon6iS2aKlI
scenes-app-inbox-sourcesteeringmodal--no-rules-yet--dark:
- hash: v1.k794b7964.6f8f050084142d4b24339c3bae76ea79b7c9ee2f4117a1b30789c5fcf19d7f19.15Qm_zKixrOfhwvrNG3ppjc95M8ywNgUCO5kC776Zto
+ hash: v1.k794b7964.a7e61e9e66ce92ec6002a2afab91836f3235de74eef26c450d7dafcc2da0e1c8.G6Jfi1ua7U3QyXzOg127Twg1h1nelaWDcZR13zTzs1s
scenes-app-inbox-sourcesteeringmodal--no-rules-yet--light:
- hash: v1.k794b7964.528d9648d48be5dfd57fbe8a9bc73e77d068616a6494007467140a1c1c741699.UYbkqgjLUPZ5QDhX34y25DiD29mqD2Nh67sfdIhoO20
+ hash: v1.k794b7964.907b6e38e6ca847a400c365c37b294ce61ef4d15ee0f37584b527323e0d8b5d8.Cr_5Q32bCgzvjbOg3KNjk0BlGSAW07Kr3E7R6ikS7lg
scenes-app-inbox-sourcesteeringmodal--rules-set--dark:
- hash: v1.k794b7964.eee5b962d9e849371de058017e32ef513268ec4ddf928057d9e6de6acf263e7a._q88iOBj8aTgXKOVWzF3c3ej0TrFuuTe7XwczbfAyKA
+ hash: v1.k794b7964.740612fa137e304fc2840a5e41b44ac04614dfd183fd55a72c041e4168f46a04.eInqcr24eNVcNY1idkcXctdumOGkShuBP27l6pf2XsQ
scenes-app-inbox-sourcesteeringmodal--rules-set--light:
- hash: v1.k794b7964.385738bfcd292440eaa22250862067de71f5e2b2b09c77014c89fd47f616c2e8.0E8wRwNii_FGTwEogE_RA51a_JU-8-dFtH41VmbGOKg
+ hash: v1.k794b7964.d1279fa1214369e191ab56aeef694231fcd401abf93e1854000fdfdcf97399bc.BKbf7ywpJGW7XqCNbou14Du1jqORsoYt5No4mJCVU3Q
scenes-app-inbox-tabs--pull-requests--dark:
hash: v1.k794b7964.474d8e744637e08afd4bb7540f0f5dafd6a79342c2f547188cb436b55f9ef8e7.PiyD1Zkhkot-_DKLU3W0T5uA7rvpTUTn5bKChCa3AV4
scenes-app-inbox-tabs--pull-requests--light:
@@ -7469,9 +7473,9 @@ snapshots:
scenes-app-sessionattributionexplorer--session-attribution-explorer--light:
hash: v1.k794b7964.001061d4b295c8f6027e5e0a7316a65883e6c0e08277ae097d3a38d64338795d.CGXqBM7ryEQypLc9SCN1GLFuIXXf0AnFxiwLLaXeFhY
scenes-app-settings-authentication-domains--boost-needs-upgrade--dark:
- hash: v1.k794b7964.d2354aea8e40abfcfeb18691d15e48abc24724460dbc0118185c750d3f8ce6d1.hd_A7ve1fnL_3LEtdoDKSxqRHrLXH_6hpuXK1o1q6yY
+ hash: v1.k794b7964.0d0269acc50353c6896d712631324ccb4b7e972c4ff6efaa91def27e45efe413.8Z3CuSbci8ER7atmaVzObZX9S0cneG9iEJbbLcsIJgQ
scenes-app-settings-authentication-domains--boost-needs-upgrade--light:
- hash: v1.k794b7964.e3d329e84737f53476a92d2c93d7f1b252418df229158d771028c74d46818043.bhONXlHgi8Q2Fy3D78gDCNp00cYvbdRVrp46JTDdG6M
+ hash: v1.k794b7964.f2e9c2eb21a4c51655c4a3a0aa51337cfb25a148b09b2b9e287eeb8e0cb108af.t6ZC79QgERyt8zxKmk77gqilvhiKGt4Wpyo1eN3l0Fg
scenes-app-settings-authentication-domains--enterprise-mixed--dark:
hash: v1.k794b7964.3a79302e05dc7901dae87f7c32770b88d4fdb9e81bd889be4885bd1fb3e61efc.0-I8CGximFaHRl67GnS-U5dHTPVBFi6ewETJLCPVxKk
scenes-app-settings-authentication-domains--enterprise-mixed--light:
diff --git a/frontend/src/lib/lemon-ui/LemonTextArea/LemonTextArea.tsx b/frontend/src/lib/lemon-ui/LemonTextArea/LemonTextArea.tsx
index f5732d3c12aa..6deb03c98b65 100644
--- a/frontend/src/lib/lemon-ui/LemonTextArea/LemonTextArea.tsx
+++ b/frontend/src/lib/lemon-ui/LemonTextArea/LemonTextArea.tsx
@@ -7,7 +7,7 @@ import { cn } from 'lib/utils/css-classes'
interface LemonTextAreaPropsBase extends Pick<
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
- 'onFocus' | 'onBlur' | 'maxLength' | 'onKeyDown'
+ 'onFocus' | 'onBlur' | 'maxLength' | 'onKeyDown' | 'aria-label'
> {
id?: string
value?: string
diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
index e1b366a1a727..22e83bdb429c 100644
--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
@@ -334,8 +334,8 @@ function Expansion({
<div className="flex items-center gap-2">
<span className="text-xs text-secondary">
{state.sourceConfig && sourceSteeringIsSet(state.sourceConfig)
- ? 'Steering rules are on for this source.'
- : 'Tell this source what matters and what to skip.'}
+ ? 'Guidance is set for this source.'
+ : 'Tell the agent what matters and what to skip.'}
</span>
<LemonButton
type="secondary"
@@ -345,8 +345,8 @@ function Expansion({
data-attr="signal-source-steering-open"
>
{state.sourceConfig && sourceSteeringIsSet(state.sourceConfig)
- ? 'Edit steering rules'
- : 'Add steering rules'}
+ ? 'Edit guidance'
+ : 'Add guidance'}
</LemonButton>
</div>
)}
diff --git a/products/signals/frontend/inbox/components/config/SourceSteeringModal.stories.tsx b/products/signals/frontend/inbox/components/config/SourceSteeringModal.stories.tsx
index 8928528db1b1..14c573181ca2 100644
--- a/products/signals/frontend/inbox/components/config/SourceSteeringModal.stories.tsx
+++ b/products/signals/frontend/inbox/components/config/SourceSteeringModal.stories.tsx
@@ -38,17 +38,21 @@ export default meta
type Story = StoryObj<typeof ModalHarness>
-/** First open: no rules yet, blocklist posture selected. */
+/** First open: nothing written yet. */
export const NoRulesYet: Story = {
args: { config: {} },
}
-/** Editing saved rules with the allowlist posture on. */
+/** Editing saved guidance. */
export const RulesSet: Story = {
args: {
config: {
steering: 'Ignore issues labeled chore or internal. Anything mentioning billing is always actionable.',
- default_not_actionable: true,
},
},
}
+
+/** A source still carrying the retired posture flag, which the gate keeps honoring. */
+export const LegacyPosture: Story = {
+ args: { config: { default_not_actionable: true } },
+}
diff --git a/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx b/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx
index c868d3a979c5..091e55afec2e 100644
--- a/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx
+++ b/products/signals/frontend/inbox/components/config/SourceSteeringModal.tsx
@@ -1,19 +1,18 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { useId } from 'react'
-import { LemonButton, LemonModal, LemonTextArea } from '@posthog/lemon-ui'
+import { LemonBanner, LemonButton, LemonModal, LemonTextArea } from '@posthog/lemon-ui'
import { LemonField } from 'lib/lemon-ui/LemonField'
-import { LemonRadio } from 'lib/lemon-ui/LemonRadio'
-import { SourceSteeringModalLogicProps, sourceSteeringModalLogic } from '../../logics/sourceSteeringModalLogic'
+import {
+ SourceSteeringModalLogicProps,
+ sourceHasLegacyPosture,
+ sourceSteeringModalLogic,
+} from '../../logics/sourceSteeringModalLogic'
import { SOURCE_STEERING_MAX_LENGTH, SignalSourceConfig } from '../../types'
-// LemonRadio keys must be React keys, so the boolean `default_not_actionable` postures get names.
-const LENIENT = 'lenient'
-const STRICT = 'strict'
-
export interface SourceSteeringModalProps {
sourceConfig: SignalSourceConfig
/** The roster label of the source being steered, for the modal title. */
@@ -25,7 +24,9 @@ export function SourceSteeringModal({ sourceConfig, sourceLabel, onClose }: Sour
const formId = useId()
const logicProps: SourceSteeringModalLogicProps = { sourceConfig, onClose }
const logic = sourceSteeringModalLogic(logicProps)
- const { isSourceSteeringSubmitting, sourceSteeringChanged, sourceSteeringValidationErrors } = useValues(logic)
+ const { isSourceSteeringSubmitting, sourceSteeringChanged, sourceSteeringValidationErrors, steeringExamples } =
+ useValues(logic)
+ const { setSourceSteeringValue } = useActions(logic)
const handleClose = (): void => {
if (isSourceSteeringSubmitting) {
@@ -38,16 +39,13 @@ export function SourceSteeringModal({ sourceConfig, sourceLabel, onClose }: Sour
typeof sourceSteeringValidationErrors.steering === 'string'
? sourceSteeringValidationErrors.steering
: undefined
- // Freeze the fields while the save is in flight: the submit already captured the form values,
- // so edits made during the request would be silently dropped by a success that closes the modal.
- const savingReason = isSourceSteeringSubmitting ? 'Saving your rules' : undefined
return (
<LemonModal
isOpen
onClose={handleClose}
- title={`Steering rules for ${sourceLabel}`}
- description="Most records from this source count as actionable and can become reports. Your rules change what gets kept. They apply from the next sync and don't remove anything already in your inbox."
+ title={`Guidance for ${sourceLabel}`}
+ description={`Tell the agent what matters and what to skip in ${sourceLabel}. It reads this when deciding what turns into a report. Leave it empty and it uses its own judgment.`}
width={560}
hasUnsavedInput={sourceSteeringChanged}
footer={
@@ -55,7 +53,7 @@ export function SourceSteeringModal({ sourceConfig, sourceLabel, onClose }: Sour
<LemonButton
type="secondary"
onClick={handleClose}
- disabledReason={isSourceSteeringSubmitting ? 'Saving your rules' : undefined}
+ disabledReason={isSourceSteeringSubmitting ? 'Saving' : undefined}
>
Cancel
</LemonButton>
@@ -67,7 +65,7 @@ export function SourceSteeringModal({ sourceConfig, sourceLabel, onClose }: Sour
disabledReason={steeringError}
data-attr="signal-source-steering-save"
>
- Save rules
+ Save
</LemonButton>
</>
}
@@ -79,44 +77,54 @@ export function SourceSteeringModal({ sourceConfig, sourceLabel, onClose }: Sour
id={formId}
enableFormOnSubmit
>
- <div className="flex flex-col gap-4">
- <LemonField name="defaultNotActionable" label="Default behavior">
- {({ value, onChange }) => (
- <LemonRadio
- aria-label="Default behavior"
- value={value ? STRICT : LENIENT}
- onChange={(posture: string) => onChange(posture === STRICT)}
- options={[
- {
- value: LENIENT,
- label: 'Include everything except what I list',
- description: 'When in doubt, a record is kept.',
- disabledReason: savingReason,
- },
- {
- value: STRICT,
- label: "Only include what's clearly actionable",
- description: 'When in doubt, a record is skipped.',
- disabledReason: savingReason,
- },
- ]}
- />
- )}
- </LemonField>
+ <div className="flex flex-col gap-3">
+ {sourceHasLegacyPosture(sourceConfig) && (
+ <LemonBanner type="info">
+ This source only reports records that clearly qualify. Saving here replaces that with what
+ you write below.
+ </LemonBanner>
+ )}
<LemonField
name="steering"
- label="Your rules for this source"
- help="Include, exclude, or prioritize. Plain language works. Leave it empty to keep only the default behavior above."
+ help="Applies from the next sync. Nothing already in your inbox changes."
>
<LemonTextArea
minRows={4}
maxRows={10}
maxLength={SOURCE_STEERING_MAX_LENGTH}
- placeholder="Ignore issues labeled chore or internal. Anything mentioning billing is always actionable."
+ // The field has no visible label by design, so name it for screen readers.
+ aria-label={`Guidance for ${sourceLabel}`}
+ placeholder="Write it like a note to a teammate."
disabled={isSourceSteeringSubmitting}
data-attr="signal-source-steering-rules"
/>
</LemonField>
+ <div className="flex flex-col gap-1">
+ <span className="text-xs text-secondary">Need a starting point? Click one to add it.</span>
+ <div className="flex flex-wrap gap-1">
+ {steeringExamples.map((example) => (
+ <LemonButton
+ key={example.label}
+ type="secondary"
+ size="xsmall"
+ tooltip={example.line}
+ // A string tooltip would otherwise become the whole accessible
+ // name, hiding the visible label from speech control.
+ aria-label={`${example.label}: adds "${example.line}"`}
+ onClick={() => setSourceSteeringValue('steering', example.result)}
+ disabledReason={
+ isSourceSteeringSubmitting
+ ? 'Saving'
+ : !example.fits
+ ? "This example won't fit in what you've written"
+ : undefined
+ }
+ >
+ {example.label}
+ </LemonButton>
+ ))}
+ </div>
+ </div>
</div>
</Form>
</LemonModal>
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index d7b28d7b2751..1b734daedace 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -444,7 +444,6 @@ export function captureSignalSourceSteeringChanged(params: {
sourceProduct: string
sourceType: string
steeringLength: number
- defaultNotActionable: boolean
success: boolean
}): void {
captureInboxEvent(INBOX_EVENTS.SOURCE_STEERING_CHANGED, {
@@ -452,7 +451,6 @@ export function captureSignalSourceSteeringChanged(params: {
source_type: params.sourceType,
steering_length: params.steeringLength,
has_steering: params.steeringLength > 0,
- default_not_actionable: params.defaultNotActionable,
success: params.success,
})
}
diff --git a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts
index 0b04dead6102..f3efe702bef3 100644
--- a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.test.ts
@@ -5,7 +5,7 @@ import { initKeaTests } from '~/test/init'
import { signalSourcesLogic } from '../signalSourcesLogic'
import { SOURCE_STEERING_MAX_LENGTH, SignalSourceConfig, SignalSourceProduct, SignalSourceType } from '../types'
-import { sourceSteeringModalLogic } from './sourceSteeringModalLogic'
+import { sourceHasLegacyPosture, sourceSteeringIsSet, sourceSteeringModalLogic } from './sourceSteeringModalLogic'
const sourceConfig: SignalSourceConfig = {
id: 'config-1',
@@ -13,7 +13,7 @@ const sourceConfig: SignalSourceConfig = {
source_type: SignalSourceType.Ticket,
enabled: true,
// A key steering does not own, to prove saves merge rather than clobber.
- config: { recording_filters: { events: [] }, steering: 'old rules' },
+ config: { recording_filters: { events: [] }, steering: 'old rules', default_not_actionable: true },
created_at: '2026-08-01T00:00:00Z',
updated_at: '2026-08-01T00:00:00Z',
status: null,
@@ -54,11 +54,10 @@ describe('sourceSteeringModalLogic', () => {
logic?.unmount()
})
- it('saves the whole config with trimmed steering keys merged in, keeping keys it does not own', async () => {
- expect(logic.values.sourceSteering).toEqual({ steering: 'old rules', defaultNotActionable: false })
+ it('saves the whole config with trimmed steering merged in, keeping keys it does not own and dropping the retired posture flag', async () => {
+ expect(logic.values.sourceSteering).toEqual({ steering: 'old rules' })
logic.actions.setSourceSteeringValue('steering', ' skip chores ')
- logic.actions.setSourceSteeringValue('defaultNotActionable', true)
await expectLogic(logic, () => {
logic.actions.submitSourceSteering()
}).toDispatchActions(['submitSourceSteeringSuccess'])
@@ -68,7 +67,6 @@ describe('sourceSteeringModalLogic', () => {
config: {
recording_filters: { events: [] },
steering: 'skip chores',
- default_not_actionable: true,
},
},
])
@@ -102,7 +100,6 @@ describe('sourceSteeringModalLogic', () => {
expect(signalSourcesLogic.values.sourceConfigs?.[0]?.config).toEqual({
recording_filters: { events: [] },
steering: 'fresh rules',
- default_not_actionable: false,
})
expect(signalSourcesLogic.values.sourceConfigs?.[0]?.status).toEqual('completed')
})
@@ -111,13 +108,34 @@ describe('sourceSteeringModalLogic', () => {
logic.unmount()
const reloaded = {
...sourceConfig,
- config: { ...sourceConfig.config, steering: 'saved rules', default_not_actionable: true },
+ config: { ...sourceConfig.config, steering: 'saved rules' },
updated_at: '2026-08-02T00:00:00Z',
}
logic = sourceSteeringModalLogic({ sourceConfig: reloaded, onClose })
logic.mount()
- expect(logic.values.sourceSteering).toEqual({ steering: 'saved rules', defaultNotActionable: true })
+ expect(logic.values.sourceSteering).toEqual({ steering: 'saved rules' })
+ })
+
+ it('still counts the retired posture flag as steering, so a filtering source is never shown as unset', () => {
+ // The gate keeps honoring the flag, so a source carrying it alone must not read as
+ // "no guidance" — that would leave it filtering with nothing to see or clear.
+ const postureOnly = { ...sourceConfig, config: { default_not_actionable: true } }
+
+ expect(sourceSteeringIsSet(postureOnly)).toBe(true)
+ expect(sourceHasLegacyPosture(postureOnly)).toBe(true)
+ expect(sourceHasLegacyPosture({ ...sourceConfig, config: { steering: 'text only' } })).toBe(false)
+ })
+
+ it('appends an example on its own line, and marks it unfittable rather than crossing the cap', () => {
+ const [example] = logic.values.steeringExamples
+ expect(example.fits).toBe(true)
+ expect(example.result).toEqual(`old rules\n${example.line}`)
+
+ // A near-full field: appending would cross the cap, which would leave the form unsavable.
+ logic.actions.setSourceSteeringValue('steering', 'x'.repeat(SOURCE_STEERING_MAX_LENGTH - 5))
+
+ expect(logic.values.steeringExamples.every((e) => e.fits)).toBe(false)
})
it('rejects rules over the server cap without issuing a request', async () => {
diff --git a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts
index 042d96c680e3..978f685de591 100644
--- a/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts
+++ b/products/signals/frontend/inbox/logics/sourceSteeringModalLogic.ts
@@ -1,4 +1,4 @@
-import { LogicWrapper, MakeLogicType, connect, kea, key, path, props } from 'kea'
+import { LogicWrapper, MakeLogicType, connect, kea, key, path, props, selectors } from 'kea'
import { forms } from 'kea-forms'
import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
@@ -21,7 +21,22 @@ import {
export interface SourceSteeringFormValues {
steering: string
- defaultNotActionable: boolean
+}
+
+/** A starting point offered in the modal: `label` is the chip, `line` is what it appends. */
+const STEERING_EXAMPLES: { label: string; line: string }[] = [
+ { 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.' },
+]
+
+export interface SteeringExample {
+ label: string
+ line: string
+ /** What the field would hold once this example is appended. */
+ result: string
+ /** False when appending would cross the cap, which would leave the form unsavable. */
+ fits: boolean
}
export interface SourceSteeringModalLogicProps {
@@ -38,15 +53,20 @@ export function sourceSteeringIsSet(config: SignalSourceConfig): boolean {
)
}
+/**
+ * Whether a source still carries the retired posture flag. The gate keeps honoring it, so the
+ * modal says so rather than showing an empty field that implies nothing is filtering.
+ */
+export function sourceHasLegacyPosture(config: SignalSourceConfig): boolean {
+ return config.config[SOURCE_DEFAULT_NOT_ACTIONABLE_KEY] === true
+}
+
// Type-checked reads: the config blob is an open object, so a non-string steering value
// (possible via the raw API before the serializer validation landed) must degrade to the
// defaults rather than break the form.
function steeringFormDefaults(sourceConfig: SignalSourceConfig): SourceSteeringFormValues {
const steering = sourceConfig.config[SOURCE_STEERING_KEY]
- return {
- steering: typeof steering === 'string' ? steering : '',
- defaultNotActionable: sourceConfig.config[SOURCE_DEFAULT_NOT_ACTIONABLE_KEY] === true,
- }
+ return { steering: typeof steering === 'string' ? steering : '' }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -65,6 +85,7 @@ export interface sourceSteeringModalLogicValues {
sourceSteeringTouched: boolean
sourceSteeringTouches: Record<string, boolean>
sourceSteeringValidationErrors: DeepPartialMap<SourceSteeringFormValues, ValidationErrorType>
+ steeringExamples: SteeringExample[]
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -113,6 +134,9 @@ export interface sourceSteeringModalLogicActions {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sourceSteeringModalLogicMeta {
key: string
+ __keaTypeGenInternalSelectorTypes: {
+ steeringExamples: (sourceSteering: SourceSteeringFormValues) => SteeringExample[]
+ }
}
export type sourceSteeringModalLogicType = MakeLogicType<
@@ -136,12 +160,12 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicType
errors: ({ steering }: SourceSteeringFormValues) => ({
steering:
steering.length > SOURCE_STEERING_MAX_LENGTH
- ? `Rules must be ${SOURCE_STEERING_MAX_LENGTH} characters or fewer`
+ ? `Keep it to ${SOURCE_STEERING_MAX_LENGTH} characters or fewer`
: undefined,
}),
submit: async (formValues: SourceSteeringFormValues) => {
if (values.currentTeamId === null) {
- lemonToast.error('Select a project before saving steering rules')
+ lemonToast.error('Select a project before saving')
throw new Error('No project selected')
}
const { sourceConfig } = logicProps
@@ -156,16 +180,14 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicType
const baseConfig =
values.sourceConfigs?.find((c: SignalSourceConfig) => c.id === sourceConfig.id)?.config ??
sourceConfig.config
- const config = {
- ...baseConfig,
- [SOURCE_STEERING_KEY]: steering,
- [SOURCE_DEFAULT_NOT_ACTIONABLE_KEY]: formValues.defaultNotActionable,
- }
+ // The posture flag has no UI any more; dropping it on save keeps the free text the
+ // only thing steering the gate, so what a user sees here is all that applies.
+ const { [SOURCE_DEFAULT_NOT_ACTIONABLE_KEY]: _droppedPosture, ...restConfig } = baseConfig
+ const config = { ...restConfig, [SOURCE_STEERING_KEY]: steering }
const analyticsParams = {
sourceProduct: sourceConfig.source_product,
sourceType: sourceConfig.source_type,
steeringLength: steering.length,
- defaultNotActionable: formValues.defaultNotActionable,
}
let updated: SignalSourceConfigApi
try {
@@ -175,11 +197,11 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicType
} catch (error) {
captureSignalSourceSteeringChanged({ ...analyticsParams, success: false })
const apiError = error instanceof ApiError ? error : null
- lemonToast.error(apiError?.detail ?? "Couldn't save your steering rules. Please try again.")
+ lemonToast.error(apiError?.detail ?? "Couldn't save your guidance. Please try again.")
throw error
}
captureSignalSourceSteeringChanged({ ...analyticsParams, success: true })
- lemonToast.success('Steering rules saved. They apply from the next sync.')
+ lemonToast.success('Guidance saved. It applies from the next sync.')
// Overlay the saved row onto the cached list before the reload: if the reload is
// slow or fails, a reopened modal would otherwise derive its form from the stale
// config and a second save could restore the obsolete rules.
@@ -196,4 +218,18 @@ export const sourceSteeringModalLogic: LogicWrapper<sourceSteeringModalLogicType
},
},
})),
+ selectors({
+ // The textarea's maxLength only bounds typing, so an example appended programmatically
+ // 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 }) => {
+ const current = steering.trimEnd()
+ const result = current ? `${current}\n${line}` : line
+ return { label, line, result, fits: result.length <= SOURCE_STEERING_MAX_LENGTH }
+ }),
+ ],
+ }),
])