: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(customer-analytics): add scout report feed tab (#76896)
Arthur Moreira de Deus17a38d82ddb8
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex f07cf9cd1c17..47bed3f56ed8 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -5230,6 +5230,10 @@ const api = {has_implementation_pr?: 'true' | 'false'/** Comma-separated reviewer user UUIDs (For-you / teammate scope). */suggested_reviewers?: string+ /** Comma-separated scout skill_name slugs. */+ scout?: string+ /** Scout skill_name prefix — matches every scout in the family. */+ scout_prefix?: string}): Promise<CountedPaginatedResponse<SignalReport>> {return await new ApiRequest().signalReports().withQueryString(params).get()},diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 0fbceec4e23b..e181e6e3be60 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -103,6 +103,7 @@ export const productRoutes: Record<string, [string, string]> = {'/customer_analytics/accounts/:accountId/:tab': ['CustomerAnalytics', 'customerAnalyticsAccounts'],'/customer_analytics/notes': ['CustomerAnalytics', 'customerAnalyticsNotes'],'/customer_analytics/announcements': ['CustomerAnalytics', 'customerAnalyticsAnnouncements'],+ '/customer_analytics/feed': ['CustomerAnalytics', 'customerAnalyticsFeed'],'/customer_analytics/journeys/new': ['CustomerJourneyBuilder', 'customerJourneyBuilder'],'/customer_analytics/journeys/templates': ['CustomerJourneyTemplates', 'customerJourneyTemplates'],'/customer_analytics/journeys/:id/edit': ['CustomerJourneyBuilder', 'customerJourneyEdit'],@@ -1009,6 +1010,7 @@ export const productUrls = {`/customer_analytics/accounts/${accountId}${tab ? `/${tab}` : ''}`,customerAnalyticsNotes: (): string => '/customer_analytics/notes',customerAnalyticsAnnouncements: (): string => '/customer_analytics/announcements',+ customerAnalyticsFeed: (): string => '/customer_analytics/feed',customerAnalyticsJourneys: (): string => '/customer_analytics/journeys',customerAnalyticsConfiguration: (tab?: string): string =>`/customer_analytics/configuration${tab ? `?tab=${tab}` : ''}`,diff --git a/frontend/src/scenes/inbox/components/cards/ReportCard.tsx b/frontend/src/scenes/inbox/components/cards/ReportCard.tsxindex 2afac1bf1739..adf6ffa71261 100644--- a/frontend/src/scenes/inbox/components/cards/ReportCard.tsx+++ b/frontend/src/scenes/inbox/components/cards/ReportCard.tsx@@ -1,5 +1,5 @@import clsx from 'clsx'-import { router } from 'kea-router'+import { combineUrl, router } from 'kea-router'import { IconArchive, IconUndo } from '@posthog/icons'import { LemonButton, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'@@ -99,12 +99,15 @@ export function ReportCard({attached = false,onArchive,onRestore,+ backUrl,}: {report: SignalReporttabKey?: InboxFlatListTabKeyattached?: booleanonArchive?: (reason: DismissalReasonValue, note: string) => voidonRestore?: () => void+ /** Internal path the detail view's back button should return to, for cards rendered outside the inbox. */+ backUrl?: string}): JSX.Element {const isArchived = tabKey === 'archived'// Resolved reports are terminal (their implementation PR merged) – shown for reference in the@@ -121,7 +124,9 @@ export function ReportCard({const conventionalTitle = parseConventionalCommitTitle(report.title)const cardTitle = displayConventionalCommitTitle(report.title, hasPr ? 'Untitled pull request' : 'Untitled report')const headline = deriveHeadline(report.summary)- const detailUrl = urls.inboxReport(tabKey, report.id)+ const detailUrl = backUrl+ ? combineUrl(urls.inboxReport(tabKey, report.id), { back: backUrl }).url+ : urls.inboxReport(tabKey, report.id)const { isArchiving, onArchiveClick } = useReportArchive({reportId: report.id,diff --git a/frontend/src/scenes/inbox/components/detail/ReportDetail.tsx b/frontend/src/scenes/inbox/components/detail/ReportDetail.tsxindex ab64bbea05fb..52514493c2bd 100644--- a/frontend/src/scenes/inbox/components/detail/ReportDetail.tsx+++ b/frontend/src/scenes/inbox/components/detail/ReportDetail.tsx@@ -1,4 +1,5 @@import { BindLogic, useValues } from 'kea'+import { router } from 'kea-router'import { ReactNode, useCallback, useState } from 'react'import { IconArrowLeft, IconDocument, IconEllipsis, IconExternal, IconPullRequest, IconSearch } from '@posthog/icons'@@ -297,6 +298,12 @@ export function InboxDetailFrame({diffStat,children,}: InboxDetailFrameProps): JSX.Element {+ const { searchParams } = useValues(router)+ // A `?back=` internal path (set by surfaces embedding inbox cards, e.g. the customer analytics+ // feed) redirects the back button there instead of the inbox list tab.+ const rawBack = searchParams.back+ const backOverride =+ typeof rawBack === 'string' && rawBack.startsWith('/') && !rawBack.startsWith('//') ? rawBack : nullconst logicProps = { reportId: report.id, report }const {reportSignals,@@ -436,10 +443,10 @@ export function InboxDetailFrame({type="tertiary"size="small"icon={<IconArrowLeft />}- to={urls.inbox(tab)}+ to={backOverride ?? urls.inbox(tab)}className="-ml-2 w-fit">- {INBOX_TAB_LABEL[tab]}+ {backOverride ? 'Back' : INBOX_TAB_LABEL[tab]}</LemonButton><div className="flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4">{/* Priority square anchors the title; everything else collapses into the meta line. */}diff --git a/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx b/products/customer_analytics/frontend/CustomerAnalyticsScene.tsxindex d3b1291ff480..a59f476deca4 100644--- a/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx+++ b/products/customer_analytics/frontend/CustomerAnalyticsScene.tsx@@ -36,6 +36,7 @@ import { CustomerJourneySelect } from './components/CustomerJourneys/CustomerJouimport { customerJourneysLogic } from './components/CustomerJourneys/customerJourneysLogic'import { DeleteJourneyButton } from './components/CustomerJourneys/DeleteJourneyButton'import { journeyEditorLogic } from './components/CustomerJourneys/journeyEditorLogic'+import { FeedTabContent } from './components/Feed/FeedTabContent'import { FeedbackButton } from './components/FeedbackButton'import { ActiveUsersInsights } from './components/Insights/ActiveUsersInsights'import { SignupInsights } from './components/Insights/SignupInsights'@@ -79,10 +80,11 @@ function CustomerAnalyticsSceneContent(): JSX.Element {reportCustomerAnalyticsViewed()})- // Accounts, Notes and Announcements are gated by CUSTOMER_ANALYTICS_CSP; without it the tabs do- // not exist, so guessed `/customer_analytics/{accounts,notes,announcements}` URLs are 404s.+ // Accounts, Notes, Announcements and Feed are gated by CUSTOMER_ANALYTICS_CSP; without it the+ // tabs do not exist, so guessed `/customer_analytics/{accounts,notes,announcements,feed}` URLs+ // are 404s.if (- (activeTab === 'accounts' || activeTab === 'notes' || activeTab === 'announcements') &&+ (activeTab === 'accounts' || activeTab === 'notes' || activeTab === 'announcements' || activeTab === 'feed') &&!featureFlags[FEATURE_FLAGS.CUSTOMER_ANALYTICS_CSP]) {return <NotFound object="page" />@@ -108,6 +110,12 @@ function CustomerAnalyticsSceneContent(): JSX.Element {const tabs: LemonTab<string>[] = []if (featureFlags[FEATURE_FLAGS.CUSTOMER_ANALYTICS_CSP]) {+ tabs.push({+ key: 'feed',+ label: 'Feed',+ content: <FeedTabContent />,+ link: combineUrl(urls.customerAnalyticsFeed(), searchParams).url,+ })tabs.push({key: 'accounts',label: 'Accounts',diff --git a/products/customer_analytics/frontend/components/Feed/FeedTabContent.tsx b/products/customer_analytics/frontend/components/Feed/FeedTabContent.tsxnew file mode 100644index 000000000000..a551dd503e48--- /dev/null+++ b/products/customer_analytics/frontend/components/Feed/FeedTabContent.tsx@@ -0,0 +1,78 @@+import { useActions, useValues } from 'kea'++import { LemonCheckbox, LemonSelect, LemonSkeleton } from '@posthog/lemon-ui'++import { STATUS_LABELS } from 'scenes/inbox/components/badges/SignalReportStatusBadge'+import { ReportCard } from 'scenes/inbox/components/cards/ReportCard'+import { SignalReportStatus } from 'scenes/inbox/types'+import { urls } from 'scenes/urls'++import { feedLogic } from './feedLogic'++const STATUS_FILTER_OPTIONS: { value: SignalReportStatus | null; label: string }[] = [+ { value: null, label: 'Any status' },+ ...[+ SignalReportStatus.READY,+ SignalReportStatus.PENDING_INPUT,+ SignalReportStatus.IN_PROGRESS,+ SignalReportStatus.CANDIDATE,+ SignalReportStatus.POTENTIAL,+ SignalReportStatus.RESOLVED,+ SignalReportStatus.FAILED,+ ].map((status) => ({ value: status, label: STATUS_LABELS[status] ?? status })),+]++export function FeedTabContent(): JSX.Element {+ const { reports, reportsResponse, reportsResponseLoading, statusFilter, myReportsOnly } = useValues(feedLogic)+ const { setStatusFilter, setMyReportsOnly, archiveReport } = useActions(feedLogic)++ const filtersActive = statusFilter !== null || myReportsOnly++ return (+ <div className="flex flex-col gap-4">+ <div className="flex items-center gap-4">+ <LemonSelect+ size="small"+ value={statusFilter}+ onChange={setStatusFilter}+ options={STATUS_FILTER_OPTIONS}+ disabledReason={reportsResponseLoading ? 'Loading reports…' : undefined}+ data-attr="customer-analytics-reports-status-filter"+ />+ <LemonCheckbox+ checked={myReportsOnly}+ onChange={setMyReportsOnly}+ label="My reports"+ info="Reports where you are a suggested reviewer"+ disabledReason={reportsResponseLoading ? 'Loading reports…' : undefined}+ data-attr="customer-analytics-reports-mine-filter"+ />+ </div>+ {reportsResponse === null ? (+ <LemonSkeleton className="h-64 w-full" />+ ) : reports.length === 0 ? (+ <div className="mx-auto max-w-md flex flex-col items-center text-center py-12 gap-2">+ <h3 className="text-base font-semibold m-0">+ {filtersActive ? 'No reports match these filters' : 'No reports yet'}+ </h3>+ <p className="text-sm text-tertiary m-0">+ {filtersActive+ ? 'Clear the filters to see every report from the customer analytics scouts.'+ : 'The customer analytics scouts post reports here when they find account changes worth reviewing.'}+ </p>+ </div>+ ) : (+ <div className="@container flex flex-col gap-1.5">+ {reports.map((report) => (+ <ReportCard+ key={report.id}+ report={report}+ backUrl={urls.customerAnalyticsFeed()}+ onArchive={(reason, note) => archiveReport(report.id, reason, note)}+ />+ ))}+ </div>+ )}+ </div>+ )+}diff --git a/products/customer_analytics/frontend/components/Feed/feedLogic.test.ts b/products/customer_analytics/frontend/components/Feed/feedLogic.test.tsnew file mode 100644index 000000000000..3cbdf7410d46--- /dev/null+++ b/products/customer_analytics/frontend/components/Feed/feedLogic.test.ts@@ -0,0 +1,58 @@+import { expectLogic } from 'kea-test-utils'++import { SignalReportStatus } from 'scenes/inbox/types'+import { userLogic } from 'scenes/userLogic'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'+import type { UserType } from '~/types'++import { CUSTOMER_ANALYTICS_SCOUT_PREFIX, feedLogic } from './feedLogic'++describe('feedLogic', () => {+ let logic: ReturnType<typeof feedLogic.build>+ let lastParams: URLSearchParams | null = null++ beforeEach(() => {+ lastParams = null+ useMocks({+ get: {+ '/api/projects/:team_id/signals/reports/': ({ request }) => {+ lastParams = new URL(request.url).searchParams+ return [200, { results: [], count: 0 }]+ },+ },+ })+ initKeaTests()+ })++ afterEach(() => {+ logic?.unmount()+ })++ it('always scopes the list to the customer analytics scout prefix', async () => {+ logic = feedLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadReports', 'loadReportsSuccess'])++ expect(lastParams?.get('scout_prefix')).toBe(CUSTOMER_ANALYTICS_SCOUT_PREFIX)+ expect(lastParams?.get('status')).toBeNull()+ expect(lastParams?.get('suggested_reviewers')).toBeNull()+ })++ it('applies the status and my-reports filters to the request', async () => {+ logic = feedLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadReportsSuccess'])+ userLogic.actions.loadUserSuccess({ id: 7, uuid: 'user-uuid-7', email: '[email protected]' } as UserType)++ await expectLogic(logic, () => {+ logic.actions.setStatusFilter(SignalReportStatus.READY)+ logic.actions.setMyReportsOnly(true)+ }).toFinishAllListeners()++ expect(lastParams?.get('scout_prefix')).toBe(CUSTOMER_ANALYTICS_SCOUT_PREFIX)+ expect(lastParams?.get('status')).toBe('ready')+ expect(lastParams?.get('suggested_reviewers')).toBe('user-uuid-7')+ })+})diff --git a/products/customer_analytics/frontend/components/Feed/feedLogic.ts b/products/customer_analytics/frontend/components/Feed/feedLogic.tsnew file mode 100644index 000000000000..e3c456f7e58e--- /dev/null+++ b/products/customer_analytics/frontend/components/Feed/feedLogic.ts@@ -0,0 +1,135 @@+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'++import api, { CountedPaginatedResponse } from 'lib/api'+import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { SignalReport, SignalReportStatus } from 'scenes/inbox/types'+import { DismissalReasonValue } from 'scenes/inbox/utils/dismissalReasons'+import { userLogic } from 'scenes/userLogic'++import type { UserType } from '../../../../../frontend/src/types'++// Matches every scout in the customer analytics family — new scouts only need a name+// starting with this prefix to show up in the feed.+export const CUSTOMER_ANALYTICS_SCOUT_PREFIX = 'signals-scout-customer-analytics'++// ponytail: single page of 100; add pagination when a team's scout reports outgrow it.+const REPORTS_LIMIT = 100++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface feedLogicValues {+ user: UserType | null // userLogic+ myReportsOnly: boolean+ reports: SignalReport[]+ reportsResponse: CountedPaginatedResponse<SignalReport> | null+ reportsResponseLoading: boolean+ statusFilter: SignalReportStatus | null+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface feedLogicActions {+ archiveReport: (+ reportId: string,+ reason: DismissalReasonValue,+ note: string+ ) => {+ note: string+ reason:+ | 'already_fixed'+ | 'analysis_wrong'+ | 'other'+ | 'report_unclear'+ | 'wontfix_intentional'+ | 'wontfix_irrelevant'+ reportId: string+ }+ loadReports: (_: any) => any+ loadReportsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadReportsSuccess: (+ reportsResponse: CountedPaginatedResponse<SignalReport>,+ payload?: any+ ) => {+ reportsResponse: CountedPaginatedResponse<SignalReport>+ payload?: any+ }+ setMyReportsOnly: (myReportsOnly: boolean) => {+ myReportsOnly: boolean+ }+ setStatusFilter: (status: SignalReportStatus | null) => {+ status: SignalReportStatus | null+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface feedLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ reports: (reportsResponse: CountedPaginatedResponse<SignalReport> | null) => SignalReport[]+ }+}++export type feedLogicType = MakeLogicType<feedLogicValues, feedLogicActions, Record<string, any>, feedLogicMeta>++export const feedLogic = kea<feedLogicType>([+ path(['products', 'customer_analytics', 'frontend', 'components', 'Feed', 'feedLogic']),+ connect(() => ({+ values: [userLogic, ['user']],+ })),+ actions({+ setStatusFilter: (status: SignalReportStatus | null) => ({ status }),+ setMyReportsOnly: (myReportsOnly: boolean) => ({ myReportsOnly }),+ archiveReport: (reportId: string, reason: DismissalReasonValue, note: string) => ({ reportId, reason, note }),+ }),+ loaders(({ values }) => ({+ reportsResponse: [+ null as CountedPaginatedResponse<SignalReport> | null,+ {+ loadReports: async (_, breakpoint) => {+ const response = await api.signalReports.list({+ scout_prefix: CUSTOMER_ANALYTICS_SCOUT_PREFIX,+ limit: REPORTS_LIMIT,+ ...(values.statusFilter ? { status: values.statusFilter } : {}),+ ...(values.myReportsOnly && values.user?.uuid ? { suggested_reviewers: values.user.uuid } : {}),+ })+ breakpoint()+ return response+ },+ },+ ],+ })),+ reducers({+ statusFilter: [null as SignalReportStatus | null, { setStatusFilter: (_, { status }) => status }],+ myReportsOnly: [false, { setMyReportsOnly: (_, { myReportsOnly }) => myReportsOnly }],+ }),+ selectors({+ reports: [+ (s) => [s.reportsResponse],+ (reportsResponse: CountedPaginatedResponse<SignalReport> | null): SignalReport[] =>+ reportsResponse?.results ?? [],+ ],+ }),+ listeners(({ actions }) => ({+ setStatusFilter: () => actions.loadReports(null),+ setMyReportsOnly: () => actions.loadReports(null),+ archiveReport: async ({ reportId, reason, note }) => {+ try {+ await api.signalReports.setState(reportId, {+ state: 'suppressed',+ dismissal_reason: reason,+ ...(note ? { dismissal_note: note } : {}),+ })+ } catch (error: any) {+ lemonToast.error(error?.detail || error?.message || 'Failed to archive report')+ }+ actions.loadReports(null)+ },+ })),+ afterMount(({ actions }) => {+ actions.loadReports(null)+ }),+])diff --git a/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts b/products/customer_analytics/frontend/customerAnalyticsSceneLogic.tsindex fbfbb640516e..1ac700193f7b 100644--- a/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts+++ b/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts@@ -43,13 +43,14 @@ import { customerAnalyticsConfigLogic } from './customerAnalyticsConfigLogic'export type BusinessType = 'b2c' | 'b2b'-type ActiveTab = 'dashboard' | 'journeys' | 'accounts' | 'notes' | 'announcements'+type ActiveTab = 'dashboard' | 'journeys' | 'accounts' | 'notes' | 'announcements' | 'feed'const SCENE_KEY_TO_TAB: Record<string, ActiveTab> = {customerAnalyticsJourneys: 'journeys',customerAnalyticsAccounts: 'accounts',customerAnalyticsNotes: 'notes',customerAnalyticsAnnouncements: 'announcements',+ customerAnalyticsFeed: 'feed',}export interface InsightDefinition {diff --git a/products/customer_analytics/manifest.tsx b/products/customer_analytics/manifest.tsxindex e46abacda701..79c9e28ee2d6 100644--- a/products/customer_analytics/manifest.tsx+++ b/products/customer_analytics/manifest.tsx@@ -43,6 +43,7 @@ export const manifest: ProductManifest = {'/customer_analytics/accounts/:accountId/:tab': ['CustomerAnalytics', 'customerAnalyticsAccounts'],'/customer_analytics/notes': ['CustomerAnalytics', 'customerAnalyticsNotes'],'/customer_analytics/announcements': ['CustomerAnalytics', 'customerAnalyticsAnnouncements'],+ '/customer_analytics/feed': ['CustomerAnalytics', 'customerAnalyticsFeed'],'/customer_analytics/journeys/new': ['CustomerJourneyBuilder', 'customerJourneyBuilder'],'/customer_analytics/journeys/templates': ['CustomerJourneyTemplates', 'customerJourneyTemplates'],'/customer_analytics/journeys/:id/edit': ['CustomerJourneyBuilder', 'customerJourneyEdit'],@@ -66,6 +67,7 @@ export const manifest: ProductManifest = {`/customer_analytics/accounts/${accountId}${tab ? `/${tab}` : ''}`,customerAnalyticsNotes: (): string => '/customer_analytics/notes',customerAnalyticsAnnouncements: (): string => '/customer_analytics/announcements',+ customerAnalyticsFeed: (): string => '/customer_analytics/feed',customerAnalyticsJourneys: (): string => '/customer_analytics/journeys',customerAnalyticsConfiguration: (tab?: string): string =>`/customer_analytics/configuration${tab ? `?tab=${tab}` : ''}`,diff --git a/products/signals/backend/temporal/signal_queries.py b/products/signals/backend/temporal/signal_queries.pyindex a96a11b2e62c..f564f54f2500 100644--- a/products/signals/backend/temporal/signal_queries.py+++ b/products/signals/backend/temporal/signal_queries.py@@ -661,6 +661,47 @@ def fetch_report_ids_for_scout_names(team: Team, scout_names: list[str]) -> set[return {row[0] for row in (result.results or []) if row[0]}+def fetch_report_ids_for_scout_prefix(team: Team, scout_prefix: str) -> set[str]:+ """Return the set of report IDs that have at least one non-deleted signal authored by a scout+ whose skill_name starts with `scout_prefix`.++ Prefix matching lets a scout family (e.g. every customer-analytics scout named+ `signals-scout-customer-analytics*`) surface new members without callers updating a name list.+ Same dedup, ordering, and cap semantics as `fetch_report_ids_for_scout_names`.+ """+ ch_query = f"""+ SELECT report_id+ FROM (+ SELECT+ JSONExtractString(metadata, 'report_id') as report_id,+ JSONExtractBool(metadata, 'deleted') as is_deleted,+ JSONExtractString(metadata, 'extra', 'skill_name') as skill_name,+ timestamp+ FROM ({_deduped_signals_subquery()})+ )+ WHERE NOT is_deleted+ AND report_id != ''+ AND skill_name != ''+ AND startsWith(skill_name, {{scout_prefix}})+ GROUP BY report_id+ ORDER BY max(timestamp) DESC+ LIMIT {_REPORT_ID_FILTER_CAP}+ """++ tag_queries(product=Product.SIGNALS, feature=Feature.QUERY)+ result = execute_hogql_query(+ query_type="SignalsFilterByScoutPrefix",+ query=ch_query,+ team=team,+ placeholders={+ "model_name": ast.Constant(value=EMBEDDING_MODEL.value),+ "scout_prefix": ast.Constant(value=scout_prefix),+ },+ )++ return {row[0] for row in (result.results or []) if row[0]}++# ---------------------------------------------------------------------------# fetch_report_ids_for_source_ids — synchronous, for the scout reverse lookup# ---------------------------------------------------------------------------diff --git a/products/signals/backend/test/test_signal_queries.py b/products/signals/backend/test/test_signal_queries.pyindex 8a930a63048a..dd5096a4520f 100644--- a/products/signals/backend/test/test_signal_queries.py+++ b/products/signals/backend/test/test_signal_queries.py@@ -18,6 +18,7 @@ from products.signals.backend.signal_metadata import ()from products.signals.backend.temporal.signal_queries import (fetch_report_ids_for_scout_names,+ fetch_report_ids_for_scout_prefix,fetch_signals_for_report_sync,)@@ -284,6 +285,38 @@ class TestFetchReportIdsForScoutNames(_SignalEmbeddingsTestBase):) == {"rErrors", "rReplay"}assert fetch_report_ids_for_scout_names(self.team, ["signals-scout-unknown"]) == set()+ def test_prefix_matches_the_scout_family_and_nothing_else(self) -> None:+ # Guards the family-prefix filter: a scout added under the prefix must appear without a+ # caller name-list change, while other scouts and non-scout signals stay excluded.+ self._emit_version(+ document_id="d1",+ report_id="rHealth",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-customer-analytics",+ )+ self._emit_version(+ document_id="d2",+ report_id="rMix",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-customer-analytics-product-mix",+ )+ self._emit_version(+ document_id="d3",+ report_id="rErrors",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-error-tracking",+ )+ self._emit_version(document_id="d4", report_id="rPipeline", source_product="errors", inserted_at=self.base)++ assert fetch_report_ids_for_scout_prefix(self.team, "signals-scout-customer-analytics") == {+ "rHealth",+ "rMix",+ }+ assert fetch_report_ids_for_scout_prefix(self.team, "signals-scout-unknown") == set()+def test_deleted_in_latest_version_drops_out(self) -> None:self._emit_version(document_id="moving",diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex ac439328db2e..6018dbe22e9d 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -150,6 +150,7 @@ from products.signals.backend.temporal.reingestion import SignalReportReingestiofrom products.signals.backend.temporal.signal_queries import (fetch_live_report_ids_for_source_ids,fetch_report_ids_for_scout_names,+ fetch_report_ids_for_scout_prefix,fetch_report_ids_for_source_products,fetch_signals_for_report_sync,)@@ -764,6 +765,7 @@ class SignalReportViewSet(qs = self._apply_signal_report_source_product_filter(qs)qs = self._apply_signal_report_source_id_filter(qs)qs = self._apply_signal_report_scout_filter(qs)+ qs = self._apply_signal_report_scout_prefix_filter(qs)qs = self._apply_signal_report_implementation_pr_filter(qs)qs = self._apply_signal_report_suggested_reviewer_filter(qs)qs = self._apply_signal_report_task_filter(qs)@@ -935,6 +937,14 @@ class SignalReportViewSet(report_ids_with_scout = fetch_report_ids_for_scout_names(self.team, scout_names)return queryset.filter(id__in=report_ids_with_scout)+ def _apply_signal_report_scout_prefix_filter(self, queryset):+ scout_prefix = (self.request.query_params.get("scout_prefix") or "").strip()+ if not scout_prefix:+ return queryset++ report_ids_with_prefix = fetch_report_ids_for_scout_prefix(self.team, scout_prefix)+ return queryset.filter(id__in=report_ids_with_prefix)+def _latest_suggested_reviewers_qs(self):"""`suggested_reviewers` rows that are the *current* (latest) version for the correlatedouter report (`OuterRef("id")`).@@ -1419,6 +1429,18 @@ class SignalReportViewSet("these scouts. Combines with source_product as an AND."),),+ OpenApiParameter(+ name="scout_prefix",+ type=OpenApiTypes.STR,+ location=OpenApiParameter.QUERY,+ required=False,+ description=(+ "Scout skill_name prefix (e.g. signals-scout-customer-analytics). Reports are kept if at "+ "least one of their contributing signals was authored by a scout whose skill_name starts "+ "with this prefix — new scouts in the family match without callers listing every name. "+ "Combines with the other filters as an AND."+ ),+ ),OpenApiParameter(name="suggested_reviewers",type=OpenApiTypes.STR,diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex e1cf198c950f..c351d05d3e57 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3825,6 +3825,10 @@ export type SignalsReportsListParams = {* Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.*/scout?: string+ /**+ * Scout skill_name prefix (e.g. signals-scout-customer-analytics). Reports are kept if at least one of their contributing signals was authored by a scout whose skill_name starts with this prefix — new scouts in the family match without callers listing every name. Combines with the other filters as an AND.+ */+ scout_prefix?: string/*** Case-insensitive substring match against report title and summary.*/diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 7ed8c54db1f7..aee4340c6842 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -84337,6 +84337,10 @@ export namespace Schemas {* Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.*/scout?: string;+ /**+ * Scout skill_name prefix (e.g. signals-scout-customer-analytics). Reports are kept if at least one of their contributing signals was authored by a scout whose skill_name starts with this prefix — new scouts in the family match without callers listing every name. Combines with the other filters as an AND.+ */+ scout_prefix?: string;/*** Case-insensitive substring match against report title and summary.*/diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex a46fe6c2c901..4398392eb906 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -49,6 +49,12 @@ export const SignalsReportsListQueryParams = /* @__PURE__ */ zod.object({.describe('Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.'),+ scout_prefix: zod+ .string()+ .optional()+ .describe(+ 'Scout skill_name prefix (e.g. signals-scout-customer-analytics). Reports are kept if at least one of their contributing signals was authored by a scout whose skill_name starts with this prefix — new scouts in the family match without callers listing every name. Combines with the other filters as an AND.'+ ),search: zod.string().optional().describe('Case-insensitive substring match against report title and summary.'),source_id: zod.string()diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex a2d31844093f..f2dc42d7b69d 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -234,6 +234,7 @@ const inboxReportsList = (): ToolBase<ordering: params.ordering,priority: params.priority,scout: params.scout,+ scout_prefix: params.scout_prefix,search: params.search,source_id: params.source_id,source_product: params.source_product,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.jsonindex 062de0cf0cf4..612e4b2f65d4 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json@@ -29,6 +29,10 @@"description": "Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.","type": "string"},+ "scout_prefix": {+ "description": "Scout skill_name prefix (e.g. signals-scout-customer-analytics). Reports are kept if at least one of their contributing signals was authored by a scout whose skill_name starts with this prefix — new scouts in the family match without callers listing every name. Combines with the other filters as an AND.",+ "type": "string"+ },"search": {"description": "Case-insensitive substring match against report title and summary.","type": "string"