: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(inbox): expand the web signal source catalog (#117678)
Georgiy Tarasovb18c81746178
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex c8248ecaf68c..767e69e4cb06 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11759,9 +11759,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.3a09b371dfcc049acc97eb1e2682d0fd201d38c4da0bffd99c604e2e64b8b18a.DDoXBuROBx-ORO785uDMT76XnmJMVgQ-Vjn6RKV8UDE+ hash: v1.k794b7964.52d81f722ccc8fc12dc4e1ece8b13cca661e3d3a22a10ee8cf4f3871f34668f8.JaD8yGUxLagreQTpOp6jncQCASQKMaJf7leX4zsHjhsscenes-app-inbox-scene--settings--light:- hash: v1.k794b7964.dac3c4ea75724904b985cd5cce6e172b0f96a0dff0a73765c64fc6ca2d9f4e7c.y6MRlO5cx7JT44gZbZ4DP1nYyE-gk-XSbciuFxtqaXI+ hash: v1.k794b7964.cc5ebdb49fe55e8235abed358864fa709477ed205573f3acc4ba69793c89d4bc.3xzgbaW2S1L64r2Nv_AYHM7Je518NO07QFuVovW_OMcscenes-app-inbox-scene--triage--dark:hash: v1.k794b7964.77e43b36fdcd81befecf4de80e489050f525840924ec6ddef37c23a9179dbe8a.B3qkZFYBncFaPn2EBg4cBoYu_LIwW29imNwBdLXF5eoscenes-app-inbox-scene--triage--light:@@ -12339,9 +12339,9 @@ snapshots:scenes-app-inbox-signal-cards--error-tracking-stack-trace--light:hash: v1.k794b7964.aa21988170efa24558a07df517a8d8fd27b9708c6f1228d7c1ffd08572e5a8ce.Y5gzV-7m1I3ViQfpe3ek_QMq0YgPZuIXGPaaQXKkJr4scenes-app-inbox-signal-cards--generic-fallbacks--dark:- hash: v1.k794b7964.0675fbd7acca5320139d134150e70d3cd9e763580b0eb4cbaa93d5756669ae15.pKrX03LXxk8_E-bezOswMJafPsVaFWft7GbSeImpQDQ+ hash: v1.k794b7964.fbba3c26836c3801e6dcb9121defbaf87a0db61334930390d1c270d02a9a901b.xtzchtNLnRe6os83PSuvBPkPTbQKCj-0K_UBpag2XGoscenes-app-inbox-signal-cards--generic-fallbacks--light:- hash: v1.k794b7964.99a6d0f14c60332de91b3c7eecd0aa469b3ab570dc56a248530902be720605f1.wxsV2n4HR7EbwyJAhKUCb8YLML76Rm7_vAY9HIX2uvI+ hash: v1.k794b7964.ffa641887d312ca4208d5d6781dad1b76bec1681812e1519da73f42e1942fc3f.9gr8-y3eJR3zPVjz6ZtIt2psP82nPRPWe7BnNM28Macscenes-app-inbox-signal-cards--long-scout-name--dark:hash: v1.k794b7964.3c84a2677fe12f1175020d96c2965a18d314044f07ab720e1d48691b2a825f1b.5LExKKJgm5K4cqExN7REXA10tdrPe74Hh3_WkruHcPIscenes-app-inbox-signal-cards--long-scout-name--light:@@ -12359,45 +12359,49 @@ 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.ab0784297c68287a91a8fa16e47b151dc56f158a2eeaf94621960920c0278dba.jQ6Wo_M2myypBPIFEl1CwEx0IZ0ZAYyOfR6B5wTaFUE+ hash: v1.k794b7964.d11eeca04cea8261c7bdda249d58e1cea26de76dca4d67176d0054f52e5f167d.S1fedIExTZm4bRd26JJvDoVi6-o0GtNmaCO5tGhdwHoscenes-app-inbox-signalsourcespanel--armed-but-products-off--light:- hash: v1.k794b7964.cb5aee49644e44410ca2c19ac56b06c1344f75cd63b69ddd59d62f7c3c45c000.QI0ucnAoyYq8x_A9AnKkQc-1MQ9nLwrR-NZ1QKhyt6Y+ hash: v1.k794b7964.e5bbba9dfbb5f49817091d81cd98d044881cfee2d5c161f8148b73806b99d94c.X4dWOUqX8LSPeaUgi8Kv3fQjOxWEH7dMyZaXNxtZP9wscenes-app-inbox-signalsourcespanel--arming-blocked--dark:- hash: v1.k794b7964.29ca85b7ec426aeee84149849d5c1257724953013031295800ef793934c761e3.b5L6ryrtEBF5MuU0ahEYMmRnTD7uB7YKMhGpAIZzWTM+ hash: v1.k794b7964.fef7c48dcc9b2fbfc27219b1413eec9efd153579fcf7b83f910f246611e01582.LhgdlWVqjSxmG2qEFiBQqWkehur-4vHGWVFHNuODsMcscenes-app-inbox-signalsourcespanel--arming-blocked--light:- hash: v1.k794b7964.c829729905dd5d5fbff1150d71f456239ed9987d45773fc39a06cd0768ec9617.GeVV4Yg6X-28j1QUI6ydIh50bCSHs0vA4kfL21llZgQ+ hash: v1.k794b7964.556d9a8b39a9e78c67f51f2de1f8cb8ce97e5a1493793633ef41505a84a6bc2b.-z4YGKPlpchvdw1WCnRy6PL1tWj8uRRjOI5_YLBVj_Ascenes-app-inbox-signalsourcespanel--error-tracking-expanded--dark:- hash: v1.k794b7964.dc82368880ce9cfb9af10463c3eedc2d8f82c10f1b08cbf3a1aa0e5e81c8f451.Ub2OUFCM-lT41xG2Tw4Cean8K9t7Z5lkXn0zz5eUk5I+ hash: v1.k794b7964.e76f849397b585435cb5c86079df492c3bc82eea9f72b94a105f2e64d63b12a2.fL6UtIc12THgb27_GBFws5GNEBby9x61_D4tgfP_ApAscenes-app-inbox-signalsourcespanel--error-tracking-expanded--light:- hash: v1.k794b7964.d0ddc20080343593ec1c5534e9dcc534b1997d666b8a57cb2b6153bd3f54af5e.pQ7BNYwTYZXS4dB4pp7samdK7BQudfkh7fEEW_EuM2I+ hash: v1.k794b7964.94aa8d254893b653a61eaea44ef060889b109a669f14f79418f80d9132ced7e3.YiTAqW3coJllwVaTalTfhBrujz30GuRVOAW_4deFLtAscenes-app-inbox-signalsourcespanel--event-definitions-unavailable--dark:- hash: v1.k794b7964.28d04b89b0825769c9c2cb617fcdb0c5a1371d398da50a8ebd8cdfdf0e01164a.P3b-y2FIqJvXfMBwXfYLteMApq02-T0AKwFRbwfIQa0+ hash: v1.k794b7964.8552b59a7a396955ace08d373e0e5be9bef701656c1ae3df14fd6821a8b468a8._B7vy88s3uCrlzIwkRLtaphTdrHRmq_H8pO1KanPBK8scenes-app-inbox-signalsourcespanel--event-definitions-unavailable--light:- hash: v1.k794b7964.26f63405e53830709106738ad58a8310c0b387524c3e71cc80622c02f12b01fb.4Kx1LTcdgaVFz-A9VXyKZGfxhz5EsqplT2WE1H3M4UI+ hash: v1.k794b7964.4303870fbe9f5877e5413253e3cef9d7ad02d9f5828fe0c7937d235af80f0c3a.xOrlb8uikUbA-icPFLvj25JViC_LoEp5H4by6bil9LUscenes-app-inbox-signalsourcespanel--everything-healthy--dark:- hash: v1.k794b7964.04173f7032d97b72af91f2253666ab1d1e57ea77b354ac2eaad25526e0f66a9e.ksK911TZrOBifMlKveU0GC6gOQVw7PwN6sQJ9pxFVGY+ hash: v1.k794b7964.e361d70c2cdb136400249ae686e12dcba647ac2cee82d2921d241b1ca0d66924.MKcXWUxdpupY-2Zcz1Ao4q3wkCQe9SIcBEqw-8PgdWoscenes-app-inbox-signalsourcespanel--everything-healthy--light:- hash: v1.k794b7964.4566e55dc26b11196f1dd8d55df92b6be69df45627e916ffffc43d82974e930c.8MRMfKTb6XaJ-1sBZD277M3txzYi8sdP5ZMfbpClGHQ+ hash: v1.k794b7964.1309cb39b590cb39b6dcafff660a2e522b53d2a24bd61146842c9fd01dc1f265.JuNmD7LQcp1OPNe5rexJZ7bQNF1Rug0Y1pcSwKvnbZY+ scenes-app-inbox-signalsourcespanel--external-sources-connected--dark:+ hash: v1.k794b7964.2e2e5f5660ac3f87f0b76ef18d23aa78a4c649db936c13d958d8f7bbdc93de1b.lCUbFTDSvIjC4nVfFKtbW9HXUwF246i4fyOhdl9qcKc+ scenes-app-inbox-signalsourcespanel--external-sources-connected--light:+ hash: v1.k794b7964.3e8954d26e3f79833018fec5af71c37455d855703c8d971ed9c70d726da95c76.cfi4mAzIhiDAzaiHEIpEMuCbFNzBAzVEAtWJMntRWy0scenes-app-inbox-signalsourcespanel--playground--dark:- hash: v1.k794b7964.f897b9dd52eae8ad29d04c46ba689c27f47602692b2144b0e75a97ef34fae702.AfAhw2Op6ddRNOGiTznSP6Wn5nrrM4iwiHZ-AaR3IRo+ hash: v1.k794b7964.dc5d9b2af4fe4ceaf2dc2279e3c9d5411f58d8972940eead3b3cfbec19d02a64.E-8-6e3oTSpbdfBZhS_0MHvVAraG1K0F0HAqIdlQ5XQscenes-app-inbox-signalsourcespanel--playground--light:- hash: v1.k794b7964.13df8c7b214cfd00e7eba5fea6da33f833ac202b7d3a2ebbadd331440bb9f97a.xHWi11Tx7CmT7o1dwJvUjX1q6A5oFMQMHGwPfEi2elg+ hash: v1.k794b7964.9538ca3cb132fbf319113686d7ee2c2f97caeb9b227d82e294ee8f0f997488be.m2flYmmOmwlP2uOjGrlVVH9zV8ucEcusNlPBYWJCsncscenes-app-inbox-signalsourcespanel--products-on-no-recent-data--dark:- hash: v1.k794b7964.061f26dc6c73e42ecd02f739191031dc8165e970db1d6edafc3f383cc1429a02.d7zgoPuBwGZYYG4ckVbe1pPkugH6lLlA_yLplgjlI2U+ hash: v1.k794b7964.be9a9327f58bde9d180c4a2b74ad4d2a1d9df8e74138da41c8e4e0018a162df2.husg4iq4YHLtBWP_IsKthbyK48p0dQq6I1qUxXKkjDcscenes-app-inbox-signalsourcespanel--products-on-no-recent-data--light:- hash: v1.k794b7964.0829c443d3d13bdfadc9b0feeb5edd61d356de66bd384ec5aad4b48fe93aeae9.77N6XxkAqnZUqdjxLVPcd2H2HrJiYDxa6qdFwBKBHZg+ hash: v1.k794b7964.7df9bf9ff498f4bd2419e205926d52796fa76788866b747b11b5e4eaabea85d8.kMEixgPWr8fx1WGUG8BR9aEj9sIlKuRAKf7H1XaKKm4scenes-app-inbox-signalsourcespanel--replay-vision-expanded--dark:- hash: v1.k794b7964.91d6f2333d152b21b0a3c3defe243ad56ec48d54a06bfc5ec3e0538cde1c6325.LOyzhXttfKQhsSDIsee-zqgPzOZyCXi4lOFLef6FOT8+ hash: v1.k794b7964.7c7f614c4974c75ea013e3532574cb64bff8b3f4ca26958333f185f7252f35f5.Mhg8AjKNmM34ybAJKlJDa5UKw2r0xw3whkigxPemnDoscenes-app-inbox-signalsourcespanel--replay-vision-expanded--light:- hash: v1.k794b7964.edaa8d90dcf46911f47d5c40ce2a6f2c8542000c2de472acde6959e2afbb0410.mBMhEdPIwxMd-Ktio7LCd0wegNurdVCgcRsT41hZ1kE+ hash: v1.k794b7964.943bcbebc067a2aac2c5d11750b427413af119fce7fcf4f7465d86d067a1f888.4uYLX-DhLeEBjEXK9fjYK-vHt_88kMD17ycJffEnHSgscenes-app-inbox-signalsourcespanel--server-side-exceptions-only--dark:- hash: v1.k794b7964.f897b9dd52eae8ad29d04c46ba689c27f47602692b2144b0e75a97ef34fae702.qixI7HhZb5rWIcR5HzZB9i8SidHDxo9eBF_dsAFvSew+ hash: v1.k794b7964.dc5d9b2af4fe4ceaf2dc2279e3c9d5411f58d8972940eead3b3cfbec19d02a64.ZgaERDAob32dWYCzcUqArIjSrudQDi4UA49jXU4oXYYscenes-app-inbox-signalsourcespanel--server-side-exceptions-only--light:- hash: v1.k794b7964.13df8c7b214cfd00e7eba5fea6da33f833ac202b7d3a2ebbadd331440bb9f97a.SL1Tzb4sMCHF1TQHfGCWGJYsBO88sT0dkLTlU88JrvQ+ hash: v1.k794b7964.9538ca3cb132fbf319113686d7ee2c2f97caeb9b227d82e294ee8f0f997488be.KUe0VsJdyQSWytb3Ub2oG0sDRRwoHx2w8cLVyJV6RDUscenes-app-inbox-signalsourcespanel--source-configs-unavailable--dark:- hash: v1.k794b7964.08032096bb8a223986a3a5b0f60f0966440a197906aafb84a0efbc3c7b1bd9e2.i7VYjJUGbfOhOXv9CPQinRTRT6qlb_EzTi5-cuV1eZo+ hash: v1.k794b7964.b73575fc8e51b4fb1233c6e9de86afcf217232ab059548ce8617ccff1ba3e27c.JZgD7AA2EEJO2ZYj2ZJLWxjYpLXoD94p3mu53X7JQE0scenes-app-inbox-signalsourcespanel--source-configs-unavailable--light:- hash: v1.k794b7964.8bb3be64379113a1efe705deafff367381f509fbcd63f758e1870a558df0460f.1XVDXtWTy01V5cjltbWNM3EAe4BKpUDnjnrXCDBlEDs+ hash: v1.k794b7964.1fed2ac0bf8cd2cdefdeb244b372b69b9d88770423f392f54182d2172a1dc3b3.n8IBYIvTFC1p5OWpipLwlHWwlemWJ-qJ11ml4rgx27Iscenes-app-inbox-slacknotificationssection--awaiting-target--dark:hash: v1.k794b7964.8ea3584f9e8ba12a10845825520e5297ebf2c60282422cec693b0bd291ceee47.UdwureshdgpAitm-HeIekB6baljLm5XiV93vEw4z3-Ascenes-app-inbox-slacknotificationssection--awaiting-target--light:diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 944f01a5b2c3..b0feb89aaaeb 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -4964,6 +4964,9 @@ importers:react:specifier: 18.3.1version: 18.3.1+ react-window:+ specifier: '*'devDependencies:'@testing-library/react':specifier: ^14.3.1diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsxindex a6143dfd644e..be695c6f8fac 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx@@ -432,6 +432,8 @@ export interface SourceWizardLogicProps {availableSources: Record<string, SourceConfigResponseApi>/** When set, only these tables will be pre-selected and they cannot be deselected */requiredTables?: string[]+ requiredTableSyncType?: 'full_refresh'+ oauthRedirectUrl?: string/** Onboarding: pre-select every syncable table with smart defaults for a one-click sync */autoConfigureTables?: boolean}@@ -499,6 +501,7 @@ export interface sourceWizardLogicValues {| 'Tables ready to query'nextButtonDisabledReason: string | nullnextButtonText: string+ oauthRedirectUrl: string | undefinedprefixRequired: booleanrequiredTables: anyreturnConfig: {@@ -910,6 +913,7 @@ export interface sourceWizardLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface sourceWizardLogicMeta {__keaTypeGenInternalSelectorTypes: {+ oauthRedirectUrl: (arg: any) => string | undefinedavailableSources: (arg: any) => anyrequiredTables: (arg: any) => anydefaultSourceConnectionDetails: (selectedConnector: SourceConfigResponseApi | null) => Record<string, unknown>@@ -1519,6 +1523,10 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([],})),selectors({+ oauthRedirectUrl: [+ () => [(_, props) => props.oauthRedirectUrl],+ (url: string | undefined): string | undefined => url,+ ],availableSources: [() => [(_, p) => p.availableSources], (availableSources) => availableSources],requiredTables: [() => [(_, p) => p.requiredTables], (requiredTables) => requiredTables ?? null],// Form defaults derived from the selected connector's field schema. Returning a fresh@@ -2566,6 +2574,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([}for (const schema of requiredSchemas) {schema.should_sync = true+ schema.sync_type = props.requiredTableSyncType ?? schema.sync_type}// createSource reads hasWebhookSchemas off databaseSchema to decide whether the// new source still needs its webhook registered.diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.tsindex 15d9614cbc98..35ff34b6158b 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts@@ -1357,12 +1357,14 @@ describe('sourceWizardLogic', () => {}) as ExternalDataSourceSyncSchemaconst mountRequiredTablesWizard = (- requiredTables: string[]+ requiredTables: string[],+ requiredTableSyncType?: 'full_refresh'): { logic: ReturnType<typeof sourceWizardLogic>; onComplete: jest.Mock; unmount: () => void } => {const onComplete = jest.fn()const logic = sourceWizardLogic({availableSources: { Github: githubSource },requiredTables,+ requiredTableSyncType,onComplete,})const unmount = logic.mount()@@ -1374,38 +1376,49 @@ describe('sourceWizardLogic', () => {jest.restoreAllMocks()})- it('syncs every repo-qualified row the credentials can read', async () => {- // Multi-repo sources name their rows `owner/repo.endpoint`, so an exact-match lookup- // for `issues` finds nothing and the wizard bails before creating the source. The- // payload forces should_sync on, so an unreadable row must not reach it.- jest.spyOn(api.externalDataSources, 'database_schema').mockResolvedValue([- apiSchema('posthog/posthog.issues'),- apiSchema('posthog/posthog-js.issues'),- apiSchema('posthog/posthog.commits'),- apiSchema('posthog/private.issues', { permission_error: 'Requires the "Issues" permission' }),- ] as ExternalDataSourceSyncSchema[])- const create = jest- .spyOn(api.externalDataSources, 'create')- .mockResolvedValue({ id: 'source-1' } as Awaited<ReturnType<typeof api.externalDataSources.create>>)- const createWebhook = jest.spyOn(api.externalDataSources, 'createWebhook')-- const { logic, onComplete, unmount } = mountRequiredTablesWizard(['issues'])+ it.each([undefined, 'full_refresh'] as const)(+ 'syncs readable repo-qualified rows with sync override %s',+ async (requiredTableSyncType) => {+ // Multi-repo sources name their rows `owner/repo.endpoint`, so an exact-match lookup+ // for `issues` finds nothing and the wizard bails before creating the source. The+ // payload forces should_sync on, so an unreadable row must not reach it.+ jest.spyOn(api.externalDataSources, 'database_schema').mockResolvedValue([+ apiSchema('posthog/posthog.issues', { sync_type: 'incremental' }),+ apiSchema('posthog/posthog-js.issues', { sync_type: 'incremental' }),+ apiSchema('posthog/posthog.commits'),+ apiSchema('posthog/private.issues', { permission_error: 'Requires the "Issues" permission' }),+ ] as ExternalDataSourceSyncSchema[])+ const create = jest+ .spyOn(api.externalDataSources, 'create')+ .mockResolvedValue({ id: 'source-1' } as Awaited<ReturnType<typeof api.externalDataSources.create>>)+ const createWebhook = jest.spyOn(api.externalDataSources, 'createWebhook')++ const { logic, onComplete, unmount } = mountRequiredTablesWizard(['issues'], requiredTableSyncType)- try {- await expectLogic(logic, () => logic.actions.getDatabaseSchemas()).toFinishAllListeners()+ try {+ await expectLogic(logic, () => logic.actions.getDatabaseSchemas()).toFinishAllListeners()- expect(create).toHaveBeenCalledTimes(1)- expect(create.mock.calls[0][0].payload?.schemas).toEqual([- expect.objectContaining({ name: 'posthog/posthog.issues', should_sync: true }),- expect.objectContaining({ name: 'posthog/posthog-js.issues', should_sync: true }),- ])- // Poll-synced tables need no webhook, so completion must not wait on one.- expect(createWebhook).not.toHaveBeenCalled()- expect(onComplete).toHaveBeenCalled()- } finally {- unmount()+ expect(create).toHaveBeenCalledTimes(1)+ expect(create.mock.calls[0][0].payload?.schemas).toEqual([+ expect.objectContaining({+ name: 'posthog/posthog.issues',+ should_sync: true,+ sync_type: requiredTableSyncType ?? 'incremental',+ }),+ expect.objectContaining({+ name: 'posthog/posthog-js.issues',+ should_sync: true,+ sync_type: requiredTableSyncType ?? 'incremental',+ }),+ ])+ // Poll-synced tables need no webhook, so completion must not wait on one.+ expect(createWebhook).not.toHaveBeenCalled()+ expect(onComplete).toHaveBeenCalled()+ } finally {+ unmount()+ }}- })+ )// Both leave the required table unsatisfied, so neither may create a source that reports// setup as complete: the first would sync nothing, the second would queue a 403 sync.diff --git a/products/data_warehouse/frontend/shared/components/forms/IntegrationChoice.tsx b/products/data_warehouse/frontend/shared/components/forms/IntegrationChoice.tsxindex efeb4d9ba75a..e700e8c0bc17 100644--- a/products/data_warehouse/frontend/shared/components/forms/IntegrationChoice.tsx+++ b/products/data_warehouse/frontend/shared/components/forms/IntegrationChoice.tsx@@ -70,6 +70,7 @@ export function SourceIntegrationChoice({...props}: SourceIntegrationChoiceProps): JSX.Element {const { saveFormStateBeforeRedirect } = useActions(sourceWizardLogic)+ const { oauthRedirectUrl } = useValues(sourceWizardLogic)const { location, searchParams } = useValues(router)const { integrations, integrationsLoading } = useValues(integrationsLogic)const integrationManagementRestriction = useIntegrationManagementRestriction()@@ -113,8 +114,8 @@ export function SourceIntegrationChoice({// standalone new-source scene would drop the user out of the onboarding flow, so when we're// on an onboarding route we return to the current onboarding URL with the source kind instead.// InlineSourceSetup reads that kind on mount and resumes the wizard (credentials are restored- // from the state saved by beforeRedirect). Outside onboarding the standalone scene is correct.- const redirectUrl = sourceOAuthRedirectUrl(sourceKind, location.pathname, location.search)+ // from the state saved by beforeRedirect). Other embedded hosts supply their own return URL.+ const redirectUrl = oauthRedirectUrl ?? sourceOAuthRedirectUrl(sourceKind, location.pathname, location.search)return (<div className="flex flex-col gap-2">diff --git a/products/signals/frontend/inbox/components/badges/sourceProductIcons.tsx b/products/signals/frontend/inbox/components/badges/sourceProductIcons.tsxindex e22931df3179..025cfd97542a 100644--- a/products/signals/frontend/inbox/components/badges/sourceProductIcons.tsx+++ b/products/signals/frontend/inbox/components/badges/sourceProductIcons.tsx@@ -16,6 +16,7 @@ import {IconReceipt,} from '@posthog/icons'+import { EXTERNAL_SIGNAL_SOURCES } from '../../externalSignalSources'import { SignalSourceProduct } from '../../types'interface SourceProductMeta {@@ -34,6 +35,21 @@ interface SourceProductMeta {* `getSourceProductMeta`, which returns `null` for unknown keys.*/export const SOURCE_PRODUCT_META: Partial<Record<SignalSourceProduct, SourceProductMeta>> = {+ ...Object.fromEntries(+ EXTERNAL_SIGNAL_SOURCES.map((source) => [+ source.source,+ {+ Icon:+ source.sourceType === 'ticket'+ ? IconSupport+ : source.category === 'Security' || source.category === 'Error tracking'+ ? IconBug+ : IconDatabase,+ colorClass: 'text-secondary',+ label: source.label,+ },+ ])+ ),[SignalSourceProduct.SessionReplay]: {Icon: IconRewindPlay,colorClass: 'text-warning',diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsxindex 625f7227c16a..3e205816be26 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.test.tsx@@ -1,6 +1,6 @@import '@testing-library/jest-dom'-import { cleanup, render, screen } from '@testing-library/react'+import { cleanup, render, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { FEATURE_FLAGS } from 'lib/constants'@@ -9,6 +9,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'+import { signalSourcesLogic } from '../../signalSourcesLogic'import { AgentsRoster } from './AgentsRoster'const SCANNERS = Array.from({ length: 10 }, (_, index) => ({@@ -44,6 +45,48 @@ describe('AgentsRoster', () => {})afterEach(cleanup)+ it('renders a window of external sources and finds an unmounted source through search', async () => {+ render(<AgentsRoster />)++ 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()+ })++ it('lets a connection retry finish before another retry can start', async () => {+ let resolveRequest!: () => void+ const pendingRequest = new Promise<void>((resolve) => {+ resolveRequest = resolve+ })+ let requests = 0+ useMocks({+ get: {+ '/api/environments/:team_id/external_data_sources/': async () => {+ requests+++ if (requests === 1) {+ return [500, { detail: 'Server error' }]+ }+ await pendingRequest+ return [200, EMPTY_LIST]+ },+ },+ })+ render(<AgentsRoster />)+ signalSourcesLogic.actions.loadSources()+ const retry = (await screen.findAllByText('Retry'))[0].closest('button')!+ await userEvent.click(retry)+ expect(retry).toHaveAttribute('aria-disabled', 'true')+ resolveRequest()+ await waitFor(() => expect(screen.queryByText(/Couldn't load your connections/)).not.toBeInTheDocument())+ expect(requests).toBe(2)+ })+// The cap keeps a long user-created list from burying the sources below it, but a filter that// could not reach past it would make a scanner unfindable by name.it('caps the scanner list, and lets both the filter and Show more reach past the cap', async () => {@@ -70,10 +113,15 @@ describe('AgentsRoster', () => {},})render(<AgentsRoster />)+ signalSourcesLogic.actions.loadSources()expect(await screen.findByText(/Couldn't load your signal sources/)).toBeInTheDocument()expect(screen.getByLabelText('Arm Support')).toBeDisabled()- expect(screen.getByLabelText('Arm GitHub issues')).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)+ 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 16625daff74e..48fd82fa6735 100644--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx@@ -7,6 +7,7 @@ import {LemonButton,LemonInput,LemonSkeleton,+ LemonSelect,LemonSwitch,LemonTag,Link,@@ -16,10 +17,10 @@ import {import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonTagType } from 'lib/lemon-ui/LemonTag/LemonTag'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import type { CISignalsSyncStatusEnumApi } from 'products/engineering_analytics/frontend/generated/api.schemas'+import { isExternalSignalSource } from '../../externalSignalSources'import { sourceSteeringIsSet } from '../../logics/sourceSteeringModalLogic'import { signalSourcesLogic } from '../../signalSourcesLogic'import type { SourceProductDataStatus, SourceProductStatus } from '../../signalSourcesLogic'@@ -28,6 +29,7 @@ import { getSourceProductMeta } from '../badges/sourceProductIcons'import { AGENT_ROSTER_GROUPS, AgentRosterDefinition, AgentRosterGroup, AgentRosterSource } from './agentRosterMeta'import { LinearTeamsModal } from './LinearTeamsModal'import { SourceSteeringModal } from './SourceSteeringModal'+import { VirtualizedSourceList } from './VirtualizedSourceList'type AgentRosterStatus = 'standby' | 'watching' | 'syncing' | 'sync_failed'@@ -108,6 +110,7 @@ interface SourceFilters {/** Per-source derived state assembled by `AgentsRoster` from `signalSourcesLogic`. */interface AgentSourceState {armed: boolean+ connected?: booleanloading: boolean/** True for data-warehouse sources that haven't been connected yet – shows a Connect button. */requiresSetup: boolean@@ -529,58 +532,79 @@ const AgentRow = memo(function AgentRow({const productOff = product?.enabled === false// An off product blocks arming (the source would watch nothing), never disarming.const armingBlocked = productOff && !armed- const tag = notableTag(status, armed, productOff, product)+ const warehouseSource = isExternalSignalSource(agent.source)+ const tag =+ warehouseSource && !loading && !armed+ ? { label: state.connected ? 'Connected · Off' : 'Not connected', type: 'default' as LemonTagType }+ : notableTag(status, armed, productOff, product)// A source whose entities the user creates gets no master switch. Arming it would write to// every entity at once, and turning it off and on again would not restore the earlier subset.const hasMasterSwitch = !agent.entitiesAreUserCreatedconst enabledCount = entities.filter((entity) => entity.enabled).lengthreturn (- <div>+ <div data-attr="signal-source-row" data-source={agent.source}>{/* A legacy row stays dimmed even while in use, so it reads as the older option. */}<div- onClick={onExpand}- className={`group flex h-13 cursor-pointer items-center gap-2 px-2 transition-colors ${+ className={`group flex min-h-13 items-center gap-2 px-2 py-2 transition-colors ${expanded ? 'bg-surface-secondary' : 'hover:bg-surface-secondary'} ${agent.legacy ? 'opacity-60 hover:opacity-100' : ''}`}>{!redesign && <StatusDot status={status} product={product} productOff={productOff} />}- <AgentIcon source={agent} />- <div className="flex min-w-0 flex-1 flex-col">- <div className="flex items-center gap-2">- <span- className={`truncate text-sm leading-5 ${armed ? 'font-medium text-default' : 'text-secondary'}`}- >- {agent.label}- </span>- {agent.alpha && (- <LemonTag type="completion" size="small">- Alpha- </LemonTag>- )}- {agent.legacy && (- <LemonTag type="caution" size="small">- Legacy- </LemonTag>- )}+ <button+ type="button"+ className="flex min-w-0 flex-1 items-center gap-2 border-0 bg-transparent p-0 text-left"+ onClick={onExpand}+ aria-expanded={expanded}+ aria-label={`${expanded ? 'Collapse' : 'Expand'} ${agent.label}`}+ data-attr="signal-source-expand"+ >+ <AgentIcon source={agent} />+ <div className="flex min-w-0 flex-1 flex-col">+ <div className="flex items-center gap-2">+ <span+ className={`truncate text-sm leading-5 ${armed ? 'font-medium text-default' : 'text-secondary'}`}+ >+ {agent.label}+ </span>+ {agent.alpha && (+ <LemonTag type="completion" size="small">+ Alpha+ </LemonTag>+ )}+ {agent.legacy && (+ <LemonTag type="caution" size="small">+ Legacy+ </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>}</div>- <span className="truncate text-xs leading-4 text-muted">{agent.watches}</span>- </div>+ </button>{tag && (<LemonTag type={tag.type} size="small">{tag.label}</LemonTag>)}- <span className="w-38 shrink-0 truncate text-right text-xs text-muted">- {entities.length > 0 && `${enabledCount} of ${entities.length} ${agent.entityNoun} on`}- </span>+ {entities.length > 0 && (+ <span className="shrink-0 truncate text-right text-xs text-muted">+ {enabledCount} of {entities.length} {agent.entityNoun} on+ </span>+ )}{(loading || requiresSetup || hasMasterSwitch) && (- // eslint-disable-next-line react/no-unknown-property- <div className="flex w-13 shrink-0 justify-end" onClick={(e) => e.stopPropagation()}>+ <div className={`flex shrink-0 justify-end ${warehouseSource ? 'w-20' : 'w-13'}`}>{loading ? (<Spinner className="text-base" />- ) : requiresSetup ? (- <LemonButton type="secondary" size="xsmall" onClick={() => onToggle(agent.source)}>- Connect+ ) : warehouseSource || requiresSetup ? (+ <LemonButton+ type="secondary"+ size="xsmall"+ onClick={() => onToggle(agent.source)}+ disabledReason={state.blockedReason}+ aria-label={`${requiresSetup ? 'Connect' : armed ? 'Pause' : 'Turn on'} ${agent.label}`}+ data-attr="signal-source-toggle"+ >+ {requiresSetup ? 'Connect' : armed ? 'Pause' : 'Turn on'}</LemonButton>) : (<LemonSwitch@@ -597,8 +621,6 @@ const AgentRow = memo(function AgentRow({)}</div>)}- {/* A real button inside the clickable row, so keyboard users can reach the- expansion (and the controls inside it, like steering). */}<LemonButtonsize="xsmall"icon={@@ -606,10 +628,7 @@ const AgentRow = memo(function AgentRow({className={`shrink-0 text-muted transition-transform ${expanded ? 'rotate-90' : ''}`}/>}- onClick={(e) => {- e.stopPropagation()- onExpand()- }}+ onClick={onExpand}aria-expanded={expanded}aria-label={`${expanded ? 'Collapse' : 'Expand'} ${agent.label}`}/>@@ -656,13 +675,18 @@ function agentListClassName(redesign: boolean): string {export function AgentsRoster(): JSX.Element {const redesign = useFeatureFlag('INBOX_REDESIGN')const {+ externalSourceStates,+ rosterGroups,+ filteredRosterGroups,+ sourceSearchQuery,+ sourceCategory,+ sourceCategoryOptions,+ sourcesLoadError,+ dataWarehouseSourcesLoading,conversationsConfig,evalReportsConfig,anomalyInvestigationConfig,- githubIssuesConfig,linearIssuesConfig,- zendeskTicketsConfig,- pgAnalyzeIssuesConfig,healthChecksConfig,ciSignalsConfig,ciSignalsConfigLoading,@@ -675,10 +699,7 @@ export function AgentsRoster(): JSX.Element {isEvalReportsToggling,isAnomalyInvestigationToggling,isErrorTrackingToggling,- isGithubIssuesToggling,isLinearIssuesToggling,- isZendeskTicketsToggling,- isPgAnalyzeIssuesToggling,isHealthChecksToggling,isCiSignalsToggling,productStatusBySource,@@ -689,6 +710,9 @@ export function AgentsRoster(): JSX.Element {linearTeamsPicker,} = useValues(signalSourcesLogic)const {+ setSourceSearchQuery,+ setSourceCategory,+ loadSources,openLinearTeamsPicker,closeLinearTeamsPicker,toggleConversations,@@ -704,7 +728,6 @@ export function AgentsRoster(): JSX.Element {loadProductDataEvents,loadSourceConfigs,} = useActions(signalSourcesLogic)- const { featureFlags } = useValues(featureFlagLogic)const [expandedSource, setExpandedSource] = useState<AgentRosterSource | null>(null)// Which modal is open is a view concern; the form and save live in sourceSteeringModalLogic.const [steeringTarget, setSteeringTarget] = useState<{ configs: SignalSourceConfig[]; label: string } | null>(null)@@ -739,15 +762,19 @@ export function AgentsRoster(): JSX.Element {entitiesLoading: false,steeringConfigs: [] as SignalSourceConfig[],}- const dwState = (config: SignalSourceConfig | null, loading: boolean): AgentSourceState => ({- ...base,- armed: !!config?.enabled,- loading,- // No config row yet → the source has never been connected; surface a Connect button.- requiresSetup: config === null,- syncStatus: config?.status,- steeringConfigs: config ? [config] : [],- })+ if (isExternalSignalSource(source)) {+ const state = externalSourceStates[source]+ return {+ ...base,+ armed: !!state.config?.enabled,+ connected: state.connected,+ loading: state.loading,+ requiresSetup: state.requiresSetup,+ syncStatus: state.config?.status,+ steeringConfigs: state.config ? [state.config] : [],+ blockedReason: state.blockedReason,+ }+ }switch (source) {case 'error_tracking':return {@@ -805,14 +832,6 @@ export function AgentsRoster(): JSX.Element {syncStatus: healthChecksConfig?.status,steeringConfigs: healthChecksConfig ? [healthChecksConfig] : [],}- case 'github':- return dwState(githubIssuesConfig, isGithubIssuesToggling)- case 'linear':- return dwState(linearIssuesConfig, isLinearIssuesToggling)- case 'zendesk':- return dwState(zendeskTicketsConfig, isZendeskTicketsToggling)- case 'pganalyze':- return dwState(pgAnalyzeIssuesConfig, isPgAnalyzeIssuesToggling)case 'engineering_analytics':return {...base,@@ -825,6 +844,7 @@ export function AgentsRoster(): JSX.Element {}},[+ externalSourceStates,errorTrackingEntities,errorTrackingConfigs,errorTrackingTypeStates,@@ -840,14 +860,8 @@ export function AgentsRoster(): JSX.Element {isAnomalyInvestigationToggling,healthChecksConfig,isHealthChecksToggling,- githubIssuesConfig,- isGithubIssuesToggling,linearIssuesConfig,isLinearIssuesToggling,- zendeskTicketsConfig,- isZendeskTicketsToggling,- pgAnalyzeIssuesConfig,- isPgAnalyzeIssuesToggling,ciSignalsConfig,ciSignalsConfigLoading,ciSignalsIsFullyEnabled,@@ -876,6 +890,10 @@ export function AgentsRoster(): JSX.Element {const handleToggle = useCallback((source: AgentRosterSource) => {+ if (isExternalSignalSource(source)) {+ initiateDataWarehouseSourceToggle(source)+ return+ }switch (source) {case 'replay_vision':// Switched per scanner, in the expanded list. No row-level control to fire.@@ -895,12 +913,6 @@ export function AgentsRoster(): JSX.Element {case 'health_checks':toggleHealthChecks()return- case 'github':- case 'linear':- case 'zendesk':- case 'pganalyze':- initiateDataWarehouseSourceToggle(source)- returncase 'engineering_analytics':toggleCiSignals()return@@ -928,16 +940,86 @@ export function AgentsRoster(): JSX.Element {[toggleScannerSignals, toggleErrorTrackingType])- const visibleGroups = AGENT_ROSTER_GROUPS.map((group) => ({- ...group,- agents: group.agents.filter((agent) => !agent.flag || featureFlags[agent.flag]),- }))+ const renderAgent = useCallback(+ (agent: AgentRosterDefinition): JSX.Element => {+ const state = stateFor(agent.source)+ // Steering needs a persisted row to write to, so optimistic `new_`+ // placeholder rows wait until the reload lands. Disabled sources keep+ // the control: enabling starts a sync immediately, so rules must be+ // settable before the first sync runs.+ const steeringConfigs =+ agent.steerable &&+ state.steeringConfigs.length > 0 &&+ state.steeringConfigs.every((config) => !config.id.startsWith('new_'))+ ? state.steeringConfigs+ : null+ const filters =+ agent.source === 'linear' && linearIssuesConfig && !linearIssuesConfig.id.startsWith('new_')+ ? {+ summary: linearTeamsSummary(linearIssuesConfig),+ changeLabel: 'Change teams',+ onChange: () => openLinearTeamsPicker({ enableOnSave: false, viaSetupWizard: false }),+ // A save or reload can replace the row, and the picker reads it on open.+ disabledReason: isLinearIssuesToggling+ ? 'Saving'+ : sourceConfigsLoading+ ? 'Refreshing'+ : undefined,+ }+ : undefined+ return (+ <AgentRow+ key={agent.source}+ agent={agent}+ state={state}+ product={productStatusBySource[agent.source]}+ expanded={expandedSource === agent.source}+ enablingProduct={+ !!enablingProduct && enablingProduct === productStatusBySource[agent.source]?.enablement+ }+ onExpand={() => setExpandedSource((current) => (current === agent.source ? null : agent.source))}+ onToggle={handleToggle}+ onToggleEntity={handleToggleEntity}+ onEnableProduct={(product) => product.enablement && enableSourceProduct(product.enablement)}+ filters={filters}+ onSteer={+ steeringConfigs+ ? () => setSteeringTarget({ configs: steeringConfigs, label: agent.label })+ : undefined+ }+ onRetryData={loadProductDataEvents}+ />+ )+ },+ [+ stateFor,+ linearIssuesConfig,+ openLinearTeamsPicker,+ isLinearIssuesToggling,+ sourceConfigsLoading,+ productStatusBySource,+ expandedSource,+ enablingProduct,+ handleToggle,+ handleToggleEntity,+ enableSourceProduct,+ loadProductDataEvents,+ ]+ )- const allAgents = visibleGroups.flatMap((group) => group.agents)+ const allAgents = rosterGroups.flatMap((group) => group.agents)const armedCount = allAgents.filter((agent) => stateFor(agent.source).armed).lengthreturn (<div className="flex flex-col gap-3">+ {sourcesLoadError && (+ <LemonBanner+ type="error"+ action={{ children: 'Retry', onClick: () => loadSources(), loading: dataWarehouseSourcesLoading }}+ >+ Couldn't load your connections. Retry to check which sources are already connected.+ </LemonBanner>+ )}{sourceConfigsLoadFailed && (// Without the configs every data-import source reads as never connected, so warn// instead of letting a person act on switches that do not reflect the server.@@ -965,68 +1047,40 @@ export function AgentsRoster(): JSX.Element {</div>)}- {visibleGroups.map((group) => (+ {filteredRosterGroups.map((group) => (<div key={group.label} className={agentGroupClassName(redesign)}><AgentRosterGroupHeader group={group} redesign={redesign} />+ {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={agentListClassName(redesign)}>- {group.agents.map((agent) => {- const state = stateFor(agent.source)- // Steering needs a persisted row to write to, so optimistic `new_`- // placeholder rows wait until the reload lands. Disabled sources keep- // the control: enabling starts a sync immediately, so rules must be- // settable before the first sync runs.- const steeringConfigs =- agent.steerable &&- state.steeringConfigs.length > 0 &&- state.steeringConfigs.every((config) => !config.id.startsWith('new_'))- ? state.steeringConfigs- : null- const filters =- agent.source === 'linear' &&- linearIssuesConfig &&- !linearIssuesConfig.id.startsWith('new_')- ? {- summary: linearTeamsSummary(linearIssuesConfig),- changeLabel: 'Change teams',- onChange: () =>- openLinearTeamsPicker({ enableOnSave: false, viaSetupWizard: false }),- // A save or reload can replace the row, and the picker reads it on open.- disabledReason: isLinearIssuesToggling- ? 'Saving'- : sourceConfigsLoading- ? 'Refreshing'- : undefined,- }- : undefined- return (- <AgentRow- key={agent.source}- agent={agent}- state={state}- product={productStatusBySource[agent.source]}- expanded={expandedSource === agent.source}- enablingProduct={- !!enablingProduct &&- enablingProduct === productStatusBySource[agent.source]?.enablement- }- onExpand={() =>- setExpandedSource((current) => (current === agent.source ? null : agent.source))- }- onToggle={handleToggle}- onToggleEntity={handleToggleEntity}- onEnableProduct={(product) =>- product.enablement && enableSourceProduct(product.enablement)- }- filters={filters}- onSteer={- steeringConfigs- ? () => setSteeringTarget({ configs: steeringConfigs, label: agent.label })- : undefined- }- onRetryData={loadProductDataEvents}- />- )- })}+ {group.id === 'external' ? (+ <VirtualizedSourceList sources={group.agents} renderSource={renderAgent} />+ ) : (+ group.agents.map(renderAgent)+ )}</div></div>))}diff --git a/products/signals/frontend/inbox/components/config/DataSourceSetup.test.tsx b/products/signals/frontend/inbox/components/config/DataSourceSetup.test.tsxnew file mode 100644index 000000000000..031cc8dfea2a--- /dev/null+++ b/products/signals/frontend/inbox/components/config/DataSourceSetup.test.tsx@@ -0,0 +1,68 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen, waitFor } from '@testing-library/react'+import { router } from 'kea-router'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { sourceWizardLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic'+import type { SourceConfigResponseApi } from 'products/warehouse_sources/frontend/generated/api.schemas'++import { DataSourceSetup } from './DataSourceSetup'++const INTERCOM_CONFIG: SourceConfigResponseApi = {+ name: 'Intercom',+ iconPath: '',+ caption: null,+ supportsColumnSelection: false,+ versions: [],+ defaultVersion: '',+ deprecatedVersions: [],+ fields: [+ {+ type: 'oauth',+ name: 'intercom_integration_id',+ label: 'Intercom workspace',+ required: true,+ kind: 'intercom',+ },+ ],+}++describe('DataSourceSetup', () => {+ afterEach(cleanup)++ it('adopts the OAuth account in the resumed signal form without losing required tables or completion', async () => {+ initKeaTests()+ useMocks({+ get: {+ '/api/projects/:team_id/external_data_sources/wizard/': { Intercom: INTERCOM_CONFIG },+ '/api/projects/:team_id/integrations/': {+ results: [+ { id: 7, kind: 'intercom', display_name: 'Example workspace', user_access_level: 'manager' },+ ],+ next: null,+ },+ },+ })+ router.actions.push('/inbox', { setup: 'signal-sources', signal_source: 'intercom', integration_id: '7' })+ const onComplete = jest.fn()+ render(+ <DataSourceSetup+ source="intercom"+ onComplete={onComplete}+ oauthRedirectUrl="/inbox?setup=signal-sources&signal_source=intercom"+ />+ )++ await screen.findByText('Intercom workspace')+ await waitFor(() =>+ expect(sourceWizardLogic.values.sourceConnectionDetails.payload.intercom_integration_id).toBe(7)+ )+ expect(sourceWizardLogic.values.requiredTables).toEqual(['conversations'])+ expect(sourceWizardLogic.props.onComplete).toBe(onComplete)+ expect(sourceWizardLogic.values.oauthRedirectUrl).toContain('signal_source=intercom')+ expect(router.values.searchParams.integration_id).toBeUndefined()+ })+})diff --git a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsxindex ff1d160ecf8a..6802b7721ab3 100644--- a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx+++ b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx@@ -18,15 +18,17 @@ export function DataSourceSetup({onComplete,onCancel,completing = false,+ oauthRedirectUrl,}: {source: WarehouseBackedSourceonComplete: () => voidonCancel?: () => voidcompleting?: boolean+ oauthRedirectUrl?: string}): JSX.Element {const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)const { load } = useActions(availableSourcesLogic)- const { dwSourceType, requiredTables } = WAREHOUSE_SOURCE_SETUP[source]+ const { dwSourceType, requiredTables, requiredTableSyncType } = WAREHOUSE_SOURCE_SETUP[source]const sourceConfig = availableSources? Object.values(availableSources).find((s: SourceConfigResponseApi) => s.name === dwSourceType)@@ -59,7 +61,9 @@ export function DataSourceSetup({props={{availableSources,requiredTables,+ requiredTableSyncType,onComplete,+ oauthRedirectUrl,}}><DataSourceSetupForm sourceConfig={sourceConfig} onCancel={onCancel} completing={completing} />diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsxindex 4d2f54d1ccc3..4faa9e451cdd 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.stories.tsx@@ -3,6 +3,7 @@ import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'import type { Meta, StoryObj } from '@storybook/react'import { within } from '@testing-library/dom'import userEvent from '@testing-library/user-event'+import { useActions } from 'kea'import { useEffect } from 'react'import { FEATURE_FLAGS } from 'lib/constants'@@ -10,6 +11,8 @@ import { teamLogic } from 'scenes/teamLogic'import { useStorybookMocks } from '~/mocks/browser'+import { availableSourcesLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/availableSourcesLogic'+import { ERROR_TRACKING_SIGNAL_SOURCE_TYPES } from '../../signalSourcesLogic'import { SignalSourceConfig, SignalSourceProduct, SignalSourceType } from '../../types'import { SignalSourcesPanel } from './SignalSourcesPanel'@@ -37,6 +40,7 @@ interface PanelState {hasAnalyticsEvents: booleaneventDefinitionsUnavailable: booleansourceConfigsUnavailable: boolean+ externalConnections: boolean}function sourceConfig(@@ -58,6 +62,19 @@ function sourceConfig(function sourceConfigsFor(state: PanelState): SignalSourceConfig[] {return [+ ...(state.externalConnections+ ? [+ sourceConfig(SignalSourceProduct.Github, SignalSourceType.Issue, true),+ {+ ...sourceConfig(SignalSourceProduct.Jira, SignalSourceType.Issue, false),+ config: { steering: 'Prioritize issues affecting sign-in and checkout.' },+ },+ {+ ...sourceConfig(SignalSourceProduct.Sentry, SignalSourceType.Issue, true),+ status: 'failed' as SignalSourceConfig['status'],+ },+ ]+ : []),...ERROR_TRACKING_SIGNAL_SOURCE_TYPES.map((sourceType) =>sourceConfig(SignalSourceProduct.ErrorTracking, sourceType, state.errorTrackingArmed)),@@ -171,6 +188,38 @@ function eventDefinitionsFor(state: PanelState): { name: string; last_seen_at: sfunction PanelHarness(state: PanelState): JSX.Element {useStorybookMocks({get: {+ '/api/environments/:team_id/external_data_sources/wizard/': () => [+ 200,+ {+ GitLab: {+ name: 'GitLab',+ label: 'GitLab',+ iconPath: '/static/services/gitlab.svg',+ caption: null,+ supportsColumnSelection: false,+ versions: [],+ defaultVersion: '',+ deprecatedVersions: [],+ fields: [+ {+ name: 'gitlab_host',+ label: 'GitLab instance URL',+ type: 'text',+ required: true,+ secret: false,+ },+ {+ name: 'personal_access_token',+ label: 'Personal access token',+ type: 'password',+ required: true,+ secret: true,+ },+ { name: 'project', label: 'Project', type: 'text', required: true, secret: false },+ ],+ },+ },+ ],'/api/environments/:team_id/': () => [200,{@@ -202,7 +251,26 @@ function PanelHarness(state: PanelState): JSX.Element {],'/api/environments/:team_id/external_data_sources/': () => [200,- { count: 0, next: null, previous: null, results: [] },+ {+ count: state.externalConnections ? 3 : 0,+ next: null,+ previous: null,+ results: state.externalConnections+ ? ['Github', 'Jira', 'Sentry'].map((source_type, index) => ({+ id: `source-${index}`,+ source_type,+ status: 'Completed',+ schemas: [+ {+ id: `schema-${index}`,+ name: 'issues',+ should_sync: true,+ sync_type: 'full_refresh',+ },+ ],+ }))+ : [],+ },],},})@@ -211,9 +279,11 @@ function PanelHarness(state: PanelState): JSX.Element {// both remount the panel (the `key`) and refetch the team against the updated mock.const stateKey = JSON.stringify(state)const { loadCurrentTeam } = teamLogic.actions+ const { load: loadAvailableSources } = useActions(availableSourcesLogic)useEffect(() => {loadCurrentTeam()- }, [stateKey, loadCurrentTeam])+ loadAvailableSources()+ }, [stateKey, loadCurrentTeam, loadAvailableSources])return (<div className="w-[760px] p-6 bg-surface-primary border rounded">@@ -246,6 +316,7 @@ const meta: Meta<typeof PanelHarness> = {hasAnalyticsEvents: true,eventDefinitionsUnavailable: false,sourceConfigsUnavailable: false,+ externalConnections: false,},}export default meta@@ -358,7 +429,8 @@ export const SourceConfigsUnavailable: Story = {export const ReplayVisionExpanded: Story = {parameters: { featureFlags: [FEATURE_FLAGS.INBOX_REDESIGN] },play: async ({ canvasElement }) => {- await userEvent.click(await within(canvasElement).findByText('Replay vision', { exact: true }))+ const [expandButton] = await within(canvasElement).findAllByLabelText('Expand Replay vision')+ await userEvent.click(expandButton)},}@@ -366,6 +438,11 @@ export const ReplayVisionExpanded: Story = {export const ErrorTrackingExpanded: Story = {parameters: { featureFlags: [FEATURE_FLAGS.INBOX_REDESIGN] },play: async ({ canvasElement }) => {- await userEvent.click(await within(canvasElement).findByText('Error tracking', { exact: true }))+ const [expandButton] = await within(canvasElement).findAllByLabelText('Expand Error tracking')+ await userEvent.click(expandButton)},}++export const ExternalSourcesConnected: Story = {+ args: { externalConnections: true },+}diff --git a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsxindex 9e618737969c..f18bba247ec6 100644--- a/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx+++ b/products/signals/frontend/inbox/components/config/SignalSourcesPanel.tsx@@ -23,7 +23,7 @@ function BackLink({ onClick }: { onClick: () => void }): JSX.Element {* the Signal sources setup modal.*/export function SignalSourcesPanel(): JSX.Element {- const { dataSourceSetupSource } = useValues(signalSourcesLogic)+ const { dataSourceSetupSource, dataSourceSetupOAuthRedirectUrl } = useValues(signalSourcesLogic)const {loadSources,loadSourceConfigs,@@ -44,7 +44,11 @@ export function SignalSourcesPanel(): JSX.Element {return (<div className="flex flex-col gap-3"><BackLink onClick={closeDataSourceSetup} />- <DataSourceSetup source={dataSourceSetupSource} onComplete={() => onDataSourceSetupComplete()} />+ <DataSourceSetup+ source={dataSourceSetupSource}+ onComplete={() => onDataSourceSetupComplete()}+ oauthRedirectUrl={dataSourceSetupOAuthRedirectUrl}+ /></div>)}diff --git a/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsx b/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsxnew file mode 100644index 000000000000..af057f64a7bd--- /dev/null+++ b/products/signals/frontend/inbox/components/config/VirtualizedSourceList.tsx@@ -0,0 +1,54 @@+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/components/config/agentRosterMeta.ts b/products/signals/frontend/inbox/components/config/agentRosterMeta.tsindex 838a1d51e7ec..8710994bc1fb 100644--- a/products/signals/frontend/inbox/components/config/agentRosterMeta.ts+++ b/products/signals/frontend/inbox/components/config/agentRosterMeta.ts@@ -1,6 +1,7 @@import { FEATURE_FLAGS, FeatureFlagKey } from 'lib/constants'import { urls } from 'scenes/urls'+import { EXTERNAL_SIGNAL_SOURCES, ExternalSignalSource } from '../../externalSignalSources'import { SignalSourceProduct } from '../../types'/**@@ -15,10 +16,7 @@ export type AgentRosterSource =| 'llm_analytics'| 'analytics'| 'health_checks'- | 'github'- | 'linear'- | 'zendesk'- | 'pganalyze'+ | ExternalSignalSource| 'engineering_analytics'export interface AgentRosterDefinition {@@ -26,6 +24,7 @@ export interface AgentRosterDefinition {/** Key into `SOURCE_PRODUCT_META` for the icon tile. */sourceProduct: SignalSourceProductlabel: string+ category?: string/** The tagline: one truncated line under the source name, saying what this source watches. */watches: string/**@@ -66,12 +65,14 @@ export interface AgentRosterDefinition {}export interface AgentRosterGroup {+ id: 'posthog' | 'external'label: stringagents: AgentRosterDefinition[]}export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [{+ id: 'posthog',label: 'PostHog data',agents: [{@@ -141,49 +142,28 @@ export const AGENT_ROSTER_GROUPS: AgentRosterGroup[] = [],},{+ id: 'external',label: 'External sources',agents: [- {- source: 'github',- sourceProduct: SignalSourceProduct.Github,- label: 'GitHub issues',- watches: 'Issues filed in GitHub',- detail: 'Reads the issues from the GitHub repositories you sync to the warehouse.',+ ...EXTERNAL_SIGNAL_SOURCES.map((source) => ({+ source: source.source,+ sourceProduct: source.source,+ label: source.label,+ category: source.category,+ watches: source.watches,+ detail: `Reads the ${source.label} data you sync to Data warehouse.`,steerable: true,- },+ })),{source: 'engineering_analytics',sourceProduct: SignalSourceProduct.EngineeringAnalytics,label: 'GitHub CI',+ category: 'Engineering',watches: 'Flaky checks and slowing GitHub Actions workflows',detail: 'Reads workflow runs and pull requests from the GitHub repositories you sync.',alpha: true,flag: FEATURE_FLAGS.ENGINEERING_ANALYTICS,},- {- source: 'linear',- sourceProduct: SignalSourceProduct.Linear,- label: 'Linear',- watches: 'Issues tracked in Linear',- detail: 'Reads the issues from the Linear workspace you sync to the warehouse.',- steerable: true,- },- {- source: 'zendesk',- sourceProduct: SignalSourceProduct.Zendesk,- label: 'Zendesk',- watches: 'Incoming Zendesk tickets',- detail: 'Reads the tickets from the Zendesk account you sync to the warehouse.',- steerable: true,- },- {- source: 'pganalyze',- sourceProduct: SignalSourceProduct.Pganalyze,- label: 'pganalyze',- watches: 'Slow Postgres queries and bad indexes',- detail: 'Reads the issues from the pganalyze account you sync to the warehouse.',- steerable: true,- },],},]diff --git a/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.test.ts b/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.test.tsindex 04af9f51aec2..0d3d1bd700b7 100644--- a/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.test.ts+++ b/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.test.ts@@ -23,26 +23,31 @@ describe('agentSetupModalLogic', () => {expect(logic.values.openModal).toBeNull()})- it('restores the GitHub modal from the callback URL and only removes GitHub parameters when closed', () => {- router.actions.push('/inbox/config', {- setup: 'github',- integration_id: '12',- installation_id: '34',- github_setup_error: 'pending',- error_message: 'Try again',- github_install_pending: '1',- source: 'saved-filter',- })- const callbackPath = router.values.location.pathname-- logic = agentSetupModalLogic()- logic.mount()-- expect(logic.values.openModal).toBe('github')-- logic.actions.closeSetupModal()-- expect(router.values.location.pathname).toBe(callbackPath)- expect(router.values.searchParams).toEqual({ source: 'saved-filter' })- })+ it.each(['github', 'signal-sources'] as const)(+ 'restores the %s modal from the callback URL and removes callback parameters when closed',+ (setup) => {+ router.actions.push('/inbox/config', {+ setup,+ signal_source: 'intercom',+ integration_error: 'access_denied',+ integration_id: '12',+ installation_id: '34',+ github_setup_error: 'pending',+ error_message: 'Try again',+ github_install_pending: '1',+ source: 'saved-filter',+ })+ const callbackPath = router.values.location.pathname++ logic = agentSetupModalLogic()+ logic.mount()++ expect(logic.values.openModal).toBe(setup)++ logic.actions.closeSetupModal()++ expect(router.values.location.pathname).toBe(callbackPath)+ expect(router.values.searchParams).toEqual({ source: 'saved-filter' })+ }+ )})diff --git a/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.ts b/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.tsindex 302c92bbab32..a12bc942e39c 100644--- a/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.ts+++ b/products/signals/frontend/inbox/components/shell/agentSetupModalLogic.ts@@ -53,7 +53,10 @@ export const agentSetupModalLogic = kea<agentSetupModalLogicType>([)},closeSetupModal: () => {- if (router.values.searchParams.setup !== 'github') {+ if (+ router.values.searchParams.setup !== 'github' &&+ router.values.searchParams.setup !== 'signal-sources'+ ) {return}const {@@ -63,22 +66,28 @@ export const agentSetupModalLogic = kea<agentSetupModalLogicType>([github_setup_error: _githubSetupError,error_message: _errorMessage,github_install_pending: _githubInstallPending,+ signal_source: _signalSource,+ integration_error: _integrationError,...searchParams} = router.values.searchParamsrouter.actions.replace(router.values.location.pathname, searchParams, router.values.hashParams)},}),- urlToAction(({ actions, values }) => ({- [urls.inbox()]: (_, searchParams) => {- if (searchParams.setup === 'github' && values.openModal !== 'github') {- actions.openSetupModal('github')+ urlToAction(({ actions, values }) => {+ function restoreSetupModal(searchParams: Record<string, unknown>): void {+ const key = searchParams.setup+ if ((key === 'github' || key === 'signal-sources') && values.openModal !== key) {+ actions.openSetupModal(key)}- },- [urls.inbox(':tab')]: ({ tab }, searchParams) => {- if (tab !== 'scout-trials' && searchParams.setup === 'github' && values.openModal !== 'github') {- actions.openSetupModal('github')- }- },- })),+ }+ return {+ [urls.inbox()]: (_, searchParams) => restoreSetupModal(searchParams),+ [urls.inbox(':tab')]: ({ tab }, searchParams) => {+ if (tab !== 'scout-trials') {+ restoreSetupModal(searchParams)+ }+ },+ }+ }),])diff --git a/products/signals/frontend/inbox/externalSignalSources.ts b/products/signals/frontend/inbox/externalSignalSources.tsnew file mode 100644index 000000000000..4f7d7c35c70f--- /dev/null+++ b/products/signals/frontend/inbox/externalSignalSources.ts@@ -0,0 +1,372 @@+import type { ExternalDataSourceTypeEnumApi } from 'products/warehouse_sources/frontend/generated/api.schemas'++import type { SignalSourceProductApi, SignalSourceConfigSourceTypeEnumApi } from '../generated/api.schemas'++interface ExternalSignalSourceDefinition {+ source: SignalSourceProductApi+ label: string+ category: string+ watches: string+ dwSourceType: ExternalDataSourceTypeEnumApi+ requiredTables: readonly string[]+ sourceType: SignalSourceConfigSourceTypeEnumApi+ // Creation-only cursors miss later edits, so these sources opt into full refresh.+ requiredTableSyncType?: 'full_refresh'+}++// Only warehouse tables registered in the signals emission registry belong here.+export const EXTERNAL_SIGNAL_SOURCES = [+ {+ source: 'gitea',+ label: 'Gitea',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'Gitea',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'github',+ label: 'GitHub issues',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'Github',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'gitlab',+ label: 'GitLab',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'GitLab',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'jira',+ label: 'Jira',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'Jira',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'linear',+ label: 'Linear',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'Linear',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'shortcut',+ label: 'Shortcut',+ category: 'Issue tracking',+ watches: 'Monitor new issues and updates',+ dwSourceType: 'Shortcut',+ requiredTables: ['stories'],+ sourceType: 'issue',+ },+ {+ source: 'bugsnag',+ label: 'Bugsnag',+ category: 'Error tracking',+ watches: 'Surface new and reopened errors',+ dwSourceType: 'Bugsnag',+ requiredTables: ['errors'],+ sourceType: 'issue',+ },+ {+ source: 'honeybadger',+ label: 'Honeybadger',+ category: 'Error tracking',+ watches: 'Surface new and reopened errors',+ dwSourceType: 'Honeybadger',+ requiredTables: ['faults'],+ sourceType: 'issue',+ },+ {+ source: 'raygun',+ label: 'Raygun',+ category: 'Error tracking',+ watches: 'Surface new and reopened errors',+ dwSourceType: 'Raygun',+ requiredTables: ['error_groups'],+ sourceType: 'issue',+ },+ {+ source: 'rollbar',+ label: 'Rollbar',+ category: 'Error tracking',+ watches: 'Surface new and reopened errors',+ dwSourceType: 'Rollbar',+ requiredTables: ['items'],+ sourceType: 'issue',+ },+ {+ source: 'sentry',+ label: 'Sentry',+ category: 'Error tracking',+ watches: 'Surface new and reopened errors',+ dwSourceType: 'Sentry',+ requiredTables: ['issues'],+ sourceType: 'issue',+ },+ {+ source: 'dixa',+ label: 'Dixa',+ category: 'Support',+ watches: 'Monitor incoming support conversations',+ dwSourceType: 'Dixa',+ requiredTables: ['conversations'],+ sourceType: 'ticket',+ },+ {+ source: 'freshdesk',+ label: 'Freshdesk',+ category: 'Support',+ watches: 'Monitor incoming support tickets',+ dwSourceType: 'Freshdesk',+ requiredTables: ['tickets'],+ sourceType: 'ticket',+ },+ {+ source: 'freshservice',+ label: 'Freshservice',+ category: 'Support',+ watches: 'Monitor incoming support tickets',+ dwSourceType: 'Freshservice',+ requiredTables: ['tickets'],+ sourceType: 'ticket',+ },+ {+ source: 'front',+ label: 'Front',+ category: 'Support',+ watches: 'Monitor incoming support conversations',+ dwSourceType: 'Front',+ requiredTables: ['conversations'],+ sourceType: 'ticket',+ },+ {+ source: 'gorgias',+ label: 'Gorgias',+ category: 'Support',+ watches: 'Monitor incoming support tickets',+ dwSourceType: 'Gorgias',+ requiredTables: ['tickets'],+ sourceType: 'ticket',+ },+ {+ source: 'hubspot',+ label: 'HubSpot',+ category: 'Support',+ watches: 'Monitor incoming support tickets',+ dwSourceType: 'Hubspot',+ requiredTables: ['tickets'],+ sourceType: 'ticket',+ },+ {+ source: 'intercom',+ label: 'Intercom',+ category: 'Support',+ watches: 'Monitor incoming support conversations',+ dwSourceType: 'Intercom',+ requiredTables: ['conversations'],+ sourceType: 'ticket',+ },+ {+ source: 'kustomer',+ label: 'Kustomer',+ category: 'Support',+ watches: 'Monitor incoming support conversations',+ dwSourceType: 'Kustomer',+ requiredTables: ['conversations'],+ sourceType: 'ticket',+ },+ {+ source: 'plain',+ label: 'Plain',+ category: 'Support',+ watches: 'Monitor incoming support conversations',+ dwSourceType: 'Plain',+ requiredTables: ['threads'],+ sourceType: 'ticket',+ },+ {+ source: 'zendesk',+ label: 'Zendesk',+ category: 'Support',+ watches: 'Monitor incoming support tickets',+ dwSourceType: 'Zendesk',+ requiredTables: ['tickets'],+ sourceType: 'ticket',+ },+ {+ source: 'pganalyze',+ label: 'pganalyze',+ category: 'Database performance',+ watches: 'Postgres performance findings, slow queries, and index recommendations',+ dwSourceType: 'PgAnalyze',+ requiredTables: ['issues', 'servers'],+ sourceType: 'issue',+ },+ {+ source: 'rapid7_insightvm',+ label: 'Rapid7 InsightVM',+ category: 'Security',+ watches: 'Surface new security and code-quality findings',+ dwSourceType: 'Rapid7Insightvm',+ requiredTables: ['vulnerabilities'],+ sourceType: 'scanner_finding',+ },+ {+ source: 'semgrep',+ label: 'Semgrep',+ category: 'Security',+ watches: 'Surface new security and code-quality findings',+ dwSourceType: 'Semgrep',+ requiredTables: ['sast_findings'],+ sourceType: 'scanner_finding',+ },+ {+ source: 'snyk',+ label: 'Snyk',+ category: 'Security',+ watches: 'Surface new security and code-quality findings',+ dwSourceType: 'Snyk',+ requiredTables: ['issues'],+ sourceType: 'scanner_finding',+ },+ {+ source: 'sonarqube',+ label: 'SonarQube',+ category: 'Security',+ watches: 'Surface new security and code-quality findings',+ dwSourceType: 'Sonarqube',+ requiredTables: ['issues'],+ sourceType: 'scanner_finding',+ requiredTableSyncType: 'full_refresh',+ },+ {+ source: 'aha',+ label: 'Aha',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Aha',+ requiredTables: ['ideas'],+ sourceType: 'feedback',+ },+ {+ source: 'asknicely',+ label: 'AskNicely',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Asknicely',+ requiredTables: ['responses'],+ sourceType: 'feedback',+ requiredTableSyncType: 'full_refresh',+ },+ {+ source: 'canny',+ label: 'Canny',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Canny',+ requiredTables: ['posts'],+ sourceType: 'feedback',+ },+ {+ source: 'featurebase',+ label: 'Featurebase',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Featurebase',+ requiredTables: ['posts'],+ sourceType: 'feedback',+ },+ {+ source: 'frill',+ label: 'Frill',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Frill',+ requiredTables: ['ideas'],+ sourceType: 'feedback',+ },+ {+ source: 'productboard',+ label: 'Productboard',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Productboard',+ requiredTables: ['notes'],+ sourceType: 'feedback',+ },+ {+ source: 'retently',+ label: 'Retently',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Retently',+ requiredTables: ['feedback'],+ sourceType: 'feedback',+ requiredTableSyncType: 'full_refresh',+ },+ {+ source: 'uservoice',+ label: 'UserVoice',+ category: 'Product feedback',+ watches: 'Turn product feedback and feature requests into inputs',+ dwSourceType: 'Uservoice',+ requiredTables: ['suggestions'],+ sourceType: 'feedback',+ },+ {+ source: 'appfigures',+ label: 'Appfigures',+ category: 'Reviews',+ watches: 'Monitor new app and product reviews',+ dwSourceType: 'Appfigures',+ requiredTables: ['reviews'],+ sourceType: 'review',+ requiredTableSyncType: 'full_refresh',+ },+ {+ source: 'appfollow',+ label: 'AppFollow',+ category: 'Reviews',+ watches: 'Monitor new app and product reviews',+ dwSourceType: 'Appfollow',+ requiredTables: ['reviews'],+ sourceType: 'review',+ },+ {+ source: 'judgeme_reviews',+ label: 'Judge.me',+ category: 'Reviews',+ watches: 'Monitor new app and product reviews',+ dwSourceType: 'JudgeMeReviews',+ requiredTables: ['reviews'],+ sourceType: 'review',+ },+ {+ source: 'google_search_console',+ label: 'Google Search Console',+ category: 'Search analytics',+ watches: 'Fix pages that rank in Google but lose clicks',+ dwSourceType: 'GoogleSearchConsole',+ requiredTables: ['search_analytics_by_query_page'],+ sourceType: 'search_opportunity',+ },+] as const satisfies readonly ExternalSignalSourceDefinition[]++export type ExternalSignalSource = (typeof EXTERNAL_SIGNAL_SOURCES)[number]['source']+export type ExternalSignalSourceCategory = (typeof EXTERNAL_SIGNAL_SOURCES)[number]['category']++export function isExternalSignalSource(source: string): source is ExternalSignalSource {+ return EXTERNAL_SIGNAL_SOURCES.some((definition) => definition.source === source)+}diff --git a/products/signals/frontend/inbox/signalSourcesLogic.test.ts b/products/signals/frontend/inbox/signalSourcesLogic.test.tsindex 1917f5c840dd..1b5c736462d0 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.test.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.test.ts@@ -1,5 +1,6 @@import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import { router } from 'kea-router'import { expectLogic } from 'kea-test-utils'import { lemonToast } from '@posthog/lemon-ui'@@ -11,6 +12,8 @@ import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { AccessControlLevel, ExternalDataJobStatus, ExternalDataSource, ExternalDataSourceSchema } from '~/types'+import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics/sourcesDataLogic'+import { signalSourcesLogic } from './signalSourcesLogic'import { SignalSourceProduct, SignalSourceType } from './types'@@ -132,6 +135,182 @@ describe('signalSourcesLogic', () => {expect(logic.values.dataSourceSetupSource).toBe(setup)})+ it.each([+ {+ source: 'jira' as const,+ warehouseType: 'Jira' as const,+ table: 'issues',+ recordType: SignalSourceType.Issue,+ refresh: false,+ },+ {+ source: 'sonarqube' as const,+ warehouseType: 'Sonarqube' as const,+ table: 'issues',+ recordType: SignalSourceType.ScannerFinding,+ refresh: true,+ },+ {+ source: 'github' as const,+ warehouseType: 'Github' as const,+ table: 'issues',+ recordType: SignalSourceType.Issue,+ refresh: false,+ },+ {+ source: 'linear' as const,+ warehouseType: 'Linear' as const,+ table: 'issues',+ recordType: SignalSourceType.Issue,+ refresh: false,+ },+ {+ source: 'intercom' as const,+ warehouseType: 'Intercom' as const,+ table: 'conversations',+ recordType: SignalSourceType.Ticket,+ refresh: false,+ },+ ])(+ 'enables $source using its existing connection and required record type',+ async ({ source, warehouseType, table, recordType, refresh }) => {+ const configWrites: unknown[] = []+ const schemaWrites: unknown[] = []+ warehouseSources = [+ {+ ...githubSource,+ source_type: warehouseType,+ schemas: [{ ...githubSchema('schema-1', table), sync_type: 'incremental' }],+ },+ ]+ useMocks({+ post: {+ '/api/projects/:team_id/signals/source_configs/': async ({ request }) => {+ configWrites.push(await request.json())+ return [200, { ...githubIssuesConfig, source_product: source, source_type: recordType }]+ },+ },+ patch: {+ '/api/environments/:team_id/external_data_schemas/:id/': async ({ request }) => {+ schemaWrites.push(await request.json())+ return [200, {}]+ },+ },+ })+ logic.actions.loadSourceConfigsSuccess([])+ sourcesDataLogic.actions.loadSourcesSuccess({ results: warehouseSources, next: null, previous: null })+ await expectLogic(logic, () =>+ logic.actions.initiateDataWarehouseSourceToggle(source)+ ).toFinishAllListeners()+ expect(logic.values.dataSourceSetupSource).toBeNull()+ expect(configWrites).toEqual(+ source === 'linear'+ ? []+ : [{ source_product: source, source_type: recordType, enabled: true, config: {} }]+ )+ if (source === 'linear') {+ expect(logic.values.linearTeamsPicker).toEqual({ enableOnSave: true, viaSetupWizard: false })+ }+ expect(schemaWrites).toEqual(refresh ? [{ should_sync: true, sync_type: 'full_refresh' }] : [])+ expect(logic.values.externalSourceStates[source].loading).toBe(false)+ }+ )++ it.each([+ ['image-only connection', 'search_analytics_by_query_page_image'],+ ['connection without schemas', null],+ ])('does not enable Search Console signals with an %s', async (_name, schemaName) => {+ const createConfig = jest.spyOn(api.signalSourceConfigs, 'create')+ const toastError = jest.spyOn(lemonToast, 'error')+ warehouseSources = [+ {+ ...githubSource,+ source_type: 'GoogleSearchConsole',+ schemas: schemaName ? [githubSchema('gsc-1', schemaName)] : [],+ },+ ]+ logic.actions.loadSourceConfigsSuccess([])+ sourcesDataLogic.actions.loadSourcesSuccess({ results: warehouseSources, next: null, previous: null })++ await expectLogic(logic, () =>+ logic.actions.initiateDataWarehouseSourceToggle('google_search_console')+ ).toFinishAllListeners()++ expect(createConfig).not.toHaveBeenCalled()+ expect(toastError).toHaveBeenCalledWith(expect.stringContaining('Add the Web search type'))+ expect(logic.values.externalSourceStates.google_search_console.loading).toBe(false)+ createConfig.mockRestore()+ toastError.mockRestore()+ })++ it('resumes Intercom setup after OAuth and enables signals on completion', async () => {+ logic.unmount()+ router.actions.push(+ '/inbox',+ { setup: 'signal-sources', signal_source: 'intercom', integration_id: '7', source: 'saved-filter' },+ { tab: 'details' }+ )+ const callbackPath = router.values.location.pathname+ const createConfig = jest.spyOn(api.signalSourceConfigs, 'create').mockResolvedValue({+ ...githubIssuesConfig,+ source_product: SignalSourceProduct.Intercom,+ source_type: SignalSourceType.Ticket,+ })+ logic = signalSourcesLogic()+ logic.mount()+ logic.actions.loadSourceConfigsSuccess([])++ expect(logic.values.dataSourceSetupSource).toBe('intercom')+ const redirect = new URL(logic.values.dataSourceSetupOAuthRedirectUrl!, 'https://example.com')+ expect(redirect.pathname).toBe(callbackPath)+ expect(redirect.searchParams.get('signal_source')).toBe('intercom')+ expect(redirect.searchParams.get('source')).toBe('saved-filter')++ await expectLogic(logic, () => logic.actions.onDataSourceSetupComplete()).toFinishAllListeners()++ expect(createConfig).toHaveBeenCalledWith({+ source_product: 'intercom',+ source_type: 'ticket',+ enabled: true,+ config: {},+ })+ expect(logic.values.dataSourceSetupSource).toBeNull()+ expect(router.values.searchParams.signal_source).toBeUndefined()+ expect(router.values.searchParams.source).toBe('saved-filter')+ createConfig.mockRestore()+ })++ it('pins sources before connected tools and filters the catalog without hiding PostHog sources', () => {+ 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'])+ expect(logic.values.externalSourceStates.jira).toMatchObject({ connected: true, requiresSetup: false })+ expect(logic.values.externalSourceStates.sentry).toMatchObject({ connected: false, requiresSetup: true })+ 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)+ })+it('carries the card guidance onto an error tracking signal type turned on later', async () => {// Error tracking is one guidance box over three rows. A row created after the guidance was// written would otherwise start empty, so that one trigger would report everything while thediff --git a/products/signals/frontend/inbox/signalSourcesLogic.ts b/products/signals/frontend/inbox/signalSourcesLogic.tsindex 9ac3c9ff7c32..52a79288bd3b 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.ts@@ -1,5 +1,6 @@import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'import { loaders } from 'kea-loaders'+import { combineUrl, router } from 'kea-router'import { lemonToast } from '@posthog/lemon-ui'@@ -25,10 +26,12 @@ import { eventDefinitionsList } from 'products/event_definitions/frontend/generaimport { visionScannersList, visionScannersPartialUpdate } from 'products/replay_vision/frontend/generated/api'import type { ReplayScannerApi } from 'products/replay_vision/frontend/generated/api.schemas'import { SignalSourceProduct, SignalSourceType } from 'products/signals/frontend/inbox/types'+import { externalDataSchemasPartialUpdate } from 'products/warehouse_sources/frontend/generated/api'import { ExternalDataSourceTypeEnumApi } from 'products/warehouse_sources/frontend/generated/api.schemas'import type { SignalSourceTypeApi, SignalSourceConfigSourceTypeEnumApi } from '../generated/api.schemas'-import type { AgentRosterSource } from './components/config/agentRosterMeta'+import { AGENT_ROSTER_GROUPS, AgentRosterGroup, AgentRosterSource } from './components/config/agentRosterMeta'+import { EXTERNAL_SIGNAL_SOURCES, ExternalSignalSource, isExternalSignalSource } from './externalSignalSources'import {SignalSourceToggleFailureReason,captureSignalSourceConfigsLoadFailed,@@ -79,7 +82,23 @@ function inheritedErrorTrackingConfig(configs: SignalSourceConfig[]): Record<str}/** Warehouse-backed signal sources, keyed by roster source id. */-export type WarehouseBackedSource = 'github' | 'linear' | 'zendesk' | 'pganalyze' | 'engineering_analytics'+export type WarehouseBackedSource = ExternalSignalSource | 'engineering_analytics'++const PINNED_SOURCE_ORDER: Partial<Record<AgentRosterSource, number>> = {+ github: 0,+ linear: 1,+ zendesk: 2,+ sentry: 3,+ jira: 4,+}++export interface ExternalSignalSourceState {+ config: SignalSourceConfig | null+ connected: boolean+ loading: boolean+ requiresSetup: boolean+ blockedReason?: string+}/** Why the Linear teams picker is open: enabling the source (its save turns it on) or editing the filter. */export interface LinearTeamsPickerState {@@ -101,54 +120,30 @@ type WarehouseSourceCompletion =* tables its signals read (pre-selected in the wizard and forced to sync), and what enabling means* once connected. Keyed by signal source, not warehouse product — GitHub backs more than one source.*/-export const WAREHOUSE_SOURCE_SETUP: Record<- WarehouseBackedSource,- {- dwSourceType: ExternalDataSourceTypeEnumApi- requiredTables: string[]- completion: WarehouseSourceCompletion- }-> = {- github: {- dwSourceType: 'Github',- requiredTables: ['issues'],- completion: {- kind: 'source_config',- sourceProduct: SignalSourceProduct.Github,- sourceType: SignalSourceType.Issue,- enableErrorMessage: 'Failed to enable GitHub Issues',- },- },- linear: {- dwSourceType: 'Linear',- requiredTables: ['issues'],- completion: {- kind: 'source_config',- sourceProduct: SignalSourceProduct.Linear,- sourceType: SignalSourceType.Issue,- enableErrorMessage: 'Failed to enable Linear Issues',- },- },- zendesk: {- dwSourceType: 'Zendesk',- requiredTables: ['tickets'],- completion: {- kind: 'source_config',- sourceProduct: SignalSourceProduct.Zendesk,- sourceType: SignalSourceType.Ticket,- enableErrorMessage: 'Failed to enable Zendesk Tickets',- },- },- pganalyze: {- dwSourceType: 'PgAnalyze',- requiredTables: ['issues', 'servers'],- completion: {- kind: 'source_config',- sourceProduct: SignalSourceProduct.Pganalyze,- sourceType: SignalSourceType.Issue,- enableErrorMessage: 'Failed to enable pganalyze',- },- },+interface WarehouseSourceSetup {+ dwSourceType: ExternalDataSourceTypeEnumApi+ requiredTables: string[]+ requiredTableSyncType?: 'full_refresh'+ completion: WarehouseSourceCompletion+}++export const WAREHOUSE_SOURCE_SETUP: Record<WarehouseBackedSource, WarehouseSourceSetup> = {+ ...(Object.fromEntries(+ EXTERNAL_SIGNAL_SOURCES.map((source): [ExternalSignalSource, WarehouseSourceSetup] => [+ source.source,+ {+ dwSourceType: source.dwSourceType,+ requiredTables: [...source.requiredTables],+ requiredTableSyncType: 'requiredTableSyncType' in source ? source.requiredTableSyncType : undefined,+ completion: {+ kind: 'source_config',+ sourceProduct: source.source,+ sourceType: source.sourceType,+ enableErrorMessage: `Failed to enable ${source.label}`,+ },+ },+ ])+ ) as Record<ExternalSignalSource, WarehouseSourceSetup>),engineering_analytics: {dwSourceType: 'Github',requiredTables: ['workflow_runs', 'pull_requests', 'workflow_jobs'],@@ -234,12 +229,14 @@ export interface signalSourcesLogicValues {featureFlags: FeatureFlagsSet // featureFlagLogicdataWarehouseSources: PaginatedResponse<ExternalDataSource> | null // sourcesDataLogicdataWarehouseSourcesLoading: boolean // sourcesDataLogic+ sourcesLoadError: boolean // sourcesDataLogiccurrentTeam: TeamPublicType | TeamType | null // teamLogicanomalyInvestigationConfig: SignalSourceConfig | nullciSignalsConfig: CISignalsConfigApi | nullciSignalsConfigLoading: booleanciSignalsIsFullyEnabled: booleanconversationsConfig: SignalSourceConfig | null+ dataSourceSetupOAuthRedirectUrl: string | undefineddataSourceSetupSource: WarehouseBackedSource | nullenabledSourcesCount: numberenablingProduct: SourceProductEnablement | null@@ -251,6 +248,8 @@ export interface signalSourcesLogicValues {sourceType: SignalSourceType}[]evalReportsConfig: SignalSourceConfig | null+ externalSourceStates: Record<ExternalSignalSource, ExternalSignalSourceState>+ filteredRosterGroups: AgentRosterGroup[]githubIssuesConfig: SignalSourceConfig | nullhasEmittingScanner: boolean | nullhasNoSources: boolean@@ -272,10 +271,17 @@ export interface signalSourcesLogicValues {productDataEventsFailed: booleanproductDataEventsLoading: booleanproductStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>>+ rosterGroups: AgentRosterGroup[]scannerInventoryKnown: boolean+ sourceCategory: string+ sourceCategoryOptions: {+ label: string+ value: string+ }[]sourceConfigs: SignalSourceConfig[] | nullsourceConfigsLoadFailed: booleansourceConfigsLoading: boolean+ sourceSearchQuery: stringsourcesModalOpen: booleantogglingSourceKeys: Set<string>visionScanners: ReplayScannerApi[] | null@@ -416,6 +422,12 @@ export interface signalSourcesLogicActions {setScannerInventoryKnown: (known: boolean) => {known: boolean}+ setSourceCategory: (category: string) => {+ category: string+ }+ setSourceSearchQuery: (query: string) => {+ query: string+ }startDataWarehouseSourceToggle: (source: WarehouseBackedSource) => {source: WarehouseBackedSource}@@ -479,6 +491,76 @@ export interface signalSourcesLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface signalSourcesLogicMeta {__keaTypeGenInternalSelectorTypes: {+ dataSourceSetupOAuthRedirectUrl: (+ dataSourceSetupSource: WarehouseBackedSource | null,+ location: {+ hash: string+ pathname: string+ search: string+ },+ searchParams: Record<string, any>,+ hashParams: Record<string, any>+ ) => string | undefined+ externalSourceStates: (+ sourceConfigs: SignalSourceConfig[] | null,+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null,+ sourcesLoadError: boolean,+ togglingSourceKeys: Set<string>+ ) => Record<ExternalSignalSource, ExternalSignalSourceState>+ rosterGroups: (+ featureFlags: FeatureFlagsSet,+ 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+ ) => 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@@ -530,7 +612,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([connect(() => ({values: [sourcesDataLogic,- ['dataWarehouseSources', 'dataWarehouseSourcesLoading'],+ ['dataWarehouseSources', 'dataWarehouseSourcesLoading', 'sourcesLoadError'],featureFlagLogic,['featureFlags'],teamLogic,@@ -541,6 +623,8 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([actions({setScannerInventoryKnown: (known: boolean) => ({ known }),+ setSourceSearchQuery: (query: string) => ({ query }),+ setSourceCategory: (category: string) => ({ category }),openSourcesModal: true,closeSourcesModal: true,initiateDataWarehouseSourceToggle: (source: WarehouseBackedSource) => ({ source }),@@ -674,6 +758,8 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([null as boolean | null,{ setErrorTrackingHasIssues: (_, { hasIssues }) => hasIssues },],+ sourceSearchQuery: ['', { setSourceSearchQuery: (_, { query }) => query }],+ sourceCategory: ['', { setSourceCategory: (_, { category }) => category }],sourcesModalOpen: [false,{@@ -795,6 +881,123 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([}),selectors({+ dataSourceSetupOAuthRedirectUrl: [+ (s) => [+ s.dataSourceSetupSource,+ router.selectors.location,+ router.selectors.searchParams,+ router.selectors.hashParams,+ ],+ (+ source: WarehouseBackedSource | null,+ location: ReturnType<typeof router.selectors.location>,+ searchParams: Record<string, unknown>,+ hashParams: Record<string, unknown>+ ): string | undefined =>+ source+ ? combineUrl(+ location.pathname,+ { ...searchParams, setup: 'signal-sources', signal_source: source },+ hashParams+ ).url+ : undefined,+ ],+ externalSourceStates: [+ (s) => [s.sourceConfigs, s.dataWarehouseSources, s.sourcesLoadError, s.togglingSourceKeys],+ (+ sourceConfigs: SignalSourceConfig[] | null,+ warehouseSources: PaginatedResponse<ExternalDataSource> | null,+ warehouseError: boolean,+ togglingKeys: Set<string>+ ): Record<ExternalSignalSource, ExternalSignalSourceState> =>+ Object.fromEntries(+ EXTERNAL_SIGNAL_SOURCES.map((source) => {+ const config =+ sourceConfigs?.find(+ (row) => row.source_product === source.source && row.source_type === source.sourceType+ ) ?? null+ const connected =+ warehouseSources?.results.some(+ (connection) => connection.source_type === source.dwSourceType+ ) ?? false+ return [+ source.source,+ {+ config,+ connected,+ loading:+ togglingKeys.has(`${source.source}_${source.sourceType}`) ||+ (warehouseSources === null && !warehouseError),+ requiresSetup: warehouseSources !== null && !connected && !config?.enabled,+ blockedReason:+ warehouseSources === null && warehouseError+ ? "Couldn't load connections. Select Retry above to try again."+ : undefined,+ },+ ]+ })+ ) as Record<ExternalSignalSource, ExternalSignalSourceState>,+ ],+ rosterGroups: [+ (s) => [s.featureFlags, s.externalSourceStates, s.ciSignalsConfig],+ (+ featureFlags: FeatureFlagsSet,+ 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())+ ),+ })),+ ],+ 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 =>@@ -1073,8 +1276,8 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([listeners(({ actions, values }) => {// Cached list is null for a beat after mount (loadSources is debounced), so a toggle click// can beat it and misread it as "no source connected", opening the connect form and- // duplicating a source. Fetch once as a fallback; on failure return empty so the caller- // opens the connect form rather than hanging.+ // duplicating a source. A failed lookup leaves connectivity unknown, so it must not open+ // another connection form.async function currentWarehouseSources(): Promise<ExternalDataSource[]> {if (values.dataWarehouseSources !== null) {return values.dataWarehouseSources.results@@ -1082,7 +1285,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([try {return (await api.externalDataSources.list()).results} catch {- return []+ throw new Error("Couldn't load your connections. Retry before connecting a new source.")}}@@ -1091,17 +1294,31 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([async function ensureRequiredTableSyncing(sources: ExternalDataSource[],dwSourceType: string,- tableName: string+ tableName: string,+ fullRefresh: boolean = false): Promise<void> {const matchesTable = (schema: ExternalDataSourceSchema): boolean =>schema.name === tableName || schema.name.endsWith(`.${tableName}`)- const schemas = sources+ const matchingSchemas = sources.filter((source: ExternalDataSource) => source.source_type === dwSourceType).flatMap((source: ExternalDataSource) => source.schemas ?? [])- .filter((schema: ExternalDataSourceSchema) => matchesTable(schema) && !schema.should_sync)+ .filter(matchesTable)+ if (matchingSchemas.length === 0) {+ throw new Error(+ dwSourceType === 'GoogleSearchConsole'+ ? 'This connection is missing web search data. Add the Web search type to your Google Search Console connection in Data warehouse, then try again.'+ : `Required table not found: ${tableName}. Update this connection in Data warehouse, then try again.`+ )+ }+ const schemas = matchingSchemas.filter(+ (schema) => !schema.should_sync || (fullRefresh && schema.sync_type !== 'full_refresh')+ )await Promise.all(schemas.map((schema: ExternalDataSourceSchema) =>- api.externalDataSchemas.update(schema.id, { should_sync: true })+ externalDataSchemasPartialUpdate(String(ApiConfig.getCurrentProjectId()), schema.id, {+ should_sync: true,+ ...(fullRefresh ? { sync_type: 'full_refresh' } : {}),+ })))}@@ -1119,6 +1336,12 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([}return {+ closeDataSourceSetup: () => {+ const { signal_source: source, ...searchParams } = router.values.searchParams+ if (source !== undefined) {+ router.actions.replace(router.values.location.pathname, searchParams, router.values.hashParams)+ }+ },loadSourceConfigsFailure: ({ error, errorObject }) => {captureSignalSourceConfigsLoadFailed(errorObject?.detail || error || 'Failed to load signal sources')},@@ -1131,7 +1354,8 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([actions.loadSources()},initiateDataWarehouseSourceToggle: async ({ source }) => {- const { dwSourceType, requiredTables, completion } = WAREHOUSE_SOURCE_SETUP[source]+ const { dwSourceType, requiredTables, requiredTableSyncType, completion } =+ WAREHOUSE_SOURCE_SETUP[source]const toggleKey = getWarehouseSourceToggleKey(source)if (completion.kind !== 'source_config' ||@@ -1153,7 +1377,12 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([return}for (const table of requiredTables) {- await ensureRequiredTableSyncing(sources, dwSourceType, table)+ await ensureRequiredTableSyncing(+ sources,+ dwSourceType,+ table,+ requiredTableSyncType === 'full_refresh'+ )}}const currentConfig = getWarehouseSourceConfig(values, source)@@ -1178,6 +1407,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([onDataSourceSetupComplete: () => {const source = values.dataSourceSetupSourceactions.closeDataSourceSetup()+ actions.loadSources()if (source === null) {return}@@ -1500,6 +1730,14 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([events(({ actions, values }) => ({afterMount: () => {+ const source = router.values.searchParams.signal_source+ if (+ router.values.searchParams.setup === 'signal-sources' &&+ typeof source === 'string' &&+ isExternalSignalSource(source)+ ) {+ actions.openDataSourceSetup(source)+ }if (values.featureFlags[FEATURE_FLAGS.PRODUCT_AUTONOMY]) {// The condition allows us to safely mount this logic for user without the product autonomy feature flag// without needlessly loading the source configsdiff --git a/products/signals/package.json b/products/signals/package.jsonindex 6cc4306047ec..a09cc3551fb4 100644--- a/products/signals/package.json+++ b/products/signals/package.json@@ -32,6 +32,7 @@"@testing-library/user-event": "*","@types/react": "*","clsx": "*",- "react": "*"+ "react": "*",+ "react-window": "*"}}