: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): split the source roster from an add-source catalog (#120277)
Georgiy Tarasove617b1ee4ad5
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 01a837404746..e9efae9a2131 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11803,9 +11803,9 @@ snapshots:scenes-app-inbox-scene--self-driving-verdict-pending--light:hash: v1.k794b7964.96cdbec6c78e8daedb06be4a0134093efcd5838af69e6e7d1722a3892cf561b5.iJ2K0zNhOVgGAPY6JvduyhDBODMwk-CN7_mAdB8scOgscenes-app-inbox-scene--settings--dark:- hash: v1.k794b7964.52d81f722ccc8fc12dc4e1ece8b13cca661e3d3a22a10ee8cf4f3871f34668f8.JaD8yGUxLagreQTpOp6jncQCASQKMaJf7leX4zsHjhs+ hash: v1.k794b7964.612c957c2cd6be3aacf8474108905309288515d8b9df4b55349af9cc46bd8db1.a8ySvmj0vf7FuB26LbmFYbJAm9h7B_6MDAM1pDxLKBQscenes-app-inbox-scene--settings--light:- hash: v1.k794b7964.cc5ebdb49fe55e8235abed358864fa709477ed205573f3acc4ba69793c89d4bc.3xzgbaW2S1L64r2Nv_AYHM7Je518NO07QFuVovW_OMc+ hash: v1.k794b7964.8f37c5b61160f9dff684aa6a1118005f609297319e926ab1d6adac8ffa811a1d.vX6fnQvxLtMMrSAm-dDjuRRwN2AL-nZQdw1J5UXzbnEscenes-app-inbox-scene--triage--dark:hash: v1.k794b7964.77e43b36fdcd81befecf4de80e489050f525840924ec6ddef37c23a9179dbe8a.B3qkZFYBncFaPn2EBg4cBoYu_LIwW29imNwBdLXF5eoscenes-app-inbox-scene--triage--light:@@ -12391,49 +12391,57 @@ snapshots:scenes-app-inbox-signal-cards--ticket-without-number--light:hash: v1.k794b7964.015ae3204d23d033c3a0b131e352122cbc3cfa019f66f8f230f059b100f8f2cc.ZMT3pKT2QFcOr116n_hOXdGWTMc0uwzvvfj8DVcWurMscenes-app-inbox-signalsourcespanel--armed-but-products-off--dark:- hash: v1.k794b7964.a2d8944eafde369e4f74f333c72585bfb11d763241ec6a04473e6b282c5b5101.fc7VWo5ALpSnQtFiSmxpw2CZ7CAvPKyeq7lMW87_fjs+ hash: v1.k794b7964.d9e1c2afb6f581f8b4c52431419f301a9ede3ace72af3c68833446a82e60a878.19TmWp9UJVMxXizkSUzcHxmGrFkTyXBwEmkxgs_rtPAscenes-app-inbox-signalsourcespanel--armed-but-products-off--light:- hash: v1.k794b7964.6bf07beb9a23edf5bca224e7fdec697a3593997141e892c4daa167ec0ceceb08.Bd2R_54n7smhx_z0WCWfHzKxgXb5h-dVCKcnX7QVqgc+ hash: v1.k794b7964.c58c22bdf4320e2f5f5745ad2748bd8ee5f44a64ad9ad11dd59f4eb53ded1155.WtmvAHN3f0h7s6wBQeoeku7KZX1E9qtZOV5nRwSwaOIscenes-app-inbox-signalsourcespanel--arming-blocked--dark:- hash: v1.k794b7964.c519fc552e2370530c5e6fd3cea466db39a1fdb54495dfb45413b54c1570e80d.35JQHa2gDM0pivHe5qEabIQauiYtEidAxXiRqddO42I+ hash: v1.k794b7964.1940ec0e00f18c0d9f69897f9653c85d4d91e8cb0529f0d01383adf4eaaef1fc.mmO8Ex3cycW_9Yuec9rKYO6VcCcuJM_hTGzY0VIActUscenes-app-inbox-signalsourcespanel--arming-blocked--light:- hash: v1.k794b7964.61a4335bf80c2c71b08648f2cd22cca1f6a2273e11f387f488a02dc4c9c69d87.1FRm7F9fkXyIMeND4qL1fcedTw56JDKJoq2sFLHJVKg+ hash: v1.k794b7964.44f5e8776f4772718f5e48859612f5b3755bb2d983b683faadc4663b8f699862.NMhn6QkLpktRDDw3BQB_RiAMbxRhp6bZjoWdqeferb0scenes-app-inbox-signalsourcespanel--error-tracking-expanded--dark:- hash: v1.k794b7964.e76f849397b585435cb5c86079df492c3bc82eea9f72b94a105f2e64d63b12a2.fL6UtIc12THgb27_GBFws5GNEBby9x61_D4tgfP_ApA+ hash: v1.k794b7964.7dde345e874d3bdbebe9771dafea12cd7e864725a82dcc3c0f316795d12c9d50.K9IoHt3jSnBEahbNFu0N2tZywxb1C5pof73cNr8l3UEscenes-app-inbox-signalsourcespanel--error-tracking-expanded--light:- hash: v1.k794b7964.94aa8d254893b653a61eaea44ef060889b109a669f14f79418f80d9132ced7e3.YiTAqW3coJllwVaTalTfhBrujz30GuRVOAW_4deFLtA+ hash: v1.k794b7964.bc2f68514bc26966b8b79cd8a31d7258099dee2b591ec8837b081395c5c5d0ef.QQbW6kVDyzyuE1fYGYHsG0s-09hNK_qyzpa35jScxYMscenes-app-inbox-signalsourcespanel--event-definitions-unavailable--dark:- hash: v1.k794b7964.273ede1dee351b8264df23cea084c64c8651c6f898ba5e7498dfacb1dad3437b.NYfsLiQoQqnTRmLcV3CkrEQBN54UuQb05Z97nFqcyAY+ hash: v1.k794b7964.b98d54eded5a8ed6ac21341da9a289bea6a0271dedd4c1c73561a970b434896e.P0rfnaWExtCCXG3N9pmVfUIQqhw19hCFK9iVd_KrRoIscenes-app-inbox-signalsourcespanel--event-definitions-unavailable--light:- hash: v1.k794b7964.a7feb1dc5040d392d657ed9e594ba944336ec8beaacef25f1ff49e0bb9d99d2d.Fi9lg22eJupE_UhaHaEJEh6uuvQ7gkYNtX6dDFYG7-o+ hash: v1.k794b7964.72e096179ea9a037671e0cdbf8cc12b35c0ca67d9080b7a7b4a3c8f58392770c.I-GXCnNUh2ZRmBJvnGYuMa7FqhTe0t8sD4vqghYN_mcscenes-app-inbox-signalsourcespanel--everything-healthy--dark:- hash: v1.k794b7964.6ef617f8bfa18c724d7242c91624a54e04c6619bda590227f5a75c49b339f71c.nP7WNiRJPNR5tPxH1cB8olCyfY9KCpOhUM8lFehxqQs+ hash: v1.k794b7964.c34f61a0c04f89820537b1bf5498a7f238a113506efc75ce33a88f4fa941ae81.mX71hzhWonRB1u71FX2hrkU4rJ8l3bnZo07w3NAaWbcscenes-app-inbox-signalsourcespanel--everything-healthy--light:- hash: v1.k794b7964.0c4877da14c3517951fbff381331a330f2a3209f785f031a089f7bd3e0c9abc2._Vg9h8cPRrZlDuI3nbl3J6kY0VoOoYBu7HBRskpYntM+ hash: v1.k794b7964.4295ef3035ff47a0427900b19b3dfd7d9cdc7742eb59ba9a6e4c26fd25396df4.3UQqYdePooSWMuZG10Kj8Zjuc-hQLUSCn68St2BHNfYscenes-app-inbox-signalsourcespanel--external-sources-connected--dark:- hash: v1.k794b7964.6edd9deeccf0f0d829b5f765420f0dc83eded4480a42329b92af3d9a75725f00.C8_ZdyXc7FqU_x1cp3ns-KBL37uaGuzGIN5oFGEqTgk+ hash: v1.k794b7964.8484a7ec658e1b397c8289a1b3f5c2e30d188b534274fc36b2f7e24bc0cf338b.LafX61fiDOHPQKLwS2KV6DSJeVa4TRHBRWe3ql530xUscenes-app-inbox-signalsourcespanel--external-sources-connected--light:- hash: v1.k794b7964.ccc6b40bb4f682e7cf2924dd746b42bf096584fac7316d16d511f924a31a951e.5kdFKoS4IkFG3g-45HETGeAJ9ixO40TCbA6cwM5BmNY+ hash: v1.k794b7964.0dd2ea8c18149d0034f469c4a7213c42e5b11f5e113fd82e5e144a1270462df9.d7yUMu-2-FeG6QV6fyB9aX7QFFeaHbdVL0wZWzuPM2cscenes-app-inbox-signalsourcespanel--playground--dark:- hash: v1.k794b7964.9aaf9cb181bfb2ec3f099088207ca81630350771c95d932e45d758f8d365fede.ahDmXEv2LABmsxZhn_ceaeofqsv-P7pX_2FS5MaELqs+ hash: v1.k794b7964.105ae0aa2757615d0382ed469bf144c50cddd7ce4a3cda18f30a0722b371e6fe.M73GXlC31bXcY0KxKIMmUoxXb9NgzYTKwUBpS_kxdMUscenes-app-inbox-signalsourcespanel--playground--light:- hash: v1.k794b7964.3ab39f6b9d00f603893a14d91acdeaf47025e0e2a1e03868e9330c1c550cf790.dg3vO2ihMZwM2ipjBCrIx9KTEgkN09lKBliMzoAmzLo+ hash: v1.k794b7964.b17a619d4c5f4991ac6c39de9a7058181f2c6b1dbd1a08d72282fc196d0b1643.aFOD39BqPd7z2E0o5LcO0QuH-u_y5Eo9eC5vXHRt6J8scenes-app-inbox-signalsourcespanel--products-on-no-recent-data--dark:- hash: v1.k794b7964.bfdb2db6f5d65762866c02d84e107baf47a192767b5c8dc4ed0a9db9ae3beaea.f_FbqaOlTxwPY3bmb4moLlwe_vHG6eOuQqdI0BiKCq8+ hash: v1.k794b7964.f7e2b82fc929c83d24de2615c4c5fee6ba4f1588a95fd2c59258b452029222b7.tjwKh7VLzhwMkw9qNTl5DowACTnugEW2xTr8cTxqT0cscenes-app-inbox-signalsourcespanel--products-on-no-recent-data--light:- hash: v1.k794b7964.ca0ebcb9705fb2514354c5a123e1805fa7d835df6406a49d927f4f176b5c7d9c.pTyxAFumNP6k9F4IvLGO5S5geNWsgKqNFPhrWYanaAw+ hash: v1.k794b7964.1b9f6d3818076c1c4e4ad45d61af019739d80a4d2abd09d3f0c7b30485b1e114.OADuXVe7AHjh2hpmzW04hqOO5s0QPDlP7Jy_CdxVSZ8scenes-app-inbox-signalsourcespanel--replay-vision-expanded--dark:- hash: v1.k794b7964.7c7f614c4974c75ea013e3532574cb64bff8b3f4ca26958333f185f7252f35f5.Mhg8AjKNmM34ybAJKlJDa5UKw2r0xw3whkigxPemnDo+ hash: v1.k794b7964.511e08623fcced57d221aefdae525351f176705e7fb05c7055ccb0c9a4e8cbbf.EdKWKqrddDSF9D5I-GchSL46n37W2YgsosAmidGN1Z8scenes-app-inbox-signalsourcespanel--replay-vision-expanded--light:- hash: v1.k794b7964.943bcbebc067a2aac2c5d11750b427413af119fce7fcf4f7465d86d067a1f888.4uYLX-DhLeEBjEXK9fjYK-vHt_88kMD17ycJffEnHSg+ hash: v1.k794b7964.492798d45d4b94b51562e0a1387ff4a4722046dcdf3079ad1b252e85aa31f217.Yh9JG6ocJT9Nsvl01aT1xWuBm2KQoedqk5UfYuedYSQscenes-app-inbox-signalsourcespanel--server-side-exceptions-only--dark:- hash: v1.k794b7964.9aaf9cb181bfb2ec3f099088207ca81630350771c95d932e45d758f8d365fede.xNsez_XmTmSXWBlDoHskgvpJv9DeTQ-9JlYgmzk_llw+ hash: v1.k794b7964.105ae0aa2757615d0382ed469bf144c50cddd7ce4a3cda18f30a0722b371e6fe.rW1i1pQTYXfhcI4jbV4L1SwTnDrV0dKRKIA9CpbKAH0scenes-app-inbox-signalsourcespanel--server-side-exceptions-only--light:- hash: v1.k794b7964.3ab39f6b9d00f603893a14d91acdeaf47025e0e2a1e03868e9330c1c550cf790.xulkXtkahCopLOdirr15K8PSIFjcIARiT1dNfLDXomQ+ hash: v1.k794b7964.b17a619d4c5f4991ac6c39de9a7058181f2c6b1dbd1a08d72282fc196d0b1643.iiyP7ijQDhrG7Lhzf5qnyzBL1NZ846qpyVx-N1umb3U+ scenes-app-inbox-signalsourcespanel--source-catalog-connect-step--dark:+ hash: v1.k794b7964.a2450493dcc246c5364fadecbc076f8a6431fa3cb54a24ce8a43f0035755b3ee.-SefbiFHh2vb_iXB1G3qGt44u-4xuonKH1IKJTLRakg+ scenes-app-inbox-signalsourcespanel--source-catalog-connect-step--light:+ hash: v1.k794b7964.28e1842012dfa855088912c8bed000371f0f09b715e9262140d07cd8e881abc4.2oNwX1CeRfidWC1ENlOQQRvuM_6cBG6R5ALLO_gYJc4+ scenes-app-inbox-signalsourcespanel--source-catalog-open--dark:+ hash: v1.k794b7964.2d397ce4347aadd97b4e2baad327b921c7c2010cc88dc4e11508806a405c5d78.wyrvp4I9i9p7m_VrTSj3TZdRouB8Zmp9q9mrgq1u4dw+ scenes-app-inbox-signalsourcespanel--source-catalog-open--light:+ hash: v1.k794b7964.6e91eac66df908a8a883f0dc2d26050f2f3f7e79ecd712a21127d86075275255.IHGjK77PkD_0Xlg1WNkBwLfqnR5MLpDn-04Coq5yNM8scenes-app-inbox-signalsourcespanel--source-configs-unavailable--dark:- hash: v1.k794b7964.eea094aa8cee2f15d923c99989991659aed0fc7a4bc272d6e0dea194a642a995.XZOrtI7rF_42vfigRqB4PH2fcbw1IAsF9J1ETxdivlU+ hash: v1.k794b7964.92b8f268a6960dcae3191f35a90160ae2170c0f03e004fdc28952c0a904cc7fa.79B_OJa_MZq3NEfccSPuVfy1vWDdhkgqZ5tikDAJGwMscenes-app-inbox-signalsourcespanel--source-configs-unavailable--light:- hash: v1.k794b7964.ef9523ad30862e00a3a47e565bf6427f9728fe6de067add1157c7b7a83ef301f.XD6Xg94vD1nlIXeO6gCWpXsHPp2-TjQnF2x3OacnYr8+ hash: v1.k794b7964.676f807c36752746f961938e31ba18b296067a6987b9adc2e9f91e4d94402ccf.jmRK6LLUX-xyeplh2X3mdIcJJCflVuLr41fhAER3uI0scenes-app-inbox-slacknotificationssection--awaiting-target--dark:hash: v1.k794b7964.45b41fad1dd8b6146ff7465279bf86d9e32f5447d189a1c54f687a6d729ee1fc._HO_rqQTGcO42B-T57VXA3yJ8kNYSWXBP-VFz8iS690scenes-app-inbox-slacknotificationssection--awaiting-target--light:diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b023a5bbf453..65d0b81f0b12 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -4994,9 +4994,6 @@ importers:react:specifier: 18.3.1version: 18.3.1- react-window:- specifier: '*'devDependencies:'@testing-library/react':specifier: ^14.3.1diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsxindex 3e205816be26..af546a42911d 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx@@ -23,6 +23,25 @@ const SCANNERS = Array.from({ length: 10 }, (_, index) => ({const EMPTY_LIST = { count: 0, next: null, previous: null, results: [] }+const GITLAB_WIZARD_CONFIG = {+ name: 'GitLab',+ label: 'GitLab',+ iconPath: '/static/services/gitlab.svg',+ caption: null,+ supportsColumnSelection: false,+ versions: [],+ defaultVersion: '',+ deprecatedVersions: [],+ fields: [{ name: 'personal_access_token', label: 'Personal access token', type: 'password', required: true }],+}++const JIRA_SOURCE = {+ id: 'source-jira',+ source_type: 'Jira',+ status: 'Completed',+ schemas: [{ id: 'schema-jira', name: 'issues', should_sync: true, sync_type: 'full_refresh' }],+}+describe('AgentsRoster', () => {beforeEach(() => {initKeaTests()@@ -35,6 +54,7 @@ describe('AgentsRoster', () => {],'/api/projects/:team_id/event_definitions/': () => [200, EMPTY_LIST],'/api/environments/:team_id/external_data_sources/': () => [200, EMPTY_LIST],+ '/api/projects/:team_id/external_data_sources/wizard/': () => [200, { GitLab: GITLAB_WIZARD_CONFIG }],},})// The roster only loads its sources behind this flag, so without it every list stays empty.@@ -45,18 +65,38 @@ describe('AgentsRoster', () => {})afterEach(cleanup)- it('renders a window of external sources and finds an unmounted source through search', async () => {+ // The roster lists what the project runs; the other forty tools wait in the catalog. A regression+ // that lists the whole registry again, or loses a connected tool from the roster, fails here.+ it('lists only connected external sources, and reaches the rest through the catalog', async () => {+ useMocks({+ get: {+ '/api/environments/:team_id/external_data_sources/': () => [+ 200,+ { count: 1, next: null, previous: null, results: [JIRA_SOURCE] },+ ],+ },+ })render(<AgentsRoster />)+ signalSourcesLogic.actions.loadSources()- expect(await screen.findByText('GitHub issues')).toBeInTheDocument()- await userEvent.click(screen.getAllByLabelText('Expand GitHub issues')[0])- expect(screen.getByText('Reads the GitHub issues data you sync to Data warehouse.')).toBeInTheDocument()- expect(screen.queryByText('GitLab')).not.toBeInTheDocument()-- await userEvent.type(screen.getByLabelText('Search external sources'), 'GitLab')-- expect(await screen.findByText('GitLab')).toBeInTheDocument()- expect(screen.getByLabelText('Arm Support')).toBeInTheDocument()+ const jiraToggle = await screen.findByLabelText('Turn on Jira')+ expect(jiraToggle.closest('[data-attr="signal-source-row"]')).toHaveAttribute('data-source', 'jira')+ expect(document.querySelector('[data-attr="signal-source-row"][data-source="github"]')).toBeNull()++ await userEvent.click(screen.getByText('Add source'))+ expect(await screen.findByText('Add a source')).toBeInTheDocument()+ const jiraTile = (): Element | null =>+ document.querySelector('[data-attr="signal-source-catalog-tile"][data-source="jira"]')+ expect(jiraTile()).toBeInTheDocument()+ await userEvent.type(screen.getByLabelText('Search sources'), 'GitLab')+ expect(jiraTile()).toBeNull()++ await userEvent.click(await screen.findByLabelText('Connect GitLab'))+ expect(signalSourcesLogic.values.dataSourceSetupSource).toBe('gitlab')+ expect(await screen.findByText('Connect GitLab')).toBeInTheDocument()+ await userEvent.click(screen.getByText('All sources'))+ expect(signalSourcesLogic.values.dataSourceSetupSource).toBeNull()+ expect(await screen.findByText('Add a source')).toBeInTheDocument()})it('lets a connection retry finish before another retry can start', async () => {@@ -105,8 +145,8 @@ describe('AgentsRoster', () => {})// A failed load leaves every switch reading off and every import source reading unconnected.- // A click then creates a row that may already exist, so the switches have to stay shut.- it('holds the source switches shut while the source list has failed to load', async () => {+ // A click then creates a row that may already exist, so the switches and tiles have to stay shut.+ it('holds the source switches and catalog tiles shut while the source list has failed to load', async () => {useMocks({get: {'/api/projects/:team_id/signals/source_configs/': () => [500, { detail: 'Server error' }],@@ -117,11 +157,11 @@ describe('AgentsRoster', () => {expect(await screen.findByText(/Couldn't load your signal sources/)).toBeInTheDocument()expect(screen.getByLabelText('Arm Support')).toBeDisabled()- await userEvent.type(screen.getByLabelText('Search external sources'), 'GitHub issues')- const githubButton = await screen.findByLabelText('Turn on GitHub issues')- expect(githubButton).toHaveAttribute('aria-disabled', 'true')- await userEvent.click(githubButton)+ await userEvent.click(screen.getByText('Add source'))+ await screen.findByText('Add a source')+ await userEvent.type(screen.getByLabelText('Search sources'), 'GitHub issues')+ expect(await screen.findByText('GitHub issues')).toBeInTheDocument()+ expect(screen.queryByLabelText('Connect GitHub issues')).not.toBeInTheDocument()expect(signalSourcesLogic.values.dataSourceSetupSource).toBeNull()- expect(screen.queryByText('Connect')).not.toBeInTheDocument()})})diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsxindex 49525bba511a..d2031250e8e7 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx@@ -7,7 +7,6 @@ import {LemonButton,LemonInput,LemonSkeleton,- LemonSelect,LemonSwitch,LemonTag,Link,@@ -23,11 +22,11 @@ import { sourceSteeringIsSet } from '../../logics/sourceSteeringModalLogic'import { signalSourcesLogic } from '../../signalSourcesLogic'import type { SourceProductDataStatus, SourceProductStatus } from '../../signalSourcesLogic'import { SignalSourceConfig, SignalSourceConfigStatus, SignalSourceType, linearTeamIdsFromConfig } from '../../types'-import { getSourceProductMeta } from '../badges/sourceProductIcons'import { AGENT_ROSTER_GROUPS, AgentRosterDefinition, AgentRosterGroup, AgentRosterSource } from './agentRosterMeta'import { LinearTeamsModal } from './LinearTeamsModal'+import { SourceAgentIcon } from './SourceAgentIcon'+import { SourceCatalogModal } from './SourceCatalogModal'import { SourceSteeringModal } from './SourceSteeringModal'-import { VirtualizedSourceList } from './VirtualizedSourceList'type AgentRosterStatus = 'standby' | 'watching' | 'syncing' | 'sync_failed'@@ -134,15 +133,6 @@ const SOURCES_WITHOUT_CONFIG_ROWS: ReadonlySet<AgentRosterSource> = new Set(['reconst SOURCE_CONFIGS_LOADING_REASON = 'Loading your signal sources'const SOURCE_CONFIGS_FAILED_REASON = "Couldn't load your signal sources. Select Retry above to try again."-function AgentIcon({ source }: { source: AgentRosterDefinition }): JSX.Element | null {- const meta = getSourceProductMeta(source.sourceProduct)- if (!meta?.Icon) {- return null- }- const Icon = meta.Icon- return <Icon className={`shrink-0 text-base ${meta.colorClass}`} />-}-/** Only the states worth interrupting a scan for. Everything healthy shows no tag at all. */function notableTag(status: AgentRosterStatus,@@ -517,7 +507,7 @@ const AgentRow = memo(function AgentRow({aria-label={`${expanded ? 'Collapse' : 'Expand'} ${agent.label}`}data-attr="signal-source-expand">- <AgentIcon source={agent} />+ <SourceAgentIcon agent={agent} /><div className="flex min-w-0 flex-1 flex-col"><div className="flex items-center gap-2"><span@@ -536,8 +526,9 @@ const AgentRow = memo(function AgentRow({</LemonTag>)}</div>- <span className="truncate text-xs leading-4 text-muted">{agent.watches}</span>- {agent.category && <span className="truncate text-xs text-muted">{agent.category}</span>}+ <span className="truncate text-xs leading-4 text-muted">+ {agent.category ? `${agent.category} · ${agent.watches}` : agent.watches}+ </span></div></button>{tag && (@@ -620,10 +611,7 @@ function AgentRosterGroupHeader({ group }: { group: AgentRosterGroup }): JSX.Eleexport function AgentsRoster(): JSX.Element {const {externalSourceStates,- filteredRosterGroups,- sourceSearchQuery,- sourceCategory,- sourceCategoryOptions,+ rosterGroups,sourcesLoadError,dataWarehouseSourcesLoading,conversationsConfig,@@ -653,8 +641,7 @@ export function AgentsRoster(): JSX.Element {linearTeamsPicker,} = useValues(signalSourcesLogic)const {- setSourceSearchQuery,- setSourceCategory,+ openSourceCatalog,loadSources,openLinearTeamsPicker,closeLinearTeamsPicker,@@ -978,44 +965,35 @@ export function AgentsRoster(): JSX.Element {</LemonBanner>)}- {filteredRosterGroups.map((group) => (+ {rosterGroups.map((group) => (<div key={group.label} className="flex flex-col gap-2 pt-2">- <AgentRosterGroupHeader group={group} />- {group.id === 'external' && (- <div className="flex flex-wrap items-center gap-2 py-2">- <LemonInput- type="search"- value={sourceSearchQuery}- onChange={setSourceSearchQuery}- placeholder="Search sources"- aria-label="Search external sources"- data-attr="signal-sources-search"- className="min-w-40 flex-1"- fullWidth- />- <LemonSelect- value={sourceCategory}- onChange={setSourceCategory}- options={sourceCategoryOptions}- data-attr="signal-sources-category"- />- </div>- )}- {group.agents.length === 0 && (- <LemonBanner type="info">- No sources match your search. Try another name or category.- </LemonBanner>- )}- <div className="-mx-2 divide-y divide-primary">- {group.id === 'external' ? (- <VirtualizedSourceList sources={group.agents} renderSource={renderAgent} />- ) : (- group.agents.map(renderAgent)+ <div className="flex items-center justify-between gap-2">+ <AgentRosterGroupHeader group={group} />+ {group.id === 'external' && (+ <LemonButton+ type="secondary"+ size="xsmall"+ icon={<IconPlus />}+ onClick={openSourceCatalog}+ data-attr="signal-source-catalog-open"+ >+ Add source+ </LemonButton>)}</div>+ {group.id === 'external' && group.agents.length === 0 ? (+ <p className="mb-0 rounded border border-dashed border-primary px-3 py-2.5 text-xs text-secondary">+ No external sources yet. Add one to let agents read the issues, tickets, and feedback in the+ tools you already use.+ </p>+ ) : (+ <div className="-mx-2 divide-y divide-primary">{group.agents.map(renderAgent)}</div>+ )}</div>))}+ <SourceCatalogModal />+{linearTeamsPicker && (<LinearTeamsModalconfig={linearIssuesConfig}diff --git a/products/signals/frontend/inbox/components/config/AgentsTab.tsx b/products/signals/frontend/inbox/components/config/AgentsTab.tsxindex 8467ba0e3644..249402df25bf 100644--- a/products/signals/frontend/inbox/components/config/AgentsTab.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsTab.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { useEffect } from 'react'-import { IconArrowLeft, IconCompass } from '@posthog/icons'+import { IconCompass } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'import { FEATURE_FLAGS } from 'lib/constants'@@ -12,7 +12,6 @@ import { scoutFleetLogic } from '../../logics/scoutFleetLogic'import { signalSourcesLogic } from '../../signalSourcesLogic'import { AgentsRoster } from './AgentsRoster'import { ConnectionsSection } from './ConnectionsSection'-import { DataSourceSetup } from './DataSourceSetup'import { SlackNotificationsSection } from './SlackNotificationsSection'function Subsection({@@ -59,25 +58,14 @@ function ScoutsSubsectionLink(): JSX.Element {)}-function BackLink({ onClick }: { onClick: () => void }): JSX.Element {- return (- <LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} onClick={onClick} className="-ml-2 w-fit">- Back- </LemonButton>- )-}-/*** Full-page Agents tab body for cloud Inbox – a high-fidelity port of the* PostHog Desktop Agents view. Composes Connections, the agent roster,- * Slack, and MCP servers. Session-analysis and data-source setup- * render inline (replacing the roster) when their sub-flow is open.+ * Slack, and MCP servers. Adding a source opens the catalog modal from the roster.*/export function AgentsTab(): JSX.Element {- const { dataSourceSetupSource } = useValues(signalSourcesLogic)const { featureFlags } = useValues(featureFlagLogic)- const { loadSources, loadSourceConfigs, loadProductDataEvents, closeDataSourceSetup, onDataSourceSetupComplete } =- useActions(signalSourcesLogic)+ const { loadSources, loadSourceConfigs, loadProductDataEvents } = useActions(signalSourcesLogic)useEffect(() => {loadSources()@@ -85,18 +73,6 @@ export function AgentsTab(): JSX.Element {loadProductDataEvents()}, []) // eslint-disable-line react-hooks/exhaustive-deps- let agentsBody: JSX.Element- if (dataSourceSetupSource !== null) {- agentsBody = (- <div className="flex flex-col gap-3">- <BackLink onClick={closeDataSourceSetup} />- <DataSourceSetup source={dataSourceSetupSource} onComplete={() => onDataSourceSetupComplete()} />- </div>- )- } else {- agentsBody = <AgentsRoster />- }-return (<div className="flex flex-col"><div className="mx-auto max-w-4xl w-full px-6 py-6 flex flex-col gap-8">@@ -118,7 +94,7 @@ export function AgentsTab(): JSX.Element {title="Signal sources"description="Each source watches for signals, and spins up an agent to look into them.">- {agentsBody}+ <AgentsRoster /></Subsection>{featureFlags[FEATURE_FLAGS.INBOX_SLACK_NOTIFICATIONS] && (diff --git a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsxindex 6802b7721ab3..a36a14e2d121 100644--- a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx+++ b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx@@ -19,12 +19,14 @@ export function DataSourceSetup({onCancel,completing = false,oauthRedirectUrl,+ cancelLabel = 'Back to signals',}: {source: WarehouseBackedSourceonComplete: () => voidonCancel?: () => voidcompleting?: booleanoauthRedirectUrl?: string+ cancelLabel?: string}): JSX.Element {const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)const { load } = useActions(availableSourcesLogic)@@ -38,7 +40,7 @@ export function DataSourceSetup({<div className="space-y-4">{onCancel && (<LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} onClick={onCancel}>- Back to signals+ {cancelLabel}</LemonButton>)}{availableSourcesLoading ? (@@ -66,7 +68,12 @@ export function DataSourceSetup({oauthRedirectUrl,}}>- <DataSourceSetupForm sourceConfig={sourceConfig} onCancel={onCancel} completing={completing} />+ <DataSourceSetupForm+ sourceConfig={sourceConfig}+ onCancel={onCancel}+ cancelLabel={cancelLabel}+ completing={completing}+ /></BindLogic>)}@@ -74,10 +81,12 @@ export function DataSourceSetup({function DataSourceSetupForm({sourceConfig,onCancel,+ cancelLabel,completing,}: {sourceConfig: SourceConfigResponseApionCancel?: () => void+ cancelLabel: stringcompleting: boolean}): JSX.Element {const { isLoading, canGoNext } = useValues(sourceWizardLogic)@@ -97,7 +106,7 @@ function DataSourceSetupForm({onClick={onCancel}disabled={isLoading || completing}>- Back to signals+ {cancelLabel}</LemonButton>)}<div className="flex items-center gap-3">diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsxindex f26f3cfe8299..8698e064c9ba 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx@@ -440,6 +440,24 @@ export const ErrorTrackingExpanded: Story = {},}+/** Connected tools in the roster: GitHub on, Sentry failing, Jira synced but off. */export const ExternalSourcesConnected: Story = {args: { externalConnections: true },}++/** The add-source catalog: every external source by category, with status tags for the ones already in use. */+export const SourceCatalogOpen: Story = {+ args: { externalConnections: true },+ play: async ({ canvasElement }) => {+ await userEvent.click(await within(canvasElement).findByText('Add source', { exact: true }))+ },+}++/** The connect step inside the catalog, reached by picking a source that is not synced yet. */+export const SourceCatalogConnectStep: Story = {+ args: { externalConnections: true },+ play: async ({ canvasElement }) => {+ await userEvent.click(await within(canvasElement).findByText('Add source', { exact: true }))+ await userEvent.click(await within(document.body).findByLabelText('Connect GitLab'))+ },+}diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsxindex f18bba247ec6..139c29321734 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx@@ -1,37 +1,16 @@-import { useActions, useValues } from 'kea'+import { useActions } from 'kea'import { useEffect } from 'react'-import { IconArrowLeft } from '@posthog/icons'-import { LemonButton } from '@posthog/lemon-ui'-import { signalSourcesLogic } from '../../signalSourcesLogic'import { AgentsRoster } from './AgentsRoster'-import { DataSourceSetup } from './DataSourceSetup'--function BackLink({ onClick }: { onClick: () => void }): JSX.Element {- return (- <LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} onClick={onClick} className="-ml-2 w-fit">- Back- </LemonButton>- )-}/*** Signal sources management: the per-source roster (each source watches for signals and- * spins up an agent to look into them), plus the session-analysis and data-source setup- * sub-flows that render inline (replacing the roster) when their flow is open. Hosted in- * the Signal sources setup modal.+ * spins up an agent to look into them). Adding a source opens the catalog modal from the+ * roster. Hosted in the Signal sources setup modal and the Settings tab.*/export function SignalSourcesPanel(): JSX.Element {- const { dataSourceSetupSource, dataSourceSetupOAuthRedirectUrl } = useValues(signalSourcesLogic)- const {- loadSources,- loadSourceConfigs,- loadVisionScanners,- loadProductDataEvents,- closeDataSourceSetup,- onDataSourceSetupComplete,- } = useActions(signalSourcesLogic)+ const { loadSources, loadSourceConfigs, loadVisionScanners, loadProductDataEvents } = useActions(signalSourcesLogic)useEffect(() => {loadSources()@@ -40,18 +19,5 @@ export function SignalSourcesPanel(): JSX.Element {loadProductDataEvents()}, []) // eslint-disable-line react-hooks/exhaustive-deps- if (dataSourceSetupSource !== null) {- return (- <div className="flex flex-col gap-3">- <BackLink onClick={closeDataSourceSetup} />- <DataSourceSetup- source={dataSourceSetupSource}- onComplete={() => onDataSourceSetupComplete()}- oauthRedirectUrl={dataSourceSetupOAuthRedirectUrl}- />- </div>- )- }-return <AgentsRoster />}diff --git a/products/signals/frontend/inbox/components/config/SourceAgentIcon.tsx b/products/signals/frontend/inbox/components/config/SourceAgentIcon.tsxnew file mode 100644index 000000000000..4c6d31bc02a3--- /dev/null+++ b/products/signals/frontend/inbox/components/config/SourceAgentIcon.tsx@@ -0,0 +1,35 @@+import { useValues } from 'kea'++import { availableSourcesLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/availableSourcesLogic'+import { SourceIcon } from 'products/data_warehouse/frontend/shared/components/SourceIcon'++import { WAREHOUSE_SOURCE_SETUP, WarehouseBackedSource } from '../../signalSourcesLogic'+import { getSourceProductMeta } from '../badges/sourceProductIcons'+import { AgentRosterDefinition } from './agentRosterMeta'++const SIZES = {+ small: { px: 16, className: 'text-base' },+ medium: { px: 24, className: 'text-2xl' },+} as const++export function SourceAgentIcon({+ agent,+ size = 'small',+}: {+ agent: AgentRosterDefinition+ size?: keyof typeof SIZES+}): JSX.Element | null {+ const { availableSources } = useValues(availableSourcesLogic)+ const warehouseSetup = Object.hasOwn(WAREHOUSE_SOURCE_SETUP, agent.source)+ ? WAREHOUSE_SOURCE_SETUP[agent.source as WarehouseBackedSource]+ : null+ if (warehouseSetup && availableSources?.[warehouseSetup.dwSourceType]?.iconPath) {+ return <SourceIcon type={warehouseSetup.dwSourceType} sizePx={SIZES[size].px} disableTooltip />+ }+ const meta = getSourceProductMeta(agent.sourceProduct)+ if (!meta?.Icon) {+ return null+ }+ const Icon = meta.Icon+ return <Icon className={`shrink-0 ${SIZES[size].className} ${meta.colorClass}`} />+}diff --git a/products/signals/frontend/inbox/components/config/SourceCatalogModal.tsx b/products/signals/frontend/inbox/components/config/SourceCatalogModal.tsxnew file mode 100644index 000000000000..e34af7dc9533--- /dev/null+++ b/products/signals/frontend/inbox/components/config/SourceCatalogModal.tsx@@ -0,0 +1,197 @@+import { useActions, useValues } from 'kea'++import { LemonBanner, LemonInput, LemonModal, LemonSelect, LemonTag, Spinner } from '@posthog/lemon-ui'++import { Tooltip } from 'lib/lemon-ui/Tooltip'++import { SourceCatalogItem, WarehouseBackedSource, signalSourcesLogic } from '../../signalSourcesLogic'+import { DataSourceSetup } from './DataSourceSetup'+import { SourceAgentIcon } from './SourceAgentIcon'++const TILE_CLASS =+ 'flex min-h-20 items-start gap-3 rounded border border-primary bg-surface-primary p-3 text-left font-[inherit] text-default'++function tileDisabledReason(item: SourceCatalogItem): string | undefined {+ if (item.blockedReason) {+ return item.blockedReason+ }+ if (item.enabled) {+ return 'Already on. Manage it from the roster.'+ }+ if (item.loading) {+ return 'Saving'+ }+ return undefined+}++function SourceTile({+ item,+ onSelect,+}: {+ item: SourceCatalogItem+ onSelect: (source: WarehouseBackedSource) => void+}): JSX.Element {+ const disabledReason = tileDisabledReason(item)+ const tag = item.enabled+ ? { label: 'On', type: 'success' as const }+ : item.syncFailed+ ? { label: 'Sync failed', type: 'danger' as const }+ : item.connected+ ? { label: 'Synced', type: 'completion' as const }+ : null+ const content = (+ <>+ <div className="mt-0.5 shrink-0">+ <SourceAgentIcon agent={item.agent} size="medium" />+ </div>+ <div className="flex min-w-0 flex-1 flex-col gap-1">+ <div className="flex flex-wrap items-center gap-1.5">+ <span className="text-sm font-semibold leading-5">{item.agent.label}</span>+ {item.agent.alpha && (+ <LemonTag type="completion" size="small">+ Alpha+ </LemonTag>+ )}+ {tag && (+ <LemonTag type={tag.type} size="small">+ {tag.label}+ </LemonTag>+ )}+ </div>+ <span className="text-xs leading-4 text-secondary">{item.agent.watches}</span>+ </div>+ {item.loading && <Spinner className="text-base" />}+ </>+ )+ if (disabledReason) {+ return (+ <Tooltip title={disabledReason}>+ <div className={`${TILE_CLASS} cursor-not-allowed opacity-60`} aria-disabled>+ {content}+ </div>+ </Tooltip>+ )+ }+ return (+ <button+ type="button"+ className={`${TILE_CLASS} cursor-pointer hover:border-bold`}+ onClick={() => onSelect(item.agent.source as WarehouseBackedSource)}+ aria-label={`${item.connected ? 'Turn on' : 'Connect'} ${item.agent.label}`}+ data-attr="signal-source-catalog-tile"+ data-source={item.agent.source}+ >+ {content}+ </button>+ )+}++function catalogGroupSummary(items: SourceCatalogItem[]): string {+ const on = items.filter((item) => item.enabled).length+ if (on === 0) {+ return `${items.length} available`+ }+ return `${on} of ${items.length} on`+}++export function SourceCatalogModal(): JSX.Element {+ const {+ sourceCatalogOpen,+ sourceCatalog,+ sourceSearchQuery,+ sourceCategory,+ sourceCategoryOptions,+ externalSourceCount,+ dataSourceSetupSource,+ dataSourceSetupOAuthRedirectUrl,+ externalAgents,+ } = useValues(signalSourcesLogic)+ const {+ closeSourceCatalog,+ closeDataSourceSetup,+ onDataSourceSetupComplete,+ setSourceSearchQuery,+ setSourceCategory,+ selectCatalogSource,+ } = useActions(signalSourcesLogic)+ const setupAgent = dataSourceSetupSource+ ? externalAgents.find((agent) => agent.source === dataSourceSetupSource)+ : undefined++ return (+ <LemonModal+ isOpen={sourceCatalogOpen}+ onClose={closeSourceCatalog}+ width={760}+ title={setupAgent ? `Connect ${setupAgent.label}` : 'Add a source'}+ description={+ setupAgent ? (+ setupAgent.watches+ ) : (+ // The header never scrolls, so the search and the category filter live in it and stay+ // put while the grid scrolls underneath.+ <div className="flex flex-col gap-3">+ <p className="mb-0">+ Connect a tool you already use. Agents read it alongside your PostHog data, so a support+ ticket and the error behind it land in one report.+ </p>+ <div className="flex flex-wrap items-center gap-2">+ <LemonInput+ type="search"+ value={sourceSearchQuery}+ onChange={setSourceSearchQuery}+ placeholder={`Search ${externalSourceCount} sources`}+ aria-label="Search sources"+ data-attr="signal-sources-search"+ className="min-w-40 flex-1"+ fullWidth+ autoFocus+ />+ <LemonSelect+ value={sourceCategory}+ onChange={setSourceCategory}+ options={sourceCategoryOptions}+ data-attr="signal-sources-category"+ />+ </div>+ </div>+ )+ }+ >+ {dataSourceSetupSource ? (+ <DataSourceSetup+ source={dataSourceSetupSource}+ onComplete={() => onDataSourceSetupComplete()}+ onCancel={closeDataSourceSetup}+ cancelLabel="All sources"+ oauthRedirectUrl={dataSourceSetupOAuthRedirectUrl}+ />+ ) : (+ <div className="flex flex-col gap-4">+ {sourceCatalog.length === 0 && (+ <LemonBanner type="info">+ No sources match your search. Try another name or category.+ </LemonBanner>+ )}+ {sourceCatalog.map((group) => (+ <div key={group.category} className="flex flex-col gap-2">+ <div className="flex items-baseline justify-between gap-2">+ <h4 className="m-0 text-sm font-semibold">{group.category}</h4>+ <span className="text-xs text-secondary">{catalogGroupSummary(group.items)}</span>+ </div>+ <div className="grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-2">+ {group.items.map((item) => (+ <SourceTile+ key={item.agent.source}+ item={item}+ onSelect={(source) => selectCatalogSource(source, 'catalog')}+ />+ ))}+ </div>+ </div>+ ))}+ </div>+ )}+ </LemonModal>+ )+}diff --git a/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsx b/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsxdeleted file mode 100644index af057f64a7bd..000000000000--- a/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsx+++ /dev/null@@ -1,54 +0,0 @@-import type { ReactElement } from 'react'-import { List, RowComponentProps, useDynamicRowHeight } from 'react-window'--import type { AgentRosterDefinition } from './agentRosterMeta'--const DEFAULT_ROW_HEIGHT = 68-const MAX_LIST_HEIGHT = 384--interface VirtualizedSourceListProps {- sources: AgentRosterDefinition[]- renderSource: (source: AgentRosterDefinition) => ReactElement-}--function SourceRow({- ariaAttributes,- index,- style,- sources,- renderSource,-}: RowComponentProps<VirtualizedSourceListProps>): JSX.Element {- return (- <div- {...ariaAttributes}- style={style}- className={index < sources.length - 1 ? 'border-b border-primary' : undefined}- >- {renderSource(sources[index])}- </div>- )-}--export function VirtualizedSourceList({ sources, renderSource }: VirtualizedSourceListProps): JSX.Element {- const sourceIds = sources.map(({ source }) => source).join(',')- const rowHeight = useDynamicRowHeight({ defaultRowHeight: DEFAULT_ROW_HEIGHT, key: sourceIds })- const height = Math.min(- MAX_LIST_HEIGHT,- sources.reduce((total, _, index) => total + (rowHeight.getRowHeight(index) ?? DEFAULT_ROW_HEIGHT), 0)- )-- return (- <List- key={sourceIds}- aria-label="External sources"- data-attr="signal-sources-list"- defaultHeight={height}- style={{ height }}- rowComponent={SourceRow}- rowCount={sources.length}- rowHeight={rowHeight}- rowProps={{ sources, renderSource }}- overscanCount={2}- />- )-}diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.tsindex e4e75421cb9d..3087368d71ab 100644--- a/products/signals/frontend/inbox/inboxAnalytics.ts+++ b/products/signals/frontend/inbox/inboxAnalytics.ts@@ -57,6 +57,8 @@ export const INBOX_EVENTS = {SOURCE_TOGGLE_FAILED: 'Signal source toggle failed',SOURCE_CONFIGS_LOAD_FAILED: 'Signal source configs load failed',SOURCE_INTEREST: 'signals source interest',+ SOURCE_CATALOG_OPENED: 'Signal source catalog opened',+ SOURCE_CATALOG_SOURCE_SELECTED: 'Signal source catalog source selected',SOURCE_STEERING_CHANGED: 'Signal source steering changed',SOURCE_FILTERS_CHANGED: 'Signal source filters changed',// Scout-troop management. Names and property shapes match the desktop app one-for-one so both@@ -828,6 +830,20 @@ export function captureSignalSourceInterest(source: string): void {captureInboxEvent(INBOX_EVENTS.SOURCE_INTEREST, { source })}+export type SignalSourceCatalogOrigin = 'catalog'++/** The add-source catalog opened. Pairs with {@link captureSignalSourceConnected} to show how many opens end in a connection. */+export function captureSignalSourceCatalogOpened(params: { connectedCount: number }): void {+ captureInboxEvent(INBOX_EVENTS.SOURCE_CATALOG_OPENED, { connected_count: params.connectedCount })+}++export function captureSignalSourceCatalogSourceSelected(params: {+ source: string+ origin: SignalSourceCatalogOrigin+}): void {+ captureInboxEvent(INBOX_EVENTS.SOURCE_CATALOG_SOURCE_SELECTED, { source: params.source, origin: params.origin })+}+/*** A source's steering rules were saved. Carries only lengths and flags: the rules text names the* customer's own labels, projects, and workflows, so it never leaves their project. Fired once thediff --git a/products/signals/frontend/inbox/signalSourcesLogic.test.ts b/products/signals/frontend/inbox/signalSourcesLogic.test.tsindex 1b5c736462d0..febefec752e8 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.test.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.test.ts@@ -6,6 +6,8 @@ import { expectLogic } from 'kea-test-utils'import { lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { teamLogic } from 'scenes/teamLogic'import { useMocks } from '~/mocks/jest'@@ -280,35 +282,42 @@ describe('signalSourcesLogic', () => {createConfig.mockRestore()})- it('pins sources before connected tools and filters the catalog without hiding PostHog sources', () => {+ // The roster shows what runs and the catalog shows the rest. A regression that lists the whole+ // registry in the roster again, or filters the catalog wrong, fails here.+ it('rosters connected sources and filters the catalog', () => {+ logic.actions.loadSourceConfigsSuccess([])sourcesDataLogic.actions.loadSourcesSuccess({results: [{ ...githubSource, source_type: 'Jira' },- { ...githubSource, id: 'source-bugsnag', source_type: 'Bugsnag' },{ ...githubSource, id: 'source-gitea', source_type: 'Gitea' },],next: null,previous: null,})- logic.actions.loadSourceConfigsSuccess([])expect(- logic.values.rosterGroups- .find((group) => group.id === 'external')- ?.agents.slice(0, 8)- .map((agent) => agent.source)- ).toEqual(['github', 'linear', 'zendesk', 'sentry', 'jira', 'bugsnag', 'gitea', 'aha'])+ logic.values.rosterGroups.find((group) => group.id === 'external')?.agents.map((agent) => agent.source)+ ).toEqual(['jira', 'gitea'])expect(logic.values.externalSourceStates.jira).toMatchObject({ connected: true, requiresSetup: false })expect(logic.values.externalSourceStates.sentry).toMatchObject({ connected: false, requiresSetup: true })++ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.ENGINEERING_ANALYTICS]: true })+ expect(logic.values.sourceCategoryOptions).toContainEqual({ label: 'Engineering', value: 'Engineering' })+ logic.actions.setSourceCategory('Engineering')+ expect(logic.values.sourceCatalog.map((group) => group.items.map((item) => item.agent.source))).toEqual([+ ['engineering_analytics'],+ ])+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.ENGINEERING_ANALYTICS]: false })+ expect(logic.values.sourceCategoryOptions).not.toContainEqual({ label: 'Engineering', value: 'Engineering' })+ expect(logic.values.sourceCatalog).toEqual([])+logic.actions.setSourceCategory('Error tracking')logic.actions.setSourceSearchQuery('SENTRY')expect(- logic.values.filteredRosterGroups- .find((group) => group.id === 'external')- ?.agents.map((source) => source.source)- ).toEqual(['sentry'])- expect(- logic.values.filteredRosterGroups.find((group) => group.id === 'posthog')?.agents.length- ).toBeGreaterThan(0)+ logic.values.sourceCatalog.map((group) => [group.category, group.items.map((item) => item.agent.source)])+ ).toEqual([['Error tracking', ['sentry']]])+ logic.actions.closeSourceCatalog()+ expect(logic.values.sourceCatalog.length).toBeGreaterThan(1)+ expect(logic.values.rosterGroups.find((group) => group.id === 'posthog')?.agents.length).toBeGreaterThan(0)})it('carries the card guidance onto an error tracking signal type turned on later', async () => {diff --git a/products/signals/frontend/inbox/signalSourcesLogic.ts b/products/signals/frontend/inbox/signalSourcesLogic.tsindex 52a79288bd3b..8b5d033530f2 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.ts@@ -30,16 +30,24 @@ import { externalDataSchemasPartialUpdate } from 'products/warehouse_sources/froimport { ExternalDataSourceTypeEnumApi } from 'products/warehouse_sources/frontend/generated/api.schemas'import type { SignalSourceTypeApi, SignalSourceConfigSourceTypeEnumApi } from '../generated/api.schemas'-import { AGENT_ROSTER_GROUPS, AgentRosterGroup, AgentRosterSource } from './components/config/agentRosterMeta'+import {+ AGENT_ROSTER_GROUPS,+ AgentRosterDefinition,+ AgentRosterGroup,+ AgentRosterSource,+} from './components/config/agentRosterMeta'import { EXTERNAL_SIGNAL_SOURCES, ExternalSignalSource, isExternalSignalSource } from './externalSignalSources'import {+ SignalSourceCatalogOrigin,SignalSourceToggleFailureReason,+ captureSignalSourceCatalogOpened,+ captureSignalSourceCatalogSourceSelected,captureSignalSourceConfigsLoadFailed,captureSignalSourceConnected,captureSignalSourceDisabled,captureSignalSourceToggleFailed,} from './inboxAnalytics'-import { SOURCE_STEERING_KEY, SignalSourceConfig, ToggleSignalSourceParams } from './types'+import { SOURCE_STEERING_KEY, SignalSourceConfig, SignalSourceConfigStatus, ToggleSignalSourceParams } from './types'/** product_enablement recipe names for products that back a signal source. */export type SourceProductEnablement = 'session_replay' | 'error_tracking' | 'conversations'@@ -92,6 +100,38 @@ const PINNED_SOURCE_ORDER: Partial<Record<AgentRosterSource, number>> = {jira: 4,}+/** Catalog categories in the order the definitions list them, so the catalog reads like the registry. */+const CATALOG_CATEGORY_ORDER: readonly string[] = Array.from(+ new Set(+ AGENT_ROSTER_GROUPS.filter((group) => group.id === 'external')+ .flatMap((group) => group.agents)+ .map((agent) => agent.category)+ .filter((category): category is string => !!category)+ )+)++function compareExternalAgents(a: AgentRosterDefinition, b: AgentRosterDefinition): number {+ return (+ (PINNED_SOURCE_ORDER[a.source] ?? Number.MAX_SAFE_INTEGER) -+ (PINNED_SOURCE_ORDER[b.source] ?? Number.MAX_SAFE_INTEGER) || a.label.localeCompare(b.label)+ )+}++export interface SourceCatalogItem {+ agent: AgentRosterDefinition+ /** The warehouse already syncs this tool, so turning it on needs no connect form. */+ connected: boolean+ enabled: boolean+ syncFailed: boolean+ loading: boolean+ blockedReason?: string+}++export interface SourceCatalogGroup {+ category: string+ items: SourceCatalogItem[]+}+export interface ExternalSignalSourceState {config: SignalSourceConfig | nullconnected: boolean@@ -248,8 +288,9 @@ export interface signalSourcesLogicValues {sourceType: SignalSourceType}[]evalReportsConfig: SignalSourceConfig | null+ externalAgents: AgentRosterDefinition[]+ externalSourceCount: numberexternalSourceStates: Record<ExternalSignalSource, ExternalSignalSourceState>- filteredRosterGroups: AgentRosterGroup[]githubIssuesConfig: SignalSourceConfig | nullhasEmittingScanner: boolean | nullhasNoSources: boolean@@ -273,6 +314,8 @@ export interface signalSourcesLogicValues {productStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>>rosterGroups: AgentRosterGroup[]scannerInventoryKnown: boolean+ sourceCatalog: SourceCatalogGroup[]+ sourceCatalogOpen: booleansourceCategory: stringsourceCategoryOptions: {label: string@@ -300,6 +343,9 @@ export interface signalSourcesLogicActions {closeLinearTeamsPicker: () => {value: true}+ closeSourceCatalog: () => {+ value: true+ }closeSourcesModal: () => {value: true}@@ -382,12 +428,22 @@ export interface signalSourcesLogicActions {source: WarehouseBackedSource}openLinearTeamsPicker: (state: LinearTeamsPickerState) => LinearTeamsPickerState+ openSourceCatalog: () => {+ value: true+ }openSourcesModal: () => {value: true}replaceSourceConfig: (config: SignalSourceConfig) => {config: SignalSourceConfig}+ selectCatalogSource: (+ source: WarehouseBackedSource,+ origin: SignalSourceCatalogOrigin+ ) => {+ origin: 'catalog'+ source: WarehouseBackedSource+ }setAllScannerSignals: (enabled: boolean) => {enabled: boolean}@@ -507,8 +563,66 @@ export interface signalSourcesLogicMeta {sourcesLoadError: boolean,togglingSourceKeys: Set<string>) => Record<ExternalSignalSource, ExternalSignalSourceState>+ externalAgents: (featureFlags: FeatureFlagsSet) => AgentRosterDefinition[]+ externalSourceCount: (externalAgents: AgentRosterDefinition[]) => number+ sourceCatalog: (+ externalAgents: AgentRosterDefinition[],+ sourceSearchQuery: string,+ sourceCategory: string,+ externalSourceStates: Record<+ | 'aha'+ | 'appfigures'+ | 'appfollow'+ | 'asknicely'+ | 'bugsnag'+ | 'canny'+ | 'dixa'+ | 'featurebase'+ | 'freshdesk'+ | 'freshservice'+ | 'frill'+ | 'front'+ | 'gitea'+ | 'github'+ | 'gitlab'+ | 'google_search_console'+ | 'gorgias'+ | 'honeybadger'+ | 'hubspot'+ | 'intercom'+ | 'jira'+ | 'judgeme_reviews'+ | 'kustomer'+ | 'linear'+ | 'pganalyze'+ | 'plain'+ | 'productboard'+ | 'rapid7_insightvm'+ | 'raygun'+ | 'retently'+ | 'rollbar'+ | 'semgrep'+ | 'sentry'+ | 'shortcut'+ | 'snyk'+ | 'sonarqube'+ | 'uservoice'+ | 'zendesk',+ ExternalSignalSourceState+ >,+ ciSignalsConfig: CISignalsConfigApi | null,+ ciSignalsIsFullyEnabled: boolean,+ isCiSignalsToggling: boolean,+ sourceConfigs: SignalSourceConfig[] | null,+ sourceConfigsLoading: boolean+ ) => SourceCatalogGroup[]+ sourceCategoryOptions: (externalAgents: AgentRosterDefinition[]) => {+ label: string+ value: string+ }[]rosterGroups: (featureFlags: FeatureFlagsSet,+ externalAgents: AgentRosterDefinition[],externalSourceStates: Record<| 'aha'| 'appfigures'@@ -552,15 +666,6 @@ export interface signalSourcesLogicMeta {>,ciSignalsConfig: CISignalsConfigApi | null) => AgentRosterGroup[]- filteredRosterGroups: (- rosterGroups: AgentRosterGroup[],- sourceSearchQuery: string,- sourceCategory: string- ) => AgentRosterGroup[]- sourceCategoryOptions: (rosterGroups: AgentRosterGroup[]) => {- label: string- value: string- }[]githubIssuesConfig: (sourceConfigs: SignalSourceConfig[] | null) => SignalSourceConfig | nulllinearIssuesConfig: (sourceConfigs: SignalSourceConfig[] | null) => SignalSourceConfig | nullzendeskTicketsConfig: (sourceConfigs: SignalSourceConfig[] | null) => SignalSourceConfig | null@@ -625,6 +730,12 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([setScannerInventoryKnown: (known: boolean) => ({ known }),setSourceSearchQuery: (query: string) => ({ query }),setSourceCategory: (category: string) => ({ category }),+ openSourceCatalog: true,+ closeSourceCatalog: true,+ selectCatalogSource: (source: WarehouseBackedSource, origin: SignalSourceCatalogOrigin) => ({+ source,+ origin,+ }),openSourcesModal: true,closeSourcesModal: true,initiateDataWarehouseSourceToggle: (source: WarehouseBackedSource) => ({ source }),@@ -758,8 +869,20 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([null as boolean | null,{ setErrorTrackingHasIssues: (_, { hasIssues }) => hasIssues },],- sourceSearchQuery: ['', { setSourceSearchQuery: (_, { query }) => query }],- sourceCategory: ['', { setSourceCategory: (_, { category }) => category }],+ sourceSearchQuery: ['', { setSourceSearchQuery: (_, { query }) => query, closeSourceCatalog: () => '' }],+ sourceCategory: ['', { setSourceCategory: (_, { category }) => category, closeSourceCatalog: () => '' }],+ // The connect form is a step inside the catalog, so resuming one after OAuth reopens the catalog+ // around it. The Linear teams picker is a modal of its own, so the catalog yields to it.+ sourceCatalogOpen: [+ false,+ {+ openSourceCatalog: () => true,+ openDataSourceSetup: () => true,+ closeSourceCatalog: () => false,+ openLinearTeamsPicker: () => false,+ closeSourcesModal: () => false,+ },+ ],sourcesModalOpen: [false,{@@ -772,6 +895,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([{openDataSourceSetup: (_, { source }) => source,closeDataSourceSetup: () => null,+ closeSourceCatalog: () => null,closeSourcesModal: () => null,},],@@ -938,66 +1062,109 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([})) as Record<ExternalSignalSource, ExternalSignalSourceState>,],+ externalAgents: [+ (s) => [s.featureFlags],+ (featureFlags: FeatureFlagsSet): AgentRosterDefinition[] =>+ AGENT_ROSTER_GROUPS.filter((group) => group.id === 'external')+ .flatMap((group) => group.agents)+ .filter((agent) => !agent.flag || featureFlags[agent.flag])+ .sort(compareExternalAgents),+ ],+ externalSourceCount: [(s) => [s.externalAgents], (agents: AgentRosterDefinition[]): number => agents.length],+ sourceCatalog: [+ (s) => [+ s.externalAgents,+ s.sourceSearchQuery,+ s.sourceCategory,+ s.externalSourceStates,+ s.ciSignalsConfig,+ s.ciSignalsIsFullyEnabled,+ s.isCiSignalsToggling,+ s.sourceConfigs,+ s.sourceConfigsLoading,+ ],+ (+ agents: AgentRosterDefinition[],+ query: string,+ category: string,+ externalStates: Record<ExternalSignalSource, ExternalSignalSourceState>,+ ciConfig: CISignalsConfigApi | null,+ ciEnabled: boolean,+ ciToggling: boolean,+ sourceConfigs: SignalSourceConfig[] | null,+ sourceConfigsLoading: boolean+ ): SourceCatalogGroup[] => {+ const needle = query.trim().toLowerCase()+ // Without the config rows a synced tool reads as never turned on, and a click would+ // create a row that may already exist, so every tile that writes one waits.+ const configsBlockedReason =+ sourceConfigs !== null+ ? undefined+ : sourceConfigsLoading+ ? 'Loading your signal sources'+ : "Couldn't load your signal sources. Close this and select Retry."+ const items = agents+ .filter(+ (agent) =>+ (!category || agent.category === category) &&+ `${agent.label} ${agent.category ?? ''} ${agent.watches}`.toLowerCase().includes(needle)+ )+ .map((agent): SourceCatalogItem => {+ if (isExternalSignalSource(agent.source)) {+ const state = externalStates[agent.source]+ return {+ agent,+ connected: state.connected,+ enabled: !!state.config?.enabled,+ syncFailed: state.config?.status === SignalSourceConfigStatus.FAILED,+ loading: state.loading,+ blockedReason: state.blockedReason ?? configsBlockedReason,+ }+ }+ return {+ agent,+ connected: !!ciConfig?.configured,+ enabled: ciEnabled,+ syncFailed: ciConfig?.sync_status === 'failed',+ loading: ciToggling,+ }+ })+ return CATALOG_CATEGORY_ORDER.map((groupCategory) => ({+ category: groupCategory,+ items: items.filter((item) => item.agent.category === groupCategory),+ })).filter((group) => group.items.length > 0)+ },+ ],+ sourceCategoryOptions: [+ (s) => [s.externalAgents],+ (agents: AgentRosterDefinition[]): { label: string; value: string }[] => [+ { label: 'All categories', value: '' },+ ...CATALOG_CATEGORY_ORDER.filter((category) => agents.some((agent) => agent.category === category)).map(+ (category) => ({ label: category, value: category })+ ),+ ],+ ],rosterGroups: [- (s) => [s.featureFlags, s.externalSourceStates, s.ciSignalsConfig],+ (s) => [s.featureFlags, s.externalAgents, s.externalSourceStates, s.ciSignalsConfig],(featureFlags: FeatureFlagsSet,+ externalAgents: AgentRosterDefinition[],externalStates: Record<ExternalSignalSource, ExternalSignalSourceState>,ciConfig: CISignalsConfigApi | null): AgentRosterGroup[] =>AGENT_ROSTER_GROUPS.map((group) => ({- ...group,- agents: group.agents- .filter((agent) => !agent.flag || featureFlags[agent.flag])- .sort((a, b) => {- if (group.id !== 'external') {- return 0- }- const connected = (source: AgentRosterSource): boolean =>- isExternalSignalSource(source)- ? externalStates[source].connected- : !!ciConfig?.configured- return (- (PINNED_SOURCE_ORDER[a.source] ?? Number.MAX_SAFE_INTEGER) -- (PINNED_SOURCE_ORDER[b.source] ?? Number.MAX_SAFE_INTEGER) ||- Number(connected(b.source)) - Number(connected(a.source)) ||- a.label.localeCompare(b.label)- )- }),- })),- ],- filteredRosterGroups: [- (s) => [s.rosterGroups, s.sourceSearchQuery, s.sourceCategory],- (groups: AgentRosterGroup[], query: string, category: string): AgentRosterGroup[] =>- groups.map((group) => ({...group,agents:- group.id !== 'external'- ? group.agents- : group.agents.filter(- (agent) =>- (!category || agent.category === category) &&- `${agent.label} ${agent.category ?? ''} ${agent.watches}`- .toLowerCase()- .includes(query.trim().toLowerCase())- ),+ group.id === 'external'+ ? externalAgents.filter((agent) =>+ isExternalSignalSource(agent.source)+ ? externalStates[agent.source].connected ||+ !!externalStates[agent.source].config?.enabled+ : !!ciConfig?.configured+ )+ : group.agents.filter((agent) => !agent.flag || featureFlags[agent.flag]),})),],- sourceCategoryOptions: [- (s) => [s.rosterGroups],- (groups: AgentRosterGroup[]): { label: string; value: string }[] => [- { label: 'All categories', value: '' },- ...Array.from(- new Set(- groups- .flatMap((group) => group.agents.map((agent) => agent.category))- .filter((category): category is string => !!category)- )- )- .sort()- .map((category) => ({ label: category, value: category })),- ],- ],githubIssuesConfig: [(s) => [s.sourceConfigs],(sourceConfigs: SignalSourceConfig[] | null): SignalSourceConfig | null =>@@ -1335,11 +1502,39 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([actions.loadSourceConfigs()}+ function forgetResumedSetup(): void {+ const { signal_source: source, ...searchParams } = router.values.searchParams+ if (source !== undefined) {+ router.actions.replace(router.values.location.pathname, searchParams, router.values.hashParams)+ }+ }+return {- closeDataSourceSetup: () => {- const { signal_source: source, ...searchParams } = router.values.searchParams- if (source !== undefined) {- router.actions.replace(router.values.location.pathname, searchParams, router.values.hashParams)+ closeDataSourceSetup: forgetResumedSetup,+ closeSourceCatalog: forgetResumedSetup,+ openSourceCatalog: () => {+ captureSignalSourceCatalogOpened({+ connectedCount: values.rosterGroups.find((group) => group.id === 'external')?.agents.length ?? 0,+ })+ },+ selectCatalogSource: ({ source, origin }) => {+ captureSignalSourceCatalogSourceSelected({ source, origin })+ if (isExternalSignalSource(source)) {+ actions.initiateDataWarehouseSourceToggle(source)+ } else {+ actions.toggleCiSignals()+ }+ },+ // A source that turned on from the catalog shows up in the roster, so the catalog gets out of+ // the way. A connect form stays: its own completion closes the catalog below.+ toggleSignalSourceSuccess: ({ params }) => {+ if (params.enabled && values.sourceCatalogOpen && values.dataSourceSetupSource === null) {+ actions.closeSourceCatalog()+ }+ },+ loadCiSignalsConfigSuccess: ({ ciSignalsConfig }) => {+ if (ciSignalsConfig.enabled && values.sourceCatalogOpen && values.dataSourceSetupSource === null) {+ actions.closeSourceCatalog()}},loadSourceConfigsFailure: ({ error, errorObject }) => {@@ -1406,7 +1601,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([},onDataSourceSetupComplete: () => {const source = values.dataSourceSetupSource- actions.closeDataSourceSetup()+ actions.closeSourceCatalog()actions.loadSources()if (source === null) {returndiff --git a/products/signals/package.json b/products/signals/package.jsonindex a09cc3551fb4..6cc4306047ec 100644--- a/products/signals/package.json+++ b/products/signals/package.json@@ -32,7 +32,6 @@"@testing-library/user-event": "*","@types/react": "*","clsx": "*",- "react": "*",- "react-window": "*"+ "react": "*"}}