:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): show live impact metrics on inbox rows and report detail (#97536)
Chris Volzer4c172676a62d
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 19c303190caa..33742a0382d7 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7953,21 +7953,25 @@ snapshots:scenes-app-inbox-cards--agent-run-cards--light:hash: v1.k794b7964.0c1350cc50f4a98d14f58b5329d0e08437f276dad0b9736f094f68e853e57d2f.eq-SJ5v2scAJ-__cH2lH0HznF0weI4gaQ9Q0kYsoD4Yscenes-app-inbox-cards--pull-request-cards--dark:- hash: v1.k794b7964.8b97dbb831fdc2d8bba1795f8f7966b2ba38cfe9be1d2e768c093d5275582c96.MAw4V26zUXwGFFM4Jxq_dfVfOgGYOy2oOhS5Pd6_QdI+ hash: v1.k794b7964.4ce62fb05fc7b7b3451f940f333fe5894684ee134d50ed368bf05ed777466f3e.2arUhgxbdC9zFLt7VkffoeMNivMf_oZtsNPWQdrjH6cscenes-app-inbox-cards--pull-request-cards--light:- hash: v1.k794b7964.96341b9eb9faf150c5136df9e3037258ab04e1bbca0db68132ad0b6eef208a3f.5x1VdsQAsZIQYuUhXHfsYknb6esQvidkGn1A8c8rasM+ hash: v1.k794b7964.19291313347041d3b8311d7a7e9b97ee8e60b7ccca476b1b3c43945a006de3fe.Lf3Mkhh7fJ5mnyomCZa2-Jcw4fOG4rgHZ5udu8CQNxgscenes-app-inbox-cards--report-card-states--dark:- hash: v1.k794b7964.33b10f41bb9d6b0c0df486790da1941c2bda06737db7b4bc5673e5db4f3f720c.3WZPIG_1hITQ6eq4axwfpT-fORwsKSYegfDJgqOOdU4+ hash: v1.k794b7964.dcc78e425e574bf9030a756c6331a31c4e92411a68a005327a641140e2f81748.WEJlDN0QU3p3TJSVYoNVJBA-Kl6AIqAoMDi3z-l3wioscenes-app-inbox-cards--report-card-states--light:- hash: v1.k794b7964.f64c9e0b53fe1c3c522d2f809948c5f06abdedc6dd19c75c20e0417967a325da.jVmHII9BuoIEVBu4R4ofLtGZH_R0_v96gUuRd-pjo_U+ hash: v1.k794b7964.46f8d12e3e39f21fbaf8eadd5df0831f7a65d9bd9ccc9d32331cd9eaaba29b0b.cVSFUcP-VTn5y8l3454O1Mrle9C_AH-Uc9Iq1yI5ZH4+ scenes-app-inbox-cards--report-card-with-impact--dark:+ hash: v1.k794b7964.b1c7935b8f5bf3606bf17317d4b766db18716f571e5863a1a9bfca5274ea7d57.seV0a7y3Ag51yKQZbjfaUaBwnrjezpYZFG2GnCJTnWM+ scenes-app-inbox-cards--report-card-with-impact--light:+ hash: v1.k794b7964.56c68b5f31cc1cf6517260cff4e49ca7cd7e595e9c9d2aaa12b968c18f147901.bV7QKcVP3NG5ZdItrP1YgQ8pVPPKGgaB-bHapE4cxicscenes-app-inbox-cards--report-cards--dark:- hash: v1.k794b7964.4f6a69243d31ecf3af3bd8e9a2910b86d739144f1a084124d90a5ce4329ae3b4.8-FcdTNkh7g8C59SeYucGlaSmzu5lZYBF4nqUXKcmPg+ hash: v1.k794b7964.5059ef43b09d7d539e721ae221c7862489eb56d6184a2425ec6fafc034d109f5.j1ttT2FTHkiJXiNtIny1AX_SshYpwTXMhYER8MrrrFcscenes-app-inbox-cards--report-cards--light:- hash: v1.k794b7964.3154a840734a4d3b9825205e598696aedf8478aca733ec1c3c6cfca1c65aaefe.JwLiYwaMyw7a3u9ZHjJgswaocEDa9ei8p9gtOw1bGXY+ hash: v1.k794b7964.d38e40561e65bbfd62d2acfebcea25eb71335b16a2630225742dc31721eb3681.S5LF2_yea5zYnBCEhaQS5p2iOWwzBOG-1vgRc5ZhTPQscenes-app-inbox-cards--skeleton--dark:- hash: v1.k794b7964.1ddf0668c485f02f50314be1c956711f6c3fc483ef5026b177f4f7327ceb676d.IlRzMcElxLYTl7cZ3trRAecyVj8MOmoZhHxaa6kkSU8+ hash: v1.k794b7964.da604dcafaf4ba22c7c00febc5956b4143660cb2455cdf613748ecb81688116e.tHlZgbxkc6M5nBT0v7CBw_TXlQHZNuNaQJI31HCHnQgscenes-app-inbox-cards--skeleton--light:- hash: v1.k794b7964.4e513be8d197697cfdd095507cd7e9f38091e0bae84bf25b6155ce546aa3d4b0.4z0OJzNBqRBJaSFz5oKVfHd5bFfSVYRcIMnfPAftG50+ hash: v1.k794b7964.d74decf0d1eec3cb7e66535e5071bbe8026b34fe398c355dedf63124eb91cd9e.zZmTI-hkVOKyADi7R2mvJyeYSzxT0HpvXctUwJQuFXgscenes-app-inbox-detail--pull-request--dark:hash: v1.k794b7964.eac158ac0dad47be46920b96d059a2b844c0251ff74738c624ccc0f616fad8cf.eNuFZwiFvHcrppJ2CZaSXGFksRtDi3spqiI_mSyG4Ckscenes-app-inbox-detail--pull-request--light:@@ -8004,6 +8008,10 @@ snapshots:hash: v1.k794b7964.7b457e88868510c008646ab0ed37de232ec66ccbd001e82256e156e44a4cfa23.38qy-CrE1s8-psQTdpOZqMVW5alFzYnH7On3bETCnGUscenes-app-inbox-detail--report-minimal--light:hash: v1.k794b7964.1ec199f350734471b4a0b1463ff94a4654a30424276fc64c115c3d65db3cdb41.Tc9W_NbKBqiZUS8nJ_J48f161oSMbOpTNtd99CK-a5I+ scenes-app-inbox-detail--report-with-metrics--dark:+ hash: v1.k794b7964.90a96dde882ddfb529a258d651ce9701878bfa46ab5a7de6718aa96298ca84de.m7fGQx62WwLVg35wZgG7MsKHRzQovXeepkAqKTT4-WU+ scenes-app-inbox-detail--report-with-metrics--light:+ hash: v1.k794b7964.884780670393d4c69f55dd785aee6aab3c0d45c767094f0ea8b14eec97d6fb94.1pT8SOGxosHbWxLY8Ba2gsFzNAZTx3OzL25T3KPuLP8scenes-app-inbox-detail--run-failed--dark:hash: v1.k794b7964.8ea3a3172853ee54499c2c6cfefce80607be334c6e811241d34287a6f765653c.-6vgVoBAALRraFupOI_QA0z0eBbSWQn1uYV0rckIjsgscenes-app-inbox-detail--run-failed--light:@@ -8072,6 +8080,30 @@ snapshots:hash: v1.k794b7964.4c821c407a94fcd72bf9dc0253cfda3ac175442059bafed964354005769d4363.goiedcRz0DK4CpkadOhtMlQ8nZUSHsDHnjewLBSPhxsscenes-app-inbox-reporoutingrules--with-rules--light:hash: v1.k794b7964.0c3c963f549f660505abd1a5a041d12f7a06ebb45425cb06455e21c6da5cdde2.BJVn3hoecT90BYZTusLudiX5sbNqxHZ0dfEqaDhwHZ4+ scenes-app-inbox-report-metrics--live-supporting-metric--dark:+ hash: v1.k794b7964.7823eebb8d33b1f49a2d55e67797c56596d520479a269b7a079685b54a0eb5b9.hjL0Bur4WrrEi7nBwPNqvWjuiRreHkyreFI1y-P17JE+ scenes-app-inbox-report-metrics--live-supporting-metric--light:+ hash: v1.k794b7964.76dcf41d57d29d0302f2a01d2dc90c74dca5fb692eae37b5053ad4b67d815b93.QK9XLjdZA9Lo3OPo81S8iucfcEmMVhvuTmqamVuY-vc+ scenes-app-inbox-report-metrics--narrow--dark:+ hash: v1.k794b7964.abdc42a0f18a51048ab7813ea7827bdec604f57cbc37755f79ad4cea5242dcd4.1Sa3qibYRiOk5HA4Lfn2ehuiRSFPbQtqkM3X6ECpXvw+ scenes-app-inbox-report-metrics--narrow--light:+ hash: v1.k794b7964.7c7f77ef03fe4629562cbad6993d2ab4f72f96fb521c30e9d5cc41d5a2433ee2.8qXJronakx89T9geIvNj7qo8DQItydkoqG4Js9fYfZg+ scenes-app-inbox-report-metrics--rate-observation--dark:+ hash: v1.k794b7964.0ef28a23f5c0d4f4c486380cafdbf255ee520ddee6706d371a49c7c6862330fe.jIfnjMLsFo3RU3GrIDsXtrM-Kdm2UeNQDXudB4XLA5A+ scenes-app-inbox-report-metrics--rate-observation--light:+ hash: v1.k794b7964.518d8977b0454a26c7b2945623168f43a0f0f1df937b2c49b99a31d9c2043ca7.qcbVDaRyXuBtJKC0_8-xT9MyvieTAWZdlpag3wJ2PIU+ scenes-app-inbox-report-metrics--saved-value--dark:+ hash: v1.k794b7964.3936c7130658cf59ea2cd6ee89b5a0180e286f462edd944bb064d90d2063f6fc.unZKGAb67RkzAavZC1hCOZzxv7Q6vSUfIyhb1z4pMiA+ scenes-app-inbox-report-metrics--saved-value--light:+ hash: v1.k794b7964.ab4abc139cf19f3947debfb4dd811fd2d43a66349e35258cb1cf739c8ff2b1a0.y-oPGZjjuMtegd3jtuDWbnoOwGcPyVtavaqhZqSB38Y+ scenes-app-inbox-report-metrics--sparse-observation--dark:+ hash: v1.k794b7964.cc38fe8770c19e25f8a42a3cb5a71702e018a88bd1021de08ac7f4ca69b9b1c5.pqM0UT5DfiIZ4UUNMgbozsDPxYzqT69qiHc29-rWb_M+ scenes-app-inbox-report-metrics--sparse-observation--light:+ hash: v1.k794b7964.257e9fff53a0c6674853181e567c0a0db2e3bb98a2cdb3ee5c6c144f8a04beef.yIzqp84tXdCa-f0KB5iqbD--Sv87tbhSjX_MOe1gidQ+ scenes-app-inbox-report-metrics--wide--dark:+ hash: v1.k794b7964.4a72fd69c80a076b8f6040c0473d1a42aa0e574e51cd9ac16c16ce74f5434d4b.UJFgWCDdVPiMssuUXnf6Px4wj9tZljS4fKvI_6WmIqI+ scenes-app-inbox-report-metrics--wide--light:+ hash: v1.k794b7964.3465b8cd1a9bf286b7ae698d78dba847138201548b8a3c56978fae74b431da53.2bz4A6FW49b2OIDhumSwnnmW8eVEaLSHMmBLZx_eFOgscenes-app-inbox-scene--empty--dark:hash: v1.k794b7964.7d08781760f326f7746ad15883a7ad1a12af173a118c112947ec8ad2637cb1e1.9lq59SDcw12Zz9wZmdfDUnV8V-8vVzWL4NZ0QbTOMgUscenes-app-inbox-scene--empty--light:@@ -8117,21 +8149,21 @@ snapshots:scenes-app-inbox-scene--report-without-evidence--light:hash: v1.k794b7964.333f20aae372ab4f77e80174ad32954456822753634ddea6f33428721714916b.AWi8H5joJwmrMRc5_mNH01H_fIT-Ogxxo2zRS7IoQzsscenes-app-inbox-scene--scouts--dark:- hash: v1.k794b7964.7053803019f3c5c4d33bad380d4e4f8e8f066ef6d8e4936908cb73958143455a.0r-TdrrkSFVt7rRBizrLuOXauYQQbDJV_SfkCoavUeQ+ hash: v1.k794b7964.b646f4c30702eee43dcae65c1195956ea374b66cb3d444fc0f39d2025ecca557.G3KE4secGKY9yb7aS1hTLPy8CaJvqlvIXav7o_udvncscenes-app-inbox-scene--scouts--light:- hash: v1.k794b7964.4621afa320a2848672229b084310b41c6ae69de64879790b82da3a4821f80d71.QzcK4mYI1XCwSl9GR5aV3jdSz0MSkxAfFPicSHHxY5k+ hash: v1.k794b7964.e6d1a5dcfea0f50a41846d715c5485a6329892831473f44d02438b0990a364c9.-ao4hlJxeVcggrjPJLINaVZ5fGA4O-2Ba177I8LWBcQscenes-app-inbox-scene--self-driving-onboarding--dark:hash: v1.k794b7964.6b7b2950c3a0df456074962aada4405283deea5158415e032f0b0f8f25e5dbc2.xg-B8FCyxFnbFGtI5vZxy2htjDbFs0Dms_9sTrA7MwYscenes-app-inbox-scene--self-driving-onboarding--light:hash: v1.k794b7964.5268ad52b39cdc5bb1d699e6a1a839a552ce397134d6773714e1f5a2d95994b6.hgkYOJDE9ZNZ0mMtcj9cpcDCtmas-opelntO_tyQ9Igscenes-app-inbox-scene--self-driving-paused--dark:- hash: v1.k794b7964.e7554de0d4e364453bf8c253190dc430a6e832643a10b71400975a07deeb98f3.yz3-YvCb9lv0mdTvRxSy2THCdsNFkxwOX5h2bcpWAKo+ hash: v1.k794b7964.2616389e7fd24ddba63e0097c5188162d95686ac6d4b38f37428491cdcaf55eb.UNTcOPiFjs1ikmM4zQxgTU1Sj6tY8wCt4elxxqnu1RAscenes-app-inbox-scene--self-driving-paused--light:- hash: v1.k794b7964.9b6321c99a8afe06a23169859a20b6d9bbb17001a045e81bf5aac7f0ce41c3a1.w9WGbvl3PBCA5r-R-eQGHObp1gJhb-IAUjQEdkVZbH4+ hash: v1.k794b7964.69039cc858d6991c1d993473916fe79011f4c1b2107c7eb5e25370df6e76ee64.Tf7rnngP037nLFfFjlmddONkfVfBcwIUC426nWgi2NMscenes-app-inbox-scene--self-driving-verdict-pending--dark:- hash: v1.k794b7964.4d2b6961afe0710eb3da215542896f678b04c483744450d8c183444a7ab37c77.f_P-EHcageD9uKoiiQfStQLl1tv_hRahYq-WB_GdDpw+ hash: v1.k794b7964.6070171adce8ba72d73e5ef46ddc59a6ebd25afbb16d2c4ae0837fa9af66e0fd.crmCZN0uPyF4FXAVize9Qi7juxKUap5RRLyfRbpmo9Qscenes-app-inbox-scene--self-driving-verdict-pending--light:- hash: v1.k794b7964.18a04e43d0b1598e406b105dcdfe548f7d26376ad3ba606401c6795ae3ea1b1f.8uOUfAOgA04AY2GECIDr5Mf98040a17lVfVUA3QpRGM+ hash: v1.k794b7964.96cdbec6c78e8daedb06be4a0134093efcd5838af69e6e7d1722a3892cf561b5.iJ2K0zNhOVgGAPY6JvduyhDBODMwk-CN7_mAdB8scOgscenes-app-inbox-scene--settings--dark:hash: v1.k794b7964.50705f30642679b4254e32e0287c65ae31125b28d9748bac83326e461c7580f1.38uhbQQ5yYrdBVeVEcGqDQ8QTqo9YtkJz36Qfu7YfMQscenes-app-inbox-scene--settings--light:@@ -8205,25 +8237,25 @@ snapshots:scenes-app-inbox-scoutrepositoriespicker--scout-settings-variant--light:hash: v1.k794b7964.a11cdab2114ddd1b6bc8d929da0d0b2c4e9cbc292d60e1adef64f93227e5a324.rL3wPJRk_-nRwk5unPytYNbzIlxyYLEjIf2lPkh_0Ocscenes-app-inbox-scoutsroster--large-fleet--dark:- hash: v1.k794b7964.6a104e1f11d3d44a190714666d7db789d8479d6e3d0686089ead4138646f8b9d.yT7Pq0w9e_Hf2v8nuO41bjNvRA7nlyUgUKrpPs623VI+ hash: v1.k794b7964.f5df414cdabc9f417423cd433df6ea5aa20cdbd4f73e059241daf0383271f512.iGDNfvCV-kotAtlPP6xgOXiZW5F55Mznu0BJos660fUscenes-app-inbox-scoutsroster--large-fleet--light:- hash: v1.k794b7964.c54727de9306e93a3c6a20bf0f41719bdcef495e0945134201c8ad05ac2f8204.eNDflDb_NZ8w9fauXrHe36z-8JHZ320f0l4AVIxPO9s+ hash: v1.k794b7964.07b35c338c0a3a2dade7da4f2257f71924a19b401fcd438bfeb534057a291692.5vFLPCDhQdgHmGZzuEawqMWEdGRRvWicCrnl-geo5x4scenes-app-inbox-scoutsroster--narrow--dark:hash: v1.k794b7964.67106f2ee332cdefdd195f9ac461c76dd294415e4f6df9dbb4863436048b1bbd.VX98iv4ZBxPp6mZ11iJxeesn7i41Dk0Kmdrziawc5Qgscenes-app-inbox-scoutsroster--narrow--light:hash: v1.k794b7964.fcdccdc5587bd8c324e82fd7620713aa70d0fc11cc3fd60617cd8385960d34f0.BrMGAFw1-lBRxGrCK8c_Ga5SKdLaAzoSH1GJj6KwvPIscenes-app-inbox-scoutsroster--roster--dark:- hash: v1.k794b7964.cb947603948fda90cc6fda9efc2e78e240efb013149e44fee03b2a4cc03b0b41.sH5fGdFy2ImPKL1Rl4GF9TmxfCvLqMSXYFrF83PFw0U+ hash: v1.k794b7964.1fa499f9b82d53b5303ac9c1aad41ae71c3181773bfebff8484f9aac6a5d7ad5.c9CzmU_NYRff7RF85AjHkQMh2xHZSlQNuLU0fF3-Utoscenes-app-inbox-scoutsroster--roster--light:- hash: v1.k794b7964.b00bf7fe96c22218a5ad7fc62fba676d095899f0e9bc4a5f54cffe8cb212a799.xPUahRQgcuZMoUDEt8wbSdryvS7tj6VZSKMZLXDY7FQ+ hash: v1.k794b7964.9641b33b8a0ebdb5f80a54278c0fb1328904398cf933ee06bfa4ccf58eb00415.2jp3o2jztnpwRlJ3x9o_KtVLLiGu42UoAmE71dud5goscenes-app-inbox-scoutsroster--roster-costs--dark:- hash: v1.k794b7964.631bfee2fc44cb760e4c6ca2194293aa4b3e2f74d70e861d33df83a8889eb97c.QewtE63qQ0MOFGw-XocsPA9on4EBS1XabnS_XJTYJ5g+ hash: v1.k794b7964.7ddc61e8730affa52b9afb1598b078872ba14f37475bd359b957df22661a6a84.xEXuC3bwseJYnapypkcC88Xl2b98bn3tgTblsquCLv0scenes-app-inbox-scoutsroster--roster-costs--light:- hash: v1.k794b7964.84d575f8fd1994a847a88ad3d5721bf8d8c48757d4baa2aea3dc8bff08a6c106.msXWGAdSdgGkTxF3cHDRUoU_EQ8Up5Pp-Awwgw3Z6jM+ hash: v1.k794b7964.8c09e07c4ea2df4d050c98b1b79d7e8d5c4923c6c78d9e597be01bf3e772f3ff.j4eAE4YSqltTOlD410S6sqyGrbS1VSOfezTnH5EuPKEscenes-app-inbox-scoutsroster--roster-costs-non-staff--dark:- hash: v1.k794b7964.6a104e1f11d3d44a190714666d7db789d8479d6e3d0686089ead4138646f8b9d.K--bqCt042LLnR6YRVsShm9WOsdBgAdfbXmYdrd5dBk+ hash: v1.k794b7964.f5df414cdabc9f417423cd433df6ea5aa20cdbd4f73e059241daf0383271f512.f49a8vTCcZp2dO9FCVQLCh6ijGDtP1wu-gE0zJ6nlgQscenes-app-inbox-scoutsroster--roster-costs-non-staff--light:- hash: v1.k794b7964.c54727de9306e93a3c6a20bf0f41719bdcef495e0945134201c8ad05ac2f8204.BdUoCVAR19TDO85c03ROxlPwBwhFjveixvMcvdsZfwk+ hash: v1.k794b7964.07b35c338c0a3a2dade7da4f2257f71924a19b401fcd438bfeb534057a291692.KZr3sPuI2eJ3GqzaWRlLHGNQtUXPN5kemWId-Pcf6F4scenes-app-inbox-scoutsroster--roster-costs-table--dark:hash: v1.k794b7964.e413457fe157fc4119197fc4cf8155ffcd44a38f9ef89ffa928555bc796dc674.JPlNpamhAWxFX_aWQ5BBG7tCN5pTYK3wc8sqnHB6XWsscenes-app-inbox-scoutsroster--roster-costs-table--light:@@ -8233,57 +8265,57 @@ snapshots:scenes-app-inbox-scoutsroster--roster-legacy--light:hash: v1.k794b7964.d0ee903a8da5dd314b8b60412ac603d71fe2780cf7f498895b6bd040fe62ea2b.HSpIhnqqTWXHITf3_Opkoex_umbGmYhw01fki4ZX2Dgscenes-app-inbox-scoutsuggestionsstrip--collapsed--dark:- hash: v1.k794b7964.cae1abb0a0c5c33fd391f83d4cf8d194603b65e8057a5a8df56c849537ed3990.fwW1NTVJXd3hBKpGVAXqqIj-OnJzTCSUQ4A19quJdvg+ hash: v1.k794b7964.83c1649fea741bc937ef2be603c9bd7aabea26f78022b8accb37de85733e55d4.7qehj5PgTiUvxt50V7ALqkOG7HkNXYnaFg5yddoGaposcenes-app-inbox-scoutsuggestionsstrip--collapsed--light:- hash: v1.k794b7964.a5a7b9df70a529eb02b58a785c25b65de38243dd7461a30f403282e996a03991.MCU-mj3s6elQuZxnXdy_h86UmvffRdRr4nieSR1Tb88+ hash: v1.k794b7964.ba1f143cb325b76519cbdd1b4d4b4ea85a86f5ce65609d2bd11027abb52ac503.Q79LTT3ZvTskWzqQLabkD8PvFaMpD2OgM-J5OsSPaMcscenes-app-inbox-scoutsuggestionsstrip--empty-fleet--dark:hash: v1.k794b7964.a9e935349a3145375d09cc1a483fd4cf2a760256000855e6e15a4cfaf2548236.mRkmlsFFKTFT_U5FUUw4ltXiVW4u7ICa1YC424x5GJEscenes-app-inbox-scoutsuggestionsstrip--empty-fleet--light:hash: v1.k794b7964.90d7232a692b063940384aa89d05c70e2c1af66eeeca08fe49bcdd9938e456a0.a3KW1AmgQwcQV84WzmFAeCk_ars13rMcEHeBSkn8S-cscenes-app-inbox-scoutsuggestionsstrip--fresh--dark:- hash: v1.k794b7964.e4a80aa15ae407bdc14f972169bef63c08d8b92df3c403939d974678cff6f683.5sFzHtegn1fpbuvGiZRd97Pgfctsk6ZwXxmU3q1LPxs+ hash: v1.k794b7964.570417fc559c4110bafec16cae540482291367ab8bd2de079ac60e5a7f00cdf0.xizQ1nHgCk4yYIF0A6lGvvcdD53WyCtXiCHRq7jnXPcscenes-app-inbox-scoutsuggestionsstrip--fresh--light:- hash: v1.k794b7964.76c8e317bfb396bf3319dd9608f6deaf5d908b4284218fca79bc4a1cf5d87327.enIP-yo5jHWRHUu4dsASWZdg0H_K_X1bQN_7VJ6task+ hash: v1.k794b7964.c27d35c322743ada3c9189be878c17324ed9225e3abe84d0d8f4cba296af874d.KvV9wXRx-aX91LPGV8mBSwOSBX_gQVO-4KEH5mbxlV4scenes-app-inbox-scoutsuggestionsstrip--last-scan-failed--dark:- hash: v1.k794b7964.3a7cd9d82ba9869916d448765364a5a2a4e3ff13519e286e5cbf6427de0317b2.1R7779omARFpg1I_tEXoqr6xiA7w-5aSepSqkLlIt_s+ hash: v1.k794b7964.de465356e1d0c3d5df4e27a38f222f1272cd482864e94f5c0926496b21585156.JrxNWbA8ll95SmETdYceyyUM7OXvaVFv4m2ZNqLTEc0scenes-app-inbox-scoutsuggestionsstrip--last-scan-failed--light:- hash: v1.k794b7964.8938e799fb00a4f81c08ec0447e3f4f60a8dd38ca45219432898eda1beeaee69.CzrkV8ue2mcji7euauznWfeSGY49QwtsydaZw3gtbvQ+ hash: v1.k794b7964.862bc68a11983494741c4d1522c7a0b5a9dbc62fa096994e7ca39fcee696dc45.Gqy-Dr8yrhe7v2EdrEZFwjferFE9JMtvLBRegJF3Ebwscenes-app-inbox-scoutsuggestionsstrip--narrow--dark:- hash: v1.k794b7964.593dc157d1faaef24b3ed48173b4729801348099124f2b5b4c6c37a9d58b87d0.eTS1JOi30O4KIRdJsX_pPUxHX0YxZQzpJ4ibd0Gcrv4+ hash: v1.k794b7964.d16cb21c4d654c63d5f8b6047b3291b636b25e21b00a91b06bd8384967f8a4ef.h9itg-CPeBGLngbSfw7_TIYGEJHnd_Z_sQ4VYIS5u0kscenes-app-inbox-scoutsuggestionsstrip--narrow--light:- hash: v1.k794b7964.35ed7ec1a9b8f6d64bd00f9c97d7cf40cd9d0515e2ae0e6b48d3f334b0f5053d.VuZe-To5pCdusgBbKyJj6gFQT5YKSwZn-0mzJHZV9qg+ hash: v1.k794b7964.f53bb4fb7dcec95a06ccdb77e47ef05be374c48412a94f0bb9946aa992800a26.eEq4lrjpj4xFevZ3ltME_QTM3VLUFCiT09vgfY_jYI0scenes-app-inbox-scoutsuggestionsstrip--never-generated--dark:- hash: v1.k794b7964.cb947603948fda90cc6fda9efc2e78e240efb013149e44fee03b2a4cc03b0b41.aVY4wYoLySAgvPFkNBZ9dpjUO3PV7DBvb00XPrTHYkw+ hash: v1.k794b7964.1fa499f9b82d53b5303ac9c1aad41ae71c3181773bfebff8484f9aac6a5d7ad5.ulg5fyOIsf7mnLJJRsP0QggXrvaVc8UBP43QUI6WGmoscenes-app-inbox-scoutsuggestionsstrip--never-generated--light:- hash: v1.k794b7964.128d7bd98d5825f08df13efa9a573b3ca20bc4d3caa04d6a16f40a211c6204fa.opx1P80t_yJe2bLDe67f7MTLDIcCgM3bNV8mQllmPcE+ hash: v1.k794b7964.b131d6038274a4ece4e940b9c90ba7d95e5a42fd946e78af7b4890049dec8e40.Go2UT1S5sP4VVuYMsC3OlKFUAXEE_DrtGhJ1N9E2w88scenes-app-inbox-scoutsuggestionsstrip--nothing-left--dark:- hash: v1.k794b7964.cb947603948fda90cc6fda9efc2e78e240efb013149e44fee03b2a4cc03b0b41.JaKUyZLXjjLcRrWBABTyco0UmwwTdI8ybIc4tMKPXwM+ hash: v1.k794b7964.1fa499f9b82d53b5303ac9c1aad41ae71c3181773bfebff8484f9aac6a5d7ad5.mZ_yEs1NwLucffpZQPXwcweXwHr5ZwUr7dMJXy12EZ0scenes-app-inbox-scoutsuggestionsstrip--nothing-left--light:- hash: v1.k794b7964.128d7bd98d5825f08df13efa9a573b3ca20bc4d3caa04d6a16f40a211c6204fa.2-20ggxaJkkZix940eTPRo-2OGdq57oCQI6HxKVz_cY+ hash: v1.k794b7964.b131d6038274a4ece4e940b9c90ba7d95e5a42fd946e78af7b4890049dec8e40.rpllE4H8WWpI6z-X5e5o_L19g9wUm6GPPVhLEMZ8s2gscenes-app-inbox-scoutsuggestionsstrip--scanning--dark:- hash: v1.k794b7964.5fbcc9252f49aeb183318dcca95c23e9d59a4404ac77c432b73f1b987e9ad08a.CB6fz41Ol6FjOmV3Hsoz0Qt6ZLuYe9SiNqeL1ZpQiTE+ hash: v1.k794b7964.02501aac586d12ac2cc0340fdac0d179a39eb4b8cc2f9532b5967c5681426088.o9gSlGc8K-5d-b0_iNcizWHVAi4ZF2pbHNANf8yVKHgscenes-app-inbox-scoutsuggestionsstrip--scanning--light:- hash: v1.k794b7964.4e32d9c94dab7dea8dc230f4849626be9c02492cbadc388f9f5e63402d25685a.0TgQOB_KdOjZNo_lB1Jz4JKCrHPX5FO1npJvQ_fIEQ0+ hash: v1.k794b7964.cf75d9626a024617eb2bd00f0e7b5ea6aa5610289ea6083dc1161d1d5dd5687d.vS3wXU4w3UhH6WmNLujNwzrZqEs8tbth-hFf5iGxaXoscenes-app-inbox-scoutsuggestionsstrip--scanning-collapsed--dark:- hash: v1.k794b7964.cfcaab9ce0c8a5495a1083d9dc520ecb2c4ca8a0ac2fea7f61ba829235794d09.1nERXNatZa2u2DcXlSGnREIjyGQTDd0Md2YmM-Lufag+ hash: v1.k794b7964.63545765bd0fe34efaf7e3ffe818f0d738caf1d73488fde1033643314d4fb661.vrZopp4IB05ShUMt04rlcq7-lUx7SOKUdaeRStEFLDsscenes-app-inbox-scoutsuggestionsstrip--scanning-collapsed--light:- hash: v1.k794b7964.e333bf9dced322d8bdcf542669d8d843dd2cdfcd2b12f535db5b95aafbbfd6b9.kYFG9VRcC3gONE3FQOoc50ywNxZv_Og30-J-I3nhOCc+ hash: v1.k794b7964.e50cd1debd9222ccdc678191c8379c5cfabd8f484da0a82620fd1e76d2fd0183.oAkedvj_wiFanZgVYWxupy_lfqpyvLqBSg-Be1NtoFoscenes-app-inbox-scoutsuggestionsstrip--scanning-with-nothing-to-show--dark:- hash: v1.k794b7964.98ef56fe8a6d7dffa479868e4cf24d4156330c6a48bee1eca9155e4cb2110346.7GlpOQ3YdsEJYvAhWYrvb7WgvRE6UTp0pnxILEdvjFY+ hash: v1.k794b7964.1ceb10e92b2b174ad12028c17dde944d0b0bc97c5b53bada9bf8a97ad01ab57a.VtAaDb7E-Kpob6xvmMPpbF0RqFpS03CJDVueTO39bhwscenes-app-inbox-scoutsuggestionsstrip--scanning-with-nothing-to-show--light:- hash: v1.k794b7964.078d542500d2f482ec93f60ce93929da3dac045f627d59218419061cb3230994.C_J1SBx3KB9EjEmzwMG4eYUw6R69CqnRwGcOppTLq1w+ hash: v1.k794b7964.3b0428f8278265e294340d9efd8410b2c805be5bf34a99e9c3b1f9121091ca00.O4pbyxNxgAnYJRBrhvNb1HX7nuJaxOmSgIcacOF5EmIscenes-app-inbox-scoutsuggestionsstrip--single-card--dark:- hash: v1.k794b7964.6dd9b783dcb009774567203065cdd77ec36bacef2a08ef84502ea35c2c86cb72.t-v7fppkwj53c7X29aUFc1CePIbHfUFa_kMcz6Q80dc+ hash: v1.k794b7964.7fb39e9f73376af10a4d336e214bd06938b336e030eb38fcc5dd93e528617ae1.4KJIUej-HPwSTEhDnsUxZ6Hh-fsp7CriBnUReVYTwa4scenes-app-inbox-scoutsuggestionsstrip--single-card--light:- hash: v1.k794b7964.583a7067bb09e415f53b1f8a13b76264e2b28a18f4d725a5162dc04182192c4f.PGN_3FMJwvukfMGbCLkWzXX9dDblmI3PWFlGySK4kLc+ hash: v1.k794b7964.02340737115749e8a564e476d98b29f4b48c64749a785d93540f6ac1ea7be4ab.3xA716O2PrpfwKlGXo3SfaX3BXUXs_FtrjttYE4OKioscenes-app-inbox-scoutsuggestionsstrip--stale--dark:- hash: v1.k794b7964.4356de4ce8daaac66ba9c822a32007d7400eefe9cec57d561c873a82371984bf.rqo1wVyiFOMzZh-Nk2W17ZPodPtTJJO5wtn_mMbNK7c+ hash: v1.k794b7964.7e2fdf9c89dde86490a07cc7ec325a0944e7de0ea176267adeb68399511bc59d.qOHNB134qWxXVmDejFTj4zBeHmSs5W6YwXwPDDosGDsscenes-app-inbox-scoutsuggestionsstrip--stale--light:- hash: v1.k794b7964.00796e0b71ec02937541060ec197e245b41b87579280b8341a8a967b5e6196bc.tDmT3J2mXWN-Etx4t4DJNaE5SenbjrPLLBItQUe2NQQ+ hash: v1.k794b7964.570754184d02350f0aa7aeb0551dcf4193adc7bf7e98b96837d83ad943fad285.HwY3-lDJfFM-XdprlRu32W06EqFnhydh4A2GqqLZw4kscenes-app-inbox-scoutsuggestionsstrip--uneven-motivations--dark:- hash: v1.k794b7964.3fcfb882c7f56b5f301d2a43d18472e505d514c8e359de582b96675f961f93c2.nsNc83Vy-zwOgjTNzGBKm3-8JpyKB7aFliZXHHQFNw8+ hash: v1.k794b7964.522e12df24c16e51c08bddd3ab68137dcd39513e11c8874cc0f8a3309a3958e0.HnUHqh1rFVoNq9orm2xGyOGw7Ks_m_pl6AgecpsNwGsscenes-app-inbox-scoutsuggestionsstrip--uneven-motivations--light:- hash: v1.k794b7964.c8b4394889278d90d9a4d657614c1753c95bee3bcc72279af006d8f18952d2ef.6FFOtF06QjkHZmrbYdkSXr0wyBxDEFhiMx80JWeKQCE+ hash: v1.k794b7964.85244b3882afe2a024d9aac8b6a4b626fe5efe4cde65d265e554ccd75ee87a0d._NkkpHjYmgDw2mBavm1_jUZomc0i6WQAM5Xyj6ZIKOUscenes-app-inbox-scoutwriteaccesstag--compact--dark:hash: v1.k794b7964.449b1898c216f12c6a62f2c0a1544ce814cdc7e4d519c69287d686e8b9a90b79.yXNYamE5tvB24QXwyniqxYtd3IAlRpo-RoLspp9zOKQscenes-app-inbox-scoutwriteaccesstag--compact--light:@@ -8453,37 +8485,37 @@ snapshots:scenes-app-inbox-sourcesteeringmodal--rules-set--light:hash: v1.k794b7964.d1279fa1214369e191ab56aeef694231fcd401abf93e1854000fdfdcf97399bc.BKbf7ywpJGW7XqCNbou14Du1jqORsoYt5No4mJCVU3Qscenes-app-inbox-tabs--pull-requests-legacy--dark:- hash: v1.k794b7964.9021fe78606b9d4fe9969dd2093af3296148c7cb1e827453b47cf8bf2db6ef9e.ppLZXULxZZHR7EBFNweGPXZ5Yz1peNL4gCTeeDEOdk4+ hash: v1.k794b7964.84c464a1792f724b7ac8d345817fcecbe2fe7333d9602d8d4a849f5f657f81d1.nz6nnoIRLkBG8IT9PSiZasjHS_qfMAlusiJjW4YBEl4scenes-app-inbox-tabs--pull-requests-legacy--light:- hash: v1.k794b7964.d66d0f73814191c857a64891ddd73dbbca609b40f71b80b5a97b95b1d0ed5d0d.coTm8czKJGGrvOoP28HGqgyV0I1HTpvp14uWHt7b4dQ+ hash: v1.k794b7964.35cab57581e7b55e28f2447da251822327e7f0008d57c62c006e2270da758523.saj4tzKOHhdj2EdJV-GSj7xrh0-kL-1yHPUwo3AK700scenes-app-inbox-tabs--reports--dark:- hash: v1.k794b7964.fe27a895558915d24de4ef9f9511479ebcd0782da864a5d1b85f81b5263327a3.wCHia_XS0ZgsPveDc9FPERSvKwbu8uzGer6NY7jUvG8+ hash: v1.k794b7964.20c7aea4ebf75887bbcdf9101576084aa8b9be2354037a667669f8f490896267.z2weaXqXGCI2k0Hu8FQs-rEmaZMLsFzcgn5Y8R_FTRkscenes-app-inbox-tabs--reports--light:- hash: v1.k794b7964.3de600060cd59ed20fe68fe175911b3ca30a42e434c72258b6e45054d3777e6b.RJUlFpkeZ-ZdCFpGYrESLRPVmSAfz8PBUJTRJ50nhVw+ hash: v1.k794b7964.be0af4a17630b288f3398a93aff3d64052019cdd034fad86ab5f5ee0a54e3291.IJFPE7sNRWSp2ppogpohC-E2HBZHESaK_YOG1q9bjfkscenes-app-inbox-tabs--reports-empty--dark:hash: v1.k794b7964.a84b301c5e7b2f3b614ae70fd79cb33521d4702790bdfe4a4dcad0816a78152e.y29PsyMQdbg-pSBHIijqi2DdHAXSdJTGVyGKvsnPn1Escenes-app-inbox-tabs--reports-empty--light:hash: v1.k794b7964.1194d41f9543372cda988c41560c2f79572ae1e4e029ede557415a44d7ab991e.9ISKBHELesQSttTAc1KUzKuISboUxudlJjjm8cDrjZ4scenes-app-inbox-tabs--reports-legacy--dark:- hash: v1.k794b7964.6bffd9df9241aef3533411aba5c41ba3b0d0ad7bd5701e5f8a0da414e0710700.-BcMQAuZIxfrd2EioB1VGkALBdOQqgN9Y1g3CmfC7Q0+ hash: v1.k794b7964.cec6d8b8fee4d8d32ee180cb79b05c055776e660ce3e59f9691b702e82dab4c1.vE8lPywd_VcZpj3dnMPAPQylAHjOgJvKF8RW58C5oFUscenes-app-inbox-tabs--reports-legacy--light:- hash: v1.k794b7964.7864bdacc54e80bd704a403fb813da48779160b95ad014df7bbae8a84a5d24a3.7J1YPQyUSF6iat2oGdHpGn1E3Ml0eTRtyb64GwDL334+ hash: v1.k794b7964.e85a99c486394b1c568acb85a0426c8c70d1feef977b9de6ddd9733f29135752.__HuRE0T7a9P3Os-phwQdQc2LOE_wbf-36gcBMADbf0scenes-app-inbox-tabs--reports-state-filtered--dark:- hash: v1.k794b7964.ef6044e404e08f120db2abcbf5275cc4274e095dc75d20ea9385e9bf0a61e996.WIJHi0FEecMWzGEWzZmTLWdZ8QrkMgs2cwpnHFIb8vY+ hash: v1.k794b7964.5be5f5aaea26683fd80f5f9567108e2dbf4301626638ceb9eed37240e5d004a2.IgnX39GEqVnf9O5yGEG-hu-1cJZ9FxsYAhICpiA3p-8scenes-app-inbox-tabs--reports-state-filtered--light:- hash: v1.k794b7964.a8c338c26cc0037d244e1932a7600df596bbc3aef58604a77a4f36f447b37760.R0uj_FJJ6_i534cJJGyBcv4mR26wX9nhPl7oX7z-Le8+ hash: v1.k794b7964.a89b15e2c0caa264b2eecf3d10be668696b7cfffb103d12086a87f333996eb10.eU27SyH25vlJskAX_ikx1Q2Fab2NeTtEa1vNruZgNe0scenes-app-inbox-tabs--runs--dark:- hash: v1.k794b7964.4ece3bdc6be5207a77eafc6d9005ce3a065539767d7a4da5f3f2f5f913bb3567.Wu4dnjXImAjEXPa2f8AdBAeJIwpnA-ak02ZeHI87kBo+ hash: v1.k794b7964.b0eb8ed605bd36103e79e0a60b214bb3923082a8a3e942619b209e2e63c4c27b.tc-_hXddEA1-okpf16Of3a1wM9gWn-D4ZW1_LLaPKq4scenes-app-inbox-tabs--runs--light:- hash: v1.k794b7964.9442c8fbd701295782fadce23184a56f86e7cb065e0ef4c86f7619cc51626ae8.GcHWMAKOH47WdIRe26bQc3uk_9GPWxqLEYiHf36jLUU+ hash: v1.k794b7964.0c202abcc37a85e878e89c016d4480c2f31d515e6304e2e892195ad39dc3df6f.msh2fjRu1c7N-r7LasOexrucG0bY6L2Zth9bPsgjsw8scenes-app-inbox-tabs--runs-empty--dark:hash: v1.k794b7964.ed7903043c325ec7591671b53d2df134905055d743cbaf4bf2dcc33365ee95a6.jOZw9YQ97uY5xNUBtLQXMcOALI_NGOluZJLyJDTY7-kscenes-app-inbox-tabs--runs-empty--light:hash: v1.k794b7964.1c1e2ee4c9b76770be05d1525f39383dac46865662d7e634c037e2e31ee084d6.-Gj5SxUV7x_-pYkYfIkN3TCUPXLkWTaSklb1RzH3mRUscenes-app-inbox-tabs--runs-loading--dark:- hash: v1.k794b7964.8be0c2b94fefd19e941ed37bb40e6a99555f4c4810caf26e51c96b24109f3a8c.BOmSgMSnMvH7zcw9WRbE8s429eBOCM-YjVD-ZVLfxD4+ hash: v1.k794b7964.f72d1f5b1d052aa1ea44c14d139de7538c8f6fce028595c6e93e65fbbcd81cb6.BXH8wRO87CQipxqRHaFZBYjL2mFan6xvAaHTyOzCH2cscenes-app-inbox-tabs--runs-loading--light:- hash: v1.k794b7964.f7e97180a938a28370ca6e9b8064cf0210294ef5bd6ecb99abd260edb65d4493.XPKVPTM20JaVDK3FBdbpqfBxLk6_sLpz2qXv7FGQ0Cw+ hash: v1.k794b7964.4eb178f9e66f29a39f3228c992661409215bf5b173ae458978b3c9876f14bb49.miH6CsWRVa_TkVCM3QJMhPicboUncrDXfrEEWYaVb24scenes-app-inbox-usagewidget--approaching-limit--dark:hash: v1.k794b7964.f8a534cc7d33cc6ade581834f3992f6755fc206b3dceea50c8033aee9ebe87d3._FCVV4FR_QGjuJATWZfSKe1QQ7QmNKf0QHLoD2c1ygAscenes-app-inbox-usagewidget--approaching-limit--light:@@ -8539,7 +8571,7 @@ snapshots:scenes-app-insights-insight-quick-start--default--dark:hash: v1.k794b7964.9c2221e83fa5d09056672573226c948c5b9cd30716e6eb5e09d1e4ea3e94e336.WkGH5TXIN9Ysp3dVcJiXuGCjwdmC2Zquw_iUGoyj0jcscenes-app-insights-insight-quick-start--default--light:- hash: v1.k794b7964.f4f1b7171b499a3b9139648ce56e3f78f1cd14a51b5b8338415f748311a20ddb.KJX8eBYzvzAaCWnTNNf5xdokTmtUrQefGzDYV7Ekn-0+ hash: v1.k794b7964.760bfbe37938f1f855a849f2cf446dbcf8782872258d9efc19cb33aaa20747ce.BSkckjSe-OUU3V1S3QrOnGaJQ7NiAVttPmNCSb37euUscenes-app-insights-loading-messages--loading-messages--dark:hash: v1.k794b7964.2ac4e765207813a981f31af901afa5db194601389aa7add7eeb41e757f761471.7tygD30SdMwymOX-K3-VdMXR_Euc2ETcd5uE0BSa5i8scenes-app-insights-loading-messages--loading-messages--light:diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 211e44e6039d..d2c6b8f6890e 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -234,6 +234,7 @@ export const FEATURE_FLAGS = {SETTINGS_SESSIONS_V2_JOIN: 'settings-sessions-v2-join', // owner: @robbie-c #team-web-analyticsSETTINGS_WEB_ANALYTICS_PRE_AGGREGATED_TABLES: 'web-analytics-pre-aggregated-tables', // owner: @lricoy #team-web-analyticsSIGNALS_PR_REFUNDS: 'signals-pr-refunds', // owner: #team-self-driving, gates the inbox PR refund flow (also checked server-side)+ SIGNALS_REPORT_METRICS: 'signals-report-metrics', // owner: #team-self-driving, gates the live impact metrics on inbox report rows and the report detail, and the snapshot refresh calls they makeSTARTUP_PROGRAM_INTENT: 'startup-program-intent', // owner: @pawel-cebula #team-billingSURVEYS_ACTIONS: 'surveys-actions', // owner: #team-surveysSURVEYS_ADAPTIVE_LIMITS: 'surveys-adaptive-limits', // owner: #team-surveysdiff --git a/products/signals/frontend/inbox/InboxScene.stories.tsx b/products/signals/frontend/inbox/InboxScene.stories.tsxindex 1432941e51b5..0bafad31d7be 100644--- a/products/signals/frontend/inbox/InboxScene.stories.tsx+++ b/products/signals/frontend/inbox/InboxScene.stories.tsx@@ -82,6 +82,7 @@ const meta: Meta = {[FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,[FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE]: 'empty-state',[FEATURE_FLAGS.INBOX_REDESIGN]: true,+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: true,},// The scene shell keeps a loader element mounted past the VR wait window, so don't block on it.testOptions: { waitForLoadersToDisappear: false },@@ -188,6 +189,7 @@ export const EmptyControl: Story = {[FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,[FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE]: 'control',[FEATURE_FLAGS.INBOX_REDESIGN]: true,+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: true,},},decorators: [diff --git a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts b/products/signals/frontend/inbox/__mocks__/inboxMocks.tsindex fa1fc892b7ce..ebf27220d9b6 100644--- a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts+++ b/products/signals/frontend/inbox/__mocks__/inboxMocks.ts@@ -24,7 +24,6 @@ export function makeReport(overrides: Partial<SignalReport> = {}): SignalReportstatus: SignalReportStatus.READY,total_weight: 1.0,signal_count: 1,- relevant_user_count: null,created_at: BASE_DATE,updated_at: BASE_DATE,artefact_count: 0,@@ -71,7 +70,6 @@ export const reportTabReports: SignalReport[] = [actionability: 'immediately_actionable',total_weight: 3.4,signal_count: 12,- relevant_user_count: 47,source_products: ['error_tracking'],is_suggested_reviewer: true,}),@@ -84,7 +82,6 @@ export const reportTabReports: SignalReport[] = [actionability: 'immediately_actionable',total_weight: 5.8,signal_count: 31,- relevant_user_count: 118,source_products: ['error_tracking', 'session_replay'],}),makeReport({@@ -96,7 +93,6 @@ export const reportTabReports: SignalReport[] = [actionability: 'requires_human_input',total_weight: 2.1,signal_count: 8,- relevant_user_count: 23,source_products: ['session_replay'],is_suggested_reviewer: true,}),@@ -109,7 +105,6 @@ export const reportTabReports: SignalReport[] = [actionability: 'requires_human_input',total_weight: 1.6,signal_count: 5,- relevant_user_count: 210,source_products: ['session_replay', 'llm_analytics'],}),makeReport({@@ -121,7 +116,6 @@ export const reportTabReports: SignalReport[] = [actionability: null,total_weight: 0.9,signal_count: 3,- relevant_user_count: 14,source_products: ['session_replay'],}),makeReport({@@ -132,7 +126,6 @@ export const reportTabReports: SignalReport[] = [actionability: 'not_actionable',total_weight: 1.2,signal_count: 6,- relevant_user_count: 9,source_products: ['zendesk'],}),]diff --git a/products/signals/frontend/inbox/__mocks__/reportMetricMocks.ts b/products/signals/frontend/inbox/__mocks__/reportMetricMocks.tsnew file mode 100644index 000000000000..3fbe1a10b615--- /dev/null+++ b/products/signals/frontend/inbox/__mocks__/reportMetricMocks.ts@@ -0,0 +1,236 @@+import { NodeKind, type InsightVizNode, type TrendsQuery } from '~/queries/schema/schema-general'+import { BaseMathType, ChartDisplayType } from '~/types'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++const dates = [+ '2026-08-16',+ '2026-08-17',+ '2026-08-18',+ '2026-08-19',+ '2026-08-20',+ '2026-08-21',+ '2026-08-22',+ '2026-08-23',+ '2026-08-24',+ '2026-08-25',+ '2026-08-26',+ '2026-08-27',+ '2026-08-28',+ '2026-08-29',+]++// A month of daily buckets, so a story can exercise a window several times longer than the default.+const sparseDates = Array.from({ length: 30 }, (_, index) => {+ const day = new Date(Date.UTC(2026, 6, 31 + index))+ return day.toISOString().slice(0, 10)+})++function eventMetricQuery(+ event: string,+ customName: string,+ math: BaseMathType = BaseMathType.TotalCount,+ dateFrom: string = '-14d'+): InsightVizNode<TrendsQuery> {+ return {+ kind: NodeKind.InsightVizNode,+ source: {+ kind: NodeKind.TrendsQuery,+ dateRange: { date_from: dateFrom, date_to: null },+ interval: 'day',+ series: [+ {+ kind: NodeKind.EventsNode,+ event,+ name: event,+ custom_name: customName,+ math,+ },+ ],+ trendsFilter: { display: ChartDisplayType.ActionsBar },+ },+ }+}++const conversionQuery: InsightVizNode<TrendsQuery> = {+ kind: NodeKind.InsightVizNode,+ source: {+ kind: NodeKind.TrendsQuery,+ dateRange: { date_from: '-14d', date_to: null },+ interval: 'day',+ series: [+ {+ kind: NodeKind.EventsNode,+ event: 'checkout_completed',+ name: 'checkout_completed',+ custom_name: 'Completed checkout',+ math: BaseMathType.UniqueUsers,+ },+ {+ kind: NodeKind.EventsNode,+ event: 'checkout_started',+ name: 'checkout_started',+ custom_name: 'Started checkout',+ math: BaseMathType.UniqueUsers,+ },+ ],+ trendsFilter: {+ display: ChartDisplayType.ActionsBar,+ formula: 'A / B',+ aggregationAxisFormat: 'percentage_scaled',+ },+ },+}++const liveMetricResults: Record<string, { aggregatedValue: number; data: number[]; label: string; days?: string[] }> = {+ $autocapture: {+ aggregatedValue: 1248,+ data: [88, 96, 104, 99, 121, 118, 132, 132, 184, 211, 196, 249, 238, 263],+ label: 'Users affected',+ },+ dead_click: {+ aggregatedValue: 3912,+ data: [312, 348, 331, 372, 396, 401, 388, 451, 522, 487, 538, 604, 671, 639],+ label: 'Dead clicks',+ },+ conversion: {+ aggregatedValue: 0.34,+ data: [0.38, 0.37, 0.39, 0.36, 0.38, 0.37, 0.35, 0.31, 0.33, 0.32, 0.35, 0.34, 0.36, 0.34],+ label: 'Conversion after the observation',+ },+ $exception: {+ aggregatedValue: 0,+ data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],+ label: 'Errors',+ },+ upload_failed: {+ aggregatedValue: 5,+ data: [3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],+ days: sparseDates,+ label: 'People who hit the overwrite',+ },+}++/** One primary affected-users metric and three supporting facts, with saved snapshots and live queries. */+export const reportMetricsFixture: ReportMetricApi[] = [+ {+ metric_id: 'affected-users',+ title: 'People who clicked Create key and got nothing back',+ kind: 'affected_users',+ role: 'primary',+ value: 1196,+ value_at: '2026-08-29T12:00:00Z',+ series: liveMetricResults.$autocapture.data,+ value_format: 'count',+ unit: 'users',+ query: eventMetricQuery('$autocapture', 'Create key click', BaseMathType.UniqueUsers),+ caption: 'Excludes internal users and test accounts.',+ },+ {+ metric_id: 'dead-clicks',+ title: 'Dead clicks on the Create key button',+ kind: 'occurrences',+ role: 'supporting',+ value: 3912,+ value_at: '2026-08-29T12:00:00Z',+ series: null,+ value_format: 'count',+ unit: 'clicks',+ query: eventMetricQuery('dead_click', 'Dead clicks'),+ caption: 'Median of 3 per affected user.',+ },+ {+ metric_id: 'conversion',+ title: 'Share of people who left settings with a key',+ kind: 'conversion_rate',+ role: 'supporting',+ value: 0.34,+ value_at: '2026-08-29T12:00:00Z',+ series: null,+ value_format: 'percentage_scaled',+ unit: null,+ query: conversionQuery,+ caption: null,+ },+ {+ metric_id: 'errors',+ title: 'Exceptions captured on the API keys page',+ kind: 'occurrences',+ role: 'supporting',+ value: 0,+ value_at: '2026-08-29T12:00:00Z',+ series: null,+ value_format: 'count',+ unit: 'errors',+ query: eventMetricQuery('$exception', 'Errors'),+ caption: 'No matching exceptions were captured.',+ },+]++/** A rare event over a month: single-digit daily counts, most of them zero, and long stretches of nothing. */+export const reportSparseMetricFixture: ReportMetricApi = {+ metric_id: 'upload-overwrites',+ title: 'People who hit the overwrite',+ kind: 'affected_users',+ role: 'primary',+ value: 5,+ value_at: '2026-08-29T12:00:00Z',+ series: liveMetricResults.upload_failed.data,+ value_format: 'count',+ unit: 'users',+ query: eventMetricQuery('upload_failed', 'Upload overwrite', BaseMathType.UniqueUsers, '-30d'),+ caption: 'Counted once per person, so the daily bars add up to more than the total.',+}++/** A primary metric whose query the viewer cannot see, so only the saved snapshot is left to show. */+export const reportSavedValueMetricFixture: ReportMetricApi = {+ metric_id: 'checkout-duration',+ title: 'Time from the first Create key click to a saved key',+ kind: 'duration',+ role: 'primary',+ value: 287,+ value_at: '2026-08-28T12:00:00Z',+ series: null,+ value_format: 'duration',+ unit: 's',+ query: null,+ caption: 'Median across the people who hit this observation.',+}++/** Answers the query endpoint for every metric in `reportMetricsFixture`, keyed on the first series' event. */+export async function reportMetricQueryHandler({ request }: { request: Request }): Promise<[number, unknown]> {+ const body = (await request.json()) as {+ query?: {+ series?: Array<{ custom_name?: string; event?: string; math?: string; name?: string }>+ trendsFilter?: { formula?: string }+ }+ }+ const series = body.query?.series?.[0]+ const resultKey = body.query?.trendsFilter?.formula ? 'conversion' : series?.event+ const result = liveMetricResults[resultKey ?? ''] ?? liveMetricResults.$autocapture++ return [+ 200,+ {+ result: [+ {+ action: {+ id: series?.event,+ type: 'events',+ order: 0,+ name: series?.name,+ custom_name: result.label,+ math: series?.math,+ properties: {},+ },+ label: result.label,+ count: result.data.at(-1) ?? 0,+ data: result.data,+ days: result.days ?? dates,+ labels: result.days ?? dates,+ aggregated_value: result.aggregatedValue,+ },+ ],+ },+ ]+}diff --git a/products/signals/frontend/inbox/components/InboxReportList.test.tsx b/products/signals/frontend/inbox/components/InboxReportList.test.tsxindex 7a63f8d56e21..d3e300f029ee 100644--- a/products/signals/frontend/inbox/components/InboxReportList.test.tsx+++ b/products/signals/frontend/inbox/components/InboxReportList.test.tsx@@ -28,7 +28,6 @@ function makeReport(id: string): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',diff --git a/products/signals/frontend/inbox/components/cards/CardSkeleton.tsx b/products/signals/frontend/inbox/components/cards/CardSkeleton.tsxindex 513066459a05..f88ca0171101 100644--- a/products/signals/frontend/inbox/components/cards/CardSkeleton.tsx+++ b/products/signals/frontend/inbox/components/cards/CardSkeleton.tsx@@ -43,7 +43,7 @@ function SkeletonRow({return (<divclassName={clsx(- 'flex w-full items-stretch gap-3 px-4 py-3.5',+ 'flex w-full items-stretch gap-3 px-4 py-4',rounded && 'rounded border border-primary bg-surface-primary',rounded && dashed && 'border-dashed',bordered && 'border-b border-primary last:border-b-0'@@ -51,7 +51,9 @@ function SkeletonRow({>{/* Matches the report card's square priority badge (`size-6`). */}<LemonSkeleton className="size-6 shrink-0 rounded-sm" />- <div className="flex min-w-0 flex-1 flex-col gap-2 py-0.5">+ {/* Freestanding cards stand in for report rows, whose impact column reserves this height,+ so the list does not jump when the rows arrive. */}+ <div className={clsx('flex min-w-0 flex-1 flex-col gap-2 py-0.5', rounded && 'min-h-23')}><LemonSkeleton className="h-3.5 w-3/5" /><LemonSkeleton className="h-3 w-4/5" /><div className="flex items-center gap-2.5 pt-0.5">diff --git a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsxindex 6db68e0d0191..5abf6b456a2b 100644--- a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx+++ b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx@@ -1,7 +1,12 @@import type { Meta, StoryObj } from '@storybook/react'+import { FEATURE_FLAGS } from 'lib/constants'++import { NodeKind, type InsightVizNode, type TrendsQuery } from '~/queries/schema/schema-general'+import { BaseMathType, ChartDisplayType, PropertyMathType } from '~/types'+import { makeReport, pullRequestReports, reportTabReports, runReportsMany } from '../../__mocks__/inboxMocks'-import { SignalReportStatus } from '../../types'+import { SignalReport, SignalReportStatus } from '../../types'import { AgentRunCard } from './AgentRunCard'import { CardSkeleton } from './CardSkeleton'import { ReportCard } from './ReportCard'@@ -31,6 +36,225 @@ export const ReportCards: Story = {),}+/** The inbox list's own frame: a container-query scope at the list's width and row spacing. */+function CardList({ children }: { children: React.ReactNode }): JSX.Element {+ return (+ <div className="bg-primary min-h-screen mx-auto max-w-4xl px-6 py-6">+ <div className="@container flex flex-col gap-1.5">{children}</div>+ </div>+ )+}++function metricQuery(+ event: string,+ customName: string,+ math: BaseMathType | PropertyMathType = BaseMathType.TotalCount+): InsightVizNode<TrendsQuery> {+ return {+ kind: NodeKind.InsightVizNode,+ source: {+ kind: NodeKind.TrendsQuery,+ dateRange: { date_from: '-14d', date_to: null },+ interval: 'day',+ series: [{ kind: NodeKind.EventsNode, event, name: event, custom_name: customName, math }],+ trendsFilter: { display: ChartDisplayType.ActionsBar },+ },+ }+}++// One row per figure shape the impact column has to line up: a rising count, a flat count, a rate, a+// scaled rate, a duration, summed revenue, a plain number with no strip, and a report with no figure at all.+const impactReports: SignalReport[] = [+ makeReport({+ title: "fix(max): Stop 'Conversation not found' on AI chat deep links",+ summary:+ 'Opening a shared AI chat link lands on a "Conversation not found" page. The thread exists, but the deep link resolves before the conversation is fetched.',+ priority: 'P1',+ source_products: ['session_replay'],+ created_at: '2026-06-02T08:00:00Z',+ updated_at: '2026-06-09T14:20:00Z',+ metrics: [+ {+ metric_id: 'affected-users',+ title: 'People who hit the not-found page',+ kind: 'affected_users',+ role: 'primary',+ value: 237,+ value_at: '2026-06-09T14:00:00Z',+ series: [4, 5, 6, 5, 8, 9, 12, 14, 16, 19, 22, 25, 28, 31],+ value_format: 'count',+ unit: 'users',+ query: metricQuery('conversation_not_found', 'People affected', BaseMathType.UniqueUsers),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: "fix(max): Don't report the 2FA gate as an exception",+ summary:+ 'Every sign-in that stops at the two-factor prompt raises an exception. The gate works as designed, so the volume buries real errors.',+ priority: 'P2',+ source_products: ['error_tracking'],+ created_at: '2026-06-04T11:30:00Z',+ updated_at: '2026-06-10T07:45:00Z',+ metrics: [+ {+ metric_id: 'occurrences',+ title: 'Exceptions raised by the 2FA gate',+ kind: 'occurrences',+ role: 'primary',+ value: 3758,+ value_at: '2026-06-10T07:00:00Z',+ series: [260, 270, 255, 280, 265, 275, 270, 262, 268, 258, 272, 266, 271, 269],+ value_format: 'count',+ unit: null,+ query: metricQuery('$exception', 'Exceptions'),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: 'fix(signals): Stop the inbox Ask AI button failing two attempts in five',+ summary:+ 'Asking a question from a report fails about two times in five. The request times out before the first token arrives, and the box clears itself.',+ priority: 'P1',+ source_products: ['llm_analytics'],+ created_at: '2026-06-05T16:10:00Z',+ updated_at: '2026-06-10T18:05:00Z',+ metrics: [+ {+ metric_id: 'error-rate',+ title: 'Share of Ask AI attempts that fail',+ kind: 'error_rate',+ role: 'primary',+ value: 40,+ value_at: '2026-06-10T18:00:00Z',+ series: [35, 42, 38, 44, 39, 41, 37, 43, 40, 38, 45, 39, 42, 40],+ value_format: 'percentage',+ unit: 'failure',+ query: metricQuery('ask_ai_failed', 'Failed attempts'),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: 'feat(signals): Add a manual setup path to the inbox takeover',+ summary:+ 'People who cannot install the agent leave the takeover screen with nothing to do. A manual path would let them finish setup by hand.',+ priority: 'P2',+ source_products: ['session_replay'],+ created_at: '2026-05-29T09:00:00Z',+ updated_at: '2026-06-09T21:15:00Z',+ metrics: [+ {+ metric_id: 'conversion-rate',+ title: 'Takeover screens that end in a finished setup',+ kind: 'conversion_rate',+ role: 'primary',+ value: 0.051,+ value_at: '2026-06-09T21:00:00Z',+ series: [5, 6, 4, 5, 5, 6, 5, 4, 5, 5, 6, 5, 5, 5],+ value_format: 'percentage_scaled',+ unit: null,+ query: metricQuery('inbox_setup_finished', 'Finished setup', BaseMathType.UniqueUsers),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: 'perf(ci): Land the stalled Depot and cache fix for CI CLI',+ summary: 'The CLI job spends most of its run rebuilding a cache that a merged fix already avoids.',+ priority: 'P3',+ source_products: ['github'],+ implementation_pr_url: 'https://github.com/example/repo/pull/86709',+ created_at: '2026-06-01T13:00:00Z',+ updated_at: '2026-06-10T10:30:00Z',+ metrics: [+ {+ metric_id: 'job-duration',+ title: 'Median CI CLI job duration',+ kind: 'duration',+ role: 'primary',+ value: 287,+ value_at: '2026-06-10T10:00:00Z',+ series: [214, 221, 218, 230, 226, 241, 255, 249, 262, 271, 268, 280, 284, 287],+ value_format: 'duration',+ unit: 's',+ query: metricQuery('ci_job_finished', 'CI CLI job', PropertyMathType.Median),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: 'fix(billing): Stop double-charging annual plans on renewal',+ summary:+ 'Annual plans renewed in the last two weeks were invoiced twice. The second invoice settles before the first refund lands.',+ priority: 'P1',+ source_products: ['revenue_analytics'],+ created_at: '2026-06-03T09:30:00Z',+ updated_at: '2026-06-10T12:15:00Z',+ metrics: [+ {+ metric_id: 'refunded-revenue',+ title: 'Revenue refunded after a double charge',+ kind: 'revenue',+ role: 'primary',+ value: 18420,+ value_at: '2026-06-10T12:00:00Z',+ series: [0, 0, 640, 1180, 920, 1460, 1720, 1310, 1890, 2050, 1640, 2210, 1980, 1420],+ value_format: 'currency',+ unit: 'USD',+ query: metricQuery('refund_issued', 'Refunded revenue', PropertyMathType.Sum),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: 'perf(ingestion): Raise the batch size on the person-property writer',+ summary: 'The writer flushes tiny batches under load, so the consumer lag grows through every peak.',+ priority: 'P3',+ source_products: ['data_pipelines'],+ created_at: '2026-06-02T15:00:00Z',+ updated_at: '2026-06-09T18:00:00Z',+ metrics: [+ {+ metric_id: 'batch-size',+ title: 'Average rows per flush',+ kind: 'custom',+ role: 'primary',+ value: 41,+ value_at: '2026-06-09T18:00:00Z',+ series: null,+ value_format: 'number',+ unit: 'rows',+ query: metricQuery('person_property_flush', 'Rows per flush', PropertyMathType.Average),+ caption: null,+ },+ ],+ }),+ makeReport({+ title: "fix(posthog-ai): Stop sending users to a Help label that doesn't exist",+ summary:+ 'The answer points at a "Help" menu entry that was renamed, so people look for a label that is not there.',+ priority: 'P2',+ source_products: ['llm_analytics'],+ created_at: '2026-06-06T12:00:00Z',+ updated_at: '2026-06-10T16:40:00Z',+ metrics: [],+ }),+]++export const ReportCardWithImpact: Story = {+ parameters: { featureFlags: [FEATURE_FLAGS.INBOX_REDESIGN, FEATURE_FLAGS.SIGNALS_REPORT_METRICS] },+ render: () => (+ <CardList>+ {impactReports.map((report) => (+ <ReportCard key={report.id} report={report} />+ ))}+ </CardList>+ ),+}+export const PullRequestCards: Story = {render: () => (<Stack>diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsxindex 7cb440ae0f16..d14bf2b45161 100644--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx@@ -1,13 +1,18 @@import '@testing-library/jest-dom'-import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'+import { act, cleanup, fireEvent, render, screen, within } from '@testing-library/react'+import userEvent from '@testing-library/user-event'import { router } from 'kea-router'import posthog from 'posthog-js'import api from 'lib/api'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { initKeaTests } from '~/test/init'+import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'+import { INBOX_EVENTS } from '../../inboxAnalytics'import { inboxBulkActionsLogic } from '../../logics/inboxBulkActionsLogic'import { SignalReport, SignalReportStatus } from '../../types'@@ -15,6 +20,9 @@ import { SELECTION_HOLD_MS } from '../../utils/reportSelection'import { ReportCard } from './ReportCard'jest.mock('posthog-js')+jest.mock('lib/components/TZLabel', () => ({+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,+}))function makeReport(id: string, overrides: Partial<SignalReport> = {}): SignalReport {return {@@ -24,7 +32,6 @@ function makeReport(id: string, overrides: Partial<SignalReport> = {}): SignalRestatus: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',@@ -35,11 +42,34 @@ function makeReport(id: string, overrides: Partial<SignalReport> = {}): SignalRe} satisfies SignalReport}+function makeMetric(overrides: Partial<ReportMetricApi> = {}): ReportMetricApi {+ return {+ metric_id: 'impact',+ title: 'Users affected',+ kind: 'affected_users',+ role: 'primary',+ value: 42,+ value_at: '2026-08-28T12:00:00Z',+ value_format: 'count',+ unit: 'users',+ caption: null,+ ...overrides,+ }+}++function enableRedesign(enabled = true): void {+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN, FEATURE_FLAGS.SIGNALS_REPORT_METRICS], {+ [FEATURE_FLAGS.INBOX_REDESIGN]: enabled,+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: enabled,+ })+}+describe('ReportCard', () => {let logic: ReturnType<typeof inboxBulkActionsLogic.build>beforeEach(() => {initKeaTests()+ featureFlagLogic.mount()logic = inboxBulkActionsLogic()logic.mount()render(<ReportCard report={makeReport('r-1')} selectable />)@@ -121,6 +151,12 @@ describe('ReportCard', () => {fireEvent.click(cardLink())expect(openedReport()).toBe(false)++ // React queues its scheduler work in the fake timer queue, and leaving fake timers drops+ // whatever is still queued. No state update in a later test would flush then.+ act(() => {+ jest.runOnlyPendingTimers()+ })})it('cancels the hold when the pointer travels, so a scroll never selects', () => {@@ -130,6 +166,10 @@ describe('ReportCard', () => {jest.advanceTimersByTime(SELECTION_HOLD_MS)expect(logic.values.selectedReportIds).toEqual([])++ act(() => {+ jest.runOnlyPendingTimers()+ })})it('records the entry method when a shift-click starts the selection', () => {@@ -195,4 +235,168 @@ describe('ReportCard', () => {expect(logic.values.selectedReportIds).toEqual(['r-1'])setState.mockRestore()})++ it('shows the affected-user snapshot in a redesigned row and prefers it over the primary metric', async () => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const user = userEvent.setup()+ const report = makeReport('r-2', {+ metrics: [+ makeMetric({+ metric_id: 'conversion',+ title: 'Conversion rate',+ kind: 'conversion_rate',+ value: 34,+ value_at: null,+ value_format: 'percentage',+ unit: null,+ }),+ makeMetric({ metric_id: 'affected-users', role: 'supporting', series: [3, 5, 9] }),+ ],+ })++ const { container } = render(<ReportCard report={report} />)++ expect(screen.getByText('42')).toBeInTheDocument()+ expect(screen.queryByText('Users affected')).not.toBeInTheDocument()+ expect(screen.queryByText('34%')).not.toBeInTheDocument()+ expect(container.querySelectorAll('[data-attr="report-card-impact-sparkline"] > *')).toHaveLength(3)++ await user.hover(screen.getByText('42'))+ expect(await screen.findByText('Users affected')).toBeInTheDocument()+ expect(await screen.findByText('2026-08-28T12:00:00Z')).toBeInTheDocument()+ })++ // The row breaks the figure away from its unit word, and each format splits at a different place.+ const rowPartCases: [string, ReportMetricApi, string, string][] = [+ [+ 'a duration in seconds',+ makeMetric({ kind: 'duration', value: 287, value_format: 'duration', unit: 's' }),+ '287',+ 'seconds',+ ],+ [+ 'a failure rate',+ makeMetric({ kind: 'error_rate', value: 40, value_format: 'percentage', unit: 'failure' }),+ '40%',+ 'failure',+ ],+ ]+ it.each(rowPartCases)('prints %s as a figure above its unit word', (_label, metric, figure, unitWord) => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const { container } = render(<ReportCard report={makeReport('r-2', { metrics: [metric] })} />)++ const block = container.querySelector('[data-attr="report-card-impact-metric"]')+ expect(block).not.toBeNull()+ expect(within(block as HTMLElement).getByText(figure)).toBeInTheDocument()+ expect(within(block as HTMLElement).getByText(unitWord)).toBeInTheDocument()+ })++ it('draws a rate strip as a line instead of bars', () => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const { container } = render(+ <ReportCard+ report={makeReport('r-2', {+ metrics: [+ makeMetric({+ kind: 'error_rate',+ value: 40,+ value_format: 'percentage',+ unit: 'failure',+ series: [35, 42, 38],+ }),+ ],+ })}+ />+ )++ const strip = container.querySelector('[data-attr="report-card-impact-sparkline"]')+ expect(strip?.tagName).toBe('svg')+ expect(strip?.querySelector('polyline')).not.toBeNull()+ })++ it('draws no strip for a single-bucket series but keeps the figure', () => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const { container } = render(+ <ReportCard report={makeReport('r-2', { metrics: [makeMetric({ series: [9] })] })} />+ )++ expect(container.querySelector('[data-attr="report-card-impact-sparkline"]')).toBeNull()+ expect(screen.getByText('42')).toBeInTheDocument()+ })++ it('keeps the timestamp on a redesigned row that has no figure', () => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const { container } = render(<ReportCard report={makeReport('r-2', { metrics: [] })} />)++ expect(container.querySelector('[data-attr="report-card-impact-metric"]')).toBeNull()+ expect(screen.getByText('2026-06-11T10:00:00Z')).toBeInTheDocument()+ })++ it('uses the primary snapshot when there is no affected-user snapshot', () => {+ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const report = makeReport('r-2', {+ metrics: [+ makeMetric({+ metric_id: 'conversion',+ title: 'Conversion rate',+ kind: 'conversion_rate',+ value: 34,+ value_at: null,+ value_format: 'percentage',+ unit: null,+ }),+ ],+ })++ const { container } = render(<ReportCard report={report} />)++ expect(screen.getByText('34%')).toBeInTheDocument()+ expect(screen.queryByText('Conversion rate')).not.toBeInTheDocument()+ expect(container.querySelector('[data-attr="report-card-impact-metric"]')).not.toBeNull()+ })++ it('does not show a list metric without a stored snapshot, under the legacy design, or with the metrics flag off', () => {+ const report = makeReport('r-2', { metrics: [makeMetric({ value: null, value_at: null })] })++ // The harness renders a card for every test; these assert against their own.+ cleanup()+ enableRedesign()+ const { container, rerender } = render(<ReportCard report={report} />)+ expect(container.querySelector('[data-attr="report-card-impact-metric"]')).toBeNull()++ enableRedesign(false)+ rerender(+ <ReportCard+ report={makeReport('r-2', {+ metrics: [{ ...report.metrics![0], value: 42 }],+ })}+ />+ )+ expect(container.querySelector('[data-attr="report-card-impact-metric"]')).toBeNull()++ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN, FEATURE_FLAGS.SIGNALS_REPORT_METRICS], {+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: false,+ })+ rerender(+ <ReportCard+ report={makeReport('r-2', {+ metrics: [{ ...report.metrics![0], value: 42 }],+ })}+ />+ )+ expect(container.querySelector('[data-attr="report-card-impact-metric"]')).toBeNull()+ })})diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.tsxindex df8ee1e70303..acda2ee5bc1c 100644--- a/products/signals/frontend/inbox/components/cards/ReportCard.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportCard.tsx@@ -40,6 +40,7 @@ import {sourceProductsTooltipTitle,} from '../badges/sourceProductIcons'import { inboxCardRowClassName } from './inboxCardRowClassName'+import { ReportCardImpactMetric } from './ReportCardImpactMetric'import { useReportCardSelection } from './useReportCardSelection'import { useReportDismiss } from './useReportDismiss'@@ -153,6 +154,10 @@ export function ReportCard({const cardTitle = displayConventionalCommitTitle(report.title, hasPr ? 'Untitled pull request' : 'Untitled report')const headline = deriveHeadline(report.summary)const redesign = useFeatureFlag('INBOX_REDESIGN')+ const metricsEnabled = useFeatureFlag('SIGNALS_REPORT_METRICS')+ // The impact column carries its own flag on top of the redesign: its figures come from live+ // queries, so it rolls out per team as the metric quality is verified.+ const showImpactColumn = redesign && metricsEnabled// The legacy layout addresses a report through the tab that listed it, so its back control returns there.const detailUrl = inboxReportDetailUrl(report.id,@@ -196,7 +201,12 @@ export function ReportCard({? dismissalReasonLabel(report.dismissal_reason): null- const cardBodyClassName = 'flex min-w-0 flex-1 items-start gap-3 text-left text-inherit no-underline'+ const cardBodyClassName = clsx(+ 'flex min-w-0 flex-1 items-start gap-3 text-left text-inherit no-underline',+ // Too narrow to hold the impact column beside the content: let it drop to its own line rather+ // than squeeze the title into a column of single words.+ showImpactColumn && 'flex-wrap @lg:flex-nowrap'+ )const cardBody = (<>{report.priority && (@@ -205,14 +215,16 @@ export function ReportCard({</div>)}- <div className="flex flex-col gap-1.5 min-w-0 flex-1">- {/* Keep the title clear of the PR badge, which is positioned within the content column. */}+ <div className={clsx('flex flex-col gap-2 min-w-0 flex-1', showImpactColumn && 'self-stretch')}>+ {/* Keep the title clear of the PR badge. With the impact column shown the badge sits+ over that column from `@lg` up, so only the stacked width needs the reserved space. */}<divclassName={clsx('min-w-0 break-words font-semibold text-sm leading-snug text-balance',// A CI glyph widens the pill, so the title gives back the space it takes.// A state that draws no glyph keeps the pill at its plain width.- hasPr && (glyphStatus ? 'pr-24' : 'pr-14')+ hasPr && (glyphStatus ? 'pr-24' : 'pr-14'),+ hasPr && showImpactColumn && '@lg:pr-0')}>{conventionalTitle && (@@ -243,7 +255,14 @@ export function ReportCard({</p>) : null}- <div className="flex items-center flex-wrap mt-1.5 min-w-0 gap-x-2.5 gap-y-1 text-xs text-tertiary leading-none select-none">+ <div+ className={clsx(+ 'flex items-center flex-wrap min-w-0 gap-x-2.5 gap-y-1 text-xs text-tertiary leading-none select-none',+ // Sit on the bottom edge of the column so the sources line up with the timestamp+ // opposite, whichever column is taller.+ showImpactColumn ? 'mt-auto pt-1' : 'mt-1.5'+ )}+ >{hasPr && repoSlug ? <span className="truncate font-mono">{repoSlug}</span> : null}<InboxCardSourceMeta sourceProducts={report.source_products} scoutSkillName={report.scout_name} />{!hasPr &&@@ -272,13 +291,28 @@ export function ReportCard({</Tooltip>)}<SignalReportBillingBadge report={report} />+ {!showImpactColumn && (+ <TZLabel+ time={report.updated_at ?? report.created_at}+ className="ml-auto shrink-0 text-xs text-tertiary tabular-nums"+ title="Last updated"+ />+ )}+ </div>+ </div>++ {/* Reserved even with no figure to show: the fixed width keeps every row's figure and+ timestamp on the same two vertical lines down the list. */}+ {showImpactColumn ? (+ <div className="flex w-full items-center gap-3 @lg:relative @lg:w-auto @lg:min-h-23 @lg:min-w-39 @lg:flex-none @lg:justify-end">+ <ReportCardImpactMetric metrics={report.metrics} /><TZLabeltime={report.updated_at ?? report.created_at}- className="ml-auto shrink-0 text-xs text-tertiary tabular-nums"+ className="ml-auto shrink-0 whitespace-nowrap text-xs leading-none text-tertiary tabular-nums @lg:absolute @lg:right-0 @lg:bottom-0 @lg:ml-0"title="Last updated"/></div>- </div>+ ) : null}</>)diff --git a/products/signals/frontend/inbox/components/cards/ReportCardImpactMetric.tsx b/products/signals/frontend/inbox/components/cards/ReportCardImpactMetric.tsxnew file mode 100644index 000000000000..62c863da8046--- /dev/null+++ b/products/signals/frontend/inbox/components/cards/ReportCardImpactMetric.tsx@@ -0,0 +1,77 @@+import { Tooltip } from '@posthog/lemon-ui'++import { TZLabel } from 'lib/components/TZLabel'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { formatReportMetricValue, reportMetricChartType, reportMetricRowParts } from '../../utils/reportMetrics'+import { ReportCardSparkline } from './ReportCardSparkline'++export function selectReportCardImpactMetric(metrics?: ReportMetricApi[]): ReportMetricApi | null {+ if (!metrics?.length) {+ return null+ }++ const hasSnapshot = (metric: ReportMetricApi): boolean =>+ metric.value !== null && Number.isFinite(metric.value) && formatReportMetricValue(metric, metric.value) !== null++ return (+ metrics.find((metric) => metric.kind === 'affected_users' && hasSnapshot(metric)) ??+ metrics.find((metric) => metric.role === 'primary' && hasSnapshot(metric)) ??+ null+ )+}++/**+ * The row's headline impact: the trailing buckets as a bar or line strip, then the figure over its unit word.+ * What it measures and when live in the tooltip.+ *+ * The two columns are fixed so figures and strips line up down a list of rows. The strip column keeps+ * its width on a row with no series, so a figure never slides left out of the column.+ */+export function ReportCardImpactMetric({ metrics }: { metrics?: ReportMetricApi[] }): JSX.Element | null {+ const metric = selectReportCardImpactMetric(metrics)+ const parts = metric ? reportMetricRowParts(metric, metric.value) : null++ if (!metric || !parts) {+ return null+ }++ const series = metric.series?.filter((point) => Number.isFinite(point)) ?? []++ return (+ <Tooltip+ title={+ <div className="flex flex-col gap-0.5">+ <span>{metric.title}</span>+ {metric.value_at ? (+ <span className="text-xs">+ Measured <TZLabel time={metric.value_at} showPopover={false} timestampStyle="absolute" />+ </span>+ ) : null}+ </div>+ }+ >+ <div+ className="grid shrink-0 grid-cols-[5rem_4rem] items-center gap-3"+ data-attr="report-card-impact-metric"+ >+ <div className="flex items-center justify-end">+ {series.length > 1 ? (+ <ReportCardSparkline values={series} type={reportMetricChartType(metric)} />+ ) : null}+ </div>+ <div className="flex min-w-0 flex-col items-center gap-0.5 text-center">+ <span className="font-mono text-sm font-semibold leading-tight tabular-nums text-primary">+ {parts.value}+ </span>+ {parts.unit ? (+ <span className="max-w-full truncate font-mono text-[10px] leading-tight text-secondary">+ {parts.unit}+ </span>+ ) : null}+ </div>+ </div>+ </Tooltip>+ )+}diff --git a/products/signals/frontend/inbox/components/cards/ReportCardSparkline.tsx b/products/signals/frontend/inbox/components/cards/ReportCardSparkline.tsxnew file mode 100644index 000000000000..429012bbaa34--- /dev/null+++ b/products/signals/frontend/inbox/components/cards/ReportCardSparkline.tsx@@ -0,0 +1,79 @@+import clsx from 'clsx'++import type { ReportMetricChartType } from '../../utils/reportMetrics'++const STRIP_WIDTH = 72+const STRIP_HEIGHT = 18+const LINE_PADDING = 2++function linePoints(values: number[]): { x: number; y: number }[] {+ const minValue = Math.min(...values)+ const maxValue = Math.max(...values)+ const range = maxValue - minValue+ const step = STRIP_WIDTH / (values.length - 1)+ const innerHeight = STRIP_HEIGHT - LINE_PADDING * 2++ return values.map((value, index) => ({+ x: index * step,+ // A flat series sits mid-strip; the figure beside it carries the level.+ y: LINE_PADDING + (range === 0 ? innerHeight / 2 : innerHeight - ((value - minValue) / range) * innerHeight),+ }))+}++/**+ * Row-sized strip of a metric's trailing buckets. Bars for buckets that add up, a line for buckets that+ * are levels; `reportMetricChartType` decides which. The shared `Sparkline` chart sizes its width from+ * the bucket count and mounts a chart per row, which is too heavy and too wide for a list of fifty+ * rows, so this draws plain elements at a fixed width instead.+ */+export function ReportCardSparkline({ values, type }: { values: number[]; type: ReportMetricChartType }): JSX.Element {+ if (type === 'line') {+ const points = linePoints(values)+ const lastPoint = points[points.length - 1]++ return (+ <svg+ className="h-4.5 w-18 flex-none overflow-visible"+ viewBox={`0 0 ${STRIP_WIDTH} ${STRIP_HEIGHT}`}+ preserveAspectRatio="none"+ aria-hidden+ data-attr="report-card-impact-sparkline"+ data-chart-type="line"+ >+ {/* The stroke palette has no border-primary entry, so reference the same token the bars use. */}+ <polyline+ className="stroke-[var(--color-border-primary)]"+ fill="none"+ strokeWidth={1.5}+ strokeLinejoin="round"+ strokeLinecap="round"+ vectorEffect="non-scaling-stroke"+ points={points.map((point) => `${point.x},${point.y}`).join(' ')}+ />+ <circle className="fill-accent" cx={lastPoint.x} cy={lastPoint.y} r={2} />+ </svg>+ )+ }++ const maxValue = Math.max(...values, 1)++ return (+ <div+ className="flex h-4.5 w-18 flex-none items-end gap-0.5"+ aria-hidden+ data-attr="report-card-impact-sparkline"+ data-chart-type="bar"+ >+ {values.map((value, index) => (+ <div+ key={index}+ className={clsx(+ 'min-h-0.5 flex-1 rounded-[1px]',+ index === values.length - 1 ? 'bg-accent' : 'bg-border-primary'+ )}+ style={{ height: `${Math.max(10, (value / maxValue) * 100)}%` }}+ />+ ))}+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx b/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsxindex 03ee38875df2..4241638d7f7f 100644--- a/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx@@ -24,7 +24,6 @@ function makeReport(overrides: Partial<SignalReport> = {}): SignalReport {actionability: 'immediately_actionable',total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',diff --git a/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts b/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.tsindex dacb09c0d27d..5a0f3fee5b2a 100644--- a/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts+++ b/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts@@ -6,7 +6,7 @@ import clsx from 'clsx'*/export function inboxCardRowClassName(attached: boolean, opts?: { dashed?: boolean }): string {return clsx(- 'group flex w-full flex-col gap-2.5 @lg:flex-row @lg:items-stretch @lg:gap-3 bg-surface-primary px-4 py-3.5 transition-all duration-150 hover:bg-surface-secondary',+ 'group flex w-full flex-col gap-2.5 @lg:flex-row @lg:items-stretch @lg:gap-3 bg-surface-primary px-4 py-4 transition-all duration-150 hover:bg-surface-secondary',attached? 'border-b border-primary last:border-b-0': opts?.dasheddiff --git a/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx b/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsxindex 47e35aa2bcf2..a58c8aff1ba7 100644--- a/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx+++ b/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx@@ -34,7 +34,6 @@ function makeReport(suggestedPrompts?: string[]): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,created_at: '2026-06-11T10:00:00Z',diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsxindex 75786a18a8ed..ae1a31a1fb1a 100644--- a/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx@@ -35,7 +35,6 @@ function makeReport(): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,created_at: '2026-06-11T10:00:00Z',diff --git a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsxindex e57518ccc2ed..57fe7cdf0c78 100644--- a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx+++ b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx@@ -20,6 +20,7 @@ import {reportTabReports,runReportsMany,} from '../../__mocks__/inboxMocks'+import { reportMetricQueryHandler, reportMetricsFixture } from '../../__mocks__/reportMetricMocks'import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'import { SignalReport, SignalReportStatus } from '../../types'import { AgentRunDetail } from './AgentRunDetail'@@ -111,6 +112,9 @@ const detailMocks = mswDecorator({],'/api/projects/:id/tasks/:taskId/runs/:runId/logs': () => new HttpResponse(mockRunLog()),},+ post: {+ '/api/environments/:team_id/query/:kind/': reportMetricQueryHandler,+ },})const meta: Meta = {@@ -119,7 +123,7 @@ const meta: Meta = {layout: 'fullscreen',viewMode: 'story',mockDate: '2026-06-11',- featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true },+ featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true, [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: true },},decorators: [detailMocks],}@@ -139,6 +143,29 @@ export const Report: Story = {),}+export const ReportWithMetrics: Story = {+ render: () => (+ <Frame>+ <ReportDetail+ report={makeReport({+ ...reportTabReports[0],+ title: 'Creating an API key does nothing when validation fails',+ summary: [+ 'The Create key button swallows its own validation error, so people click it repeatedly and leave settings without a key.',+ '## Problem',+ 'When the new API key form fails validation, the click handler returns early before the error state reaches the form. The button stays enabled and nothing renders.',+ '## Impact',+ 'People creating keys are usually mid-setup, wiring an SDK or a CI job, so a silent failure here stalls an integration without leaving an error event behind.',+ '## Solution',+ 'Set the form errors before the early return so the existing error rendering works again, and give the button a disabled reason while the request is in flight.',+ ].join('\n\n'),+ metrics: reportMetricsFixture,+ })}+ />+ </Frame>+ ),+}+export const ReportMinimal: Story = {render: () => (<Frame>diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsxindex 84ab80289732..d7aef2ac1ac5 100644--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx@@ -7,12 +7,14 @@ import {IconEllipsis,IconExternal,IconSearch,+ IconTrends,IconSidebarClose,IconSidebarOpen,} from '@posthog/icons'import { LemonButton, LemonTabs, LemonSelect } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonMenu, LemonMenuItem } from 'lib/lemon-ui/LemonMenu'import { addProjectIdIfMissing } from 'lib/utils/kea-router'import { SignalNode } from 'scenes/debug/signals/types'@@ -49,6 +51,8 @@ import { ReportActivitySection } from './ReportActivitySection'import { ReportChart } from './ReportChart'import { useReportDetailActions } from './ReportDetailActions'import { ReportFeedbackFooter } from './ReportFeedbackFooter'+import { ReportImpactMetrics } from './ReportImpactMetrics'+import { ReportPrimaryMetric } from './ReportPrimaryMetric'import { ReportSummaryBody } from './ReportSummaryBody'import { ReportTasksSection } from './ReportTasksSection'import { SuggestedReviewersSection } from './SuggestedReviewersSection'@@ -274,8 +278,9 @@ export function InboxDetailFrame({</span>)- // Hiding the rail gives the report column the full width, which is what reading a diff needs. The- // Both controls live on the rail: hide in the Evidence header, show in the strip the rail folds to.+ // Hiding the rail gives the report column the full width, which is what reading a diff needs.+ // Both controls live on the rail: hide in the header of its first section, show in the strip+ // the rail folds to.const onToggleRail = (): void => {toggleEvidenceRail()captureSectionToggle('evidence_rail')(!evidenceRailCollapsed)@@ -314,6 +319,15 @@ export function InboxDetailFrame({// The report body: title, summary, charts, and the rating. On a PR-bearing report it is the// "Summary" tab; otherwise it sits under the "Report summary" header.+ // The key observation leads the evidence rail; the supporting tiles belong to the body's Impact section.+ const metricsEnabled = useFeatureFlag('SIGNALS_REPORT_METRICS')+ const primaryMetric = metricsEnabled ? report.metrics?.find((metric) => metric.role === 'primary') : undefined+ const supportingMetrics = metricsEnabled+ ? (report.metrics?.filter((metric) => metric.role !== 'primary') ?? [])+ : []+ const impactMetrics =+ supportingMetrics.length > 0 ? <ReportImpactMetrics reportId={report.id} metrics={supportingMetrics} /> : null+const summaryColumn = (<div className="flex flex-1 flex-col gap-6">{titleHeading}@@ -325,14 +339,16 @@ export function InboxDetailFrame({chartPlacements={chartPlacements}implementButton={implementButton}pullRequestNote={pullRequestNote}+ impactMetrics={impactMetrics}/>) : (- <>+ <div className="flex flex-col gap-6"><p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>No summary yet. An agent is still investigating.</p>{pullRequestNote}- </>+ {impactMetrics}+ </div>)}{trailingCharts.length > 0 && (<div className="flex flex-col gap-4 mt-5">@@ -392,14 +408,25 @@ export function InboxDetailFrame({<aside className={DETAIL_ASIDE_COLLAPSED_CLASS}>{showRailButton}</aside>) : (<aside className={DETAIL_ASIDE_CLASS}>- {/* Evidence leads: it is what the summary's claims rest on. */}+ {/* The observation leads, then the evidence its claims rest on. */}+ {primaryMetric && (+ <DetailSection+ icon={<IconTrends />}+ title="Observation"+ collapsible+ onToggleCollapsed={captureSectionToggle('observation')}+ rightSlot={hideRailButton}+ >+ <ReportPrimaryMetric reportId={report.id} metric={primaryMetric} />+ </DetailSection>+ )}{hasEvidence && (<DetailSectionicon={<IconSearch />}title="Evidence"collapsibleonToggleCollapsed={captureSectionToggle('evidence')}- rightSlot={hideRailButton}+ rightSlot={primaryMetric ? undefined : hideRailButton}>{reportSignalsLoading && reportSignals === null ? (<EvidenceSkeleton count={evidenceCount} />diff --git a/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.test.tsx b/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.test.tsxnew file mode 100644index 000000000000..189f41085565--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.test.tsx@@ -0,0 +1,253 @@+import '@testing-library/jest-dom'++import { act, cleanup, render, screen, waitFor } from '@testing-library/react'++import { useMocks } from '~/mocks/jest'+import { NodeKind } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'+import { BaseMathType, ChartDisplayType } from '~/types'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { ReportImpactMetrics } from './ReportImpactMetrics'++jest.mock('lib/components/TZLabel', () => ({+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,+}))++const query = {+ kind: NodeKind.InsightVizNode,+ source: {+ kind: NodeKind.TrendsQuery,+ dateRange: { date_from: '-7d', date_to: null },+ interval: 'day',+ series: [+ {+ kind: NodeKind.EventsNode,+ event: '$autocapture',+ name: '$autocapture',+ math: BaseMathType.UniqueUsers,+ },+ ],+ trendsFilter: { display: ChartDisplayType.ActionsBar },+ },+}++const percentageQuery = {+ ...query,+ source: {+ ...query.source,+ trendsFilter: {+ ...query.source.trendsFilter,+ aggregationAxisFormat: 'percentage_scaled',+ },+ },+}++function makeMetric(overrides: Partial<ReportMetricApi> = {}): ReportMetricApi {+ return {+ metric_id: 'affected-users',+ title: 'Users affected',+ kind: 'affected_users',+ role: 'supporting',+ value: 9,+ value_at: '2026-08-29T12:00:00Z',+ value_format: 'count',+ unit: 'users',+ query,+ caption: null,+ ...overrides,+ }+}++function trendsResponse(aggregatedValue: number): Record<string, unknown> {+ return {+ result: [+ {+ label: 'Users affected',+ count: 7,+ data: [4, 7],+ days: ['2026-08-28', '2026-08-29'],+ labels: ['2026-08-28', '2026-08-29'],+ aggregated_value: aggregatedValue,+ },+ ],+ }+}++describe('ReportImpactMetrics', () => {+ beforeEach(() => initKeaTests())+ afterEach(() => {+ cleanup()+ jest.restoreAllMocks()+ })++ it('replaces a supporting snapshot with its live whole-window value', async () => {+ let requests = 0+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': () => {+ requests += 1+ return [200, trendsResponse(42)]+ },+ },+ })++ render(<ReportImpactMetrics reportId="live-supporting" metrics={[makeMetric()]} />)++ expect(await screen.findByText('42')).toBeInTheDocument()+ expect(screen.queryByText('9')).not.toBeInTheDocument()+ expect(screen.getByText('Last 7 days')).toBeInTheDocument()+ expect(screen.queryByText('Current window')).not.toBeInTheDocument()+ expect(requests).toBe(1)+ })++ it('sets the tile unit apart from its figure', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [200, trendsResponse(3912)],+ },+ })++ render(+ <ReportImpactMetrics+ reportId="unit-supporting"+ metrics={[makeMetric({ metric_id: 'dead-clicks', title: 'Dead clicks', unit: 'clicks' })]}+ />+ )++ expect(await screen.findByText('3,912')).toBeInTheDocument()+ expect(screen.getByText('clicks')).toBeInTheDocument()+ })++ it('uses the generated supporting role default when role is omitted', async () => {+ let requests = 0+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': () => {+ requests += 1+ return [200, trendsResponse(42)]+ },+ },+ })++ render(<ReportImpactMetrics reportId="default-supporting" metrics={[makeMetric({ role: undefined })]} />)++ expect(await screen.findByText('42')).toBeInTheDocument()+ expect(screen.queryByText('9')).not.toBeInTheDocument()+ expect(requests).toBe(1)+ })++ it('keeps the saved supporting value visible while its live value loads', async () => {+ let finishRequest: ((response: [number, Record<string, unknown>]) => void) | undefined+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': () =>+ new Promise<[number, Record<string, unknown>]>((resolve) => {+ finishRequest = resolve+ }),+ },+ })++ render(<ReportImpactMetrics reportId="loading-supporting" metrics={[makeMetric()]} />)++ expect(screen.getByText('9')).toBeInTheDocument()+ expect(screen.getByText('Refreshing current value')).toBeInTheDocument()++ await waitFor(() => expect(finishRequest).not.toBeUndefined())+ await act(async () => finishRequest?.([200, trendsResponse(10)]))+ })++ it('settles a supporting metric to its saved value when the live query never runs', async () => {+ let requests = 0+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': () => {+ requests += 1+ return [200, trendsResponse(42)]+ },+ },+ })++ // An invalid RE2 regex filter makes the frontend refuse to run the query, so the loader+ // settles with a null response and no request. The card must leave the loading state.+ const unrunnableQuery = {+ ...query,+ source: {+ ...query.source,+ series: [+ { ...query.source.series[0], properties: [{ key: '$current_url', operator: 'regex', value: '(' }] },+ ],+ },+ }++ render(+ <ReportImpactMetrics reportId="unrunnable-supporting" metrics={[makeMetric({ query: unrunnableQuery })]} />+ )++ expect(await screen.findByText(/No current value/)).toHaveTextContent(+ 'No current value. Showing the latest saved value.'+ )+ expect(screen.getByText('9')).toBeInTheDocument()+ expect(screen.queryByText('Refreshing current value')).not.toBeInTheDocument()+ expect(screen.queryByText('Loading current value')).not.toBeInTheDocument()+ expect(requests).toBe(0)+ })++ it('explains when a supporting refresh failed and keeps its saved value', async () => {+ jest.spyOn(console, 'error').mockImplementation()+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [500, { detail: 'Query failed' }],+ },+ })++ render(<ReportImpactMetrics reportId="failed-supporting" metrics={[makeMetric()]} />)++ expect(await screen.findByText(/Couldn't refresh this metric/)).toHaveTextContent(+ "Couldn't refresh this metric. Showing the latest saved value. Refresh the page to try again."+ )+ expect(screen.getByText('9')).toBeInTheDocument()+ })++ it('renders a live zero instead of falling back to a nonzero snapshot', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [200, trendsResponse(0)],+ },+ })++ render(<ReportImpactMetrics reportId="zero-supporting" metrics={[makeMetric()]} />)++ expect(await screen.findByText('0')).toBeInTheDocument()+ expect(screen.queryByText('9')).not.toBeInTheDocument()+ })++ it('formats a live scaled percentage before replacing its snapshot', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [200, trendsResponse(0.34)],+ },+ })++ render(+ <ReportImpactMetrics+ reportId="scaled-supporting"+ metrics={[+ makeMetric({+ metric_id: 'conversion-rate',+ title: 'Conversion rate',+ kind: 'conversion_rate',+ value: 0.12,+ value_format: 'percentage_scaled',+ unit: null,+ query: percentageQuery,+ }),+ ]}+ />+ )++ expect(await screen.findByText('34%')).toBeInTheDocument()+ expect(screen.queryByText('12%')).not.toBeInTheDocument()+ })+})diff --git a/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.tsx b/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.tsxnew file mode 100644index 000000000000..7b6399665b5d--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportImpactMetrics.tsx@@ -0,0 +1,50 @@+import clsx from 'clsx'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { asReportMetricAggregateQuery } from '../../utils/reportMetrics'+import { ReportSupportingMetric } from './ReportSupportingMetric'+import { ReportSupportingMetricQuery } from './ReportSupportingMetricQuery'++// One tile per column up to four, so a report with two or three tiles does not leave an empty slot.+// Tailwind needs the full class strings written out, so each count is listed explicitly.+const IMPACT_GRID: Record<number, string> = {+ 1: 'grid-cols-1',+ 2: 'grid-cols-1 @min-[24rem]/report-impact:grid-cols-2',+ 3: 'grid-cols-1 @min-[24rem]/report-impact:grid-cols-2 @min-[40rem]/report-impact:grid-cols-3',+ 4: 'grid-cols-1 @min-[24rem]/report-impact:grid-cols-2 @min-[48rem]/report-impact:grid-cols-4',+}++/** The supporting metrics as a grid of tiles. Callers own the heading, so it can sit under the summary's Impact section. */+export function ReportImpactMetrics({+ reportId,+ metrics,+}: {+ reportId: string+ metrics: ReportMetricApi[]+}): JSX.Element | null {+ if (metrics.length === 0) {+ return null+ }++ return (+ <div className="@container/report-impact" data-attr="report-impact-metrics">+ <div className={clsx('grid gap-2.5', IMPACT_GRID[metrics.length] ?? IMPACT_GRID[3])}>+ {metrics.map((metric) => {+ const query = asReportMetricAggregateQuery(metric.query)++ return query ? (+ <ReportSupportingMetricQuery+ key={metric.metric_id}+ reportId={reportId}+ metric={metric}+ query={query.source}+ />+ ) : (+ <ReportSupportingMetric key={metric.metric_id} metric={metric} />+ )+ })}+ </div>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportMetricMetaLine.tsx b/products/signals/frontend/inbox/components/detail/ReportMetricMetaLine.tsxnew file mode 100644index 000000000000..bbcbf767e42d--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportMetricMetaLine.tsx@@ -0,0 +1,48 @@+import { Fragment, type ReactNode } from 'react'++import { TZLabel } from 'lib/components/TZLabel'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++export interface ReportMetricMetaSegment {+ key: string+ node: ReactNode+}++/** When the saved snapshot was measured; empty when the metric has no snapshot time. */+export function measuredMetaSegments(metric: ReportMetricApi): ReportMetricMetaSegment[] {+ if (!metric.value_at) {+ return []+ }++ return [+ {+ key: 'measured',+ node: (+ <span>+ Measured <TZLabel time={metric.value_at} />+ </span>+ ),+ },+ ]+}++/** The small mono line under an observation figure, its segments joined by a middle dot. */+export function ReportMetricMetaLine({ segments }: { segments: ReportMetricMetaSegment[] }): JSX.Element | null {+ if (segments.length === 0) {+ return null+ }++ // Plain inline flow, not a flex row: the line then wraps between words instead of leaving a+ // separator stranded at the end of a line.+ return (+ <div className="font-mono text-[11px] text-tertiary">+ {segments.map((segment, index) => (+ <Fragment key={segment.key}>+ {index > 0 ? <span aria-hidden> · </span> : null}+ {segment.node}+ </Fragment>+ ))}+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportMetrics.stories.tsx b/products/signals/frontend/inbox/components/detail/ReportMetrics.stories.tsxnew file mode 100644index 000000000000..a451cb00cac7--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportMetrics.stories.tsx@@ -0,0 +1,117 @@+import type { Meta, StoryObj } from '@storybook/react'++import { mswDecorator } from '~/mocks/browser'++import {+ reportMetricQueryHandler,+ reportMetricsFixture,+ reportSavedValueMetricFixture,+ reportSparseMetricFixture,+} from '../../__mocks__/reportMetricMocks'+import { ReportImpactMetrics } from './ReportImpactMetrics'+import { ReportPrimaryMetric } from './ReportPrimaryMetric'++const [primaryMetric, ...supportingMetrics] = reportMetricsFixture+const rateMetric = reportMetricsFixture.find((metric) => metric.kind === 'conversion_rate') ?? primaryMetric++/** The observation in a rail-width column beside the Impact tiles, the way the report detail lays them out. */+function ReportMetricsLayout({ reportId, railWidth }: { reportId: string; railWidth: string }): JSX.Element {+ return (+ <div className="flex flex-wrap items-start gap-6">+ <div className={railWidth}>+ <ReportPrimaryMetric reportId={reportId} metric={primaryMetric} />+ </div>+ <div className="flex min-w-64 flex-1 flex-col gap-3">+ <h2 className="m-0 text-lg font-semibold">Impact</h2>+ <ReportImpactMetrics reportId={reportId} metrics={supportingMetrics} />+ </div>+ </div>+ )+}++const meta: Meta<typeof ReportMetricsLayout> = {+ title: 'Scenes-App/Inbox/Report metrics',+ component: ReportMetricsLayout,+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-08-29',+ },+ decorators: [+ mswDecorator({+ post: {+ '/api/environments/:team_id/query/:kind/': reportMetricQueryHandler,+ },+ }),+ ],+}+export default meta++type Story = StoryObj<typeof ReportMetricsLayout>++export const Wide: Story = {+ args: { reportId: 'report-with-metrics', railWidth: 'w-[26rem]' },+ render: (args) => (+ <div className="min-h-screen bg-primary p-6">+ <div className="mx-auto max-w-5xl">+ <ReportMetricsLayout {...args} />+ </div>+ </div>+ ),+}++export const Narrow: Story = {+ args: { reportId: 'narrow-report-with-metrics', railWidth: 'w-full' },+ render: (args) => (+ <div className="min-h-screen bg-primary p-6">+ <div className="w-96 max-w-full">+ <ReportMetricsLayout {...args} />+ </div>+ </div>+ ),+}++export const SavedValue: Story = {+ render: () => (+ <div className="min-h-screen bg-primary p-6">+ <div className="w-[26rem] max-w-full">+ <ReportPrimaryMetric reportId="report-with-saved-metric" metric={reportSavedValueMetricFixture} />+ </div>+ </div>+ ),+}++/** A rate draws a line strip that floats to its range, where a count draws bars from zero. */+export const RateObservation: Story = {+ render: () => (+ <div className="min-h-screen bg-primary p-6">+ <div className="w-[26rem] max-w-full">+ <ReportPrimaryMetric reportId="report-with-rate-metric" metric={{ ...rateMetric, role: 'primary' }} />+ </div>+ </div>+ ),+}++/** A month-long window on a rare event: 30 buckets and single-digit counts still have to read as a shape. */+export const SparseObservation: Story = {+ render: () => (+ <div className="min-h-screen bg-primary p-6">+ <div className="w-[26rem] max-w-full">+ <ReportPrimaryMetric reportId="report-with-sparse-metric" metric={reportSparseMetricFixture} />+ </div>+ </div>+ ),+}++export const LiveSupportingMetric: Story = {+ render: () => (+ <div className="min-h-screen bg-primary p-6">+ <div className="mx-auto max-w-md">+ <ReportImpactMetrics+ reportId="report-with-live-supporting-metric"+ metrics={[{ ...primaryMetric, role: 'supporting' }]}+ />+ </div>+ </div>+ ),+}diff --git a/products/signals/frontend/inbox/components/detail/ReportObservationCard.tsx b/products/signals/frontend/inbox/components/detail/ReportObservationCard.tsxnew file mode 100644index 000000000000..5dcbed6ec13d--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportObservationCard.tsx@@ -0,0 +1,68 @@+import type { ReactNode } from 'react'++import { IconExternal, IconTrends } from '@posthog/icons'+import { Link } from '@posthog/lemon-ui'++import { LemonCard } from 'lib/lemon-ui/LemonCard'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { chartOpenTarget } from '../../utils/chartOpenTarget'+import { asReportMetricTrendsQuery, reportMetricFilterCount, reportMetricWindowLabel } from '../../utils/reportMetrics'++/**+ * Frame for the report's key observation: what was observed and how it is counted, then the value+ * and chart the caller has, then the window and filters the numbers come from with a way to open+ * the full insight.+ */+export function ReportObservationCard({+ metric,+ children,+}: {+ metric: ReportMetricApi+ children: ReactNode+}): JSX.Element {+ const query = asReportMetricTrendsQuery(metric.query)+ const openTarget = query ? chartOpenTarget(query) : null+ const filterCount = query ? reportMetricFilterCount(query) : 0+ const windowLabel = query ? reportMetricWindowLabel(query) : null+ const facts = [+ windowLabel,+ filterCount > 0 ? `${filterCount} ${filterCount === 1 ? 'filter' : 'filters'}` : null,+ ].filter((fact): fact is string => fact !== null)++ return (+ <LemonCard+ hoverEffect={false}+ className="@container/report-observation flex flex-col gap-2 p-3"+ data-attr="report-primary-metric"+ >+ <div className="flex flex-col gap-1">+ <h2 className="m-0 text-sm font-semibold leading-snug text-primary">{metric.title}</h2>+ {metric.caption ? <p className="m-0 text-xs leading-snug text-secondary">{metric.caption}</p> : null}+ </div>+ {children}+ {query ? (+ <div+ className="flex items-center gap-1.5 text-[11px] text-tertiary"+ data-attr="report-primary-metric-source"+ >+ <IconTrends className="size-3.5 shrink-0" aria-hidden />+ <span className="min-w-0 truncate">{facts.length > 0 ? facts.join(' · ') : 'Trends query'}</span>+ {openTarget ? (+ <Link+ to={openTarget.url}+ target="_blank"+ disableClientSideRouting+ className="ml-auto flex shrink-0 items-center gap-0.5 whitespace-nowrap"+ data-attr="report-primary-metric-open"+ >+ {openTarget.label}+ <IconExternal className="size-3" />+ </Link>+ ) : null}+ </div>+ ) : null}+ </LemonCard>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportObservationChart.tsx b/products/signals/frontend/inbox/components/detail/ReportObservationChart.tsxnew file mode 100644index 000000000000..5d3b30cae822--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportObservationChart.tsx@@ -0,0 +1,112 @@+import { useValues } from 'kea'+import { useMemo } from 'react'++import { TimeSeriesBarChart, TimeSeriesLineChart } from '@posthog/quill-charts'+import type { Series, TimeSeriesBarChartConfig, TimeSeriesLineChartConfig } from '@posthog/quill-charts'++import { useChartConfig, useChartTheme } from 'lib/charts/hooks'+import { teamLogic } from 'scenes/teamLogic'++import type { IntervalType } from '~/types'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import {+ formatReportMetricParts,+ formatReportMetricValue,+ type ReportMetricChartType,+ type ReportMetricSeriesPoints,+} from '../../utils/reportMetrics'++// Only the top is pinned: the sides keep the computed gutter so the first and last date labels fit.+// The top gridline sits at the top of the plot, and its tick label is centered on it, so the plot+// starts far enough down for the upper half of that label to stay inside the chart box.+const BAR_MARGINS = { top: 9 }++/** Height of the chart. A month of daily buckets needs this much room for the bar heights to+ * separate and for the date row to stay smaller than the plot. The skeleton that stands in while+ * the series loads reserves the same height, so the card does not resize when the data lands. */+export const OBSERVATION_CHART_HEIGHT_CLASS = 'h-36'++// Each labeled gridline already marks its own value, so the y baseline and the tick marks would+// state the scale a second time. A card this narrow cannot spend width on that.+const AXIS_CHROME = { showGrid: true, showAxisLines: { x: true, y: false }, showTickMarks: false } as const++/**+ * The observation's trend over its window: formatted values on the left, dates along the bottom, and+ * exact values in the tooltip. Bars for buckets that add up, a line for buckets that are levels;+ * `reportMetricChartType` decides which.+ */+export function ReportObservationChart({+ metric,+ points,+ type,+ interval,+}: {+ metric: ReportMetricApi+ points: ReportMetricSeriesPoints+ type: ReportMetricChartType+ interval: IntervalType | null | undefined+}): JSX.Element {+ const theme = useChartTheme()+ const { timezone } = useValues(teamLogic)++ const series = useMemo<Series[]>(+ () => [{ key: metric.metric_id, label: metric.title, data: points.values }],+ [metric.metric_id, metric.title, points.values]+ )+ const valueFormatter = useMemo(+ () => (value: number) => formatReportMetricValue(metric, value) ?? String(value),+ [metric]+ )+ const yAxisValueFormatter = useMemo(+ () => (value: number) => {+ if (metric.value_format === 'count' && !Number.isInteger(value)) {+ return ''+ }+ return formatReportMetricParts(metric, value)?.value ?? String(value)+ },+ [metric]+ )+ const xAxis = useMemo(() => ({ timezone, interval: interval ?? 'day' }), [timezone, interval])++ const lineConfig = useChartConfig<TimeSeriesLineChartConfig>(+ () => ({+ xAxis,+ // Rates and durations emphasize change, so the value axis floats to the observed range.+ yAxis: { startAtZero: false, tickFormatter: yAxisValueFormatter },+ ...AXIS_CHROME,+ showCrosshair: true,+ tooltip: { pinnable: false, valueFormatter },+ }),+ [xAxis, yAxisValueFormatter, valueFormatter]+ )+ const barConfig = useChartConfig<TimeSeriesBarChartConfig>(+ () => ({+ xAxis,+ yAxis: { tickFormatter: yAxisValueFormatter },+ ...AXIS_CHROME,+ showCrosshair: false,+ barCornerRadius: 1,+ bandPadding: 0.25,+ minBarSize: 2,+ margins: BAR_MARGINS,+ tooltip: { pinnable: false, hitArea: 'band', valueFormatter },+ }),+ [xAxis, yAxisValueFormatter, valueFormatter]+ )++ return (+ <div+ className={`flex ${OBSERVATION_CHART_HEIGHT_CLASS} w-full min-w-0 flex-col overflow-hidden`}+ data-attr="report-primary-metric-chart"+ data-chart-type={type}+ >+ {type === 'bar' ? (+ <TimeSeriesBarChart series={series} labels={points.labels} theme={theme} config={barConfig} />+ ) : (+ <TimeSeriesLineChart series={series} labels={points.labels} theme={theme} config={lineConfig} />+ )}+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportObservationValue.tsx b/products/signals/frontend/inbox/components/detail/ReportObservationValue.tsxnew file mode 100644index 000000000000..2273d7d6f459--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportObservationValue.tsx@@ -0,0 +1,27 @@+import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { formatReportMetricParts } from '../../utils/reportMetrics'++/** The observation's headline figure: a large mono number with its unit set small beside it. */+export function ReportObservationValue({+ metric,+ value,+}: {+ metric: ReportMetricApi+ value: number | null | undefined+}): JSX.Element {+ const parts = formatReportMetricParts(metric, value)++ if (!parts) {+ return <span className="text-2xl font-semibold leading-tight text-tertiary">Not available</span>+ }++ return (+ <div className="flex flex-wrap items-baseline gap-2.5">+ <span className="font-mono text-2xl font-semibold leading-tight tabular-nums text-primary">+ {parts.value}+ </span>+ {parts.unit ? <span className="font-mono text-xs text-secondary">{parts.unit}</span> : null}+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.test.tsx b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.test.tsxnew file mode 100644index 000000000000..16e168107cd7--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.test.tsx@@ -0,0 +1,226 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen, waitFor, within } from '@testing-library/react'++import { ensureJsdom, getHogChart } from '@posthog/quill-charts/testing'++import { useMocks } from '~/mocks/jest'+import { NodeKind } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'+import { BaseMathType, ChartDisplayType } from '~/types'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { ReportPrimaryMetric } from './ReportPrimaryMetric'++jest.mock('lib/components/TZLabel', () => ({+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,+}))++const query = {+ kind: NodeKind.InsightVizNode,+ source: {+ kind: NodeKind.TrendsQuery,+ dateRange: { date_from: '-7d', date_to: null },+ interval: 'day',+ series: [+ {+ kind: NodeKind.EventsNode,+ event: '$autocapture',+ name: '$autocapture',+ math: BaseMathType.UniqueUsers,+ },+ ],+ trendsFilter: { display: ChartDisplayType.ActionsBar },+ },+}++function makeMetric(overrides: Partial<ReportMetricApi> = {}): ReportMetricApi {+ return {+ metric_id: 'affected-users',+ title: 'Users affected',+ kind: 'affected_users',+ role: 'supporting',+ value: 9,+ value_at: '2026-08-29T12:00:00Z',+ value_format: 'count',+ unit: 'users',+ query,+ caption: null,+ ...overrides,+ }+}++function primaryMetricElement(container: HTMLElement): HTMLElement {+ const element = container.querySelector<HTMLElement>('[data-attr="report-primary-metric"]')+ if (!element) {+ throw new Error('Expected the primary metric to render')+ }+ return element+}++function trendsResponse(aggregatedValue: number, data: number[] = [4, 7]): Record<string, unknown> {+ return {+ result: [+ {+ label: 'Users affected',+ count: 7,+ data,+ days: ['2026-08-28', '2026-08-29'],+ labels: ['2026-08-28', '2026-08-29'],+ aggregated_value: aggregatedValue,+ },+ ],+ }+}++ensureJsdom()++describe('ReportPrimaryMetric', () => {+ beforeEach(() => initKeaTests())+ afterEach(() => {+ cleanup()+ jest.restoreAllMocks()+ })++ it('uses a whole-window total for the primary headline and buckets for its chart', async () => {+ const requestedDisplays: Array<string | undefined> = []+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': async ({ request }) => {+ const body = (await request.json()) as {+ query?: { trendsFilter?: { display?: string } }+ }+ requestedDisplays.push(body.query?.trendsFilter?.display)+ return [200, trendsResponse(42, [0, 1])]+ },+ },+ })++ const { container } = render(+ <ReportPrimaryMetric reportId="primary" metric={makeMetric({ role: 'primary' })} />+ )++ const observation = within(primaryMetricElement(container))+ expect(await observation.findByText('42')).toBeInTheDocument()+ expect(observation.getByText('users')).toBeInTheDocument()+ const chart = await waitFor(() => {+ const element = container.querySelector<HTMLElement>('[data-attr="report-primary-metric-chart"]')+ if (!element) {+ throw new Error('Expected the observation chart to render')+ }+ return element+ })+ expect(chart).toHaveAttribute('data-chart-type', 'bar')+ expect(getHogChart(chart).yTicks().filter(Boolean)).toEqual(['0', '1'])+ await waitFor(() =>+ expect(requestedDisplays).toEqual(+ expect.arrayContaining([ChartDisplayType.BoldNumber, ChartDisplayType.ActionsBar])+ )+ )+ expect(requestedDisplays).toHaveLength(2)+ })++ it('reads the live figure and names the window', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [200, trendsResponse(1248)],+ },+ })++ const { container } = render(+ <ReportPrimaryMetric reportId="live-meta" metric={makeMetric({ role: 'primary' })} />+ )++ const observation = within(primaryMetricElement(container))+ expect(await observation.findByText('1,248')).toBeInTheDocument()+ expect(observation.getByText('Last 7 days')).toBeInTheDocument()+ })++ it('keeps the saved value when a primary metric falls back after a failed refresh', async () => {+ jest.spyOn(console, 'error').mockImplementation()+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [500, { detail: 'Query failed' }],+ },+ })++ render(<ReportPrimaryMetric reportId="failed-primary" metric={makeMetric({ role: 'primary' })} />)++ expect(await screen.findByText(/Couldn't refresh this metric/)).toBeInTheDocument()+ expect(screen.getByText('9')).toBeInTheDocument()+ })++ it('falls back to the saved primary value when the live query returns no series', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [200, { result: [] }],+ },+ })++ render(<ReportPrimaryMetric reportId="empty-series-primary" metric={makeMetric({ role: 'primary' })} />)++ expect(+ await screen.findByText(/No value for this window\. Showing the latest saved value\./)+ ).toBeInTheDocument()+ expect(screen.getByText('9')).toBeInTheDocument()+ })++ it('shows the saved primary value without a load error when the query is omitted', () => {+ const { container } = render(+ <ReportPrimaryMetric reportId="omitted-primary" metric={makeMetric({ role: 'primary', query: null })} />+ )++ expect(screen.getByText('9')).toBeInTheDocument()+ expect(screen.getByText('users')).toBeInTheDocument()+ expect(screen.getByText(/Measured/)).toHaveTextContent('Measured 2026-08-29T12:00:00Z')+ expect(container.querySelector('[data-attr="report-primary-metric-chart"]')).toBeNull()+ expect(screen.queryByText(/Couldn't load the trend/)).not.toBeInTheDocument()+ expect(screen.queryByText(/Refresh the page to try again/)).not.toBeInTheDocument()+ })++ it('describes the count and names the window and filters behind it with a link to open the insight', () => {+ const filteredQuery = {+ ...query,+ source: { ...query.source, properties: [{ key: '$browser', value: 'Chrome', type: 'event' }] },+ }+ const { container } = render(+ <ReportPrimaryMetric+ reportId="source"+ metric={makeMetric({+ role: 'primary',+ query: filteredQuery,+ caption: 'Unique users on the captured exception.',+ })}+ />+ )++ expect(screen.getByText('Unique users on the captured exception.')).toBeInTheDocument()+ const source = container.querySelector('[data-attr="report-primary-metric-source"]')+ expect(source).toHaveTextContent('Last 7 days · 1 filter')+ const open = container.querySelector<HTMLAnchorElement>('[data-attr="report-primary-metric-open"]')+ expect(open).toHaveTextContent('Open insight')+ expect(open?.getAttribute('href')).toContain('/insights/new')+ })++ it('names no query when the viewer cannot see it', () => {+ const { container } = render(+ <ReportPrimaryMetric reportId="no-source" metric={makeMetric({ role: 'primary', query: null })} />+ )++ expect(container.querySelector('[data-attr="report-primary-metric-source"]')).toBeNull()+ })++ it('marks a primary metric as not available when its query and snapshot are both absent', () => {+ render(+ <ReportPrimaryMetric+ reportId="redacted-primary"+ metric={makeMetric({ role: 'primary', query: null, value: null })}+ />+ )++ expect(screen.getByText('Not available')).toBeInTheDocument()+ expect(screen.queryByText(/Couldn't load this metric's trend/)).not.toBeInTheDocument()+ expect(screen.queryByText(/Refresh the page to try again/)).not.toBeInTheDocument()+ })+})diff --git a/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.tsx b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.tsxnew file mode 100644index 000000000000..df4de8dd0f3b--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetric.tsx@@ -0,0 +1,43 @@+import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import {+ asReportMetricAggregateQuery,+ asReportMetricSeriesQuery,+ formatReportMetricValue,+} from '../../utils/reportMetrics'+import { measuredMetaSegments, ReportMetricMetaLine } from './ReportMetricMetaLine'+import { ReportObservationCard } from './ReportObservationCard'+import { ReportObservationValue } from './ReportObservationValue'+import { ReportPrimaryMetricQuery } from './ReportPrimaryMetricQuery'++export function ReportPrimaryMetric({ reportId, metric }: { reportId: string; metric: ReportMetricApi }): JSX.Element {+ const aggregateQuery = asReportMetricAggregateQuery(metric.query)+ const seriesQuery = asReportMetricSeriesQuery(metric)++ if (!aggregateQuery || !seriesQuery) {+ // No query means nothing ran: the list projection omits it during the detail fetch, and access+ // rules can redact it for a viewer. Show the saved snapshot or `Not available`, not a load+ // failure the reader cannot fix by refreshing. A live query that fails is handled downstream in+ // ReportPrimaryMetricQuery.+ const snapshot = formatReportMetricValue(metric, metric.value)+ const segments = snapshot ? measuredMetaSegments(metric) : []++ return (+ <ReportObservationCard metric={metric}>+ <div className="flex flex-col gap-1.5">+ <ReportObservationValue metric={metric} value={metric.value} />+ <ReportMetricMetaLine segments={segments} />+ </div>+ </ReportObservationCard>+ )+ }++ return (+ <ReportPrimaryMetricQuery+ reportId={reportId}+ metric={metric}+ aggregateQuery={aggregateQuery.source}+ seriesQuery={seriesQuery}+ />+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportPrimaryMetricQuery.tsx b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetricQuery.tsxnew file mode 100644index 000000000000..237e63903f29--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportPrimaryMetricQuery.tsx@@ -0,0 +1,108 @@+import { useValues } from 'kea'++import { LemonSkeleton } from '@posthog/lemon-ui'++import { Spinner } from 'lib/lemon-ui/Spinner'++import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'+import { InsightVizNode, TrendsQuery } from '~/queries/schema/schema-general'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import {+ formatReportMetricValue,+ reportMetricAggregate,+ reportMetricChartType,+ reportMetricSeriesPoints,+} from '../../utils/reportMetrics'+import { measuredMetaSegments, ReportMetricMetaLine } from './ReportMetricMetaLine'+import { ReportObservationCard } from './ReportObservationCard'+import { OBSERVATION_CHART_HEIGHT_CLASS, ReportObservationChart } from './ReportObservationChart'+import { ReportObservationValue } from './ReportObservationValue'++export function ReportPrimaryMetricQuery({+ reportId,+ metric,+ aggregateQuery,+ seriesQuery,+}: {+ reportId: string+ metric: ReportMetricApi+ aggregateQuery: TrendsQuery+ seriesQuery: InsightVizNode<TrendsQuery>+}): JSX.Element {+ const collectionId = `report-metrics-${reportId}`+ const aggregateProps: DataNodeLogicProps = {+ key: `ReportMetricAggregate.${reportId}.${metric.metric_id}`,+ query: aggregateQuery,+ dataNodeCollectionId: collectionId,+ autoLoad: true,+ }+ const seriesProps: DataNodeLogicProps = {+ key: `ReportMetricSeries.${reportId}.${metric.metric_id}`,+ query: seriesQuery.source,+ dataNodeCollectionId: collectionId,+ autoLoad: true,+ }+ const { response, responseError, responseLoading } = useValues(dataNodeLogic(aggregateProps))+ const {+ response: seriesResponse,+ responseError: seriesError,+ responseLoading: seriesLoading,+ } = useValues(dataNodeLogic(seriesProps))++ const aggregate = reportMetricAggregate(response)+ const hasAggregate = formatReportMetricValue(metric, aggregate) !== null+ const snapshot = formatReportMetricValue(metric, metric.value)+ const responseResolved = response !== null && response !== undefined+ const seriesResolved = seriesResponse !== null && seriesResponse !== undefined+ const points = seriesResolved ? reportMetricSeriesPoints(seriesResponse) : null++ const snapshotMeta = snapshot ? <ReportMetricMetaLine segments={measuredMetaSegments(metric)} /> : null++ return (+ <ReportObservationCard metric={metric}>+ <div className="flex min-h-8 flex-col gap-1">+ {responseLoading && !responseResolved ? (+ <div className="flex items-center gap-2 text-xs text-tertiary">+ <Spinner className="text-lg" />+ <span>Loading current value</span>+ </div>+ ) : responseError ? (+ <>+ {snapshot ? <ReportObservationValue metric={metric} value={metric.value} /> : null}+ <p className="m-0 text-xs text-tertiary">+ Couldn't refresh this metric.+ {snapshot ? ' Showing the latest saved value.' : null} Refresh the page to try again.+ </p>+ {snapshotMeta}+ </>+ ) : hasAggregate ? (+ <ReportObservationValue metric={metric} value={aggregate} />+ ) : snapshot ? (+ <>+ <ReportObservationValue metric={metric} value={metric.value} />+ <p className="m-0 text-xs text-tertiary">+ No value for this window. Showing the latest saved value.+ </p>+ {snapshotMeta}+ </>+ ) : (+ <span className="text-xs text-tertiary">No value for this window.</span>+ )}+ </div>+ {seriesLoading && !seriesResolved ? (+ <LemonSkeleton className={`${OBSERVATION_CHART_HEIGHT_CLASS} w-full`} />+ ) : seriesError ? (+ <p className="m-0 text-xs text-tertiary">Couldn't load the trend. Refresh the page to try again.</p>+ ) : points ? (+ <ReportObservationChart+ metric={metric}+ points={points}+ type={reportMetricChartType(metric)}+ interval={seriesQuery.source.interval}+ />+ ) : null}+ </ReportObservationCard>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsxindex 9d59d468568e..099f5b0ed6b0 100644--- a/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx@@ -1,4 +1,4 @@-import { ReactNode, useCallback, useMemo } from 'react'+import { Fragment, ReactNode, useCallback, useMemo } from 'react'import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'@@ -44,6 +44,11 @@ interface ReportSummaryBodyProps {* the body when the summary has no sections, so a report never hides that its fix already shipped.*/pullRequestNote?: ReactNode+ /**+ * The report's supporting metric tiles. Rendered at the top of the Impact section; a summary without one+ * gets an Impact section for them ahead of Solution, so the storyboard order holds.+ */+ impactMetrics?: ReactNode}/**@@ -55,9 +60,19 @@ export function ReportSummaryBody({chartPlacements,implementButton,pullRequestNote,+ impactMetrics,}: ReportSummaryBodyProps): JSX.Element {const parsed = useMemo(() => parseReportSummary(summary), [summary])const hasSolutionSection = parsed.sections.some((section) => section.kind === 'solution')+ const hasImpactSection = parsed.sections.some((section) => section.kind === 'impact')+ const solutionIndex = parsed.sections.findIndex((section) => section.kind === 'solution')+ const impactFallback =+ impactMetrics && !hasImpactSection ? (+ <section className="flex flex-col gap-2">+ <h2 className="m-0 text-lg font-semibold">Impact</h2>+ {impactMetrics}+ </section>+ ) : nullif (parsed.sections.length === 0) {return (@@ -67,6 +82,7 @@ export function ReportSummaryBody({sourceOffset={parsed.leadOffset}chartPlacements={chartPlacements}/>+ {impactFallback}{pullRequestNote}</div>)@@ -82,18 +98,27 @@ export function ReportSummaryBody({className="text-base text-primary leading-relaxed break-words [&>*+*]:mt-3.5"/>)}- {parsed.sections.map((section) => (- <section key={`${section.kind}-${section.bodyOffset}`} className="flex flex-col gap-2">- <h2 className="m-0 text-lg font-semibold">{section.heading}</h2>- <SummaryMarkdown- markdown={section.body}- sourceOffset={section.bodyOffset}- chartPlacements={chartPlacements}- />- {section.kind === 'solution' && pullRequestNote && <div className="mt-2">{pullRequestNote}</div>}- {section.kind === 'solution' && implementButton && <div className="mt-2">{implementButton}</div>}- </section>+ {parsed.sections.map((section, index) => (+ <Fragment key={`${section.kind}-${section.bodyOffset}`}>+ {index === solutionIndex && impactFallback}+ <section className="flex flex-col gap-2">+ <h2 className="m-0 text-lg font-semibold">{section.heading}</h2>+ {section.kind === 'impact' && impactMetrics && <div className="mb-1">{impactMetrics}</div>}+ <SummaryMarkdown+ markdown={section.body}+ sourceOffset={section.bodyOffset}+ chartPlacements={chartPlacements}+ />+ {section.kind === 'solution' && pullRequestNote && (+ <div className="mt-2">{pullRequestNote}</div>+ )}+ {section.kind === 'solution' && implementButton && (+ <div className="mt-2">{implementButton}</div>+ )}+ </section>+ </Fragment>))}+ {!hasSolutionSection && impactFallback}{!hasSolutionSection && pullRequestNote}</div>)diff --git a/products/signals/frontend/inbox/components/detail/ReportSupportingMetric.tsx b/products/signals/frontend/inbox/components/detail/ReportSupportingMetric.tsxnew file mode 100644index 000000000000..c2793299d29d--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportSupportingMetric.tsx@@ -0,0 +1,78 @@+import { TZLabel } from 'lib/components/TZLabel'+import { LemonCard } from 'lib/lemon-ui/LemonCard'+import { Spinner } from 'lib/lemon-ui/Spinner'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { formatReportMetricParts, reportMetricWindowLabel } from '../../utils/reportMetrics'++export interface ReportSupportingMetricLiveState {+ value: number | null+ loading: boolean+ error: boolean+}++/** One tile in the Impact grid: the figure first, then what it counts and any saved-value context. */+export function ReportSupportingMetric({+ metric,+ liveState,+}: {+ metric: ReportMetricApi+ liveState?: ReportSupportingMetricLiveState+}): JSX.Element {+ const liveParts = liveState ? formatReportMetricParts(metric, liveState.value) : null+ const snapshotParts = formatReportMetricParts(metric, metric.value)+ const parts = liveParts ?? snapshotParts+ const usingSnapshot = !liveParts && !!snapshotParts+ const windowLabel = reportMetricWindowLabel(metric.query) ?? 'Current window'++ return (+ <LemonCard+ hoverEffect={false}+ className="flex h-full min-w-0 flex-col gap-1 bg-surface-secondary p-3.5"+ data-attr="report-metric"+ >+ <div className="font-mono text-xl font-semibold leading-tight break-words tabular-nums text-primary">+ {parts ? (+ <>+ {parts.value}+ {parts.unit ? (+ <>+ {' '}+ <span className="text-xs font-normal text-secondary">{parts.unit}</span>+ </>+ ) : null}+ </>+ ) : (+ 'Not available'+ )}+ </div>+ <h3 className="m-0 text-[11px] font-normal leading-normal tracking-wide break-words text-secondary">+ {metric.title}+ </h3>+ {liveState?.loading ? (+ <p className="m-0 flex items-center gap-1 text-[11px] text-tertiary">+ {!snapshotParts ? <Spinner className="text-sm" /> : null}+ {snapshotParts ? 'Refreshing current value' : 'Loading current value'}+ </p>+ ) : liveState?.error ? (+ <p className="m-0 text-[11px] text-tertiary">+ Couldn't refresh this metric.{usingSnapshot ? ' Showing the latest saved value.' : null} Refresh the+ page to try again.+ </p>+ ) : liveState && liveParts ? (+ <span className="font-mono text-[11px] text-tertiary">{windowLabel}</span>+ ) : liveState ? (+ <p className="m-0 text-[11px] text-tertiary">+ No current value.{usingSnapshot ? ' Showing the latest saved value.' : null}+ </p>+ ) : null}+ {metric.value_at && (!liveState || usingSnapshot) ? (+ <span className="font-mono text-[11px] text-tertiary">+ Measured <TZLabel time={metric.value_at} />+ </span>+ ) : null}+ {metric.caption ? <p className="m-0 break-words text-[11px] text-tertiary">{metric.caption}</p> : null}+ </LemonCard>+ )+}diff --git a/products/signals/frontend/inbox/components/detail/ReportSupportingMetricQuery.tsx b/products/signals/frontend/inbox/components/detail/ReportSupportingMetricQuery.tsxnew file mode 100644index 000000000000..bed9e18e5ce8--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportSupportingMetricQuery.tsx@@ -0,0 +1,38 @@+import { useValues } from 'kea'++import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'+import { TrendsQuery } from '~/queries/schema/schema-general'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import { reportMetricAggregate } from '../../utils/reportMetrics'+import { ReportSupportingMetric } from './ReportSupportingMetric'++export function ReportSupportingMetricQuery({+ reportId,+ metric,+ query,+}: {+ reportId: string+ metric: ReportMetricApi+ query: TrendsQuery+}): JSX.Element {+ const dataNodeProps: DataNodeLogicProps = {+ key: `ReportMetric.${reportId}.${metric.metric_id}`,+ query,+ dataNodeCollectionId: `report-metrics-${reportId}`,+ autoLoad: true,+ }+ const { response, responseError, responseLoading } = useValues(dataNodeLogic(dataNodeProps))++ return (+ <ReportSupportingMetric+ metric={metric}+ liveState={{+ value: reportMetricAggregate(response),+ loading: responseLoading,+ error: !!responseError,+ }}+ />+ )+}diff --git a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsxindex 674f019d2f53..d19c01f7fa15 100644--- a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx+++ b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx@@ -16,7 +16,6 @@ function makeReport(id: string, overrides: Partial<SignalReport> = {}): SignalRestatus: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,created_at: '2026-06-11T10:00:00Z',diff --git a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsxindex c88634e0f034..68277fb97200 100644--- a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx+++ b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx@@ -82,7 +82,7 @@ const meta: Meta = {layout: 'fullscreen',viewMode: 'story',mockDate: '2026-06-11',- featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true },+ featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true, [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: true },testOptions: { waitForLoadersToDisappear: false },},}diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsxindex 1d0db13cb4db..0b4e98eb8fdb 100644--- a/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx@@ -69,7 +69,6 @@ function makeReport(id: string, status: SignalReportStatus): SignalReport {status,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',diff --git a/products/signals/frontend/inbox/inboxAnalytics.test.ts b/products/signals/frontend/inbox/inboxAnalytics.test.tsindex 06af1d7ee407..2c4dfd3f2306 100644--- a/products/signals/frontend/inbox/inboxAnalytics.test.ts+++ b/products/signals/frontend/inbox/inboxAnalytics.test.ts@@ -29,7 +29,6 @@ function makeReport(overrides: Partial<SignalReport> = {}): SignalReport {status: SignalReportStatus.READY,total_weight: 1,signal_count: 1,- relevant_user_count: null,created_at: '2026-06-20T00:00:00Z',updated_at: '2026-06-20T00:00:00Z',artefact_count: 0,diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.tsindex ea5dabdff766..7aaea1d211c6 100644--- a/products/signals/frontend/inbox/inboxSceneLogic.ts+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts@@ -22,7 +22,8 @@ import { Breadcrumb } from '~/types'import type { UserType } from '~/types'import { OriginProduct, Task, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'-import { signalsReportsViewedCreate } from 'products/signals/frontend/generated/api'+import { signalsReportsRefreshMetricsCreate, signalsReportsViewedCreate } from 'products/signals/frontend/generated/api'+import type { SignalReportMetricSnapshotsApi } from 'products/signals/frontend/generated/api.schemas'import {captureInboxReportClosed,@@ -52,6 +53,7 @@ import {import { mergeReportRows, selectedFlatListSections } from './utils/flatReportList'import { isInboxRedesignEnabled } from './utils/inboxRedesign'import { inboxTabRedirectPath } from './utils/inboxReportUrls'+import { isReportMetricsEnabled, mergeReportMetricSnapshots, reportNeedsMetricRefresh } from './utils/reportMetrics'import { decodeScoutCreateTemplate } from './utils/scoutTemplateDeepLink'// Newest-first scout runs to pull for the Runs panel. The scout-runs endpoint caps at 100 server-side.@@ -199,13 +201,19 @@ function clearScratchpadSearch(): void {}}-function findLoadedReport(id: string): SignalReport | null {- for (const sectionKey of Object.keys(INBOX_REPORT_SECTION_LIST_PARAMS) as InboxReportSectionKey[]) {+function mountedReportLists(): ReturnType<typeof reportListLogic.build>[] {+ return (Object.keys(INBOX_REPORT_SECTION_LIST_PARAMS) as InboxReportSectionKey[]).flatMap((sectionKey) => {const mounted = reportListLogic.findMounted({sectionKey,listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey],})- const found = mounted?.values.reports.find((r: SignalReport) => r.id === id)+ return mounted ? [mounted] : []+ })+}++function findLoadedReport(id: string): SignalReport | null {+ for (const mounted of mountedReportLists()) {+ const found = mounted.values.reports.find((r: SignalReport) => r.id === id)if (found) {return found}@@ -391,6 +399,9 @@ export interface inboxSceneLogicActions {variants: Record<string, boolean | string>} // featureFlagLogicloadSourceConfigs: () => any // signalSourcesLogic+ applySelectedReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => {+ snapshots: SignalReportMetricSnapshotsApi[]+ }loadRuns: (_payload: void) => voidloadRunsFailure: (error: string,@@ -427,6 +438,9 @@ export interface inboxSceneLogicActions {id: string}}+ refreshSelectedReportMetrics: (id: string) => {+ id: string+ }reportDetailScrolled: () => {value: true}@@ -520,6 +534,10 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([// Seed (or clear) the selected report synchronously from an already-loaded list row, so the// detail renders without a spinner while the authoritative fetch runs in the background.seedSelectedReport: (report: SignalReport | null) => ({ report }),+ // Ask the server for the newest snapshot of the open report's metrics. Best effort: a failure+ // leaves the saved snapshot in place, and the detail shows the live query result anyway.+ refreshSelectedReportMetrics: (id: string) => ({ id }),+ applySelectedReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => ({ snapshots }),setActiveTab: (tab: InboxTabKey) => ({ tab }),// Scout detail surface: selecting a scout opens its full-width detail over the list. An// optional finding id deep-links to one emitted finding within that scout (highlighted +@@ -630,6 +648,9 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([// dispatches `seedSelectedReport` in the same tick, so we never flash through a stale// report or a spinner when the row is already loaded. The loader repopulates it on fetch.seedSelectedReport: (_, { report }) => report,+ // Only the numbers change: the report keeps its prose and queries as loaded.+ applySelectedReportMetricSnapshots: (state, { snapshots }) =>+ state ? mergeReportMetricSnapshots(state, snapshots) : state,},selectedReportId: [null as string | null,@@ -920,6 +941,32 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([// scout from being auto-paused as ignored. The analytics event above stays the rich// record (rank, open method, dwell), so a failure here is swallowed.void signalsReportsViewedCreate(String(teamLogic.values.currentTeamId), report.id).catch(() => {})+ if (reportNeedsMetricRefresh(report, Date.now())) {+ actions.refreshSelectedReportMetrics(report.id)+ }+ },+ refreshSelectedReportMetrics: async ({ id }, breakpoint) => {+ if (!isReportMetricsEnabled(values.featureFlags)) {+ return+ }+ let response: Awaited<ReturnType<typeof signalsReportsRefreshMetricsCreate>>+ try {+ response = await signalsReportsRefreshMetricsCreate(String(teamLogic.values.currentTeamId), {+ report_ids: [id],+ })+ } catch {+ return+ }+ breakpoint()+ if (values.selectedReportId !== id) {+ return+ }+ const snapshots = [...response.reports]+ actions.applySelectedReportMetricSnapshots(snapshots)+ // The row for this report in every loaded list shows the same number.+ for (const mounted of mountedReportLists()) {+ mounted.actions.applyReportMetricSnapshots(snapshots)+ }},reportDetailScrolled: () => {// Fire the dwell signal once per open, on the first scroll. The metric's dwell branchdiff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.tsindex 636e0c0d2540..6a847ac8f86c 100644--- a/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts@@ -24,7 +24,6 @@ function makeReport(id: string): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',diff --git a/products/signals/frontend/inbox/logics/reportListLogic.test.ts b/products/signals/frontend/inbox/logics/reportListLogic.test.tsindex 0e1be5c2f2a6..825102ca7d28 100644--- a/products/signals/frontend/inbox/logics/reportListLogic.test.ts+++ b/products/signals/frontend/inbox/logics/reportListLogic.test.ts@@ -1,6 +1,9 @@/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */import { expectLogic } from 'kea-test-utils'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'@@ -15,6 +18,7 @@ import {import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic, shouldDefaultToEntireProject } from './reportListLogic'const REPORTS_URL = '/api/projects/:team_id/signals/reports/'+const REFRESH_METRICS_URL = '/api/projects/:team_id/signals/reports/refresh_metrics/'function makeReport(id: string): SignalReport {return {@@ -24,7 +28,6 @@ function makeReport(id: string): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',@@ -233,4 +236,95 @@ describe('reportListLogic', () => {expect(logic.values.livePrReportIds).toEqual(['1', '3', '5'])})})+ // Snapshots refresh on read, like error tracking counts: a loaded page sends the ids whose saved+ // number is missing or old, and the reply's numbers land on the rows without touching the prose.+ describe('metric snapshots', () => {+ const staleMetric = {+ metric_id: 'affected-users',+ title: 'Affected users',+ kind: 'affected_users' as const,+ role: 'primary' as const,+ value: 17,+ value_at: '2026-06-11T10:00:00Z',+ series: [3, 5, 9],+ value_format: 'count' as const,+ unit: 'users',+ }+ let requestedIds: string[][]+ let logic: ReturnType<typeof reportListLogic.build>++ beforeEach(async () => {+ requestedIds = []+ const stale = { ...makeReport('stale'), metrics: [staleMetric] }+ const fresh = {+ ...makeReport('fresh'),+ metrics: [{ ...staleMetric, value_at: new Date(Date.now() - 60_000).toISOString() }],+ }+ useMocks({+ get: {+ '/api/projects/:team_id/signals/reports/available_reviewers': {},+ [REPORTS_URL]: [+ 200,+ { count: 3, next: null, previous: null, results: [stale, fresh, makeReport('bare')] },+ ],+ },+ post: {+ [REFRESH_METRICS_URL]: async ({ request }) => {+ const body = (await request.json()) as { report_ids: string[] }+ requestedIds.push(body.report_ids)+ return [+ 200,+ {+ reports: [+ {+ id: 'stale',+ metrics: [+ {+ ...staleMetric,+ value: 21,+ value_at: '2026-06-12T10:00:00Z',+ series: [5, 9, 21],+ },+ ],+ },+ ],+ },+ ]+ },+ },+ })+ initKeaTests()+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.SIGNALS_REPORT_METRICS], {+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: true,+ })+ logic = reportListLogic({+ sectionKey: 'needs-decision',+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],+ })+ logic.mount()+ logic.actions.ensureLoaded()+ await expectLogic(logic).toFinishAllListeners()+ })++ afterEach(() => logic.unmount())++ it('sends only the stale rows and merges the refreshed numbers onto them', () => {+ expect(requestedIds).toEqual([['stale']])+ const byId = Object.fromEntries(logic.values.reports.map((report) => [report.id, report]))+ expect(byId.stale.metrics?.[0]).toMatchObject({ value: 21, series: [5, 9, 21] })+ expect(byId.stale.title).toBe('Report stale')+ expect(byId.fresh.metrics?.[0].value).toBe(17)+ })++ it('sends nothing while the metrics flag is off', async () => {+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.SIGNALS_REPORT_METRICS], {+ [FEATURE_FLAGS.SIGNALS_REPORT_METRICS]: false,+ })+ logic.actions.refreshReportMetrics(['stale'])+ await expectLogic(logic).toFinishAllListeners()++ expect(requestedIds).toEqual([['stale']])+ })+ })})diff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.tsindex b05cfc6b1873..cbe7fb9d81ff 100644--- a/products/signals/frontend/inbox/logics/reportListLogic.ts+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts@@ -7,10 +7,14 @@ import api, { CountedPaginatedResponse } from 'lib/api'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'import { derivePrState } from 'lib/signals/prState'+import { teamLogic } from 'scenes/teamLogic'import { userLogic } from 'scenes/userLogic'import type { UserType } from '~/types'+import { signalsReportsRefreshMetricsCreate } from 'products/signals/frontend/generated/api'+import type { SignalReportMetricSnapshotsApi } from 'products/signals/frontend/generated/api.schemas'+import { captureInboxReportAction, type InboxReportActionSurface } from '../inboxAnalytics'import {ACTIONABLE_ACTIONABILITY_VALUES,@@ -27,6 +31,7 @@ import {import type { SignalReportPriority } from '../types'import { DismissalFeedback, ResolveReasonValue, suppressDismissalPayload } from '../utils/dismissalReasons'import { isInboxRedesignEnabled } from '../utils/inboxRedesign'+import { isReportMetricsEnabled, mergeReportMetricSnapshots, reportNeedsMetricRefresh } from '../utils/reportMetrics'import { reportPullRequests, primaryReportPullRequest } from '../utils/reportPullRequests'import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'import { buildSignalReportListOrdering, inboxFiltersLogic } from './inboxFiltersLogic'@@ -34,6 +39,8 @@ import type { InboxFilterState, InboxSortDirection, InboxSortField } from './inbimport { prCiStatusLogic } from './prCiStatusLogic'const PAGE_SIZE = 50+// The refresh endpoint's own id cap per call.+const METRIC_REFRESH_PAGE_SIZE = 20/** Fixed, section-defining server filter (e.g. `{ has_implementation_pr: 'true' }`). */export type ReportListParams = Record<string, string>@@ -147,6 +154,7 @@ export interface reportListLogicValues {sortDirection: InboxSortDirection // inboxFiltersLogicsortField: InboxSortField // inboxFiltersLogicsourceProductFilter: string[] // inboxFiltersLogic+ currentTeamId: number | null // teamLogicuser: UserType | null // userLogiccount: number | nullcountLoading: boolean@@ -165,6 +173,7 @@ export interface reportListLogicValues {reportsLoadFailed: booleanreportsResponse: ReportListResponse | nullreportsResponseLoading: boolean+ staleMetricReportIds: string[]totalCount: number | null}@@ -211,6 +220,9 @@ export interface reportListLogicActions {reportIds: string[]source: string} // prCiStatusLogic+ applyReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => {+ snapshots: SignalReportMetricSnapshotsApi[]+ }dismissReport: (reportId: string,dismissal: DismissalFeedback@@ -272,6 +284,9 @@ export interface reportListLogicActions {refresh: () => {value: true}+ refreshReportMetrics: (reportIds: string[]) => {+ reportIds: string[]+ }removeReport: (reportId: string) => {reportId: string}@@ -310,6 +325,7 @@ export interface reportListLogicMeta {arg: any) => anyreports: (reportsResponse: ReportListResponse | null) => SignalReport[]+ staleMetricReportIds: (reports: SignalReport[]) => string[]hasMore: (reportsResponse: ReportListResponse | null) => booleanisLoaded: (reportsResponse: ReportListResponse | null) => booleanlivePrReportIds: (reports: SignalReport[]) => string[]@@ -362,6 +378,8 @@ export const reportListLogic = kea<reportListLogicType>([['user'],featureFlagLogic,['featureFlags'],+ teamLogic,+ ['currentTeamId'],],actions: [inboxFiltersLogic,@@ -390,6 +408,10 @@ export const reportListLogic = kea<reportListLogicType>([restoreReport: (reportId: string, surface: InboxReportActionSurface) => ({ reportId, surface }),removeReport: (reportId: string) => ({ reportId }),refresh: true,+ // Ask the server for the newest snapshot of the metrics these rows show. Best effort: a+ // failure leaves the rows on their saved snapshot.+ refreshReportMetrics: (reportIds: string[]) => ({ reportIds }),+ applyReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => ({ snapshots }),}),loaders(({ values }) => ({@@ -443,6 +465,11 @@ export const reportListLogic = kea<reportListLogicType>([reducers({reportsResponse: {+ // Only the numbers change: the row keeps its title, summary, and query as loaded.+ applyReportMetricSnapshots: (state, { snapshots }) =>+ state+ ? { ...state, results: state.results.map((r) => mergeReportMetricSnapshots(r, snapshots)) }+ : state,// Optimistic removal on archive – keeps the list snappy; count refreshes in the background.removeReport: (state, { reportId }) =>state@@ -537,6 +564,13 @@ export const reportListLogic = kea<reportListLogicType>([(s) => [s.reportsResponse],(reportsResponse: ReportListResponse | null): SignalReport[] => reportsResponse?.results ?? [],],+ // Rows whose metric snapshot is missing or older than the server's freshness window. Rows+ // refreshed on an earlier page are fresh, so a next-page load only sends the new ones.+ staleMetricReportIds: [+ (s) => [s.reports],+ (reports: SignalReport[]): string[] =>+ reports.filter((report) => reportNeedsMetricRefresh(report, Date.now())).map((report) => report.id),+ ],hasMore: [(s) => [s.reportsResponse],(reportsResponse: ReportListResponse | null): boolean =>@@ -594,8 +628,34 @@ export const reportListLogic = kea<reportListLogicType>([// Announce this section's open pull requests so their CI state is resolved in one batch. Both// loaders report: the first page and each appended page bring rows that need painting. An// empty announcement matters too, because it retires the rows a narrowed filter dropped.- loadReportsSuccess: () => actions.trackReports(props.sectionKey, values.livePrReportIds),- loadMoreReportsSuccess: () => actions.trackReports(props.sectionKey, values.livePrReportIds),+ loadReportsSuccess: () => {+ actions.trackReports(props.sectionKey, values.livePrReportIds)+ actions.refreshReportMetrics(values.staleMetricReportIds)+ },+ loadMoreReportsSuccess: () => {+ actions.trackReports(props.sectionKey, values.livePrReportIds)+ actions.refreshReportMetrics(values.staleMetricReportIds)+ },+ // One page of ids per request, sent one after the other so a page open never fans out into+ // parallel query bursts. A newer page load supersedes an in-flight refresh at the breakpoint.+ refreshReportMetrics: async ({ reportIds }, breakpoint) => {+ if (!isReportMetricsEnabled(values.featureFlags)) {+ return+ }+ for (let offset = 0; offset < reportIds.length; offset += METRIC_REFRESH_PAGE_SIZE) {+ const page = reportIds.slice(offset, offset + METRIC_REFRESH_PAGE_SIZE)+ let response: Awaited<ReturnType<typeof signalsReportsRefreshMetricsCreate>>+ try {+ response = await signalsReportsRefreshMetricsCreate(String(values.currentTeamId), {+ report_ids: page,+ })+ } catch {+ return+ }+ breakpoint()+ actions.applyReportMetricSnapshots([...response.reports])+ }+ },// First For-you count for the primary section: if the user has no reports suggested to// them, default to Entire project so they don't land on an empty inbox. Only when they haven't// picked a scope themselves, and only once the user's uuid has resolved (so the count isdiff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.tsindex 6ab7afa71b31..3ff9f8f4759a 100644--- a/products/signals/frontend/inbox/types.ts+++ b/products/signals/frontend/inbox/types.ts@@ -2,6 +2,7 @@ import type { UserBasicType } from '~/types'import {type ReportChartApi,+ type ReportMetricApi,type SignalReportPullRequestApi,type SignalReportAssigneeApi,type SignalReportAssignmentPrStateEnumApi,@@ -77,13 +78,13 @@ export interface SignalReport {status: SignalReportStatustotal_weight: numbersignal_count: number- relevant_user_count: number | nullcreated_at: stringupdated_at: stringartefact_count: numberis_suggested_reviewer: boolean/** Charts the report shows, placed by `[label](chart:<chart_id>)` links in the summary. */charts?: ReportChartApi[]+ metrics?: ReportMetricApi[]/** Prompts the report's author suggests sending about it (questions or next-step actions), offered above the "Ask AI" box. */suggested_prompts?: string[]/** Count of signals at the time the latest research run kicked off. */diff --git a/products/signals/frontend/inbox/utils/chartOpenTarget.test.ts b/products/signals/frontend/inbox/utils/chartOpenTarget.test.tsindex b482a417a372..2ce92d83bd4e 100644--- a/products/signals/frontend/inbox/utils/chartOpenTarget.test.ts+++ b/products/signals/frontend/inbox/utils/chartOpenTarget.test.ts@@ -9,6 +9,11 @@ describe('chartOpenTarget', () => {source: { kind: NodeKind.TrendsQuery, series: [] },} as unknown as Node+ const funnelChart = {+ kind: NodeKind.InsightVizNode,+ source: { kind: NodeKind.FunnelsQuery, series: [] },+ } as unknown as Node+const sqlChart = {kind: NodeKind.DataVisualizationNode,source: { kind: NodeKind.HogQLQuery, query: 'select 1' },@@ -43,7 +48,8 @@ describe('chartOpenTarget', () => {})it.each([- ['a trends chart', trendsChart, 'Open as new insight'],+ ['a trends chart', trendsChart, 'Open insight'],+ ['a funnel chart', funnelChart, 'Open insight'],['a SQL chart', sqlChart, 'Open in SQL editor'],])('labels %s by where it actually lands', (_name, query: Node, label: string) => {expect(chartOpenTarget(query)?.label).toBe(label)diff --git a/products/signals/frontend/inbox/utils/chartOpenTarget.ts b/products/signals/frontend/inbox/utils/chartOpenTarget.tsindex ebcc1a8a396c..51b0d5811788 100644--- a/products/signals/frontend/inbox/utils/chartOpenTarget.ts+++ b/products/signals/frontend/inbox/utils/chartOpenTarget.ts@@ -76,5 +76,5 @@ export function chartOpenTarget(query: Node): ChartOpenTarget | null {if (isDataVisualizationNode(query) && isHogQLQuery(query.source)) {return { url, label: 'Open in SQL editor' }}- return { url, label: 'Open as new insight' }+ return { url, label: 'Open insight' }}diff --git a/products/signals/frontend/inbox/utils/reportMetrics.test.ts b/products/signals/frontend/inbox/utils/reportMetrics.test.tsnew file mode 100644index 000000000000..fe3f78f92f8e--- /dev/null+++ b/products/signals/frontend/inbox/utils/reportMetrics.test.ts@@ -0,0 +1,353 @@+import { NodeKind } from '~/queries/schema/schema-general'+import { ChartDisplayType } from '~/types'++import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'++import {+ asReportMetricAggregateQuery,+ asReportMetricSeriesQuery,+ asReportMetricTrendsQuery,+ formatReportMetricParts,+ formatReportMetricValue,+ mergeReportMetricSnapshots,+ reportMetricAggregate,+ reportMetricChartType,+ reportNeedsMetricRefresh,+ reportMetricFilterCount,+ reportMetricRowParts,+ reportMetricSeriesPoints,+ reportMetricUnitWord,+ reportMetricWindowLabel,+ type ReportMetricInsightQuery,+} from './reportMetrics'++const NOW = Date.parse('2026-09-09T12:00:00Z')+const SNAPSHOT_METRIC: ReportMetricApi = {+ metric_id: 'affected-users',+ title: 'Affected users',+ kind: 'affected_users',+ role: 'primary',+ value: 17,+ value_at: '2026-09-09T11:30:00Z',+ series: [3, 5, 9],+ value_format: 'count',+ unit: 'users',+ query: { kind: 'InsightVizNode', source: { kind: 'TrendsQuery', series: [] } },+ caption: null,+}++describe('reportMetrics', () => {+ test.each([+ ['result response', { result: [{ aggregated_value: 0, data: [4, 7, 9] }] }, 0],+ ['results response', { results: [{ aggregated_value: 41, data: [20, 31] }] }, 41],+ ['missing aggregate', { results: [{ data: [20, 31] }] }, null],+ ['invalid aggregate', { results: [{ aggregated_value: Number.NaN }] }, null],+ ])('reads the whole-window aggregate from a %s', (_name, response, expected) => {+ expect(reportMetricAggregate(response)).toBe(expected)+ })++ test.each([+ ['zero count', { value_format: 'count', unit: 'users' } as const, 0, '0 users'],+ ['percentage points', { value_format: 'percentage', unit: null } as const, 34, '34%'],+ ['small percentage points', { value_format: 'percentage', unit: null } as const, 0.04, '0.04%'],+ ['scaled percentage', { value_format: 'percentage_scaled', unit: null } as const, 0.34, '34%'],+ ['small scaled percentage', { value_format: 'percentage_scaled', unit: null } as const, 0.0004, '0.04%'],+ ['milliseconds', { value_format: 'duration', unit: 'ms' } as const, 1250, '1.25s'],+ ['currency', { value_format: 'currency', unit: 'USD' } as const, 42.5, '$42.50'],+ ['small number', { value_format: 'number', unit: null } as const, 0.004, '0.004'],+ ['unavailable value', { value_format: 'number', unit: null } as const, null, null],+ ])('formats a %s metric', (_name, metric, value, expected) => {+ expect(formatReportMetricValue(metric, value)).toBe(expected)+ })++ test.each([+ [+ 'count with a unit',+ { value_format: 'count', unit: 'users' } as const,+ 1410,+ { value: '1,410', unit: 'users' },+ ],+ [+ 'percent unit folded in',+ { value_format: 'percentage', unit: '%' } as const,+ 34,+ { value: '34%', unit: null },+ ],+ [+ 'currency code folded in',+ { value_format: 'currency', unit: 'USD' } as const,+ 42.5,+ { value: '$42.50', unit: null },+ ],+ [+ 'milliseconds folded in',+ { value_format: 'duration', unit: 'ms' } as const,+ 1250,+ { value: '1.25s', unit: null },+ ],+ ])('splits a %s metric into a value and a separate unit', (_name, metric, value, expected) => {+ expect(formatReportMetricParts(metric, value)).toEqual(expected)+ })++ function trendsQuery(math: string, trendsFilter?: Record<string, unknown>): ReportMetricApi['query'] {+ return {+ kind: 'InsightVizNode',+ source: {+ kind: 'TrendsQuery',+ dateRange: { date_from: '-7d' },+ interval: 'day',+ series: [{ kind: 'EventsNode', event: '$autocapture', math }],+ ...(trendsFilter ? { trendsFilter } : {}),+ },+ }+ }++ // Buckets that add up draw as bars; buckets that are levels draw as a line.+ const chartTypeCases: [string, Pick<ReportMetricApi, 'value_format' | 'query'>, 'bar' | 'line'][] = [+ ['a count', { value_format: 'count', query: trendsQuery('dau') }, 'bar'],+ ['a percentage rate', { value_format: 'percentage', query: trendsQuery('total') }, 'line'],+ ['a scaled rate', { value_format: 'percentage_scaled', query: trendsQuery('total') }, 'line'],+ ['a duration', { value_format: 'duration', query: trendsQuery('avg') }, 'line'],+ ['a plain number', { value_format: 'number', query: trendsQuery('total') }, 'line'],+ ['summed revenue', { value_format: 'currency', query: trendsQuery('sum') }, 'bar'],+ ['average revenue', { value_format: 'currency', query: trendsQuery('avg') }, 'line'],+ ['revenue with no query', { value_format: 'currency', query: undefined }, 'line'],+ ]+ it.each(chartTypeCases)('draws %s as a %s strip', (_name, metric, expected) => {+ expect(reportMetricChartType(metric)).toBe(expected)+ })++ it.each([+ ['count', 'bar', ChartDisplayType.ActionsBar],+ ['percentage', 'line', ChartDisplayType.ActionsLineGraph],+ ] as const)(+ 'embeds a %s metric Trends query as a %s chart without changing its measurement',+ (valueFormat, _shape, display) => {+ const query = asReportMetricSeriesQuery({ value_format: valueFormat, query: trendsQuery('dau') })++ expect(query).toMatchObject({+ embedded: true,+ showFilters: false,+ source: {+ dateRange: { date_from: '-7d' },+ interval: 'day',+ series: [{ event: '$autocapture', math: 'dau' }],+ trendsFilter: { display },+ },+ })+ }+ )++ it('drops a stored percent-stack view and hidden series when deriving the chart', () => {+ const query = asReportMetricSeriesQuery({+ value_format: 'count',+ query: trendsQuery('dau', {+ display: ChartDisplayType.ActionsLineGraph,+ showPercentStackView: true,+ hiddenLegendIndexes: [0],+ }),+ })++ // A single-series metric chart must not percent-stack (every bucket would read 100%) or hide+ // its only series.+ expect(query?.source.trendsFilter).toMatchObject({+ display: ChartDisplayType.ActionsBar,+ showPercentStackView: false,+ })+ expect(query?.source.trendsFilter?.hiddenLegendIndexes).toBeUndefined()+ })++ it('derives a whole-window aggregate query without changing the stored measurement', () => {+ const storedQuery = {+ kind: 'InsightVizNode',+ source: {+ kind: 'TrendsQuery',+ dateRange: { date_from: '-7d' },+ interval: 'day',+ series: [{ kind: 'EventsNode', event: '$autocapture', math: 'dau' }],+ trendsFilter: { display: ChartDisplayType.ActionsLineGraph },+ },+ }++ expect(asReportMetricAggregateQuery(storedQuery)).toMatchObject({+ source: {+ dateRange: { date_from: '-7d' },+ interval: 'day',+ series: [{ event: '$autocapture', math: 'dau' }],+ trendsFilter: { display: ChartDisplayType.BoldNumber },+ },+ })+ expect(storedQuery.source.trendsFilter.display).toBe(ChartDisplayType.ActionsLineGraph)+ })++ it('keeps a supporting metric query unchanged when validating it', () => {+ const query = {+ kind: 'InsightVizNode',+ source: {+ kind: 'TrendsQuery',+ dateRange: { date_from: '-7d' },+ series: [{ kind: 'EventsNode', event: '$autocapture', math: 'dau' }],+ trendsFilter: { display: 'ActionsLineGraph' },+ },+ }++ expect(asReportMetricTrendsQuery(query)).toBe(query)+ })++ test.each([+ ['an authored word', { kind: 'occurrences', unit: 'clicks', value_format: 'count' } as const, 'clicks'],+ [+ 'a percent sign on an error rate',+ { kind: 'error_rate', unit: '%', value_format: 'percentage' } as const,+ 'failure',+ ],+ [+ 'a percent sign on a scaled conversion rate',+ { kind: 'conversion_rate', unit: '%', value_format: 'percentage_scaled' } as const,+ 'conversion',+ ],+ ['a seconds suffix', { kind: 'duration', unit: 's', value_format: 'duration' } as const, 'seconds'],+ ['a milliseconds suffix', { kind: 'duration', unit: 'ms', value_format: 'duration' } as const, 'ms'],+ ['a currency code', { kind: 'revenue', unit: 'USD', value_format: 'currency' } as const, 'revenue'],+ ['no unit on a custom metric', { kind: 'custom', unit: null, value_format: 'number' } as const, ''],+ ['a whitespace-only unit', { kind: 'affected_users', unit: ' ', value_format: 'count' } as const, 'users'],+ ])('names the row unit from %s', (_name, metric, expected) => {+ expect(reportMetricUnitWord(metric)).toBe(expected)+ })++ test.each([+ [+ 'a count',+ { kind: 'occurrences', unit: null, value_format: 'count' } as const,+ 3758,+ { value: '3,758', unit: 'events' },+ ],+ [+ 'percentage points',+ { kind: 'error_rate', unit: '%', value_format: 'percentage' } as const,+ 40,+ { value: '40%', unit: 'failure' },+ ],+ [+ 'a scaled percentage',+ { kind: 'conversion_rate', unit: null, value_format: 'percentage_scaled' } as const,+ 0.051,+ { value: '5.1%', unit: 'conversion' },+ ],+ [+ 'a duration in seconds',+ { kind: 'duration', unit: 's', value_format: 'duration' } as const,+ 287,+ { value: '287', unit: 'seconds' },+ ],+ [+ 'a currency amount',+ { kind: 'revenue', unit: 'USD', value_format: 'currency' } as const,+ 1200,+ { value: '$1,200.00', unit: 'revenue' },+ ],+ [+ 'a plain number',+ { kind: 'affected_users', unit: null, value_format: 'number' } as const,+ 4.2,+ { value: '4.2', unit: 'users' },+ ],+ ['an unavailable value', { kind: 'affected_users', unit: null, value_format: 'count' } as const, null, null],+ ['an unusable value', { kind: 'affected_users', unit: null, value_format: 'count' } as const, Number.NaN, null],+ ])('stacks %s over its unit word', (_name, metric, value, expected) => {+ expect(reportMetricRowParts(metric, value)).toEqual(expected)+ })++ test.each([+ ['-14d', { source: { dateRange: { date_from: '-14d' } } }, 'Last 14 days'],+ ['-24h', { source: { dateRange: { date_from: '-24h' } } }, 'Last 24 hours'],+ ['-1d', { source: { dateRange: { date_from: '-1d' } } }, 'Last day'],+ ['-4w', { source: { dateRange: { date_from: '-4w' } } }, 'Last 4 weeks'],+ ['-1m', { source: { dateRange: { date_from: '-1m' } } }, 'Last month'],+ ['-2y', { source: { dateRange: { date_from: '-2y' } } }, 'Last 2 years'],+ ['a query with no date range', { source: { interval: 'day' } }, null],+ ['an absolute date', { source: { dateRange: { date_from: '2026-01-01' } } }, null],+ ['a missing query', undefined, null],+ ])('labels the live window of %s', (_name, query, expected) => {+ expect(reportMetricWindowLabel(query)).toBe(expected)+ })++ describe('reportMetricSeriesPoints', () => {+ const bucket = { days: ['2026-09-07', '2026-09-08', '2026-09-09'], data: [3, null, 9] }++ it.each([+ ['a `results` envelope', { results: [bucket] }, { labels: bucket.days, values: [3, NaN, 9] }],+ ['a `result` envelope', { result: [bucket] }, { labels: bucket.days, values: [3, NaN, 9] }],+ ['no series', { results: [] }, null],+ ['a series without days', { results: [{ data: [1, 2] }] }, null],+ [+ 'more days than values',+ { results: [{ days: ['2026-09-08', '2026-09-09'], data: [4] }] },+ { labels: ['2026-09-08'], values: [4] },+ ],+ ])('reads the first series buckets from %s', (_name, response, expected) => {+ expect(reportMetricSeriesPoints(response)).toEqual(expected)+ })+ })++ describe('reportMetricFilterCount', () => {+ const series = (properties?: unknown): Record<string, unknown> => ({+ kind: NodeKind.EventsNode,+ event: '$pageview',+ ...(properties === undefined ? {} : { properties }),+ })+ const trends = (source: Record<string, unknown>): ReportMetricInsightQuery =>+ ({ kind: NodeKind.InsightVizNode, source: { kind: NodeKind.TrendsQuery, ...source } }) as never++ it.each([+ ['no filters', trends({ series: [series()] }), 0],+ ['series filters', trends({ series: [series([{ key: 'a' }, { key: 'b' }]), series([{ key: 'c' }])] }), 3],+ [+ 'a property group on the query',+ trends({+ series: [series()],+ properties: { type: 'AND', values: [{ type: 'OR', values: [{ key: 'a' }, { key: 'b' }] }] },+ }),+ 2,+ ],+ ])('counts %s', (_label, query, expected) => {+ expect(reportMetricFilterCount(query)).toBe(expected)+ })+ })+ test.each([+ ['no metrics', {}, false],+ ['fresh snapshot', { metrics: [{ ...SNAPSHOT_METRIC, value_at: '2026-09-09T11:50:00Z' }] }, false],+ ['stale snapshot', { metrics: [SNAPSHOT_METRIC] }, true],+ ['no snapshot', { metrics: [{ ...SNAPSHOT_METRIC, value: null, value_at: null }] }, true],+ ])('asks for a refresh when a report has %s', (_name, report, expected) => {+ expect(reportNeedsMetricRefresh(report as { metrics?: ReportMetricApi[] }, NOW)).toBe(expected)+ })++ it('merges refreshed numbers by metric_id and keeps the query', () => {+ const report = { id: 'r1', metrics: [{ ...SNAPSHOT_METRIC }] }+ const merged = mergeReportMetricSnapshots(report, [+ {+ id: 'r1',+ metrics: [+ {+ ...SNAPSHOT_METRIC,+ value: 21,+ value_at: '2026-09-09T12:00:00Z',+ series: [5, 9, 21],+ },+ ],+ },+ ])++ expect(merged).not.toBe(report)+ expect(merged.metrics[0]).toMatchObject({+ value: 21,+ value_at: '2026-09-09T12:00:00Z',+ series: [5, 9, 21],+ query: SNAPSHOT_METRIC.query,+ })+ // The same numbers back, or another report's snapshot, leave the row object untouched.+ expect(mergeReportMetricSnapshots(report, [{ id: 'r1', metrics: [SNAPSHOT_METRIC] }])).toBe(report)+ expect(mergeReportMetricSnapshots(report, [{ id: 'other', metrics: [] }])).toBe(report)+ })+})diff --git a/products/signals/frontend/inbox/utils/reportMetrics.ts b/products/signals/frontend/inbox/utils/reportMetrics.tsnew file mode 100644index 000000000000..7452c0e60ad7--- /dev/null+++ b/products/signals/frontend/inbox/utils/reportMetrics.ts@@ -0,0 +1,443 @@+import { FEATURE_FLAGS } from 'lib/constants'+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'+import { formatCurrency } from 'lib/utils/currency'+import { formatDurationMilliseconds, humanFriendlyDuration } from 'lib/utils/durations'+import { humanFriendlyNumber, percentage, significantDecimalPlaces } from 'lib/utils/numbers'++import { CurrencyCode, InsightVizNode, Node, NodeKind, TrendsQuery } from '~/queries/schema/schema-general'+import { isInsightVizNode, isTrendsQuery } from '~/queries/utils'+import { ChartDisplayType, PropertyMathType } from '~/types'++import type { ReportMetricApi, SignalReportMetricSnapshotsApi } from 'products/signals/frontend/generated/api.schemas'++export type ReportMetricInsightQuery = InsightVizNode & { source: TrendsQuery }+type ReportMetricFormatting = Pick<ReportMetricApi, 'unit' | 'value_format'>+export type ReportMetricChartType = 'bar' | 'line'++function finiteNumber(value: unknown): number | null {+ return typeof value === 'number' && Number.isFinite(value) ? value : null+}++function isString(value: unknown): value is string {+ return typeof value === 'string'+}++function firstTrendsSeries(response: unknown): Record<string, unknown> | null {+ if (!response || typeof response !== 'object') {+ return null+ }++ const wrappedResponse = response as { result?: unknown; results?: unknown }+ const series = Array.isArray(wrappedResponse.result)+ ? wrappedResponse.result+ : Array.isArray(wrappedResponse.results)+ ? wrappedResponse.results+ : null+ const firstSeries = series?.[0]++ return firstSeries && typeof firstSeries === 'object' ? (firstSeries as Record<string, unknown>) : null+}++export function reportMetricAggregate(response: unknown): number | null {+ return finiteNumber(firstTrendsSeries(response)?.aggregated_value)+}++export interface ReportMetricSeriesPoints {+ /** ISO bucket starts, aligned with `values`. */+ labels: string[]+ /** One value per bucket, `NaN` where the bucket has no number. */+ values: number[]+}++export function reportMetricSeriesPoints(response: unknown): ReportMetricSeriesPoints | null {+ const firstSeries = firstTrendsSeries(response)+ const days = firstSeries?.days+ const data = firstSeries?.data+ if (!Array.isArray(days) || !Array.isArray(data)) {+ return null+ }++ const labels = days.filter(isString)+ const length = Math.min(labels.length, data.length)+ if (length === 0) {+ return null+ }++ return {+ labels: labels.slice(0, length),+ values: data.slice(0, length).map((value) => finiteNumber(value) ?? NaN),+ }+}++function withUnit(value: string, unit: string | null): string {+ return unit ? `${value} ${unit}` : value+}++function isCurrencyCode(unit: string | null): unit is CurrencyCode {+ return !!unit && Object.values(CurrencyCode).includes(unit as CurrencyCode)+}++export interface ReportMetricValueParts {+ value: string+ /** Suffix to show beside the value; null when the format already carries it (%, duration, currency). */+ unit: string | null+}++export function formatReportMetricParts(+ metric: ReportMetricFormatting,+ value: number | null | undefined+): ReportMetricValueParts | null {+ if (value === null || value === undefined || !Number.isFinite(value)) {+ return null+ }++ const valueFormat = metric.value_format ?? 'number'+ const unit = metric.unit ?? null++ switch (valueFormat) {+ case 'count':+ return { value: humanFriendlyNumber(value, 0), unit }+ // Percentage and unbounded number values take decimal places from their magnitude, like the+ // insight chart axis (aggregationAxisFormat), so a small non-zero rate or number does not+ // round to `0%` or `0` and read as no impact.+ case 'percentage':+ return { value: percentage(value / 100, significantDecimalPlaces(value)), unit: unit === '%' ? null : unit }+ case 'percentage_scaled':+ return {+ value: percentage(value, significantDecimalPlaces(value * 100)),+ unit: unit === '%' ? null : unit,+ }+ case 'duration':+ if (unit === 'ms') {+ return { value: formatDurationMilliseconds(value), unit: null }+ }+ if (unit === 's') {+ return { value: humanFriendlyDuration(value, { maxUnits: 2, secondsPrecision: 3 }), unit: null }+ }+ return { value: humanFriendlyNumber(value, significantDecimalPlaces(value)), unit }+ case 'currency':+ return isCurrencyCode(unit)+ ? { value: formatCurrency(value, unit), unit: null }+ : { value: humanFriendlyNumber(value, 2), unit }+ case 'number':+ return { value: humanFriendlyNumber(value, significantDecimalPlaces(value)), unit }+ }+}++export function formatReportMetricValue(+ metric: ReportMetricFormatting,+ value: number | null | undefined+): string | null {+ const parts = formatReportMetricParts(metric, value)+ return parts ? withUnit(parts.value, parts.unit) : null+}++export function asReportMetricTrendsQuery(query: unknown): ReportMetricInsightQuery | null {+ if (!query || typeof query !== 'object' || !isInsightVizNode(query as Node)) {+ return null+ }++ const insightQuery = query as InsightVizNode+ if (!isTrendsQuery(insightQuery.source)) {+ return null+ }++ return insightQuery as ReportMetricInsightQuery+}++function seriesMathValues(query: unknown): string[] {+ const source = asReportMetricTrendsQuery(query)?.source+ return source?.series.map((series) => (series as { math?: unknown }).math).filter(isString) ?? []+}++/**+ * Bars for a metric whose buckets add up: a count of events, sessions, or people, or revenue summed per+ * bucket. A line for a metric whose bucket value is a level: a rate, a duration, an average, or revenue+ * that is not a sum. Bars invite the reader to add the buckets up and compare their heights against+ * zero, which misreads a rate that sits between 35% and 45% as fourteen near-full bars.+ */+export function reportMetricChartType(metric: Pick<ReportMetricApi, 'value_format' | 'query'>): ReportMetricChartType {+ const valueFormat = metric.value_format ?? 'number'+ if (valueFormat === 'count') {+ return 'bar'+ }+ if (valueFormat === 'currency') {+ const maths = seriesMathValues(metric.query)+ return maths.length > 0 && maths.every((math) => math === PropertyMathType.Sum) ? 'bar' : 'line'+ }+ return 'line'+}++export function asReportMetricSeriesQuery(+ metric: Pick<ReportMetricApi, 'value_format' | 'query'>+): ReportMetricInsightQuery | null {+ const insightQuery = asReportMetricTrendsQuery(metric.query)+ if (!insightQuery) {+ return null+ }++ const source: TrendsQuery = {+ ...insightQuery.source,+ kind: NodeKind.TrendsQuery,+ trendsFilter: {+ ...insightQuery.source.trendsFilter,+ display:+ reportMetricChartType(metric) === 'bar'+ ? ChartDisplayType.ActionsBar+ : ChartDisplayType.ActionsLineGraph,+ // A report metric renders a single series, so a stored percent-stack view would normalize+ // every bucket to 100% and a hidden-legend index could blank the only series. Drop both+ // display leftovers before deriving the longitudinal chart.+ showPercentStackView: false,+ hiddenLegendIndexes: undefined,+ },+ }++ return {+ ...insightQuery,+ kind: NodeKind.InsightVizNode,+ source,+ full: false,+ showFilters: false,+ showHeader: false,+ showTable: false,+ showCorrelationTable: false,+ showResults: true,+ embedded: true,+ }+}++export function asReportMetricAggregateQuery(query: unknown): ReportMetricInsightQuery | null {+ const insightQuery = asReportMetricTrendsQuery(query)+ if (!insightQuery) {+ return null+ }++ const source: TrendsQuery = {+ ...insightQuery.source,+ kind: NodeKind.TrendsQuery,+ trendsFilter: {+ ...insightQuery.source.trendsFilter,+ // Time-series Trends responses intentionally expose interval buckets only. A total-value+ // display makes the backend aggregate over the whole date range, which is essential for+ // distinct-user metrics where summing the buckets would count returning people twice.+ display: ChartDisplayType.BoldNumber,+ },+ }++ return {+ ...insightQuery,+ kind: NodeKind.InsightVizNode,+ source,+ full: false,+ showFilters: false,+ showHeader: false,+ showTable: false,+ showCorrelationTable: false,+ showResults: true,+ embedded: true,+ }+}++function unitCarriesFormat(unit: string, valueFormat: NonNullable<ReportMetricApi['value_format']>): boolean {+ switch (valueFormat) {+ case 'percentage':+ case 'percentage_scaled':+ return unit === '%'+ case 'duration':+ return unit === 'ms' || unit === 's'+ case 'currency':+ return isCurrencyCode(unit)+ default:+ return false+ }+}++/** The one word an inbox row shows under the figure, such as `users`, `events`, or `seconds`. */+export function reportMetricUnitWord(metric: Pick<ReportMetricApi, 'kind' | 'unit' | 'value_format'>): string {+ const unit = metric.unit?.trim() ?? ''++ // An authored unit wins, except when the value format already renders it (a `%` sign, a duration+ // suffix, a currency symbol). Repeating it below the figure would read as `34% / %`.+ if (unit && !unitCarriesFormat(unit, metric.value_format ?? 'number')) {+ return unit+ }++ switch (metric.kind) {+ case 'affected_users':+ return 'users'+ case 'affected_sessions':+ return 'sessions'+ case 'occurrences':+ return 'events'+ case 'error_rate':+ return 'failure'+ case 'conversion_rate':+ return 'conversion'+ case 'duration':+ if (unit === 's') {+ return 'seconds'+ }+ if (unit === 'ms') {+ return 'ms'+ }+ return ''+ case 'revenue':+ return 'revenue'+ case 'custom':+ return ''+ }+}++export function reportMetricRowParts(+ metric: Pick<ReportMetricApi, 'kind' | 'unit' | 'value_format'>,+ value: number | null | undefined+): { value: string; unit: string } | null {+ const numericValue = finiteNumber(value)+ if (numericValue === null) {+ return null+ }++ const unit = reportMetricUnitWord(metric)+ const valueFormat = metric.value_format ?? 'number'++ switch (valueFormat) {+ case 'count':+ return { value: humanFriendlyNumber(numericValue, 0), unit }+ case 'percentage':+ return { value: percentage(numericValue / 100, significantDecimalPlaces(numericValue)), unit }+ case 'percentage_scaled':+ return { value: percentage(numericValue, significantDecimalPlaces(numericValue * 100)), unit }+ // The row stacks the unit word under the figure, so a duration stays a plain number in its own+ // unit. A composed `4m 47s` would collide with the `seconds` word below it.+ case 'duration':+ return { value: humanFriendlyNumber(numericValue, significantDecimalPlaces(numericValue)), unit }+ case 'currency': {+ const currency = metric.unit?.trim() ?? null+ return isCurrencyCode(currency)+ ? { value: formatCurrency(numericValue, currency), unit }+ : { value: humanFriendlyNumber(numericValue, 2), unit }+ }+ case 'number':+ return { value: humanFriendlyNumber(numericValue, significantDecimalPlaces(numericValue)), unit }+ }+}++const RELATIVE_WINDOW_RE = /^-(\d+)(h|d|w|m|y)$/+const RELATIVE_WINDOW_NOUNS: Record<string, string> = {+ h: 'hour',+ d: 'day',+ w: 'week',+ m: 'month',+ y: 'year',+}++/** Label the live query's relative window, such as `Last 14 days`. Null when it is not relative. */+export function reportMetricWindowLabel(query: unknown): string | null {+ if (!query || typeof query !== 'object') {+ return null+ }+ const source = (query as { source?: unknown }).source+ if (!source || typeof source !== 'object') {+ return null+ }+ const dateRange = (source as { dateRange?: unknown }).dateRange+ if (!dateRange || typeof dateRange !== 'object') {+ return null+ }++ const dateFrom = (dateRange as { date_from?: unknown }).date_from+ const match = typeof dateFrom === 'string' ? RELATIVE_WINDOW_RE.exec(dateFrom) : null+ if (!match) {+ return null+ }++ const amount = Number(match[1])+ const noun = RELATIVE_WINDOW_NOUNS[match[2]]+ return amount === 1 ? `Last ${noun}` : `Last ${amount} ${noun}s`+}++function countPropertyFilters(properties: unknown): number {+ if (Array.isArray(properties)) {+ return properties.reduce<number>((count, item) => count + countPropertyFilters(item), 0)+ }+ if (!properties || typeof properties !== 'object') {+ return 0+ }+ // A property group nests its filters under `values`; a leaf filter is the one with a `key`.+ const node = properties as { values?: unknown; key?: unknown }+ if (Array.isArray(node.values)) {+ return countPropertyFilters(node.values)+ }+ return typeof node.key === 'string' ? 1 : 0+}++/** How many property filters narrow the query, across its series and the query itself. */+export function reportMetricFilterCount(query: ReportMetricInsightQuery): number {+ const seriesFilters = query.source.series.reduce<number>(+ (count, series) => count + countPropertyFilters((series as { properties?: unknown }).properties),+ 0+ )+ return seriesFilters + countPropertyFilters(query.source.properties)+}++/**+ * Whether inbox report rows and the report detail show live impact metrics, and whether the client+ * asks the server to refresh their snapshots. One reader for every logic, so the flag key is+ * written once. Components read the same flag through `useFeatureFlag('SIGNALS_REPORT_METRICS')`.+ */+export function isReportMetricsEnabled(featureFlags: FeatureFlagsSet): boolean {+ return !!featureFlags[FEATURE_FLAGS.SIGNALS_REPORT_METRICS]+}++/** The server serves a snapshot measured inside this window as is, so the request is not worth sending. */+export const REPORT_METRIC_SNAPSHOT_FRESH_FOR_MS = 15 * 60 * 1000++/** Whether any metric on the report has no snapshot, or one older than the freshness window. */+export function reportNeedsMetricRefresh(report: { metrics?: ReportMetricApi[] }, now: number): boolean {+ return (report.metrics ?? []).some((metric) => {+ if (metric.value === null || metric.value === undefined || !metric.value_at) {+ return true+ }+ const measuredAt = Date.parse(metric.value_at)+ return !Number.isFinite(measuredAt) || now - measuredAt >= REPORT_METRIC_SNAPSHOT_FRESH_FOR_MS+ })+}++function sameSeries(a: number[] | null | undefined, b: number[] | null | undefined): boolean {+ if (!a || !b) {+ return !a === !b+ }+ return a.length === b.length && a.every((point, index) => point === b[index])+}++/**+ * Copy refreshed `value`, `value_at`, and `series` onto the report's metrics by metric_id. The+ * query stays as loaded. Returns the same report object when nothing changed, so a memoized row+ * does not re-render for a refresh that measured the same number.+ */+export function mergeReportMetricSnapshots<T extends { id: string; metrics?: ReportMetricApi[] }>(+ report: T,+ snapshots: readonly SignalReportMetricSnapshotsApi[]+): T {+ const refreshed = snapshots.find((snapshot) => snapshot.id === report.id)+ if (!refreshed || !report.metrics?.length) {+ return report+ }+ const byId = new Map(refreshed.metrics.map((metric) => [metric.metric_id, metric]))+ let changed = false+ const metrics = report.metrics.map((metric) => {+ const snapshot = byId.get(metric.metric_id)+ if (+ !snapshot ||+ (snapshot.value === metric.value &&+ snapshot.value_at === metric.value_at &&+ sameSeries(snapshot.series, metric.series))+ ) {+ return metric+ }+ changed = true+ return { ...metric, value: snapshot.value, value_at: snapshot.value_at, series: snapshot.series }+ })+ return changed ? { ...report, metrics } : report+}diff --git a/products/signals/frontend/inbox/utils/reportOrdering.test.ts b/products/signals/frontend/inbox/utils/reportOrdering.test.tsindex 259fe28da5da..6ee0ab36da96 100644--- a/products/signals/frontend/inbox/utils/reportOrdering.test.ts+++ b/products/signals/frontend/inbox/utils/reportOrdering.test.ts@@ -9,7 +9,6 @@ function report(id: string, overrides: Partial<SignalReport>): SignalReport {status: SignalReportStatus.READY,total_weight: 0,signal_count: 1,- relevant_user_count: null,artefact_count: 0,is_suggested_reviewer: false,priority: 'P2',