: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
feat(signals): flatten the scouts roster into one sortable table (#86456)
posthog[bot]10df8f2fdeed
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex edaed6688bbc..ee740ea2a1f0 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6656,6 +6656,14 @@ snapshots:hash: v1.k794b7964.cb0a021303b103cdcd037db93be44c2c5eae3e59494ab8a726ac8e430f631dfd.n4BzfjRbtrkqXUS8HZwDAYrPQHYDeqCHuny9Z4Oz134scenes-app-inbox-scoutmcpserverspicker--scout-settings-variant--light:hash: v1.k794b7964.2f1013abc412adb4544bca6a00209d3051c46969db69d4242ab201ecf5d189f3.YVfbrzpaRzPwuCbeFXmaVOLla0fvhHmAm1CkuaKWCLI+ scenes-app-inbox-scoutsroster--large-fleet--dark:+ hash: v1.k794b7964.2edbcf914b5f961852835f1490dd17656f189e2c6453327846338df4e7254019.4vMqblPFx5vXbwrom8O_uEP_Qz6tJeyjhi9ciTIVvLU+ scenes-app-inbox-scoutsroster--large-fleet--light:+ hash: v1.k794b7964.7ab0f4823811e07dd11ab8df5d6ca380da32882d2ebc860fb5e5dcb19979a4c5.gGnZTgS_baawVjUk8Op2gnecTdx78A5k8vD0l3eVkUs+ scenes-app-inbox-scoutsroster--roster--dark:+ hash: v1.k794b7964.f1a62e97c92b9d013867516a202b6e851a3e98f0db73527490d81c03b0d01c43.Eo9e2d8VEXu3DbgxnzfcgVYlcoytILv9Ts3J8C3iiNA+ scenes-app-inbox-scoutsroster--roster--light:+ hash: v1.k794b7964.d77ce79b5c591194555316bfd6a28ef4d590e8b79ca888dcec301f287ac6bf0b.-Wpf2QnPo3079sXvwc0w_metttiQCg3IdcKq_Z3AEmsscenes-app-inbox-selfdrivingsection--daily-limit-reached--dark:hash: v1.k794b7964.fc51db50c7d112ee96cfe4992358fca180bde9b993e6070c996eafb00df19426.D5c3L-swBUOALS-MsAbV5qUc9iNKrvrIOlyp4Rnoszcscenes-app-inbox-selfdrivingsection--daily-limit-reached--light:diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNameCell.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNameCell.tsxindex c8952f662503..cc47b4f49ece 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNameCell.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNameCell.tsx@@ -7,7 +7,6 @@ import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signalsimport { ScoutGroupKey, scoutSubtitle } from '../../../utils/scoutGroups'import { prettifyScoutSkillName, ScoutRollup } from '../../../utils/scoutRunsWindow'-import { ScoutStatusDot } from './ScoutStatusDot'const SUBTITLE_TONE_CLASS = {danger: 'text-danger',@@ -28,7 +27,6 @@ export function ScoutNameCell({return (<div className="flex flex-col gap-0.5 py-0.5"><div className="flex items-center gap-2">- <ScoutStatusDot group={group} /><Link to={urls.inboxScout(config.skill_name)} subtle className="truncate text-sm font-medium">{prettifyScoutSkillName(config.skill_name)}</Link>@@ -37,16 +35,9 @@ export function ScoutNameCell({<LemonTag size="small">Quiet by design</LemonTag></Tooltip>)}- {!config.emit && (- <Tooltip title="This scout runs and investigates, but nothing it finds reaches your inbox">- <LemonTag size="small" type="option">- Dry run- </LemonTag>- </Tooltip>- )}</div>{subtitle && (- <span className={cn('ml-4 line-clamp-1 text-[11.5px]', SUBTITLE_TONE_CLASS[subtitle.tone])}>+ <span className={cn('line-clamp-1 text-[11.5px]', SUBTITLE_TONE_CLASS[subtitle.tone])}>{subtitle.text}</span>)}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsxnew file mode 100644index 000000000000..b9dd687302a9--- /dev/null+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx@@ -0,0 +1,56 @@+import type { Meta, StoryObj } from '@storybook/react'++import { FEATURE_FLAGS } from 'lib/constants'++import { mswDecorator } from '~/mocks/browser'++import { mockLargeScoutFleet, mockScoutConfigs } from '../../../__mocks__/scoutConfigs'+import { ScoutsRoster } from './ScoutsRoster'++// The flat roster: one alphabetical table with a sortable Status column. Use this to check the+// column layout, the status dots, and how a wide fleet reads without lifecycle sections.++const meta: Meta<typeof ScoutsRoster> = {+ title: 'Scenes-App/Inbox/ScoutsRoster',+ component: ScoutsRoster,+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-06-11',+ featureFlags: { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true },+ testOptions: { waitForLoadersToDisappear: false },+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/scout/runs/recent-per-scout/': () => [200, []],+ '/api/projects/:id/signals/scout/runs/findings/summary/': () => [200, null],+ '/api/projects/:id/signals/scout/metadata/current/': () => [200, null],+ '/api/projects/:id/signals/scout/scratchpad/': () => [200, []],+ },+ }),+ ],+}+export default meta++type Story = StoryObj<typeof ScoutsRoster>++export const Roster: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/scout/configs/': () => [200, mockScoutConfigs],+ },+ }),+ ],+}++export const LargeFleet: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/scout/configs/': () => [200, mockLargeScoutFleet],+ },+ }),+ ],+}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsxindex b258b726314b..fd99b0800962 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx@@ -9,13 +9,13 @@ import { SCOUT_ROSTER_WINDOW_LABEL, SCOUT_RUNS_PER_SCOUT_LABEL } from '../../../import { ScoutAlphaBanner } from './ScoutAlphaBanner'import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'import { ScoutsEmptyState } from './ScoutsEmptyState'-import { ScoutsRosterGroups } from './ScoutsRosterGroups'import { ScoutsRosterHeader } from './ScoutsRosterHeader'+import { ScoutsRosterTable } from './ScoutsRosterTable'/**- * The scout roster: one grouped table over the whole troop, ordered so the scouts that need a- * decision sit above the ones that don't. Replaces the card list that used to live in the Scout- * troop modal — the fleet outgrew a 760px portal, and a modal can't host the scout pages it links to.+ * The scout roster: one alphabetical table over the whole troop, with lifecycle as a sortable+ * Status column. Replaces the card list that used to live in the Scout troop modal — the fleet+ * outgrew a 760px portal, and a modal can't host the scout pages it links to.*/export function ScoutsRoster(): JSX.Element {const { scoutConfigs, scoutConfigsLoading, enabledCount, customScoutCount } = useValues(scoutFleetLogic)@@ -76,7 +76,7 @@ export function ScoutsRoster(): JSX.Element {<div className="flex flex-col"><ScoutAlphaBanner /><ScoutsRosterHeader />- <ScoutsRosterGroups />+ <ScoutsRosterTable /><div className="flex flex-col gap-1 px-6 py-4"><span className="text-xs text-muted">The totals above cover the {SCOUT_ROSTER_WINDOW_LABEL}. Each scout's run strip shows its{' '}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroup.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroup.tsxdeleted file mode 100644index cd73d263fe59..000000000000--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroup.tsx+++ /dev/null@@ -1,156 +0,0 @@-import { useActions, useValues } from 'kea'-import { router } from 'kea-router'--import { LemonTable } from '@posthog/lemon-ui'--import { cn } from 'lib/utils/css-classes'-import { urls } from 'scenes/urls'--import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'--import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'-import {- SCOUT_GROUP_HINT,- SCOUT_GROUP_LABEL,- ScoutGroupBucket,- ScoutGroupKey,- scoutCadenceLabel,-} from '../../../utils/scoutGroups'-import { ScoutEnabledSwitch } from './ScoutConfigControls'-import { ScoutNameCell } from './ScoutNameCell'-import { ScoutNextRunLabel } from './ScoutNextRunLabel'-import { ScoutRunBoxes } from './ScoutRunBoxes'--const GROUP_HEADING_CLASS: Record<ScoutGroupKey, string> = {- needs_you: 'bg-danger-highlight text-danger',- working: 'bg-surface-secondary text-secondary',- watching: 'bg-surface-secondary text-secondary',- dry_run: 'bg-surface-secondary text-secondary',- settling_in: 'bg-surface-secondary text-secondary',- off: 'bg-surface-secondary text-secondary',-}--export function ScoutsRosterGroup({- bucket,- showHeader,-}: {- bucket: ScoutGroupBucket- showHeader: boolean-}): JSX.Element {- const { rollups, updatingScoutIds, scoutRunsLoadedOnce } = useValues(scoutFleetLogic)- const { updateScoutConfig } = useActions(scoutFleetLogic)- const hint = SCOUT_GROUP_HINT[bucket.key]- // Watching holds the watchdogs whose silence is the job, so say so on the group rather than- // leaving a reader to wonder why a scout with no output is fine.- const exemptCount =- bucket.key === 'watching' ? bucket.configs.filter((config) => config.auto_pause_exempt).length : 0-- return (- <div className="flex flex-col">- <div- className={cn(- 'flex items-center gap-2 border-y border-primary px-6 py-1 text-[11px] font-semibold uppercase tracking-wide',- GROUP_HEADING_CLASS[bucket.key]- )}- >- <span>{SCOUT_GROUP_LABEL[bucket.key]}</span>- <span className="font-medium opacity-60">{bucket.configs.length}</span>- {hint && (- <span className="font-normal normal-case tracking-normal opacity-70">- {hint}- {exemptCount > 0 && ` — ${exemptCount} quiet by design`}- </span>- )}- </div>- <LemonTable- embedded- size="small"- showHeader={showHeader}- rowKey={(config: SignalScoutConfig) => config.id}- dataSource={bucket.configs}- rowClassName={(config: SignalScoutConfig) => cn('cursor-pointer', !config.enabled && 'opacity-65')}- onRow={(config: SignalScoutConfig) => ({- // The row is one big target for the scout page, but a link or button inside it- // (a run box, the name) already navigates itself: a second push here would- // override the run box's task URL.- onClick: (event) => {- if ((event.target as HTMLElement).closest('a, button')) {- return- }- router.actions.push(urls.inboxScout(config.skill_name))- },- })}- columns={[- {- title: 'Scout',- key: 'scout',- width: '34%',- render: (_, config: SignalScoutConfig) => (- <ScoutNameCell config={config} group={bucket.key} rollup={rollups.get(config.skill_name)} />- ),- },- {- title: 'Cadence',- key: 'cadence',- width: '12%',- render: (_, config: SignalScoutConfig) => (- <span className="text-xs text-secondary">{scoutCadenceLabel(config)}</span>- ),- },- {- title: 'Next run',- key: 'nextRun',- width: '12%',- render: (_, config: SignalScoutConfig) => (- <span className="text-xs text-secondary tabular-nums">- <ScoutNextRunLabel config={config} />- </span>- ),- },- {- title: 'Recent runs',- key: 'runs',- width: '30%',- // The strip is a timeline ending at "now", anchored right so every row's- // newest run shares one vertical line; the header follows its content.- align: 'right',- render: (_, config: SignalScoutConfig) => {- const runs = rollups.get(config.skill_name)?.runs ?? []- if (runs.length) {- return <ScoutRunBoxes runs={runs} />- }- // Until the runs request has landed once, an empty rollup means "not- // loaded", not "never ran"; the poll retries a failed load on its own.- return scoutRunsLoadedOnce ? (- <span className="text-xs text-muted">No runs yet</span>- ) : (- <span className="text-xs text-muted">…</span>- )- },- },- {- title: '',- key: 'enabled',- width: '8%',- render: (_, config: SignalScoutConfig) => (- // Stop the row's navigation: flipping a scout off is not a request to- // open it, and landing on its page afterwards hides the row you just changed.- <div- className="flex justify-end"- onClick={(event) => event.stopPropagation()}- onKeyDown={(event) => event.stopPropagation()}- role="presentation"- >- <ScoutEnabledSwitch- config={config}- onUpdate={updateScoutConfig}- updating={updatingScoutIds.includes(config.id)}- />- </div>- ),- },- ]}- />- </div>- )-}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroups.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroups.tsxdeleted file mode 100644index 163cb72d4347..000000000000--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterGroups.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { useValues } from 'kea'--import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'-import { ScoutsRosterGroup } from './ScoutsRosterGroup'--export function ScoutsRosterGroups(): JSX.Element {- const { rosterBuckets } = useValues(scoutFleetLogic)-- if (rosterBuckets.length === 0) {- return <span className="px-6 py-6 text-sm text-muted">No scouts match the current filters.</span>- }-- return (- <div className="flex flex-col">- {rosterBuckets.map((bucket, index) => (- <ScoutsRosterGroup key={bucket.key} bucket={bucket} showHeader={index === 0} />- ))}- </div>- )-}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsxnew file mode 100644index 000000000000..80eb115b7516--- /dev/null+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsx@@ -0,0 +1,144 @@+import { useActions, useValues } from 'kea'+import { router } from 'kea-router'++import { LemonTable } from '@posthog/lemon-ui'++import { cn } from 'lib/utils/css-classes'+import { urls } from 'scenes/urls'++import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'+import {+ compareScoutsByName,+ SCOUT_GROUP_LABEL,+ SCOUT_GROUP_ORDER,+ scoutCadenceLabel,+ ScoutRosterRow,+} from '../../../utils/scoutGroups'+import { ScoutEnabledSwitch } from './ScoutConfigControls'+import { ScoutNameCell } from './ScoutNameCell'+import { ScoutNextRunLabel } from './ScoutNextRunLabel'+import { ScoutRunBoxes } from './ScoutRunBoxes'+import { ScoutStatusDot } from './ScoutStatusDot'++/**+ * The whole troop in one alphabetical table. A scout's lifecycle is a sortable Status column rather+ * than a section heading, so finding one by name is a single scan instead of a guess at which bucket+ * the scheduler put it in.+ */+export function ScoutsRosterTable(): JSX.Element {+ const { rosterScouts, rollups, updatingScoutIds, scoutRunsLoadedOnce } = useValues(scoutFleetLogic)+ const { updateScoutConfig } = useActions(scoutFleetLogic)++ if (rosterScouts.length === 0) {+ return <span className="px-6 py-6 text-sm text-muted">No scouts match the current filters.</span>+ }++ return (+ <LemonTable+ embedded+ size="small"+ rowKey={(row: ScoutRosterRow) => row.config.id}+ dataSource={rosterScouts}+ rowClassName={(row: ScoutRosterRow) => cn('cursor-pointer', !row.config.enabled && 'opacity-65')}+ onRow={(row: ScoutRosterRow) => ({+ // The row is one big target for the scout page, but a link or button inside it+ // (a run box, the name) already navigates itself: a second push here would+ // override the run box's task URL.+ onClick: (event) => {+ if ((event.target as HTMLElement).closest('a, button')) {+ return+ }+ router.actions.push(urls.inboxScout(row.config.skill_name))+ },+ })}+ columns={[+ {+ title: 'Scout',+ key: 'scout',+ width: '34%',+ sorter: (a: ScoutRosterRow, b: ScoutRosterRow) => compareScoutsByName(a.config, b.config),+ render: (_, row: ScoutRosterRow) => (+ <ScoutNameCell+ config={row.config}+ group={row.group}+ rollup={rollups.get(row.config.skill_name)}+ />+ ),+ },+ {+ title: 'Status',+ key: 'status',+ width: '14%',+ sorter: (a: ScoutRosterRow, b: ScoutRosterRow) =>+ SCOUT_GROUP_ORDER.indexOf(a.group) - SCOUT_GROUP_ORDER.indexOf(b.group),+ render: (_, row: ScoutRosterRow) => (+ <span className="flex items-center gap-2 text-xs text-secondary">+ <ScoutStatusDot group={row.group} />+ {SCOUT_GROUP_LABEL[row.group]}+ </span>+ ),+ },+ {+ title: 'Cadence',+ key: 'cadence',+ width: '12%',+ render: (_, row: ScoutRosterRow) => (+ <span className="text-xs text-secondary">{scoutCadenceLabel(row.config)}</span>+ ),+ },+ {+ title: 'Next run',+ key: 'nextRun',+ width: '12%',+ render: (_, row: ScoutRosterRow) => (+ <span className="text-xs text-secondary tabular-nums">+ <ScoutNextRunLabel config={row.config} />+ </span>+ ),+ },+ {+ title: 'Recent runs',+ key: 'runs',+ width: '28%',+ // The strip is a timeline ending at "now", anchored right so every row's+ // newest run shares one vertical line; the header follows its content.+ align: 'right',+ render: (_, row: ScoutRosterRow) => {+ const runs = rollups.get(row.config.skill_name)?.runs ?? []+ if (runs.length) {+ return <ScoutRunBoxes runs={runs} />+ }+ // Until the runs request has landed once, an empty rollup means "not+ // loaded", not "never ran"; the poll retries a failed load on its own.+ return scoutRunsLoadedOnce ? (+ <span className="text-xs text-muted">No runs yet</span>+ ) : (+ <span className="text-xs text-muted">…</span>+ )+ },+ },+ {+ title: '',+ key: 'enabled',+ width: '8%',+ render: (_, row: ScoutRosterRow) => (+ // Stop the row's navigation: flipping a scout off is not a request to+ // open it, and landing on its page afterwards hides the row you just changed.+ <div+ className="flex justify-end"+ onClick={(event) => event.stopPropagation()}+ onKeyDown={(event) => event.stopPropagation()}+ role="presentation"+ >+ <ScoutEnabledSwitch+ config={row.config}+ onUpdate={updateScoutConfig}+ updating={updatingScoutIds.includes(row.config.id)}+ />+ </div>+ ),+ },+ ]}+ />+ )+}diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.tsindex c2bc0fe2ea00..85121faf350b 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts@@ -142,9 +142,8 @@ describe('scoutFleetLogic', () => {expect(logic.values.updatingScoutIds).toEqual([])})- // The roster is the only consumer of the tag filter, so assert through the buckets it renders.- const rosterConfigIds = (): string[] =>- logic.values.rosterBuckets.flatMap((bucket) => bucket.configs.map((config) => config.id))+ // The roster is the only consumer of the tag filter, so assert through the rows it renders.+ const rosterConfigIds = (): string[] => logic.values.rosterScouts.map((row) => row.config.id)it('filters scouts by any selected tag and stops applying tags that are no longer in use', () => {const revenueScout = { ...BASE_CONFIG, tags: ['revenue'] }@@ -175,7 +174,7 @@ describe('scoutFleetLogic', () => {expect(rosterConfigIds()).toHaveLength(3)})- it('groups the roster by lifecycle, leading with the scouts that are producing', () => {+ it('lists the whole roster A→Z and tags each row with its lifecycle group', () => {logic.actions.loadScoutConfigsSuccess([{ ...BASE_CONFIG, id: 'quiet', skill_name: 'signals-scout-quiet' },{ ...BASE_CONFIG, id: 'busy', skill_name: 'signals-scout-busy' },@@ -198,50 +197,17 @@ describe('scoutFleetLogic', () => {// `busy` filed a report in the window, which is what separates Working from Watching.logic.actions.loadScoutRunsSuccess([makeRun({ skill_name: 'signals-scout-busy', emitted_report_ids: ['r-1'] })])- expect(logic.values.rosterBuckets.map((bucket) => bucket.key)).toEqual([- 'working',- 'needs_you',- 'watching',- 'off',+ // One flat list ordered by name, not split across lifecycle sections.+ expect(logic.values.rosterScouts.map((row) => [row.config.id, row.group])).toEqual([+ ['broken', 'needs_you'],+ ['busy', 'working'],+ ['off', 'off'],+ ['quiet', 'watching'],])+ // The header still tallies the fleet by group, unnarrowed by search.expect(logic.values.rosterGroupCounts).toMatchObject({ working: 1, needs_you: 1, watching: 1, off: 1 })})- it('leaves a row where it is when its switch is flipped, instead of relocating it mid-click', async () => {- logic.actions.loadScoutConfigsSuccess([- { ...BASE_CONFIG, id: 'quiet', skill_name: 'signals-scout-quiet' },- { ...BASE_CONFIG, id: 'other', skill_name: 'signals-scout-other' },- ])- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rosterBuckets.map((bucket) => bucket.key)).toEqual(['watching'])-- // The optimistic half of a toggle: the switch reads off immediately...- logic.actions.patchScoutConfigLocally('quiet', { enabled: false })-- // ...but the row stays in the group it was rendered in, rather than jumping to Off.- expect(logic.values.rosterBuckets.map((bucket) => bucket.key)).toEqual(['watching'])- expect(rosterConfigIds()).toEqual(['other', 'quiet'])- expect(logic.values.scoutConfigs?.find((config) => config.id === 'quiet')?.enabled).toBe(false)- })-- it('re-places rows once server data lands', async () => {- logic.actions.loadScoutConfigsSuccess([{ ...BASE_CONFIG, id: 'quiet', skill_name: 'signals-scout-quiet' }])- await expectLogic(logic).toFinishAllListeners()-- logic.actions.loadScoutConfigsSuccess([- {- ...BASE_CONFIG,- id: 'quiet',- skill_name: 'signals-scout-quiet',- enabled: false,- status: 'paused_by_user',- },- ])- await expectLogic(logic).toFinishAllListeners()-- expect(logic.values.rosterBuckets.map((bucket) => bucket.key)).toEqual(['off'])- })-it('keeps configs unresolved until the current team is available', async () => {logic.unmount()teamLogic.actions.loadCurrentTeamSuccess(null)diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.tsindex 0a6bcd7730fe..6ab99474a414 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts@@ -37,7 +37,7 @@ import {} from '../inboxAnalytics'import { SignalScoutRunSummary } from '../types'import { aiConsentDisabledReason } from '../utils/aiConsent'-import { groupScouts, scoutGroup, ScoutGroupBucket, ScoutGroupKey } from '../utils/scoutGroups'+import { compareScoutsByName, groupScouts, scoutGroup, ScoutGroupKey, ScoutRosterRow } from '../utils/scoutGroups'export type ScoutEnabledFilter = 'all' | 'enabled' | 'disabled'import {@@ -91,24 +91,6 @@ const RUNS_REFETCH_INTERVAL_MS = 60_000const RUNS_PAGE_LIMIT = 100const MAX_RUNS_PAGES = 15-/** Rows the roster is showing after every filter, for the `filter_match_count` analytics property. */-function rosterMatchCount(buckets: ScoutGroupBucket[]): number {- return buckets.reduce((total, bucket) => total + bucket.configs.length, 0)-}--/** Where each scout's row belongs, given the configs and run rollups currently loaded. */-function computeRosterPlacement(values: {- scoutConfigs: SignalScoutConfig[] | null- rollups: Map<string, ScoutRollup>-}): Record<string, ScoutGroupKey> {- const now = new Date()- const placement: Record<string, ScoutGroupKey> = {}- for (const config of values.scoutConfigs ?? []) {- placement[config.id] = scoutGroup(config, values.rollups.get(config.skill_name), now)- }- return placement-}-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface scoutFleetLogicValues {dataProcessingAccepted: boolean // aiConsentLogic@@ -133,9 +115,8 @@ export interface scoutFleetLogicValues {lastRunAt: string | nullmanualRunScoutIds: string[]rollups: Map<string, ScoutRollup>- rosterBuckets: ScoutGroupBucket[]rosterGroupCounts: Record<ScoutGroupKey, number>- rosterPlacement: Record<string, ScoutGroupKey>+ rosterScouts: ScoutRosterRow[]runningChatType: ScoutChatType | nullrunsWindow: {complete: boolean@@ -267,9 +248,6 @@ export interface scoutFleetLogicActions {runScoutNowFinished: (configId: string) => {configId: string}- setRosterPlacement: (placement: Record<string, ScoutGroupKey>) => {- placement: Record<string, ScoutGroupKey>- }setScoutEnabledFilter: (filter: ScoutEnabledFilter) => {filter: ScoutEnabledFilter}@@ -327,18 +305,16 @@ export interface scoutFleetLogicMeta {lastRunAt: (scoutConfigs: SignalScoutConfigApi[] | null) => string | nullscoutTagOptions: (scoutConfigs: SignalScoutConfigApi[] | null) => ScoutTagOption[]activeScoutTags: (selectedScoutTags: string[], scoutTagOptions: ScoutTagOption[]) => string[]- rosterBuckets: (+ rosterScouts: (scoutConfigs: SignalScoutConfigApi[] | null,rollups: Map<string, ScoutRollup>,activeScoutTags: string[],scoutSearch: string,- scoutEnabledFilter: ScoutEnabledFilter,- rosterPlacement: Record<string, ScoutGroupKey>- ) => ScoutGroupBucket[]+ scoutEnabledFilter: ScoutEnabledFilter+ ) => ScoutRosterRow[]rosterGroupCounts: (scoutConfigs: SignalScoutConfigApi[] | null,- rollups: Map<string, ScoutRollup>,- rosterPlacement: Record<string, ScoutGroupKey>+ rollups: Map<string, ScoutRollup>) => Record<ScoutGroupKey, number>emittedFindingsSummary: (fleetFindingsSummary: FleetFindingsSummaryApi | null) => {authoredReportCount: number@@ -390,7 +366,6 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([setScoutEnabledFilter: (filter: ScoutEnabledFilter) => ({ filter }),runScoutNow: (configId: string) => ({ configId }),runScoutNowFinished: (configId: string) => ({ configId }),- setRosterPlacement: (placement: Record<string, ScoutGroupKey>) => ({ placement }),// Started/stopped by the fleet-list component so the always-mounted setup widget// (which only reads configs) doesn't trigger the paginated runs-window polling.startRunsPolling: true,@@ -590,17 +565,6 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([updateScoutConfigFinished: (state, { configId }) => state.filter((id) => id !== configId),},],- /**- * Which group each scout's row currently sits in. Refreshed only when server data lands- * (configs or the runs window), never on a local edit — so toggling a scout leaves its row- * where it is instead of relocating it mid-click. The next poll re-places it truthfully.- */- rosterPlacement: [- {} as Record<string, ScoutGroupKey>,- {- setRosterPlacement: (_, { placement }) => placement,- },- ],manualRunScoutIds: [[] as string[],{@@ -685,35 +649,23 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([selectedScoutTags.filter((tag) => scoutTagOptions.some((option) => option.tag === tag)),],/**- * The roster, bucketed by lifecycle group and narrowed by the roster's own chrome (search- * and the tag filter). Grouping is time-dependent (the cold-start window), so this- * recomputes on every runs poll — which is also when a scout can cross between Working and- * Watching, so the two stay in step.+ * The roster as one alphabetical list, each row tagged with its lifecycle group and narrowed+ * by the roster's own chrome (search and the tag filter). The group is time-dependent (the+ * cold-start window), so this recomputes on every runs poll — which is also when a scout can+ * cross between Working and Watching, so the Status column stays in step.*/- rosterBuckets: [- (s) => [- s.scoutConfigs,- s.rollups,- s.activeScoutTags,- s.scoutSearch,- s.scoutEnabledFilter,- s.rosterPlacement,- ],+ rosterScouts: [+ (s) => [s.scoutConfigs, s.rollups, s.activeScoutTags, s.scoutSearch, s.scoutEnabledFilter],(scoutConfigs: SignalScoutConfig[] | null,rollups: Map<string, ScoutRollup>,activeScoutTags: string[],scoutSearch: string,- scoutEnabledFilter: ScoutEnabledFilter,- rosterPlacement: Record<string, ScoutGroupKey>- ): ScoutGroupBucket[] => {+ scoutEnabledFilter: ScoutEnabledFilter+ ): ScoutRosterRow[] => {const query = scoutSearch.trim().toLowerCase()- // Alphabetical only. Sorting by `enabled` too would jump a row to the bottom of its- // group the moment you switched it off, on top of the group change itself.- const matching = [...(scoutConfigs ?? [])]- .sort((a, b) =>- prettifyScoutSkillName(a.skill_name).localeCompare(prettifyScoutSkillName(b.skill_name))- )+ const now = new Date()+ return [...(scoutConfigs ?? [])].filter((config) => configMatchesScoutTags(config, activeScoutTags)).filter((config) =>@@ -726,7 +678,8 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([config.skill_name.toLowerCase().includes(query) ||(config.description ?? '').toLowerCase().includes(query))- return groupScouts(matching, rollups, new Date(), rosterPlacement)+ .sort(compareScoutsByName)+ .map((config) => ({ config, group: scoutGroup(config, rollups.get(config.skill_name), now) }))},],/**@@ -734,11 +687,10 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([* scouts need a decision, and that number must not move as you type into the search box.*/rosterGroupCounts: [- (s) => [s.scoutConfigs, s.rollups, s.rosterPlacement],+ (s) => [s.scoutConfigs, s.rollups],(scoutConfigs: SignalScoutConfig[] | null,- rollups: Map<string, ScoutRollup>,- rosterPlacement: Record<string, ScoutGroupKey>+ rollups: Map<string, ScoutRollup>): Record<ScoutGroupKey, number> => {const counts: Record<ScoutGroupKey, number> = {needs_you: 0,@@ -748,7 +700,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([settling_in: 0,off: 0,}- for (const bucket of groupScouts(scoutConfigs ?? [], rollups, new Date(), rosterPlacement)) {+ for (const bucket of groupScouts(scoutConfigs ?? [], rollups, new Date())) {counts[bucket.key] = bucket.configs.length}return counts@@ -803,7 +755,8 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([captureScoutAction({actionType: 'filter_enabled',surface: 'fleet_list',- extra: { filter, filter_match_count: rosterMatchCount(values.rosterBuckets) },+ // `filter_match_count`: rows still shown after every filter.+ extra: { filter, filter_match_count: values.rosterScouts.length },})},// Debounced so a typed query fires once per pause, not per keystroke; clearing fires nothing.@@ -817,17 +770,9 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([captureScoutAction({actionType: 'search_scouts',surface: 'fleet_list',- extra: { search_length: query.length, filter_match_count: rosterMatchCount(values.rosterBuckets) },+ extra: { search_length: query.length, filter_match_count: values.rosterScouts.length },})},- // Placement is refreshed here, off server data only, and deliberately not from- // `patchScoutConfigLocally` — an optimistic toggle must not relocate the row being clicked.- loadScoutConfigsSuccess: () => {- actions.setRosterPlacement(computeRosterPlacement(values))- },- loadScoutRunsSuccess: () => {- actions.setRosterPlacement(computeRosterPlacement(values))- },runScoutNow: async ({ configId }) => {const teamId = teamLogic.values.currentTeamIdif (!teamId) {diff --git a/products/signals/frontend/inbox/utils/scoutGroups.ts b/products/signals/frontend/inbox/utils/scoutGroups.tsindex d61178a74523..a3f63dd0aed1 100644--- a/products/signals/frontend/inbox/utils/scoutGroups.ts+++ b/products/signals/frontend/inbox/utils/scoutGroups.ts@@ -3,7 +3,7 @@ import { dayjs } from 'lib/dayjs'import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'-import { dailyCronToTime, formatRunIntervalShort, ScoutRollup } from './scoutRunsWindow'+import { dailyCronToTime, formatRunIntervalShort, prettifyScoutSkillName, ScoutRollup } from './scoutRunsWindow'/*** Where a scout sits in the roster, in the backend's own lifecycle vocabulary.@@ -28,16 +28,6 @@ export const SCOUT_GROUP_LABEL: Record<ScoutGroupKey, string> = {off: 'Off',}-/** Shown beside the group heading, so a group's bar is stated rather than inferred from its name. */-export const SCOUT_GROUP_HINT: Record<ScoutGroupKey, string | null> = {- needs_you: null,- working: 'filed something recently',- watching: 'running, nothing worth filing',- dry_run: 'investigating, but filing nothing',- settling_in: 'too new to judge',- off: null,-}-/** Matches `SignalScoutConfig.COLD_START_GRACE` — how long the sweep leaves a new scout alone. */export const SCOUT_COLD_START_DAYS = 14@@ -97,22 +87,26 @@ export interface ScoutGroupBucket {configs: SignalScoutConfig[]}-/**- * Buckets in display order, empty groups dropped. Input order is preserved inside each bucket.- *- * `placement` pins a scout to the group it was last placed in. Without it, flipping a scout's- * switch moves its row to another group the instant you click — the row you were aiming at jumps- * out from under the pointer. Placement is refreshed when server data lands, not on local edits.- */+/** A roster row: a scout config paired with the lifecycle group it currently sits in. */+export interface ScoutRosterRow {+ config: SignalScoutConfig+ group: ScoutGroupKey+}++/** A→Z by display name — the roster's default order and the Scout column's sort. */+export function compareScoutsByName(a: SignalScoutConfig, b: SignalScoutConfig): number {+ return prettifyScoutSkillName(a.skill_name).localeCompare(prettifyScoutSkillName(b.skill_name))+}++/** Buckets in display order, empty groups dropped. Input order is preserved inside each bucket. */export function groupScouts(configs: SignalScoutConfig[],rollups: Map<string, ScoutRollup>,- now: Date,- placement?: Record<string, ScoutGroupKey>+ now: Date): ScoutGroupBucket[] {const buckets = new Map<ScoutGroupKey, SignalScoutConfig[]>()for (const config of configs) {- const key = placement?.[config.id] ?? scoutGroup(config, rollups.get(config.skill_name), now)+ const key = scoutGroup(config, rollups.get(config.skill_name), now)const bucket = buckets.get(key)if (bucket) {bucket.push(config)