Skip to content

: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.

feat(eng-analytics): name the repository in the title, one switcher (#115532)

Julian Beze18e9b67a0e2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index f56e8d9ec64b..0e545dd64a5c 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -10111,33 +10111,33 @@ snapshots:
scenes-app-discussions--threads--light:
hash: v1.k794b7964.28ac830bf83be5cbb6d7a397d67c9b9c61711904a822de38402b82220b0f7a49.7wENY7hvo1-qAJwq5fcsvKGJsfRAF_vDkpnM8iqFZcc
scenes-app-engineering-analytics-author--author--dark:
- hash: v1.k794b7964.94843c0a69e5003d66026b75cc9c10c151375f639da48a64f7cf91247a3b8f14.Hgttx9kcZ3ObLfprwLMFS6TiLVsIJ22TfNpEnNjlnvo
+ hash: v1.k794b7964.ff5169311ed640229e7e4e791015b800eabcc548e48091a7d28013f7fed6942a.dyMcBSZUAemOPks-dEn2DkyVxKIW9MT67sr4dyB8GnY
scenes-app-engineering-analytics-author--author--light:
- hash: v1.k794b7964.444a9ecb15101f5165d9b18aa01c66baf0f921d5201d471f28648efb6b4c532c.lTmfkqJuvx0jP2W2sbfFu04HuO_bzCL0NHi7How_M88
+ hash: v1.k794b7964.88918e729db00cea8ce5a81784041733534cfd94018f4450d0052db7c60950f6.-yOQH5JoksSXNfNYpuPCXZbyTsZIdroyfc-sTntDTRg
scenes-app-engineering-analytics-author--author-narrow--dark:
- hash: v1.k794b7964.76aa3e24e92358988de45bda84c5ffafaaf65a49219fb19368419cf1d2694d52.3S2BhVPHN7CdplDfDVcq_uEwGFQHup3a3295mXiwavs
+ hash: v1.k794b7964.df060d92c6cab950e3b3fc5f7ab4d13dc2846123b28dad4e164f6fbb5fb7c92b.Y0vhsOnMEUjdmInZk6CuQL8f1oKhz7MggwdMTb7lGlY
scenes-app-engineering-analytics-author--author-narrow--light:
- hash: v1.k794b7964.3bd500e42cd2d5b4a866a8ac44476819ac19d424b1824d547803d03b41266eb7.e01uryY0yYNw3FxEch4-IgL-kFfBZlxYG2MW-KZq4VE
+ hash: v1.k794b7964.639e89c10fa4136652e034476578d99e7fe5635eef3a72161d06c591853b47bb.-2mZovTXpLb8aly4meNx7O4aRKKnRsaOpMKYFYZ2C6Y
scenes-app-engineering-analytics-author--author-without-reviews-or-deploys--dark:
- hash: v1.k794b7964.d866f278ac6f10ab1c02bfd118aebeba489beae23a3e924712539e80aab71622.AD_zrOifVoF3YyTFK7B9g5NKM6BUH7ipLTyETIxX75E
+ hash: v1.k794b7964.fda2f4b864df8de55a95a0276c164806b0eb68df0da0e1ae59e5eb620316646d.JyxrsplGUgHLKXmQYLuLZwgKE9gdHuT1n3I1wvJSwE4
scenes-app-engineering-analytics-author--author-without-reviews-or-deploys--light:
- hash: v1.k794b7964.ed20abf791a343c4746b96bf254ae2ade623baa3c8b77a55add4c68bb624a6c2.L-CzeVOPJhXcNU1HLeZ7MT-b-SouqwR1BVBTjKtBBQc
+ hash: v1.k794b7964.bbe0efd081d2fea333b3cb8df8b6d85167446e2bb010d33b263818f6f20f35bc.wv0hkY0Q8_4hO1cphqjOFJTdnoW-OnUUieSgir4Io_Y
scenes-app-engineering-analytics-authors--author-friction--dark:
- hash: v1.k794b7964.88728c06ce00b8f11db949d90b27a1b2093f0cb8673c28a3bacc0b5ff9a56b5e.OhfSy6zVs-UDsLgYDEhzFETfYob5SWTgB7RTbEuDb_c
+ hash: v1.k794b7964.44f2a672734bc56680e808b2ff3b19d0a36e82e59b863a5f199cce0a308384a3.gV5NRx3Zwla-yAtye0PAjkvaTIb0oSI8Sjx6Ldw-b8M
scenes-app-engineering-analytics-authors--author-friction--light:
- hash: v1.k794b7964.3bc0729aea98363b40832cf35ec30a99dba6d5e8a744e2ac8e74ff80d924d108.9Vhg9iYWBSHy87Mnmc2hZjQWgTLmBkO0zoh8uTIe-9w
+ hash: v1.k794b7964.b06da71416dab33fc0abca62952fd6ceccd7878d9194eae7d4c1fb12aaf3f04d.kC8sJyGcK0twviEpaUnMBPlLpB25nJrNiV_ggfAfIOI
scenes-app-engineering-analytics-authors--author-friction-not-ready--dark:
- hash: v1.k794b7964.92889e0db2ca295765d91586d19fdd5183d8b6af425237baf4c5e6d0273b4949.q-FafIaHo1UO3RKISmWRKJWxEtw8-pgrKYWP4q9DoR8
+ hash: v1.k794b7964.20fb06c357509e1306a49d07b0f5fff99dac190a717513098c4751fd23cecc16.sw8-xuTvnb0EqE1IEnSorbPH1Z3zSGn4hAreYRpdh9I
scenes-app-engineering-analytics-authors--author-friction-not-ready--light:
- hash: v1.k794b7964.bf18cf3f51dd0436b64f4d6cb533b6a36a7811c161122355a08d40a5136db8be.uGZadwMtx40uqMkqplCKQP9fzEMLnYReDvNvfVsG6EU
+ hash: v1.k794b7964.6fdf8e926ffcf6c19de577b10ffecc198d3efacb230417bfa2e34197dc7739e2.PYoNrS9UU1dGptqa9avUSQrqh9j1A0aCs_94bUY92lk
scenes-app-engineering-analytics-ci-explorer--activity--dark:
- hash: v1.k794b7964.005688d655bbf55094665d28f169ae2b22a3bcf0b6aa688edf97ba329b1110cd.EyYMn--lW0UFsRUy8i9m9veNkiSjIEz_JW1p7ovBoIk
+ hash: v1.k794b7964.0b6c9bd5f9b09fc57aba9efae46cd06a6957f443c2985c9400c8f52de4972ec4.N0mRsO13OynXXmMhOzuFND755MYiuJB75jSfnoq8ULU
scenes-app-engineering-analytics-ci-explorer--activity--light:
- hash: v1.k794b7964.9abfe9faeff9146ab7982097647c1861907dd6f99afed3d54a29f1ade3f56062.A_zcy6RuaLTRxwNFyBPwf2F8rYxq4SVxEbplKLkAsc0
+ hash: v1.k794b7964.e1dc01cfa887b479b7d727311b722a2449a6d202678422222115406182676832.mYk-7fx7SArg0GTT8RhZVOqvlf--_HgAXY1hyIpP070
scenes-app-engineering-analytics-ci-explorer--overview--dark:
- hash: v1.k794b7964.85d63d9371adec11a5a02cb06c37d3fb6deb18af7835034997d8689aa6c1eb79.kMPBPBRY6gs6uw8vOVvz1ODLndgPglp7DYy8eu7hXMc
+ hash: v1.k794b7964.5dfa7a3e5bf7314de5a6bf2fa1bd9b7181000fb538b77a8e7f4a06d16757e4b8.LEKZfQdDvbhVvZQK7uSeKO0R1lm9HCQpyXSjhKHkb28
scenes-app-engineering-analytics-ci-explorer--overview--light:
- hash: v1.k794b7964.2f2ec0fff11b656fbf4aec4b169a2caad41121f5a6b16b90c7eec5a50da4f23d.qMvQqwHD1OLgyk4E_gFFa3OglRYmmG4ZbVmVTk7anhE
+ hash: v1.k794b7964.754465b57e875b46d4b88facf2fbc60b7d36e5a560f5ccb990dcb0f5292b68b1.fIh6qm-tpvb9zbT6zDG6u7GyCsXt6axcPvwzVeRpPnQ
scenes-app-engineering-analytics-delivery-pipeline--all-stages--dark:
hash: v1.k794b7964.e6fc5778d62714ed6fd4174b65c767a850d116b902223aa6f2086ce967edcaed.HoZOw65AQI9tW_L6CG_9JN6y7lmyhzy_Q1PQL__zCsk
scenes-app-engineering-analytics-delivery-pipeline--all-stages--light:
@@ -10151,25 +10151,25 @@ snapshots:
scenes-app-engineering-analytics-delivery-pipeline--without-deploys--light:
hash: v1.k794b7964.5eaee687a224ef9cd7d3707391948732cacb11769bdd619f315a101abcb85de1.ymQC-4XF77SeJ0AN5SrtlyYKs8Ve29MBfz4J8FGLWtg
scenes-app-engineering-analytics-deploys--deploys--dark:
- hash: v1.k794b7964.147b3bbd58fa6b12254d5feb856666c37d29b20811d56266e1c49c9a8ff38c71.w57_5LTQOTVnIgNL2S51JXOTgbLfAibU62FFXqb74tk
+ hash: v1.k794b7964.b76a4c4ae6568e85467fca2229b8af3c5dd321e960b04fa6095f7b17ee8ca51d.ZsG9gKS_OgwdqL_8r6lu8VwFR43hSryeLv-v7pdFZyw
scenes-app-engineering-analytics-deploys--deploys--light:
- hash: v1.k794b7964.ed431aaa863dac63185e2216719bfffcc040d409a81a84dcf1bc64441bd99cad.eAoo478U78CnFhA0vU7UQcnmgmF4lg0QWxEIS7POdbc
+ hash: v1.k794b7964.7cd73adfeb30f704bef26f5b3d7f82f1f79e7d2fed330ff36cd959d4be8f2247.-SCIQdE2AqilxLboo_KpcJ92G5iYtecwva78Ty28_9s
scenes-app-engineering-analytics-deploys--deploys-narrow--dark:
- hash: v1.k794b7964.2349f598080f3bcd391cc79cc4a5ec119e17a007c0f465142d0a3d3e1c8e40bd.SgpPe_VZPDswYdGakTfFSQaYJOBMoo0oEoIp26cpfjs
+ hash: v1.k794b7964.e2d9bf820ed734f5bd5e40e6ffcc1052a57fa9dc96d368f573001edc4105b45f.JBIN6I-Kp7RbzDrhU3YVdeu5w_8U_GCBqP6p-EZH-DI
scenes-app-engineering-analytics-deploys--deploys-narrow--light:
- hash: v1.k794b7964.ebf52e834f9dfb48670fecdf7cd048db17637d1a03431302d31237d85df2afdd.vqcEUwCLQhxgaS7bgWsfuPjGQh70XrnEpFsrerIueHM
+ hash: v1.k794b7964.ae21094d2eaeb9aac8bebe6a6b52d68521a6c24fe1819a9aeb2ef8c08851bbfc.jc_a1ktWcnfbN1EsmD-FN9yPqcjNwzKyJrBzl7q2p4Q
scenes-app-engineering-analytics-deploys--deploys-with-limited-deployment-coverage--dark:
- hash: v1.k794b7964.b73717e68553852893d474def66455b97e468fd15b88acf63c1767f04ed25795.sO1XE2QSAaJ03g-fa4GHUhJmFARwamrP6TLUg9JGFfE
+ hash: v1.k794b7964.21bcb8d2a00b90e919f26a369d72934f8ef07df3dbaa8edfea9115920c411f85.qLsV0OYMoELdcwfteOEL5kNwZ1ke3VML4UdKWk7SYo4
scenes-app-engineering-analytics-deploys--deploys-with-limited-deployment-coverage--light:
- hash: v1.k794b7964.5973e47db15bcfbb6be4fac11c2615aab12a75cec3aa928aa73d719df59c7121.g3ciIaUoBMdZaqw11XSC7k6NFpNz97_DDkKFtEtBYe4
+ hash: v1.k794b7964.e674381d93a267c615cae2b55f2ad02dac05003524c2fc19b8ca7d17feb8bdb0.NIBTf-fVvf-DOvOM_gxOIvzuUtF2WwyavDz1BSNR8ls
scenes-app-engineering-analytics-deploys--deploys-without-attributed-pull-requests--dark:
- hash: v1.k794b7964.7eb3f20a78ea96a8532ec6d8c5350c426abcd2bff550fcf7a3bfe24756a517f6.-GeqyJ7_IuZPS8oE2Xozpu5x7-bMJdIRpdhjG3w5WZ8
+ hash: v1.k794b7964.252e42ccb7c30eb8e3486f2468dff136fdb182d96d64024285728c108fb5f37b.FTrp-r5PNZN5rEexRHgCXhZ5rtqChNcGX-0HmWxp-AI
scenes-app-engineering-analytics-deploys--deploys-without-attributed-pull-requests--light:
- hash: v1.k794b7964.738106d0e1395c0267ced93bbfb2d27d3663e1f283cf20e3b39b433e1046e8d9.O0Z3V-8Lwd6eSXKgTUgPCsxifWHeugMGvBMlU5U0OT4
+ hash: v1.k794b7964.d39baa54afacd428192364e80168998ac3942b88835531bc73b95a1ef6c2a46e.V0HjDQmBfsHkhtQ_zt8F5VC4YR_2Hg-gFnV4cSDZKYo
scenes-app-engineering-analytics-deploys--deploys-without-deploy-data--dark:
- hash: v1.k794b7964.c1def6391795f86943b93d705aa33c71a7d7245998a475d67cbb81d3ca6c09fc.sOo_RfLHvW46GCYPg4hjJrrDrra4SBMPT8KLQqm87hU
+ hash: v1.k794b7964.2ae59025f68217d4b2779e36278e8111e89936df612bdd9e5ca65794deaf0f3d.Pn4RWBsARZLEX2-ThveuGyO_KOMZAEfcE7yfR3jyxx0
scenes-app-engineering-analytics-deploys--deploys-without-deploy-data--light:
- hash: v1.k794b7964.f0266cb70e564be2e81e39cda96a615758639c457fc21b40eda6f5972649db16.rkCob4cEXY8d_NfF0ibE6TPZ5QwJFTuRjO2B6cEOpWo
+ hash: v1.k794b7964.3460b3138f2d33806c8bed55f53a12225d28c204a68fad9ab698a564c349c7a3.v8YmOH4zgh9UNmtNnWFUBHTiyIILAvltyrvOH0UaHQ8
scenes-app-engineering-analytics-lead-time-box-plot--default--dark:
hash: v1.k794b7964.a88a986e975778b0ad232c7e8f75211b0d66acb126082b2f781fd9d5641ff28d.P4_7HWOcC-Z8pGr_2GTGkAc_fzupx_TRaZdlauEmVQE
scenes-app-engineering-analytics-lead-time-box-plot--default--light:
@@ -10179,97 +10179,101 @@ snapshots:
scenes-app-engineering-analytics-lead-time-box-plot--horizontal-log-scale--light:
hash: v1.k794b7964.bc3a9455717626ef2f9541e03740bd0027c89139cd54ba4eb57a883d0e222667.OlAdmRvrHHSpGH8a2jHqV60Z957X8hIrNlcY9Duvv9A
scenes-app-engineering-analytics-pull-request--merged--dark:
- hash: v1.k794b7964.cfa95ee3ba1f33eb810abdfab9dcd5a9310eebfa6980f0c25c3b5bef018df6c3.kRQLDy_o49HMTWk59KNhBRgruGdLwXTWtJKID35xbtk
+ hash: v1.k794b7964.914da66b8ffcd2d304504ee64f546d481a086f850a595453eac277776709a5f8.lRLNQnprlC-abPDRUnVoIsQdk3RrVERdN-r9yixuN7M
scenes-app-engineering-analytics-pull-request--merged--light:
- hash: v1.k794b7964.9d7169ecf7fcde9ae1db3ab295ef573b326ade9e845b39d2ecb015cf36d37a16.ebUmViA0mm2a-ejX8gGTDWKz-KXuKjZ4s6-dfPi7290
+ hash: v1.k794b7964.341faee45938a8f6e8f5bebf7d084d5cdbcc7167f936a9650faec95045075c61.dn9TGnxHEk5KJWSHuMY2q7AB4_hkGL3-1bKs7eRnruU
scenes-app-engineering-analytics-pull-request--out-of-the-merge-queue--dark:
- hash: v1.k794b7964.2df5b530fac3f1f3382e303a58ef6676857eb1cae6374009b1e50068cfca47ef.9trVDkB8z3JHxUTAvQ_POCWnGsU8YlpdI-iUyZ4l-UA
+ hash: v1.k794b7964.93978802c42af2797d05a301adfe70d194d33f3e0702525c5e7661ace6c5cfe3.m62m19bjRUDWr9gYD9QWEv8GwNN1-Fjy3CSodAnv050
scenes-app-engineering-analytics-pull-request--out-of-the-merge-queue--light:
- hash: v1.k794b7964.88a465845cea19b9c2a2978d5ebd32f7b2e0855ad4c811381fc709e5a3c86776.D1RYpIxamLomvbpClGc_24NAbokt_xGdmN7nqHFeWA0
+ hash: v1.k794b7964.6797fcc13df425c50c66c660ac6db3d4dd8474b41a47d0b09a1670b469efd81f.fPK07aqVd8TZO06FptD5tbBRFhJRw1JnJ4DrUYHkISM
scenes-app-engineering-analytics-pull-request--section-load-errors--dark:
- hash: v1.k794b7964.0afaedfa37c206f596d077bf9c3bf1c2e4796ae2766ac8bf3f731c1a9f8cd7d8.QTSqaIlk5JU2ILV3SdefnQb7uc3mXYy13jpItpyGg6M
+ hash: v1.k794b7964.97e7bcdeea9686784229086d09b943f4228fbb41a4f8255932df388ca98e1e9e.y0wF4Trm7Vu1BWmenoIA0-1ZaL4U5e4gXQfvI-ZqxfU
scenes-app-engineering-analytics-pull-request--section-load-errors--light:
- hash: v1.k794b7964.b9e2a9e84eb666481eb303f5f97dbe8284b89e9316e4c793bb1a189edbf3a98d.jlYwHaG_fAyElPt4Easkh-s3dEuLiYqW4HFCa2GNRGM
+ hash: v1.k794b7964.6666cde9262743b7824ee9a39abb36a0d5285419252424ea5fe8b21d8e3c412c.SMA91aAvY1AeNAGRUyxxwMjJd5yiRkLrLmKbzSH_IOc
scenes-app-engineering-analytics-repo-overview--repo-overview--dark:
- hash: v1.k794b7964.077cfb3dcac2efee05dc6a05d8f1d9cc2e9c16ef5b3bc051483e4028ec183946.deNllNcvsAVJ8en4lFZMNs_PLIDnPylJAWoL4NbICgw
+ hash: v1.k794b7964.1891b27c427eeacc778c17aae2a415e4cde048540f95d79be52a4031e8ad5f58.zvBjyvMrnN15yUfqWfiC8MaI72OThY0dXnKCunATzgs
scenes-app-engineering-analytics-repo-overview--repo-overview--light:
- hash: v1.k794b7964.42c8dd908c805d1407de2b7b89cb18b03a0e1bb36a1bbe658e5d290a15703af2.8_CCzIg7IRKZwTlD4YfR0aqDWAfxWhBeuugC6bnEpO0
+ hash: v1.k794b7964.fc84c401be718826fc1ffafb2978e6d9a9a757ff719a693c48ca658e89444e54.S5_fgia9xnwRe3shj_RdfaA9Gd-UZG_7FpQ50KuSbzw
+ scenes-app-engineering-analytics-repo-overview--repo-overview-with-several-repositories--dark:
+ hash: v1.k794b7964.a69d28c8183bdf87f260ada495110b72c587f00c66969154879ea353d3b16179.30e70egR2_ldxgEYgJejAai4nO9obPXMdSnaLMzTRFo
+ scenes-app-engineering-analytics-repo-overview--repo-overview-with-several-repositories--light:
+ hash: v1.k794b7964.8ff34e1ffc6b5400f8f82094342c784032db60aeb30f3fa33a856ad6b9b14752.qa7dL0EfUjAqKl9NrHwi9i99dhTA5oZ_DkiR3lRFBzQ
scenes-app-engineering-analytics-repo-overview--repo-overview-with-trunk-queue-data--dark:
- hash: v1.k794b7964.077cfb3dcac2efee05dc6a05d8f1d9cc2e9c16ef5b3bc051483e4028ec183946.ui64LHDiZfvlBAFwcmPG0dnXOSdTw9vT_V4vgac24_M
+ hash: v1.k794b7964.1891b27c427eeacc778c17aae2a415e4cde048540f95d79be52a4031e8ad5f58.wLPhR03AW0mLDd-VoCK2IKCP2LztfvjIGoTiK4I4yiA
scenes-app-engineering-analytics-repo-overview--repo-overview-with-trunk-queue-data--light:
- hash: v1.k794b7964.42c8dd908c805d1407de2b7b89cb18b03a0e1bb36a1bbe658e5d290a15703af2.ItEacHg6ph-2ceZCSKBA8TNsBGIi32Zc85R1t9Z6RwM
+ hash: v1.k794b7964.fc84c401be718826fc1ffafb2978e6d9a9a757ff719a693c48ca658e89444e54.aTnGv7rF-txJenzrAmrPW2BnDIr2e3GpGxsu5A_7tTA
scenes-app-engineering-analytics-run-activity-chart--default--dark:
hash: v1.k794b7964.7f17c5ac7c6862493f7c4d59e6e3c3146c42e3d7b08908ee1716d387c129ba64.lPsE9KrOSZee9wJq8zjqYnvk09numvEFWOn4mdCOgJE
scenes-app-engineering-analytics-run-activity-chart--default--light:
hash: v1.k794b7964.f63752ff3ebf3bbee3be4ddc83d1ff657d9cdd11ee71e7283c30ce5a1aefde72.yTb8kpRqcG51TbM2CqgRmC5YvgE7-6pV1Trc7y5wuto
scenes-app-engineering-analytics-team--team--dark:
- hash: v1.k794b7964.9ddb8638593809903ad048fd0dc36d76f1558cbd10f65a36503f7b3c1bb7a2e8.lhhA3Dojxz5aDLfACuv7V7vDS-hAOr0VI7c6OPXmPI0
+ hash: v1.k794b7964.a5bc8fb0bdd3adc10575d43d3ba8ceb181efd98c469ed22796ff5327e6315651.AsJ06jN8TcLrfrosGcFYHeWlYmOPHgalEy73tLwA4W4
scenes-app-engineering-analytics-team--team--light:
- hash: v1.k794b7964.e3e2163a7c066bc26f1b3e7f80541d5c5bf1419d8a503d35a554ed72d048ee82.Ov31vsxKog4PRQOFXFyXMS-QrY6UhgMxAqqtaJWocWM
+ hash: v1.k794b7964.7753e75a2165d57413477c842d50011e2a9476e3839ce6f41c4fcb00e4a431e3.qQbjpW74HQWjmaqXsJIX6kBTKvSNHXwqd8LAmNkzKkg
scenes-app-engineering-analytics-team--team-narrow--dark:
- hash: v1.k794b7964.6de8ee5eac265b4472c96f92c8e082ac9cea49406503cec0021e8dcdbe7d927d.mOg79dFV_FrNp_7sqO6ohCyZMfuWDwbOpdE5esKnjjk
+ hash: v1.k794b7964.55431d5c832741cd6c8d5953ba8f1b4ccd362c2aa7e34b26d388912dd72b1e7b.5r2nPgm6q9GMJRHuKQc3ObiyHgaHMKFAKPWEvZgJhIk
scenes-app-engineering-analytics-team--team-narrow--light:
- hash: v1.k794b7964.0150502cfbac0b95b123c0e37f806559babbd5501547b0259566f8aad52cb08a.YFoPIcTeQqzV_19qbyRbDN2tEJCviQxRF0MlSJyC0ss
+ hash: v1.k794b7964.23024f4c0eb64934a5a67d2f79061760b5b4b4d596925d89a1d7993a12761c67.NAW7D6iVUAz5nR_hvIEi84xSpJax21k2xifaiM2vdUU
scenes-app-engineering-analytics-team--team-quarantine-load-error--dark:
- hash: v1.k794b7964.1c6be5bb3f64f79843d2befde083faec26e3b4ad6dd7d2867a99b599d2943324.hFMUrz-ggVkoUYAZ_UL5sx4qeN-_zFWPHOXyg7GP1CU
+ hash: v1.k794b7964.77c575cecba49fa92771d47405459a3f4402dce86cab60be624748091d188d5d.COKc5F_D5CpuK9chdnArWpaaNQFcRAOJyaaFlPHMDUM
scenes-app-engineering-analytics-team--team-quarantine-load-error--light:
- hash: v1.k794b7964.35fc08fe30a34fafdde9dd5048a5e81e8c17ecc2979a1e3840744de6825ad3cb.4wPCav0Ylkv-DrywkGXIu-7QyXyHwZqMjOLucNIIsiw
+ hash: v1.k794b7964.e90b1519b03f9a0cc2ee0369f1d02154a164a65e458e0277d2132eee21e398f5.W_fV1zG9sgT0eyp1Dpr-qfwuwQlCUknbQ0ITN4IdBLk
scenes-app-engineering-analytics-team--team-without-membership--dark:
- hash: v1.k794b7964.2e1a6a228e691ae3ea643ebfdf22bade2ebe807a33821654bd59e3ab499e39c8.TFV-yx33ZgxZHTfeNJeXQ6TenTVR4r5myTdJM5CIROw
+ hash: v1.k794b7964.766dd82e1455ab292ceb9b1ad30d92838d81f46b44cd1a202a26ecf5c3179a97.dbY04U1FaFTM_XwnL4j-rrab-Xf9ymtXz1NUgeMljzQ
scenes-app-engineering-analytics-team--team-without-membership--light:
- hash: v1.k794b7964.a9ab1c76bcd7aa78683e75ab34dbd4d8c0d2b87df0464138df865a43fac470c7.tL5_rdplygpDskdSRBIeYGBpXzaPZ3ZtrcJE8nNZ8Mc
+ hash: v1.k794b7964.20d657188668aa8f6871b3521f5022cf47a6700a66b8ce68a617d0d0df7603c3.xmavmmRhkhq5VjxxL6Yaah7ILbyFIbt2ADH1gdKTRhw
scenes-app-engineering-analytics-teams--team-ci-health-load-error--dark:
- hash: v1.k794b7964.2c5b47795360001e6281631b9c29b313cab79a2c10b335f018c3a9b333ba8593.aEHiND5D1aaD-yEMHu8kAQRrHw2X6AIRTQS6X9j0CNk
+ hash: v1.k794b7964.91f41bfd199f6c0e5fc5525238a4edde1ec25bac091d9864f0c84c87d178e2a0.a1rGkUe-PuXajH6rSFfyDqT5qXIwkSnTSwnFkZ-eaYI
scenes-app-engineering-analytics-teams--team-ci-health-load-error--light:
- hash: v1.k794b7964.3c0e74717954d87c4897c6449b6b11e296988aa9b3ecc8169d47e8b290f92852.hin4fcT7XyKyrwZ4N7JtOEUo_RqohPnmkRExX4Ns0TA
+ hash: v1.k794b7964.aa265a96931e2cdd1286d8c10c4866dfd70c385759b802f1a761fb4bc711c3c8.6FIxJt-PSZCrINMAXSptpXIzQeY04bTy78dM_kabU3E
scenes-app-engineering-analytics-teams--team-ci-health-roster--dark:
- hash: v1.k794b7964.ab345005be51ec67d355c2fb12b7eaaeb52764b0c0a3b9598ebc1767f9ae7457.Zmaq5AaqeZ-xTAJJ2O24qjoSj03D1kUPUwk9c2bHWfw
+ hash: v1.k794b7964.70832fa9d00df6db3e7f3c8b492ae0cc55fdeddfd00f440a012215690cc19dfe._oSSve8AP13dzO4rSQnjIXRfZY2RwRMc0ec7whyjmng
scenes-app-engineering-analytics-teams--team-ci-health-roster--light:
- hash: v1.k794b7964.cfe54886d432295145a2e955fb75306173e31ba6c5f0f988e47f8304f2c75979.n8OplejM8MfCpDTi27u9UowHP9fdc8ORprBRHaemOUA
+ hash: v1.k794b7964.e71f436a7f09207e3da79f0442c1458d8e2b28495c103619da3202c75c1c803d.MfYZ0dipgOxBXPKBuiplD-_V0mi8d0_PAnRXW4xFoFc
scenes-app-engineering-analytics-tests--quarantine-load-error--dark:
- hash: v1.k794b7964.bd56f14c086152fa97390134d29ab0cff68e6665c1a309a4db67f45c49a82818.7yComHRRY3qMsmJoz1YQZPupup7KgJWWQpoljHmXm3c
+ hash: v1.k794b7964.61604dad7ebdd3dba65d24cba3c6c633cf2ac2b25ab6d6d527a39b0e915ad2f6.iqq-xSMeJPeD1MijNryt_ytiLfZMnk3l3HsFu7jTfCU
scenes-app-engineering-analytics-tests--quarantine-load-error--light:
- hash: v1.k794b7964.347941621d95c7c11794a84921fe1f54ff4668b2bedaab6077ef1a6639a66f65.wIJ72rGbFRl1gB8pjM9dkYL4RyVDXgqOv9Vzp7WKwIE
+ hash: v1.k794b7964.7c8692eaff05f6ca68161d39fe7d1639710ca073b8b8d5281ff780f6808e00ca.QsOuDftwq-oEC6bluAhsy4FX3vvhfpMDKKKKJbHYHas
scenes-app-engineering-analytics-tests--trunk-quarantine-debt--dark:
- hash: v1.k794b7964.41892d24d65c8cc06d1f1f165538ac6beaaa8670f99dd627f7f9d3d9ee4ef65a.dbB27LQtlzKpCunXSypblJGJp3t9aasjNQjv1CT6pZU
+ hash: v1.k794b7964.986f7011d08120964f658a6151bb31ad93b14eae1503fe551fdcc579f686187a.Kc9jo-7j16HiF49RwTYIVlOqhvGSUyuv3OYgIF9MK0I
scenes-app-engineering-analytics-tests--trunk-quarantine-debt--light:
- hash: v1.k794b7964.a8d43ba93a1718052c275b7d574875bd039b35a2c403a9593b4308f97ce784e1.ON_7Z_jI9aa1Ox9dM4hpKINXMr_nATRGJY-kb-84nf4
+ hash: v1.k794b7964.fa98ca60dc51d87d64f26cd10a3c62f405bea1f9da1275b16773b7b404854b2b.aTt8aN28jUh5oFCRq9MVp7f3m_wzVRUBTK9w4IIKsqI
scenes-app-engineering-analytics-tests--trunk-quarantine-debt-owners-unavailable--dark:
- hash: v1.k794b7964.7313d59ace1c2e1265e10c583b1920993fafffec375cb0502fddaa4e20f0b344.kyhTOViHH9-9t7-iP7h5uN8aVzXV-8stvq77ZGWUk-w
+ hash: v1.k794b7964.b9e2979854b42dbf1637a1f49e1301d8dcf9537583aba0152f711a8e6e66e550.eUzepRo-Fl1znw9-3EXQihIvqloaguuzsEvQ6c3GuY0
scenes-app-engineering-analytics-tests--trunk-quarantine-debt-owners-unavailable--light:
- hash: v1.k794b7964.7b7f303bf22453a8d6eb96843474d0a59a32380952dffc7664d54813929b4fbd.gi92G3lpZOydZUdHvBu8AhXUgFoxHrTb3vpO1WHLreE
+ hash: v1.k794b7964.70bc2ea4a5fcd54507b2dfabcc07f590c62cce10b526a0ed280528ecbceea69b.iWeEYnBFIGrt7LXKgREcgR-zbrDUOw5_60buXfMetZ4
scenes-app-engineering-analytics-workflow--workflow-detail--dark:
- hash: v1.k794b7964.1132baa645ded0d70abc360942d20068924331001a3a99046c3e746dfbbf1e35.dLHGZ-aDc-qgyY7CTPv2vSRMWGJep13Gw5CxFdXXkEc
+ hash: v1.k794b7964.ed63cba05c3a1c2d6b7dc9b6441aac22e0d6dc988c7012fd074f12822ec5cbca.6zKD-NymQGqdyyeFHU9TPVEBlS9GtMTJnLXpB431ELE
scenes-app-engineering-analytics-workflow--workflow-detail--light:
- hash: v1.k794b7964.b2a14120c4df9a52509de5392723bfcb14cb81128fba8f3ba4b499a0f134c6cf.qAxBUafAs5RsmXJx-49jIxS03fzjtji4i9K7HGZ0oqI
+ hash: v1.k794b7964.bb503cbb4f6ee08e34c92e80b227f54591ead62e84841c18924afcd3599ccd1b._zHPcoT_vIZB1LrL6RT2mh7oLmbZMeaXKGObUi7ZvuM
scenes-app-engineering-analytics-workflow--workflow-detail-scoped-to-pull-requests--dark:
- hash: v1.k794b7964.889b5ab67fa7293dd20beaebeb6e3ea532aeca6344117d07050ad8142e88326d.hek4_r2-WlU60IFgM7viY_W63krkieL82GVmeT0Xhi0
+ hash: v1.k794b7964.1896c52142144d82af5db567bd08cf4bd87e11e2dc489c6e913fc503b83653a7.afFZpV5zRDFsJfZIUzW_9NcRiqkKedD5yrBgZAVHf7E
scenes-app-engineering-analytics-workflow--workflow-detail-scoped-to-pull-requests--light:
- hash: v1.k794b7964.b9a798d0633f8970ccbc1895d1e47377916613be6d8104b881fd10eb05ba5e9f.TgqGfPMycY2VS7EKGgfdBoh5hlokFh4_25NbhBYSmjY
+ hash: v1.k794b7964.e28db48aeba4771cb18ef4ff388ba0aba3045aaf2f9d622c384b0b2b10f16f1f.8vHMuh1LeR1QDvmgRxtdc3Kuxz1mBsdn2xnGcyDK8V8
scenes-app-engineering-analytics-workflow--workflow-detail-section-load-errors--dark:
- hash: v1.k794b7964.5697e0d891db7e06b7e8e16b5e3abd8e5302cf6aa680d0b1336b23b9e87a524a.Jj7T7C_NtnkG38Bcd2cIow_jqN1TR5LYEkz7W8m23a0
+ hash: v1.k794b7964.f778b874ef5ab671500a6743a4550d815d63ff2a9dedad4bbb311b252b64ef16._LJoKtU2xCtL3ikMrqPbjaMnE_0wxr9-xc-4t2wbyA4
scenes-app-engineering-analytics-workflow--workflow-detail-section-load-errors--light:
- hash: v1.k794b7964.195e5a4f86daf73d83fda292f45b2c2d146e4f04f9587a20336b0430ecc53925.qvN29ywYqV9EWLwwfwoIGczIX_5--0uSrVZEwM6Cobc
+ hash: v1.k794b7964.54bd5d744f9ff16d43d5476daa93c4c8af0f2fdc466a00c49479421f1dbef642.2uK1j4cniblurwfUzmx3XF1wCcqHEbpSO9YncZXXmAw
scenes-app-engineering-analytics-workflow-run--depot-run--dark:
- hash: v1.k794b7964.700c8e576002a8ee86244357b292b70ce82ff204414e001f67ac70908178f246.fCt9_ACi4OPiDvNY1z_1iu04-E4zW42XoVXunMJoDa0
+ hash: v1.k794b7964.5c5247ade6a51626e420c95ace81dfa0d92707dd77eda9dff82f72c4958a9ba3.21Y90ddqSJGLKmHOC70BrV8BhhYKMdIGsvR5iVGjk-s
scenes-app-engineering-analytics-workflow-run--depot-run--light:
- hash: v1.k794b7964.92e946b11c14dd56f65a492866e85a716c4cf44866830ac96c41e236eabf0e3d.ntCPLQEnZ-toghbJD8tLx9kaywEU-NA_OZJncYcu1YM
+ hash: v1.k794b7964.4310d3874a46f749abe9a3c33499cb2b1eddf16f679397b7ecdc7fd016e449ee.67NkPxMSowlRW7ZO98l69xmdgHeDHUNcN7ky4baYFCE
scenes-app-engineering-analytics-workflow-run--failed-run--dark:
- hash: v1.k794b7964.a00911d6c52b4049f604b641659b6fdcfbda71c715e1bbcb937eb2e5d8f7af25.Cn8V_cwoSpfwEXevukgCHuTVDB8Fpcid4fxJ2GZI7kc
+ hash: v1.k794b7964.57f0a4fa93b2ac0047988fcd1d21743e33c2d17a2c2976afec0978fd5250dbfd.sGvtBqyRxBWVbXP9YU1ZPhLX904HyMQr769HrYc4MBE
scenes-app-engineering-analytics-workflow-run--failed-run--light:
- hash: v1.k794b7964.67de5687f7a25b3a2ecd710aaa119d73d9187fa1eb08ef3ac124aeb033c1a648.pJQTg4VwETVX5q6D8e85bipscOSKpq8syvXnIdPK1sc
+ hash: v1.k794b7964.09457937484f13b9ebace240d32ca5bc8588813dd0dc10cb4c3f82c7881e5fbe.iBfzBOcMkH-74yq3tKjMFySd2Pjh5cXuufgQ2MM235Q
scenes-app-engineering-analytics-workflow-run--jobs-and-logs-load-errors--dark:
- hash: v1.k794b7964.5511ee7856a856085ceb33bc00887b8db15923dd81a89647f8c3560ad1368e5f.Hu8V3ge_4aXm6BKNHrndiSyU-m5NsRHojTeUAASOvFU
+ hash: v1.k794b7964.5b1a4847316c45be19eb0e63d58c896838e336d81f6882433d233fc8a0e7275d.DxIuUSHtA6_g2kYXEiKntxQMUlSdDZWmeBfpbacRkjQ
scenes-app-engineering-analytics-workflow-run--jobs-and-logs-load-errors--light:
- hash: v1.k794b7964.8d6bf7c0f4238aa5be869b4182bf75ca1c1acecadcb6091318286f4513b2f8d0.nT4uFXeozIsR2wryuF0Wzmdg5A2Lus5xSA5npxN7cqE
+ hash: v1.k794b7964.44f6726cfc2b369ce0db7b59370e0acf20ad1d09ace4b9c6c3403120febecd03.xWF_CftCSU7mg4blQY9jDIWgeWaPR2j-53zfWcQJ8CI
scenes-app-engineering-analytics-workflows--workflow-list--dark:
- hash: v1.k794b7964.9ff33d7aca77bbd3fc44cceea7dcceda758f1f336cbbc2ff08c6ad0a0753a343.US059hzG0MBu__41cQIXFJ13UmOqb5RibtChjQqaOpQ
+ hash: v1.k794b7964.fc44fa9cd4dd6dd8b0441d092200cea1e725e79a69f0dedcd1b01846167f081a.Sg04hN89_51SXgj-p2ZzxB3JqRajOR7Li1lwphiuakg
scenes-app-engineering-analytics-workflows--workflow-list--light:
- hash: v1.k794b7964.086a675ed307a0b658e97f433a0ca524e843ea7aa9dc7bf02d60ecf947252350.2R1ALlOKLCrCNPE_JP8s4GtLW1nv_CynXyWnHCZiSXc
+ hash: v1.k794b7964.9f81e79ede2e7ffc62f1645acb9f49a31e86e85def090163933ffa106ed86175.Dacf-BZYxlFn64FDiMr9z-UhyIRwBe-xGUFfRWgkjBA
scenes-app-engineering-analytics-workflows--workflow-list-scoped-to-merge-queue--dark:
- hash: v1.k794b7964.cd415dce5640149a0ec0500d4218ab70f7584f65f6abc204602b97d1e9239c2a.itZi5U9R78-ZspDJWYdVOeJzXx-EcR8gVtthfbzpjA4
+ hash: v1.k794b7964.818caf5183ea935082c368a11e606bf9077c4e5ea9ed2bc07a9e92fbba9486a9.YNE-xXkKtBriW22MVaTabGWwbSckC1suHhSXmLJagkQ
scenes-app-engineering-analytics-workflows--workflow-list-scoped-to-merge-queue--light:
- hash: v1.k794b7964.49ab6522e67ad615c78f0bd38c5d2d93ef4bfde0159c8c79585c96096ef91833.d_Wl4TZWhL-by1secJzvhEpH1dn1uUXcz9K-q3_gGuE
+ hash: v1.k794b7964.5f510d936c2a4b2cedfa3b285c271894781f8f2156bf88946364364557aa64d6.iXYaJ6uq4SH82W73bZN2f3EnOZKe2um1gZbcTUPV9vc
scenes-app-error-project-access-denied--default--dark:
hash: v1.k794b7964.6d58f8cb9ef390270f74ef07d5104b7f42d70bb51ca35f3fdb6556bab46581ce.GP8NrKkdhrAlKBIiXl3b5ydJgg0KsSjEWj1UHG2muTo
scenes-app-error-project-access-denied--default--light:
diff --git a/products/engineering_analytics/frontend/components/EntityHeader.tsx b/products/engineering_analytics/frontend/components/EntityHeader.tsx
index 2da173e94eab..63e310d354f1 100644
--- a/products/engineering_analytics/frontend/components/EntityHeader.tsx
+++ b/products/engineering_analytics/frontend/components/EntityHeader.tsx
@@ -2,9 +2,6 @@
import { ReactNode } from 'react'
-import { IconBox } from '@posthog/icons'
-import { Link } from '@posthog/lemon-ui'
-
import { cn } from 'lib/utils/css-classes'
export type VerdictKind = 'success' | 'danger' | 'warning' | 'muted'
@@ -45,29 +42,6 @@ export function VerdictPill({ kind, children }: { kind: VerdictKind; children: R
/** The repo's identity header, shared across the hub and secondary tabs so the subject reads the same
* everywhere: box icon · repo name · owner/name slug with a GitHub link. `right` docks the source
* picker on multi-source teams. */
-export function RepoEntityHeader({ repoFullName, right }: { repoFullName: string; right?: ReactNode }): JSX.Element {
- const name = repoFullName.split('/')[1] || repoFullName || 'GitHub repository'
- return (
- <EntityHeader
- icon={<IconBox />}
- title={name}
- // No slug line when the source hasn't reported a repo name yet.
- slug={
- repoFullName ? (
- <>
- {repoFullName}
- {' · '}
- <Link to={`https://github.com/${repoFullName}`} target="_blank" targetBlankIcon>
- View on GitHub
- </Link>
- </>
- ) : undefined
- }
- right={right}
- />
- )
-}
-
export function EntityHeader({
icon,
title,
diff --git a/products/engineering_analytics/frontend/components/ProductNav.tsx b/products/engineering_analytics/frontend/components/ProductNav.tsx
new file mode 100644
index 000000000000..6545916039ae
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ProductNav.tsx
@@ -0,0 +1,38 @@
+import { useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { LemonTabs } from '@posthog/lemon-ui'
+
+import { PRODUCT_TABS } from '../lib/productTabs'
+import { withScope } from '../lib/scope'
+import type { EngineeringAnalyticsView } from '../scenes/engineeringAnalyticsSceneLogic'
+
+export interface ProductNavProps {
+ /** The tab to highlight. A detail page passes the tab it drills down from. */
+ activeTab: EngineeringAnalyticsView
+ /** The 'owner/name' the page shows, so every tab opens in the same repository. */
+ repo: string | null
+ sourceId: string | null
+ /** The active tab's content: a tab's own page, or the detail page beneath it. */
+ children: JSX.Element
+}
+
+/** The product's tab bar, shared by the tab pages and every detail page under them. */
+export function ProductNav({ activeTab, repo, sourceId, children }: ProductNavProps): JSX.Element {
+ const { searchParams } = useValues(router)
+
+ return (
+ <LemonTabs
+ activeKey={activeTab}
+ data-attr="engineering-analytics-tabs"
+ sceneInset
+ tabs={PRODUCT_TABS.map((tab) => ({
+ key: tab.key,
+ label: tab.label,
+ link: withScope(tab.url(repo), searchParams, sourceId),
+ 'data-attr': tab.dataAttr,
+ content: tab.key === activeTab ? children : <></>,
+ }))}
+ />
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/RepoSceneTitle.tsx b/products/engineering_analytics/frontend/components/RepoSceneTitle.tsx
new file mode 100644
index 000000000000..002f6908dd60
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/RepoSceneTitle.tsx
@@ -0,0 +1,23 @@
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+
+import { RepoSwitcher } from './RepoSwitcher'
+
+export interface RepoSceneTitleProps {
+ repo: string | null
+ description?: string
+ actions?: JSX.Element
+}
+
+/** The title every page of the product shares: the repository it shows, with the switch button beside it.
+ * The breadcrumbs above carry the product name, and a page about one entity names it in its own header. */
+export function RepoSceneTitle({ repo, description, actions }: RepoSceneTitleProps): JSX.Element {
+ return (
+ <SceneTitleSection
+ name={repo ?? 'Engineering analytics'}
+ nameSuffix={<RepoSwitcher />}
+ description={description}
+ resourceType={{ type: 'health' }}
+ actions={actions}
+ />
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/RepoSwitcher.tsx b/products/engineering_analytics/frontend/components/RepoSwitcher.tsx
new file mode 100644
index 000000000000..aa53e303fa93
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/RepoSwitcher.tsx
@@ -0,0 +1,38 @@
+import { useActions, useValues } from 'kea'
+
+import { IconChevronDown } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { LemonMenu } from 'lib/lemon-ui/LemonMenu/LemonMenu'
+
+import { repoScopeLogic } from '../scenes/repoScopeLogic'
+
+/** The one place to change repository: a button beside the repository title. With one repository there is
+ * nothing to switch to, so it renders nothing. */
+export function RepoSwitcher(): JSX.Element | null {
+ const { hasMultipleSources, sourceOptions, selectedScope } = useValues(repoScopeLogic)
+ const { switchRepo } = useActions(repoScopeLogic)
+
+ if (!hasMultipleSources) {
+ return null
+ }
+ return (
+ <LemonMenu
+ items={sourceOptions.map((option) => ({
+ label: option.label,
+ active: option.value === selectedScope,
+ onClick: () => switchRepo(option.value),
+ }))}
+ >
+ <LemonButton
+ type="secondary"
+ size="small"
+ sideIcon={<IconChevronDown />}
+ // pinned: data-attr of the repository picker this button replaces; autocapture insights use it.
+ data-attr="engineering-analytics-source-select"
+ >
+ Switch repository
+ </LemonButton>
+ </LemonMenu>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ScopeBar.tsx b/products/engineering_analytics/frontend/components/ScopeBar.tsx
index 071a774ba4dd..7aa84a63426f 100644
--- a/products/engineering_analytics/frontend/components/ScopeBar.tsx
+++ b/products/engineering_analytics/frontend/components/ScopeBar.tsx
@@ -1,4 +1,4 @@
-// Shared scope bar: hierarchy chips (repo › workflow › run) on the left, dismissible filter chips on
+// Shared scope bar: the in-page trail (list › entity) on the left, dismissible filter chips on
// the right, and the shared date scope (engineeringAnalyticsFiltersLogic) so a window picked on one page
// carries to the next. The run-scope control lives here too, but pages dock it on their scope panel.
@@ -7,15 +7,7 @@ import { router } from 'kea-router'
import { Fragment, ReactNode, useState } from 'react'
import { IconChevronDown, IconX } from '@posthog/icons'
-import {
- LemonButton,
- LemonDropdown,
- LemonInput,
- LemonSegmentedButton,
- LemonSelect,
- Link,
- Spinner,
-} from '@posthog/lemon-ui'
+import { LemonButton, LemonDropdown, LemonInput, LemonSegmentedButton, Link, Spinner } from '@posthog/lemon-ui'
import { DateFilter } from 'lib/components/DateFilter/DateFilter'
import { cn } from 'lib/utils/css-classes'
@@ -24,13 +16,12 @@ import { urls } from 'scenes/urls'
import { DateMappingOption } from '~/types'
-import { scopeFromValue, withScope } from '../lib/scope'
+import { withScope } from '../lib/scope'
import {
RUN_SCOPE_OPTIONS,
SHARED_DEFAULT_DATE_FROM,
engineeringAnalyticsFiltersLogic,
} from '../scenes/engineeringAnalyticsFiltersLogic'
-import { engineeringAnalyticsLogic } from '../scenes/engineeringAnalyticsLogic'
import { workflowSwitcherLogic } from '../scenes/workflowSwitcherLogic'
// The endpoints require a window start (no "all time"), so offer relative windows and Custom only.
@@ -68,52 +59,6 @@ export interface LensChip {
const CHIP_CLASS =
'inline-flex items-center gap-1.5 rounded border border-primary bg-surface-primary px-2.5 py-1 text-xs text-secondary'
-/** A repo picker on multi-repo teams (multiple sources, or one source syncing several repos), otherwise
- * the repo name. `pickerOnly` skips the static chip on pages that already state the repo elsewhere (the
- * hub's entity header). */
-export function SourceScopeChip({ pickerOnly = false }: { pickerOnly?: boolean }): JSX.Element | null {
- const { hasMultipleSources, sourceOptions, selectedScope, activeSource } = useValues(engineeringAnalyticsLogic)
- const { setScope } = useActions(engineeringAnalyticsLogic)
- const repoLabel = activeSource?.repo
- if (hasMultipleSources) {
- return (
- <LemonSelect
- size="small"
- value={selectedScope}
- onChange={(value) => {
- const { sourceId, repo } = value ? scopeFromValue(value) : { sourceId: null, repo: null }
- setScope(sourceId, repo)
- }}
- options={sourceOptions}
- placeholder={repoLabel || 'Repository'}
- allowClear
- dropdownMatchSelectWidth={false}
- data-attr="engineering-analytics-source-select"
- />
- )
- }
- // No repo name yet: render nothing rather than a dead "Repository" pill.
- if (pickerOnly || !repoLabel) {
- return null
- }
- return (
- <span className={CHIP_CLASS}>
- <strong className="font-semibold text-primary">{repoLabel}</strong>
- </span>
- )
-}
-
-/** Repo chip on detail pages: links back to the hub without mounting the hub's loaders. */
-export function RepoScopeChip({ label, to }: { label: string; to: string }): JSX.Element {
- return (
- <Link to={to}>
- <span className={cn(CHIP_CLASS, 'cursor-pointer')}>
- <strong className="font-semibold text-primary">{label}</strong>
- </span>
- </Link>
- )
-}
-
/** Workflow crumb that doubles as a switcher: a searchable dropdown of the repo's workflows, loaded
* lazily on first open, navigating to the picked workflow's page. */
export function WorkflowScopeChip({
@@ -269,16 +214,13 @@ export function WorkflowScopeControls(): JSX.Element {
}
export function ScopeBar({
- repoSlot,
- crumbs = [],
+ crumbs,
lensFilter,
showDate = true,
extra,
}: {
- /** The repo chip: <SourceScopeChip /> on hub/list pages, <RepoScopeChip /> on detail pages. */
- repoSlot: ReactNode
- /** Hierarchy below the repo (workflow › run); empty on the repo hub itself. */
- crumbs?: ScopeCrumb[]
+ /** The trail from the list tab to this page (Workflows › workflow › run). The title names the repository. */
+ crumbs: ScopeCrumb[]
/** The active cross-cutting lens (pr: #N). Dismissing it zooms out to `to`. */
lensFilter?: LensChip
showDate?: boolean
@@ -286,10 +228,9 @@ export function ScopeBar({
}): JSX.Element {
return (
<div className="flex flex-wrap items-center gap-2">
- {repoSlot}
- {crumbs.map((crumb) => (
+ {crumbs.map((crumb, index) => (
<Fragment key={crumb.label}>
- <span className="text-xs text-tertiary">›</span>
+ {index > 0 && <span className="text-xs text-tertiary">›</span>}
{crumb.node ? (
crumb.node
) : crumb.to ? (
diff --git a/products/engineering_analytics/frontend/components/ScopePanel.tsx b/products/engineering_analytics/frontend/components/ScopePanel.tsx
index 174f76a70fba..21611ec81231 100644
--- a/products/engineering_analytics/frontend/components/ScopePanel.tsx
+++ b/products/engineering_analytics/frontend/components/ScopePanel.tsx
@@ -1,11 +1,11 @@
-// The scope boundary: the source and window controls sit on the panel's rim, and everything inside
-// reflects them. Current-state surfaces belong outside it.
+// The scope boundary: the window controls sit on the panel's rim, and everything inside reflects them.
+// The repository is the page's own scope, set from the title. Current-state surfaces belong outside it.
import { ReactNode } from 'react'
import { Spinner } from '@posthog/lemon-ui'
-import { ScopeDateFilter, SourceScopeChip } from './ScopeBar'
+import { ScopeDateFilter } from './ScopeBar'
export function ScopePanel({
busy = false,
@@ -14,7 +14,8 @@ export function ScopePanel({
}: {
/** Reloading with data already on screen, so a window change reads as "updating" rather than a silent swap. */
busy?: boolean
- /** Rim controls; defaults to the shared source chip and window picker. A page with its own window state passes its picker. */
+ /** Rim controls; defaults to the shared window picker. A page with its own window state passes its picker,
+ * and a page with a fixed window passes null. */
controls?: ReactNode
children: ReactNode
}): JSX.Element {
@@ -22,12 +23,7 @@ export function ScopePanel({
<div className="relative mt-4 flex flex-col rounded-lg border border-primary p-4">
<div className="-mt-8 -mr-1 flex max-w-full flex-wrap items-center justify-end gap-2 self-end bg-primary px-2">
{busy && <Spinner className="text-secondary" />}
- {controls ?? (
- <>
- <SourceScopeChip pickerOnly />
- <ScopeDateFilter />
- </>
- )}
+ {controls === undefined ? <ScopeDateFilter /> : controls}
</div>
<div className="flex flex-col gap-4 pt-2">{children}</div>
</div>
diff --git a/products/engineering_analytics/frontend/lib/productTabs.ts b/products/engineering_analytics/frontend/lib/productTabs.ts
new file mode 100644
index 000000000000..0494f28c3cdf
--- /dev/null
+++ b/products/engineering_analytics/frontend/lib/productTabs.ts
@@ -0,0 +1,49 @@
+import { urls } from 'scenes/urls'
+
+import type { EngineeringAnalyticsView } from '../scenes/engineeringAnalyticsSceneLogic'
+
+export interface ProductTab {
+ key: EngineeringAnalyticsView
+ label: string
+ /** The tab's path inside a repository ('owner/name'). */
+ url: (repo?: string | null) => string
+ dataAttr: string
+}
+
+/** The product's top-level areas, in tab order. Detail pages render inside the tab they drill down from. */
+export const PRODUCT_TABS: ProductTab[] = [
+ { key: 'hub', label: 'Overview', url: urls.engineeringAnalytics, dataAttr: 'engineering-analytics-overview-tab' },
+ {
+ key: 'pull-requests',
+ label: 'Pull requests',
+ url: urls.engineeringAnalyticsPullRequestList,
+ dataAttr: 'engineering-analytics-pull-requests-tab',
+ },
+ {
+ key: 'workflows',
+ label: 'Workflows',
+ url: urls.engineeringAnalyticsWorkflows,
+ dataAttr: 'engineering-analytics-workflows-tab',
+ },
+ {
+ key: 'tests',
+ label: 'Tests',
+ url: urls.engineeringAnalyticsTests,
+ // Pinned because autocapture dashboards and selectors use the original value.
+ dataAttr: 'engineering-analytics-test-health-tab',
+ },
+ {
+ key: 'deploys',
+ label: 'Deploys',
+ url: urls.engineeringAnalyticsDeploys,
+ // Pinned because autocapture dashboards and selectors use the original value.
+ dataAttr: 'engineering-analytics-health-tab',
+ },
+ { key: 'teams', label: 'Teams', url: urls.engineeringAnalyticsTeams, dataAttr: 'engineering-analytics-teams-tab' },
+ {
+ key: 'authors',
+ label: 'Authors',
+ url: urls.engineeringAnalyticsAuthors,
+ dataAttr: 'engineering-analytics-authors-tab',
+ },
+]
diff --git a/products/engineering_analytics/frontend/lib/repoBreadcrumbs.ts b/products/engineering_analytics/frontend/lib/repoBreadcrumbs.ts
new file mode 100644
index 000000000000..2c5ebdb4db56
--- /dev/null
+++ b/products/engineering_analytics/frontend/lib/repoBreadcrumbs.ts
@@ -0,0 +1,22 @@
+import { urls } from 'scenes/urls'
+
+import { Breadcrumb } from '~/types'
+
+import { withScope } from './scope'
+
+/** The crumbs every page shares, so the top bar reads the same on detail pages as on tabs. */
+export function repoBreadcrumbs(
+ repo: string | null,
+ searchParams: Record<string, string | undefined> = {},
+ sourceId: string | null = null
+): Breadcrumb[] {
+ return [
+ {
+ key: 'EngineeringAnalytics',
+ name: 'Engineering analytics',
+ path: withScope(urls.engineeringAnalytics(repo), searchParams, sourceId),
+ iconType: 'health',
+ },
+ ...(repo ? [{ key: ['EngineeringAnalyticsRepo', repo], name: repo, iconType: 'health' } as Breadcrumb] : []),
+ ]
+}
diff --git a/products/engineering_analytics/frontend/lib/repoScope.ts b/products/engineering_analytics/frontend/lib/repoScope.ts
index e0ee6bed7180..7af1ca5dff24 100644
--- a/products/engineering_analytics/frontend/lib/repoScope.ts
+++ b/products/engineering_analytics/frontend/lib/repoScope.ts
@@ -63,14 +63,18 @@ export function repoPathFor(pathname: string, repo: string): string {
return `${repoPrefix(repoOwner, repoName)}${rest && rest !== '/' ? rest : '/overview'}`
}
-/** Where switching to `repo` lands: the same page in that repository, or the list tab for an entity page. */
-export function switchRepoPath(pathname: string, repo: string): string {
+/** Where switching to `repo` lands: the same page in that repository, or the list tab for an entity page.
+ * A null repo is a legacy source that names none, so it lands on the repo-less form of that page. */
+export function switchRepoPath(pathname: string, repo: string | null): string {
const match = REPO_PATH.exec(pathname)
if (!match) {
- return repoPathFor(pathname, repo)
+ return repo ? repoPathFor(pathname, repo) : pathname
}
const rest = match[3] ?? '/overview'
const entityTab = ENTITY_TAB.find(([pattern]) => pattern.test(rest))?.[1]
+ if (!repo) {
+ return `${PRODUCT_ROOT}${entityTab ?? rest}`
+ }
const [repoOwner, repoName] = repo.split('/')
return `${repoPrefix(repoOwner, repoName)}${entityTab ?? rest}`
}
diff --git a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
index ea121a3b4562..3cdd43c0786c 100644
--- a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
@@ -5,16 +5,20 @@ import { LemonButton, LemonSkeleton, LemonTabs, Link, Tooltip } from '@posthog/l
import { TZLabel } from 'lib/components/TZLabel'
import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { CIExplorerActivity } from '../components/ciExplorer/CIExplorerActivity'
import { CIExplorerOverview } from '../components/ciExplorer/CIExplorerOverview'
import { CIExplorerSummaryCounts } from '../components/ciExplorer/CIExplorerSummaryCounts'
import { EntityHeader } from '../components/EntityHeader'
+import { ProductNav } from '../components/ProductNav'
import { PullRequestStateTag } from '../components/PullRequestStateTag'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
+import { ScopeBar } from '../components/ScopeBar'
+import { withCurrentScope } from '../lib/scope'
import { CIExplorerLogicProps, CIExplorerView, ciExplorerLogic } from './ciExplorerLogic'
import { repoScopeLogic } from './repoScopeLogic'
@@ -46,6 +50,7 @@ export function CIExplorerScene(): JSX.Element {
freshnessLoading,
refreshing,
} = useValues(ciExplorerLogic)
+ const { repoOwner, repoName, number, sourceId } = useMountedLogic(ciExplorerLogic).props
const { loadPrRuns, refresh } = useActions(ciExplorerLogic)
const pullRequest = lifecycle?.pull_request
@@ -54,9 +59,8 @@ export function CIExplorerScene(): JSX.Element {
return (
<SceneContent className="pb-4">
- <SceneTitleSection
- name="CI explorer"
- resourceType={{ type: 'health' }}
+ <RepoSceneTitle
+ repo={`${repoOwner}/${repoName}`}
actions={
<LemonButton
type="secondary"
@@ -69,75 +73,93 @@ export function CIExplorerScene(): JSX.Element {
}
/>
- {pullRequest && (
- <EntityHeader
- icon={<IconPullRequest />}
- title={pullRequest.title}
- slug={
- <>
- <PullRequestStateTag state={pullRequest.state} isDraft={pullRequest.is_draft} />
- <Link to={pullRequestUrl}>
- {pullRequest.repo.owner}/{pullRequest.repo.name} #{pullRequest.number}
- </Link>
- </>
- }
- right={view === 'overview' && activePush ? <CIExplorerSummaryCounts /> : undefined}
- />
- )}
-
- <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-primary">
- <LemonTabs
- activeKey={currentView}
- // Each tab is a link, so the router makes the change and Back undoes it.
- onChange={() => {}}
- tabs={[
- { key: 'overview', label: 'Overview', link: viewUrl('overview') },
- { key: 'activity', label: 'Activity', link: viewUrl('activity') },
- ]}
- barClassName="mb-0 border-b-0"
- data-attr="ci-explorer-views"
- />
- <div className="flex items-center gap-2 pb-1 text-xs text-secondary">
- <Tooltip title="Last sync of the stored CI data. Refresh reloads it and does not start a sync.">
- <span>
- {syncedAt ? (
+ <ProductNav activeTab="pull-requests" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ <ScopeBar
+ crumbs={[
+ {
+ label: 'Pull requests',
+ to: withCurrentScope(
+ urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),
+ sourceId
+ ),
+ },
+ { label: `#${number}`, to: pullRequestUrl },
+ { label: 'CI explorer' },
+ ]}
+ showDate={false}
+ />
+ {pullRequest && (
+ <EntityHeader
+ icon={<IconPullRequest />}
+ title={pullRequest.title}
+ slug={
<>
- Synced <TZLabel time={syncedAt} />
+ <PullRequestStateTag state={pullRequest.state} isDraft={pullRequest.is_draft} />
+ <Link to={pullRequestUrl}>
+ {pullRequest.repo.owner}/{pullRequest.repo.name} #{pullRequest.number}
+ </Link>
</>
- ) : freshnessLoading ? (
- 'Checking sync time'
- ) : (
- 'Sync time unknown'
- )}
- </span>
- </Tooltip>
- <LemonButton
- type="secondary"
- size="xsmall"
- icon={<IconRefresh />}
- onClick={refresh}
- loading={busy}
- disabledReason={busy ? 'Loading' : undefined}
- data-attr="ci-explorer-refresh"
- >
- Refresh
- </LemonButton>
- </div>
- </div>
+ }
+ right={view === 'overview' && activePush ? <CIExplorerSummaryCounts /> : undefined}
+ />
+ )}
- {loadFailed ? (
- <CIAnalyticsLoadError
- onRetry={loadPrRuns}
- loading={prRunsLoading}
- title="Couldn't load this pull request's CI runs"
- />
- ) : prRuns === null ? (
- <LemonSkeleton className="h-96 w-full" />
- ) : view === 'activity' ? (
- <CIExplorerActivity />
- ) : (
- <CIExplorerOverview />
- )}
+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-primary">
+ <LemonTabs
+ activeKey={currentView}
+ // Each tab is a link, so the router makes the change and Back undoes it.
+ onChange={() => {}}
+ tabs={[
+ { key: 'overview', label: 'Overview', link: viewUrl('overview') },
+ { key: 'activity', label: 'Activity', link: viewUrl('activity') },
+ ]}
+ barClassName="mb-0 border-b-0"
+ data-attr="ci-explorer-views"
+ />
+ <div className="flex items-center gap-2 pb-1 text-xs text-secondary">
+ <Tooltip title="Last sync of the stored CI data. Refresh reloads it and does not start a sync.">
+ <span>
+ {syncedAt ? (
+ <>
+ Synced <TZLabel time={syncedAt} />
+ </>
+ ) : freshnessLoading ? (
+ 'Checking sync time'
+ ) : (
+ 'Sync time unknown'
+ )}
+ </span>
+ </Tooltip>
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ icon={<IconRefresh />}
+ onClick={refresh}
+ loading={busy}
+ disabledReason={busy ? 'Loading' : undefined}
+ data-attr="ci-explorer-refresh"
+ >
+ Refresh
+ </LemonButton>
+ </div>
+ </div>
+
+ {loadFailed ? (
+ <CIAnalyticsLoadError
+ onRetry={loadPrRuns}
+ loading={prRunsLoading}
+ title="Couldn't load this pull request's CI runs"
+ />
+ ) : prRuns === null ? (
+ <LemonSkeleton className="h-96 w-full" />
+ ) : view === 'activity' ? (
+ <CIExplorerActivity />
+ ) : (
+ <CIExplorerOverview />
+ )}
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
index 8e7313cbd886..bb1581cfee54 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
@@ -10,15 +10,16 @@ import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { AuthorFrictionCard } from '../components/AuthorFrictionCard'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { EntityHeader, VerdictPill } from '../components/EntityHeader'
+import { ProductNav } from '../components/ProductNav'
import { PullRequestDayView } from '../components/PullRequestDayView'
import { RedTimeByCauseCard } from '../components/RedTimeByCauseCard'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
import { formatCost, formatMinutes } from '../components/runTables'
-import { DELIVERY_DATE_OPTIONS, RepoScopeChip, ScopeBar, ScopeDateFilter } from '../components/ScopeBar'
+import { DELIVERY_DATE_OPTIONS, ScopeBar, ScopeDateFilter } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
import { ShareRow } from '../components/ShareRow'
@@ -73,8 +74,7 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {
} = useValues(timelinesLogic)
const { loadTimelines, setDayViewAlignment } = useActions(timelinesLogic)
- const hubUrl = withCurrentScope(urls.engineeringAnalytics(repo), sourceId)
- const pullRequestsUrl = withCurrentScope(urls.engineeringAnalyticsPullRequestList(repo), sourceId)
+ const authorsUrl = withCurrentScope(urls.engineeringAnalyticsAuthors(repo), sourceId)
const avatarUrl = timelines?.items[0]?.author.avatar_url
const workflowCostsTotal = workflowCosts.reduce((sum, c) => sum + (c.estimated_cost_usd ?? 0), 0)
// Ranked, biggest spend first; the bar length is each workflow's share of the window's total.
@@ -84,156 +84,162 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Author" resourceType={{ type: 'health' }} />
- <ScopeBar
- repoSlot={
- <RepoScopeChip
- label={
- repoSlugs.length === 1 ? repoSlugs[0] : repoSlugs.length ? 'All repositories' : 'Repository'
+ <RepoSceneTitle repo={repo} />
+ <ProductNav activeTab="authors" repo={repo} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ <ScopeBar crumbs={[{ label: 'Authors', to: authorsUrl }, { label: handle }]} showDate={false} />
+ <EntityHeader
+ icon={
+ avatarUrl ? (
+ <img src={avatarUrl} alt="" className="size-10 rounded-lg" />
+ ) : (
+ <Lettermark name={handle} />
+ )
+ }
+ title={handle}
+ slug={
+ <Link
+ to={`https://github.com/${encodeURIComponent(handle)}`}
+ target="_blank"
+ targetBlankIcon
+ >
+ github.com/{handle}
+ </Link>
+ }
+ right={
+ summary ? (
+ <VerdictPill kind="muted">{pluralize(summary.open_pr_count, 'open PR')}</VerdictPill>
+ ) : undefined
}
- to={hubUrl}
/>
- }
- lensFilter={{ label: `author: ${handle}`, to: pullRequestsUrl }}
- showDate={false}
- />
- <EntityHeader
- icon={
- avatarUrl ? (
- <img src={avatarUrl} alt="" className="size-10 rounded-lg" />
- ) : (
- <Lettermark name={handle} />
- )
- }
- title={handle}
- slug={
- <Link to={`https://github.com/${encodeURIComponent(handle)}`} target="_blank" targetBlankIcon>
- github.com/{handle}
- </Link>
- }
- right={
- summary ? (
- <VerdictPill kind="muted">{pluralize(summary.open_pr_count, 'open PR')}</VerdictPill>
- ) : undefined
- }
- />
- {/* The page explains one author's own friction against the repository and the author's own team. The
+ {/* The page explains one author's own friction against the repository and the author's own team. The
friction rank orders experiences, never delivery performance (SPEC §2). It reads a fixed window, so it
sits outside the panel the date picker governs. */}
- <Section id="author-friction" title="Friction" note={`Last ${frictionDetail?.window_days ?? 30} days`}>
- {frictionDetailFailed ? (
- <CIAnalyticsLoadError onRetry={loadFrictionDetail} />
- ) : (
- <AuthorFrictionCard detail={frictionDetail} loading={frictionDetailLoading} sourceId={sourceId} />
- )}
- </Section>
- <ScopePanel
- busy={summaryLoading || comparisonLoading || timelinesLoading || workflowCostsLoading}
- controls={<ScopeDateFilter dateOptions={DELIVERY_DATE_OPTIONS} />}
- >
- <DeliverySections
- scope={deliveryScope}
- scopeLabel="This author"
- sourceId={sourceId}
- repo={repo}
- // Both reads keep their previous window while they reload, so the team rows wait for both.
- comparison={comparisonLoading || summaryLoading ? null : comparison}
- comparisonFailed={comparisonFailed}
- />
-
- <Section id="delivery-pull-requests" title="Pull requests">
- {timelinesFailed ? (
- <CIAnalyticsLoadError onRetry={loadTimelines} />
- ) : (
- <div className="flex flex-col gap-2">
- <RedTimeByCauseCard
- redTime={redTime}
- loading={timelinesLoading}
- jobsAvailable={!!timelines?.jobs_available}
- />
- <PullRequestDayView
- timelines={timelines}
- groups={dayViewGroups}
- days={dayViewAxisDays}
- alignment={dayViewAlignment}
- onAlignmentChange={setDayViewAlignment}
- loading={timelinesLoading}
+ <Section
+ id="author-friction"
+ title="Friction"
+ note={`Last ${frictionDetail?.window_days ?? 30} days`}
+ >
+ {frictionDetailFailed ? (
+ <CIAnalyticsLoadError onRetry={loadFrictionDetail} />
+ ) : (
+ <AuthorFrictionCard
+ detail={frictionDetail}
+ loading={frictionDetailLoading}
sourceId={sourceId}
/>
- </div>
- )}
- </Section>
+ )}
+ </Section>
+ <ScopePanel
+ busy={summaryLoading || comparisonLoading || timelinesLoading || workflowCostsLoading}
+ controls={<ScopeDateFilter dateOptions={DELIVERY_DATE_OPTIONS} />}
+ >
+ <DeliverySections
+ scope={deliveryScope}
+ scopeLabel="This author"
+ sourceId={sourceId}
+ repo={repo}
+ // Both reads keep their previous window while they reload, so the team rows wait for both.
+ comparison={comparisonLoading || summaryLoading ? null : comparison}
+ comparisonFailed={comparisonFailed}
+ />
- <Section id="author-cost" title="Where their CI minutes go">
- {workflowCostsLoading ? (
- <LemonCard hoverEffect={false} className="p-4">
- <LemonSkeleton className="mb-3 h-4 w-24" />
- {Array.from({ length: 6 }).map((_, i) => (
- <div
- key={i}
- className="flex items-center gap-3 border-b border-primary px-1 py-2 last:border-b-0"
- >
- <div className="w-48 shrink-0">
- <LemonSkeleton className="h-3.5 w-32" />
- <LemonSkeleton className="mt-1.5 h-2.5 w-20" />
- </div>
- <LemonSkeleton className="h-2 flex-1" />
- <LemonSkeleton className="h-3.5 w-12 shrink-0" />
- </div>
- ))}
- </LemonCard>
- ) : workflowCostsFailed ? (
- <CIAnalyticsLoadError onRetry={loadWorkflowCosts} />
- ) : workflowCosts.length > 0 ? (
- <LemonCard hoverEffect={false} className="p-4">
- <div className="mb-2 flex items-center justify-between gap-2">
- <h3 className="m-0 text-xs font-semibold text-secondary">By workflow</h3>
- <span className="text-xs tabular-nums text-tertiary">
- {formatCost(workflowCostsTotal)} total
- </span>
- </div>
- {rankedCosts.slice(0, 8).map((cost) => {
- const usd = cost.estimated_cost_usd ?? 0
- const share = workflowCostsTotal > 0 ? usd / workflowCostsTotal : 0
- return (
- <ShareRow
- key={cost.workflow_name || '(unknown)'}
- label={cost.workflow_name || '(unknown workflow)'}
- sub={`${formatMinutes(cost.billable_minutes)} billable`}
- value={formatCost(usd)}
- valueSub={`${Math.round(share * 100)}%`}
- share={share}
- color="var(--data-color-1)"
- fullWidthBar
- to={
- singleRepo
- ? combineUrl(
- urls.engineeringAnalyticsWorkflowRuns(
- singleRepo.owner,
- singleRepo.name,
- cost.workflow_name
- ),
- sourceId ? { source: sourceId } : {}
- ).url
- : undefined
- }
+ <Section id="delivery-pull-requests" title="Pull requests">
+ {timelinesFailed ? (
+ <CIAnalyticsLoadError onRetry={loadTimelines} />
+ ) : (
+ <div className="flex flex-col gap-2">
+ <RedTimeByCauseCard
+ redTime={redTime}
+ loading={timelinesLoading}
+ jobsAvailable={!!timelines?.jobs_available}
+ />
+ <PullRequestDayView
+ timelines={timelines}
+ groups={dayViewGroups}
+ days={dayViewAxisDays}
+ alignment={dayViewAlignment}
+ onAlignmentChange={setDayViewAlignment}
+ loading={timelinesLoading}
+ sourceId={sourceId}
/>
- )
- })}
- {workflowCosts.length > 8 && (
- <div className="pt-2 text-xs text-tertiary">
- +{workflowCosts.length - 8} more{' '}
- {pluralize(workflowCosts.length - 8, 'workflow', undefined, false)}, not shown
</div>
)}
- </LemonCard>
- ) : (
- <span className="text-xs text-secondary">
- No cost data yet. The job-level source isn't synced, or nothing ran in the window.
- </span>
- )}
- </Section>
- </ScopePanel>
+ </Section>
+
+ <Section id="author-cost" title="Where their CI minutes go">
+ {workflowCostsLoading ? (
+ <LemonCard hoverEffect={false} className="p-4">
+ <LemonSkeleton className="mb-3 h-4 w-24" />
+ {Array.from({ length: 6 }).map((_, i) => (
+ <div
+ key={i}
+ className="flex items-center gap-3 border-b border-primary px-1 py-2 last:border-b-0"
+ >
+ <div className="w-48 shrink-0">
+ <LemonSkeleton className="h-3.5 w-32" />
+ <LemonSkeleton className="mt-1.5 h-2.5 w-20" />
+ </div>
+ <LemonSkeleton className="h-2 flex-1" />
+ <LemonSkeleton className="h-3.5 w-12 shrink-0" />
+ </div>
+ ))}
+ </LemonCard>
+ ) : workflowCostsFailed ? (
+ <CIAnalyticsLoadError onRetry={loadWorkflowCosts} />
+ ) : workflowCosts.length > 0 ? (
+ <LemonCard hoverEffect={false} className="p-4">
+ <div className="mb-2 flex items-center justify-between gap-2">
+ <h3 className="m-0 text-xs font-semibold text-secondary">By workflow</h3>
+ <span className="text-xs tabular-nums text-tertiary">
+ {formatCost(workflowCostsTotal)} total
+ </span>
+ </div>
+ {rankedCosts.slice(0, 8).map((cost) => {
+ const usd = cost.estimated_cost_usd ?? 0
+ const share = workflowCostsTotal > 0 ? usd / workflowCostsTotal : 0
+ return (
+ <ShareRow
+ key={cost.workflow_name || '(unknown)'}
+ label={cost.workflow_name || '(unknown workflow)'}
+ sub={`${formatMinutes(cost.billable_minutes)} billable`}
+ value={formatCost(usd)}
+ valueSub={`${Math.round(share * 100)}%`}
+ share={share}
+ color="var(--data-color-1)"
+ fullWidthBar
+ to={
+ singleRepo
+ ? combineUrl(
+ urls.engineeringAnalyticsWorkflowRuns(
+ singleRepo.owner,
+ singleRepo.name,
+ cost.workflow_name
+ ),
+ sourceId ? { source: sourceId } : {}
+ ).url
+ : undefined
+ }
+ />
+ )
+ })}
+ {workflowCosts.length > 8 && (
+ <div className="pt-2 text-xs text-tertiary">
+ +{workflowCosts.length - 8} more{' '}
+ {pluralize(workflowCosts.length - 8, 'workflow', undefined, false)}, not
+ shown
+ </div>
+ )}
+ </LemonCard>
+ ) : (
+ <span className="text-xs text-secondary">
+ No cost data yet. The job-level source isn't synced, or nothing ran in the window.
+ </span>
+ )}
+ </Section>
+ </ScopePanel>
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx
index 549902ad00a2..f7e0e62e2299 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx
@@ -6,7 +6,6 @@ import { AuthorFrictionTable } from '../components/AuthorFrictionTable'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
import { FrictionGroupLegend } from '../components/FrictionGroupLegend'
-import { SourceScopeChip } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
import { authorFrictionLogic } from './authorFrictionLogic'
@@ -55,7 +54,7 @@ export function EngineeringAnalyticsAuthors(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <ScopePanel busy={frictionLoading && !!friction} controls={<SourceScopeChip pickerOnly />}>
+ <ScopePanel busy={frictionLoading && !!friction} controls={null}>
<Section
id="author-friction"
title="Friction by author"
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.tsx
index cb24c804f9ea..539171aadfe3 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.tsx
@@ -6,7 +6,7 @@ import { dayjs } from 'lib/dayjs'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
-import { ScopeBar, ScopeDateFilter, SourceScopeChip } from '../components/ScopeBar'
+import { ScopeDateFilter } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { DoraDeploymentFrequency } from './DoraDeploymentFrequency'
import { DoraDeploymentHealth } from './DoraDeploymentHealth'
@@ -28,7 +28,6 @@ export function EngineeringAnalyticsDeploys(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <ScopeBar repoSlot={<SourceScopeChip />} showDate={false} />
{dora?.latest_deploy_status_at && (
<span className="text-xs text-tertiary" data-attr="engineering-analytics-dora-freshness">
Latest deploy status synced {dayjs(dora.latest_deploy_status_at).fromNow()}.
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
index c1630bb983b3..fc28454d1f46 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
@@ -5,7 +5,6 @@ import { LemonButton, LemonCard, LemonInput, LemonSegmentedButton, LemonSelect }
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
import { DeliveryPipeline } from '../components/DeliveryPipeline'
-import { RepoEntityHeader } from '../components/EntityHeader'
import { PullRequestJumpInput } from '../components/PullRequestJumpInput'
import { PullRequestTable } from '../components/PullRequestTable'
import { ScopePanel } from '../components/ScopePanel'
@@ -32,7 +31,6 @@ export function EngineeringAnalyticsPullRequests(): JSX.Element {
readyCount,
thrashCount,
sourceId,
- activeSource,
notConnected,
pullRequestsLoadError,
} = useValues(engineeringAnalyticsLogic)
@@ -86,8 +84,7 @@ export function EngineeringAnalyticsPullRequests(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <div className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2">
- <RepoEntityHeader repoFullName={activeSource?.repo || ''} />
+ <div className="flex flex-wrap justify-end">
<PullRequestJumpInput />
</div>
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
index 31c2e7b3804c..3edf61a3c3b8 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
@@ -1,15 +1,14 @@
import { BindLogic, useActions, useValues } from 'kea'
-import { combineUrl, router } from 'kea-router'
-import { LemonBanner, LemonButton, LemonTab, LemonTabs } from '@posthog/lemon-ui'
+import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
import { SceneExport } from 'scenes/sceneTypes'
-import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ProductKey } from '~/queries/schema/schema-general'
+import { ProductNav } from '../components/ProductNav'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
import { engineeringAnalyticsEmptyState } from '../emptyState/engineeringAnalyticsEmptyState'
import { doraLogic } from './doraLogic'
import { EngineeringAnalyticsAuthors } from './EngineeringAnalyticsAuthors'
@@ -18,7 +17,7 @@ import { engineeringAnalyticsLogic } from './engineeringAnalyticsLogic'
import { EngineeringAnalyticsPullRequests } from './EngineeringAnalyticsPullRequests'
import {
EngineeringAnalyticsView,
- VIEW_DESCRIPTIONS,
+ viewDescription,
engineeringAnalyticsSceneLogic,
} from './engineeringAnalyticsSceneLogic'
import { EngineeringAnalyticsTeams } from './EngineeringAnalyticsTeams'
@@ -60,81 +59,58 @@ function DeploysRefreshButton(): JSX.Element {
return <RefreshButton extraLoading={doraLoading} />
}
+// Each tab's own page. Detail pages render beneath their tab through ProductNav too.
+const TAB_CONTENT: Record<EngineeringAnalyticsView, () => JSX.Element> = {
+ hub: () => <RepoOverviewScene />,
+ 'pull-requests': () => <EngineeringAnalyticsPullRequests />,
+ workflows: () => <EngineeringAnalyticsWorkflows />,
+ tests: () => <EngineeringAnalyticsTests />,
+ deploys: () => <EngineeringAnalyticsDeploys />,
+ teams: () => <EngineeringAnalyticsTeams />,
+ authors: () => <EngineeringAnalyticsAuthors />,
+}
+
+function EngineeringAnalyticsTabs(): JSX.Element {
+ const { activeView } = useValues(engineeringAnalyticsSceneLogic)
+ const { scopeRepo, sourceId } = useValues(engineeringAnalyticsLogic)
+ return (
+ <ProductNav activeTab={activeView} repo={scopeRepo} sourceId={sourceId}>
+ {TAB_CONTENT[activeView]()}
+ </ProductNav>
+ )
+}
+
export function EngineeringAnalyticsScene(): JSX.Element {
- const { searchParams } = useValues(router)
const { activeView } = useValues(engineeringAnalyticsSceneLogic)
const { scopeRepo } = useValues(engineeringAnalyticsLogic)
- // The repository rides in the path, so an old `?repo` must not follow the tabs.
- const { repo: _repo, ...linkParams } = searchParams
-
- // The general areas of the product. A drill-down page sits below the tab it opens from.
- const tabs: LemonTab<EngineeringAnalyticsView>[] = [
- {
- key: 'hub',
- label: 'Overview',
- content: <RepoOverviewScene />,
- link: combineUrl(urls.engineeringAnalytics(scopeRepo), linkParams).url,
- 'data-attr': 'engineering-analytics-overview-tab',
- },
- {
- key: 'pull-requests',
- label: 'Pull requests',
- content: <EngineeringAnalyticsPullRequests />,
- link: combineUrl(urls.engineeringAnalyticsPullRequestList(scopeRepo), linkParams).url,
- 'data-attr': 'engineering-analytics-pull-requests-tab',
- },
- {
- key: 'workflows',
- label: 'Workflows',
- content: <EngineeringAnalyticsWorkflows />,
- link: combineUrl(urls.engineeringAnalyticsWorkflows(scopeRepo), linkParams).url,
- 'data-attr': 'engineering-analytics-workflows-tab',
- },
- {
- key: 'tests',
- label: 'Tests',
- content: <EngineeringAnalyticsTests />,
- link: combineUrl(urls.engineeringAnalyticsTests(scopeRepo), linkParams).url,
- // Pinned because autocapture dashboards and selectors use the original value.
- 'data-attr': 'engineering-analytics-test-health-tab',
- },
- {
- key: 'deploys',
- label: 'Deploys',
- content: <EngineeringAnalyticsDeploys />,
- link: combineUrl(urls.engineeringAnalyticsDeploys(scopeRepo), linkParams).url,
- // Pinned because autocapture dashboards and selectors use the original value.
- 'data-attr': 'engineering-analytics-health-tab',
- },
- {
- key: 'teams',
- label: 'Teams',
- content: <EngineeringAnalyticsTeams />,
- link: combineUrl(urls.engineeringAnalyticsTeams(scopeRepo), linkParams).url,
- 'data-attr': 'engineering-analytics-teams-tab',
- },
- {
- key: 'authors',
- label: 'Authors',
- content: <EngineeringAnalyticsAuthors />,
- link: combineUrl(urls.engineeringAnalyticsAuthors(scopeRepo), linkParams).url,
- 'data-attr': 'engineering-analytics-authors-tab',
- },
- ]
return (
<BindLogic logic={engineeringAnalyticsLogic} props={{}}>
<SceneContent className="pb-16">
- <SceneTitleSection
- name="Engineering analytics"
- description={VIEW_DESCRIPTIONS[activeView]}
- resourceType={{ type: 'health' }}
- actions={activeView === 'deploys' ? <DeploysRefreshButton /> : <RefreshButton />}
+ <RepoSceneTitle
+ repo={scopeRepo}
+ description={viewDescription(activeView, scopeRepo)}
+ actions={
+ <>
+ {scopeRepo && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={`https://github.com/${scopeRepo}`}
+ targetBlank
+ data-attr="engineering-analytics-view-on-github"
+ >
+ View on GitHub
+ </LemonButton>
+ )}
+ {activeView === 'deploys' ? <DeploysRefreshButton /> : <RefreshButton />}
+ </>
+ }
/>
<LemonBanner type="info" dismissKey="engineering-analytics-alpha">
Engineering analytics is in alpha. Metrics are limited to CI events, and details may change.
</LemonBanner>
- <LemonTabs activeKey={activeView} data-attr="engineering-analytics-tabs" tabs={tabs} sceneInset />
+ <EngineeringAnalyticsTabs />
</SceneContent>
</BindLogic>
)
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
index d70f4c10ae22..ab6afa03d8e7 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
@@ -11,13 +11,14 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
import { CountCell } from '../components/CountCell'
import { EntityHeader } from '../components/EntityHeader'
-import { RepoScopeChip, ScopeBar, ScopeDateFilter } from '../components/ScopeBar'
+import { ProductNav } from '../components/ProductNav'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
+import { ScopeBar, ScopeDateFilter } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
import { TeamQuarantinedTestsTable } from '../components/TeamQuarantinedTestsTable'
@@ -70,7 +71,6 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
const isUnowned = ownerTeam === UNOWNED_TEAM
const mainDataNotConnected = [activityStatus, healthRowStatus, mergeTrendStatus].includes('notConnected')
- const hubUrl = withCurrentScope(urls.engineeringAnalytics(repo), sourceId)
const teamsUrl = withCurrentScope(urls.engineeringAnalyticsTeams(repo), sourceId)
const testColumns: LemonTableColumns<TeamTestSignalRow> = [
@@ -210,116 +210,123 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Team" resourceType={{ type: 'health' }} />
- <ScopeBar
- repoSlot={<RepoScopeChip label={repository ?? 'repository'} to={hubUrl} />}
- crumbs={[{ label: 'teams', to: teamsUrl }, { label: isUnowned ? 'unowned' : ownerTeam }]}
- showDate={false}
- />
- <EntityHeader
- icon={<IconPeople />}
- title={isUnowned ? 'Unowned surfaces' : ownerTeam}
- titleSuffix={
- isUnowned ? (
- <Tooltip title="Tests whose CI spans carry no ownership stamp. An ownership gap to close, not a real team.">
- <LemonTag type="warning">ownership gap</LemonTag>
- </Tooltip>
- ) : undefined
- }
- slug={null}
- />
-
- {mainDataNotConnected ? (
- <ConnectGitHubSource />
- ) : (
- <>
- {/* Friction reads a fixed window, so it sits above the panel the date picker governs, as on the
- author page. */}
- {!isUnowned && <TeamFrictionSection githubTeam={ownerTeam} />}
+ <RepoSceneTitle repo={repo} />
+ <ProductNav activeTab="teams" repo={repo} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ <ScopeBar
+ crumbs={[{ label: 'Teams', to: teamsUrl }, { label: isUnowned ? 'unowned' : ownerTeam }]}
+ showDate={false}
+ />
+ <EntityHeader
+ icon={<IconPeople />}
+ title={isUnowned ? 'Unowned surfaces' : ownerTeam}
+ titleSuffix={
+ isUnowned ? (
+ <Tooltip title="Tests whose CI spans carry no ownership stamp. An ownership gap to close, not a real team.">
+ <LemonTag type="warning">ownership gap</LemonTag>
+ </Tooltip>
+ ) : undefined
+ }
+ slug={null}
+ />
- {deliveryScope ? (
- <TeamDeliveryPanel
- scope={deliveryScope}
- sourceId={sourceId}
- repo={repo}
- busy={windowBusy}
- controls={windowControls}
- >
- {windowedSections}
- </TeamDeliveryPanel>
+ {mainDataNotConnected ? (
+ <ConnectGitHubSource />
) : (
- <ScopePanel busy={windowBusy} controls={windowControls}>
- {windowedSections}
- </ScopePanel>
- )}
+ <>
+ {/* Friction reads a fixed window, so it sits above the panel the date picker governs, as on the
+ author page. */}
+ {!isUnowned && <TeamFrictionSection githubTeam={ownerTeam} />}
- <Section id="team-tests" title="Owned tests with signal" busy={activityLoading && !!activity}>
- {activityStatus === 'error' ? (
- <CIAnalyticsLoadError onRetry={loadActivity} loading={activityLoading} />
- ) : (
- <LemonTable
- data-attr="engineering-analytics-team-tests-table"
- size="small"
- columns={testColumns}
- dataSource={activity?.tests ?? []}
- rowKey={(row) => `${row.runner}:${row.nodeid}`}
- loading={activityLoading}
- pagination={{ pageSize: 25 }}
- useURLForSorting={false}
- emptyState="No owned tests with signal."
- nouns={['test', 'tests']}
- />
- )}
- {activity?.truncatedTests && (
- <div className="mt-2 text-xs text-tertiary">
- Showing the strongest signals. More owned tests had signal.
- </div>
- )}
- </Section>
+ {deliveryScope ? (
+ <TeamDeliveryPanel
+ scope={deliveryScope}
+ sourceId={sourceId}
+ repo={repo}
+ busy={windowBusy}
+ controls={windowControls}
+ >
+ {windowedSections}
+ </TeamDeliveryPanel>
+ ) : (
+ <ScopePanel busy={windowBusy} controls={windowControls}>
+ {windowedSections}
+ </ScopePanel>
+ )}
- <Section
- id="team-quarantined-tests"
- title="Quarantined tests"
- busy={trunkQuarantineLoading && !!trunkQuarantine}
- >
- {trunkQuarantineStatus === 'error' ? (
- <CIAnalyticsLoadError
- title="Couldn't load quarantined tests"
- description="Loading Trunk quarantine data failed. Retry, or check the source's sync status."
- onRetry={loadTrunkQuarantine}
- loading={trunkQuarantineLoading}
- />
- ) : trunkQuarantineLoading && !trunkQuarantine ? (
- <LemonSkeleton className="h-32 w-full" />
- ) : trunkQuarantineStatus === 'notConnected' || !trunkQuarantine?.available ? (
- <div className="py-8 text-center text-sm text-secondary">
- No Trunk source is connected. Connect the Trunk.io data warehouse source to see this
- team's quarantined tests.
- </div>
- ) : !trunkQuarantine.ownersResolved ? (
- <LemonBanner type="warning">
- We could not read {trunkQuarantine.repository}'s ownership files, so quarantined tests
- can't be matched to teams. Try again in a few minutes.
- </LemonBanner>
- ) : (
- <>
- <TeamQuarantinedTestsTable
- tests={quarantinedTests}
- ttlDays={trunkQuarantine.ttlDays}
- repository={trunkQuarantine.repository}
- loading={trunkQuarantineLoading}
- />
- {trunkQuarantine.truncated && (
+ <Section
+ id="team-tests"
+ title="Owned tests with signal"
+ busy={activityLoading && !!activity}
+ >
+ {activityStatus === 'error' ? (
+ <CIAnalyticsLoadError onRetry={loadActivity} loading={activityLoading} />
+ ) : (
+ <LemonTable
+ data-attr="engineering-analytics-team-tests-table"
+ size="small"
+ columns={testColumns}
+ dataSource={activity?.tests ?? []}
+ rowKey={(row) => `${row.runner}:${row.nodeid}`}
+ loading={activityLoading}
+ pagination={{ pageSize: 25 }}
+ useURLForSorting={false}
+ emptyState="No owned tests with signal."
+ nouns={['test', 'tests']}
+ />
+ )}
+ {activity?.truncatedTests && (
<div className="mt-2 text-xs text-tertiary">
- Showing quarantined tests from the oldest {trunkQuarantine.limit} in the
- repository. This team may have more.
+ Showing the strongest signals. More owned tests had signal.
</div>
)}
- </>
- )}
- </Section>
- </>
- )}
+ </Section>
+
+ <Section
+ id="team-quarantined-tests"
+ title="Quarantined tests"
+ busy={trunkQuarantineLoading && !!trunkQuarantine}
+ >
+ {trunkQuarantineStatus === 'error' ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load quarantined tests"
+ description="Loading Trunk quarantine data failed. Retry, or check the source's sync status."
+ onRetry={loadTrunkQuarantine}
+ loading={trunkQuarantineLoading}
+ />
+ ) : trunkQuarantineLoading && !trunkQuarantine ? (
+ <LemonSkeleton className="h-32 w-full" />
+ ) : trunkQuarantineStatus === 'notConnected' || !trunkQuarantine?.available ? (
+ <div className="py-8 text-center text-sm text-secondary">
+ No Trunk source is connected. Connect the Trunk.io data warehouse source to see
+ this team's quarantined tests.
+ </div>
+ ) : !trunkQuarantine.ownersResolved ? (
+ <LemonBanner type="warning">
+ We could not read {trunkQuarantine.repository}'s ownership files, so quarantined
+ tests can't be matched to teams. Try again in a few minutes.
+ </LemonBanner>
+ ) : (
+ <>
+ <TeamQuarantinedTestsTable
+ tests={quarantinedTests}
+ ttlDays={trunkQuarantine.ttlDays}
+ repository={trunkQuarantine.repository}
+ loading={trunkQuarantineLoading}
+ />
+ {trunkQuarantine.truncated && (
+ <div className="mt-2 text-xs text-tertiary">
+ Showing quarantined tests from the oldest {trunkQuarantine.limit} in the
+ repository. This team may have more.
+ </div>
+ )}
+ </>
+ )}
+ </Section>
+ </>
+ )}
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
index 8e16c1fb9eeb..557ddd3336f9 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
@@ -7,7 +7,6 @@ import { urls } from 'scenes/urls'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
import { CountCell } from '../components/CountCell'
-import { ScopeBar, SourceScopeChip } from '../components/ScopeBar'
import { Section } from '../components/Section'
import { timesTypical } from '../lib/format'
import { rowNavigationProps } from '../lib/rowNavigation'
@@ -118,7 +117,6 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <ScopeBar repoSlot={<SourceScopeChip />} showDate={false} />
<Section id="team-ci-health" title="Owned tests by team">
{teamsFailed ? (
<CIAnalyticsLoadError onRetry={loadTeams} loading={teamsLoading} />
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx
index 8b8556ad5443..5859a37949e8 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx
@@ -8,7 +8,6 @@ import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
-import { ScopeBar, SourceScopeChip } from '../components/ScopeBar'
import { Section } from '../components/Section'
import { StatCard } from '../components/StatCard'
import { TeamQuarantinedTestsTable } from '../components/TeamQuarantinedTestsTable'
@@ -192,7 +191,6 @@ function TrunkQuarantineDebtBoard(): JSX.Element {
export function EngineeringAnalyticsTests(): JSX.Element {
return (
<div className="flex flex-col gap-8">
- <ScopeBar repoSlot={<SourceScopeChip />} showDate={false} />
<TrunkQuarantineDebtBoard />
</div>
)
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx
index 03631ed87593..e8f3d49fb251 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx
@@ -6,8 +6,7 @@ import { LemonButton, LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
-import { RepoEntityHeader } from '../components/EntityHeader'
-import { SourceScopeChip, WorkflowScopeControls } from '../components/ScopeBar'
+import { WorkflowScopeControls } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { WorkflowHealthTable } from '../components/WorkflowHealthTable'
import { WorkflowsHealthHeader } from '../components/WorkflowsHealthHeader'
@@ -25,7 +24,6 @@ export function EngineeringAnalyticsWorkflows(): JSX.Element {
hasActiveWorkflowFilters,
workflowCostAvailable,
sourceId,
- activeSource,
notConnected,
workflowHealthLoadError,
} = useValues(engineeringAnalyticsLogic)
@@ -41,8 +39,6 @@ export function EngineeringAnalyticsWorkflows(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <RepoEntityHeader repoFullName={activeSource?.repo || ''} right={<SourceScopeChip pickerOnly />} />
-
<ScopePanel busy={workflowHealthLoading && workflowHealth.length > 0} controls={<WorkflowScopeControls />}>
<WorkflowsHealthHeader
summary={fleetSummary}
diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
index 8c4c571457a7..3a6a4705bb0d 100644
--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
@@ -20,19 +20,20 @@ import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { EntityHeader, VerdictPill } from '../components/EntityHeader'
import { FailureLogGroups } from '../components/FailureLogs'
import { GroupedJobsTable } from '../components/GroupedJobsTable'
import { MetricTile } from '../components/MetricTile'
+import { ProductNav } from '../components/ProductNav'
import { PullRequestComparisonCard } from '../components/PullRequestComparisonCard'
import { PullRequestDeliveryTimeline } from '../components/PullRequestDeliveryTimeline'
import { PullRequestFrictionCard } from '../components/PullRequestFrictionCard'
import { PullRequestStateTag } from '../components/PullRequestStateTag'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
import { RunConclusionTag } from '../components/runTables'
-import { RepoScopeChip, ScopeBar } from '../components/ScopeBar'
+import { ScopeBar } from '../components/ScopeBar'
import { Section } from '../components/Section'
import type { WorkflowJobApi } from '../generated/api.schemas'
import { compactCount, compactUsd } from '../lib/format'
@@ -445,6 +446,7 @@ export function PullRequestDetailScene(): JSX.Element {
frictionLoading,
frictionFailed,
} = useValues(pullRequestDetailLogic)
+ const { number } = useMountedLogic(pullRequestDetailLogic).props
const {
loadLifecycle,
loadPrCost,
@@ -473,22 +475,23 @@ export function PullRequestDetailScene(): JSX.Element {
if (loadFailed) {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Pull request" resourceType={{ type: 'health' }} />
- <CIAnalyticsLoadError
- title="Couldn't load this pull request"
- description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
- onRetry={loadLifecycle}
- loading={lifecycleLoading}
- />
+ <RepoSceneTitle repo={`${repoOwner}/${repoName}`} />
+ <ProductNav activeTab="pull-requests" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <CIAnalyticsLoadError
+ title="Couldn't load this pull request"
+ description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
+ onRetry={loadLifecycle}
+ loading={lifecycleLoading}
+ />
+ </ProductNav>
</SceneContent>
)
}
return (
<SceneContent className="pb-16">
- <SceneTitleSection
- name="Pull request"
- resourceType={{ type: 'health' }}
+ <RepoSceneTitle
+ repo={`${repoOwner}/${repoName}`}
actions={
githubUrl && pullRequest ? (
<>
@@ -517,266 +520,278 @@ export function PullRequestDetailScene(): JSX.Element {
}
/>
- <ScopeBar
- repoSlot={
- <RepoScopeChip
- label={`${repoOwner}/${repoName}`}
- to={withCurrentScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), sourceId)}
+ <ProductNav activeTab="pull-requests" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ <ScopeBar
+ crumbs={[
+ {
+ label: 'Pull requests',
+ to: withCurrentScope(
+ urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),
+ sourceId
+ ),
+ },
+ { label: `#${number}` },
+ ]}
+ showDate={false}
/>
- }
- lensFilter={{
- label: `pr: #${pullRequest?.number ?? ''}`,
- to: withCurrentScope(
- urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),
- sourceId
- ),
- }}
- showDate={false}
- />
- {pullRequest ? (
- <>
- <EntityHeader
- icon={<IconPullRequest />}
- title={pullRequest.title}
- slug={
- <>
- <PullRequestStateTag state={pullRequest.state} isDraft={pullRequest.is_draft} />
- <span>
- {pullRequest.repo.owner}/{pullRequest.repo.name} #{pullRequest.number}
- </span>
- <span>·</span>
- <span className="flex items-center gap-1.5">
- {pullRequest.author.avatar_url && (
- <img
- src={pullRequest.author.avatar_url}
- alt=""
- className="size-4 shrink-0 rounded-full"
- />
- )}
- <Link
- to={
- combineUrl(
- urls.engineeringAnalyticsAuthor(
- pullRequest.author.handle,
- `${repoOwner}/${repoName}`
- ),
- sourceId ? { source: sourceId } : {}
- ).url
- }
- >
- {pullRequest.author.handle}
- </Link>
- {pullRequest.author.is_bot && <LemonTag type="muted">bot</LemonTag>}
- </span>
- <span>
- · opened <TZLabel time={pullRequest.created_at} />
- </span>
- </>
- }
- right={
- pullRequest.state === 'merged' ? (
- <VerdictPill kind="muted">Merged</VerdictPill>
- ) : latestPushStats && latestPushStats.failingWorkflows.length > 0 ? (
- <VerdictPill kind="danger">CI failing</VerdictPill>
- ) : latestPushStats && latestPushStats.running > 0 ? (
- <VerdictPill kind="warning">CI running</VerdictPill>
- ) : latestPushStats ? (
- <VerdictPill kind="success">CI passing</VerdictPill>
- ) : undefined
- }
- />
- <div className="flex flex-wrap gap-2.5">
- <MetricTile
- label="Latest push"
- tooltip="Workflows green on the newest commit, one verdict per workflow."
- value={latestPushStats ? `${latestPushStats.green} / ${latestPushStats.total}` : '—'}
- sub={
- latestPushStats && latestPushStats.failingWorkflows.length > 0
- ? `${latestPushStats.failingWorkflows.slice(0, 3).join(', ')} failing`
- : latestPushStats && latestPushStats.running > 0
- ? `${latestPushStats.running} still running`
- : latestPushStats
- ? 'passing'
- : undefined
- }
- loading={tilesLoading}
- />
- <MetricTile
- label="CI wall time"
- tooltip="On the newest commit: earliest run start to latest completed run end."
- value={
- latestRound?.wallSeconds != null
- ? humanFriendlyDuration(latestRound.wallSeconds, { maxUnits: 2 })
- : '—'
- }
- sub={latestRound?.pending ? 'still running' : undefined}
- loading={tilesLoading}
- />
- <MetricTile
- label="Pushes"
- tooltip="Commits that triggered CI on this pull request."
- value={prRunsFailed ? '—' : `${pushes}`}
- sub={
- rerunCycles > 0 ? (
- <span className="font-semibold text-warning-dark">+{rerunCycles} re-runs</span>
- ) : undefined
- }
- loading={tilesLoading}
- />
- <MetricTile
- label="CI cost"
- tooltip={
- visiblePrCost?.jobs_available
- ? `${compactUsd(
- (visiblePrCost.estimated_cost_usd ?? 0) / Math.max(1, pushes)
- )} per push${visiblePrCost.unsettled_jobs > 0 ? ` · ${pluralize(visiblePrCost.unsettled_jobs, 'unsettled job')} excluded` : ''}.`
- : prCostFailed
- ? 'Loading CI cost failed.'
- : 'Available once the job-level source is synced.'
- }
- value={visiblePrCost?.jobs_available ? compactUsd(visiblePrCost.estimated_cost_usd) : '—'}
- sub={
- prCostFailed ? (
- <LemonButton size="xsmall" onClick={loadPrCost} loading={prCostLoading}>
- Retry
- </LemonButton>
- ) : visiblePrCost?.jobs_available ? undefined : (
- 'Job-level source not synced'
- )
- }
- loading={prCostLoading}
- />
- {visiblePrCost?.llm_spend && (
- <MetricTile
- label="LLM spend"
- tooltip="Token spend from AI coding/review sessions on this PR's branch, including spend from the same session before the branch was created."
- value={compactUsd(visiblePrCost.llm_spend.cost_usd)}
- sub={`${compactCount(
- visiblePrCost.llm_spend.input_tokens + visiblePrCost.llm_spend.output_tokens
- )} tokens · ${pluralize(visiblePrCost.llm_spend.generations, 'generation')}`}
+ {pullRequest ? (
+ <>
+ <EntityHeader
+ icon={<IconPullRequest />}
+ title={pullRequest.title}
+ slug={
+ <>
+ <PullRequestStateTag state={pullRequest.state} isDraft={pullRequest.is_draft} />
+ <span>
+ {pullRequest.repo.owner}/{pullRequest.repo.name} #{pullRequest.number}
+ </span>
+ <span>·</span>
+ <span className="flex items-center gap-1.5">
+ {pullRequest.author.avatar_url && (
+ <img
+ src={pullRequest.author.avatar_url}
+ alt=""
+ className="size-4 shrink-0 rounded-full"
+ />
+ )}
+ <Link
+ to={
+ combineUrl(
+ urls.engineeringAnalyticsAuthor(
+ pullRequest.author.handle,
+ `${repoOwner}/${repoName}`
+ ),
+ sourceId ? { source: sourceId } : {}
+ ).url
+ }
+ >
+ {pullRequest.author.handle}
+ </Link>
+ {pullRequest.author.is_bot && <LemonTag type="muted">bot</LemonTag>}
+ </span>
+ <span>
+ · opened <TZLabel time={pullRequest.created_at} />
+ </span>
+ </>
+ }
+ right={
+ pullRequest.state === 'merged' ? (
+ <VerdictPill kind="muted">Merged</VerdictPill>
+ ) : latestPushStats && latestPushStats.failingWorkflows.length > 0 ? (
+ <VerdictPill kind="danger">CI failing</VerdictPill>
+ ) : latestPushStats && latestPushStats.running > 0 ? (
+ <VerdictPill kind="warning">CI running</VerdictPill>
+ ) : latestPushStats ? (
+ <VerdictPill kind="success">CI passing</VerdictPill>
+ ) : undefined
+ }
/>
- )}
- </div>
- </>
- ) : (
- <LemonSkeleton className="h-24 w-full" />
- )}
-
- {/* Friction exists only for merged pull requests. It reads a fixed window, like the author and team
- pages, and comes first there too. */}
- {pullRequest?.state === 'merged' && (
- <Section id="pr-friction" title="Friction" note={`Last ${friction?.window_days ?? 30} days`}>
- {frictionFailed ? (
- <CIAnalyticsLoadError onRetry={loadFriction} loading={frictionLoading} />
+ <div className="flex flex-wrap gap-2.5">
+ <MetricTile
+ label="Latest push"
+ tooltip="Workflows green on the newest commit, one verdict per workflow."
+ value={
+ latestPushStats ? `${latestPushStats.green} / ${latestPushStats.total}` : '—'
+ }
+ sub={
+ latestPushStats && latestPushStats.failingWorkflows.length > 0
+ ? `${latestPushStats.failingWorkflows.slice(0, 3).join(', ')} failing`
+ : latestPushStats && latestPushStats.running > 0
+ ? `${latestPushStats.running} still running`
+ : latestPushStats
+ ? 'passing'
+ : undefined
+ }
+ loading={tilesLoading}
+ />
+ <MetricTile
+ label="CI wall time"
+ tooltip="On the newest commit: earliest run start to latest completed run end."
+ value={
+ latestRound?.wallSeconds != null
+ ? humanFriendlyDuration(latestRound.wallSeconds, { maxUnits: 2 })
+ : '—'
+ }
+ sub={latestRound?.pending ? 'still running' : undefined}
+ loading={tilesLoading}
+ />
+ <MetricTile
+ label="Pushes"
+ tooltip="Commits that triggered CI on this pull request."
+ value={prRunsFailed ? '—' : `${pushes}`}
+ sub={
+ rerunCycles > 0 ? (
+ <span className="font-semibold text-warning-dark">
+ +{rerunCycles} re-runs
+ </span>
+ ) : undefined
+ }
+ loading={tilesLoading}
+ />
+ <MetricTile
+ label="CI cost"
+ tooltip={
+ visiblePrCost?.jobs_available
+ ? `${compactUsd(
+ (visiblePrCost.estimated_cost_usd ?? 0) / Math.max(1, pushes)
+ )} per push${visiblePrCost.unsettled_jobs > 0 ? ` · ${pluralize(visiblePrCost.unsettled_jobs, 'unsettled job')} excluded` : ''}.`
+ : prCostFailed
+ ? 'Loading CI cost failed.'
+ : 'Available once the job-level source is synced.'
+ }
+ value={
+ visiblePrCost?.jobs_available
+ ? compactUsd(visiblePrCost.estimated_cost_usd)
+ : '—'
+ }
+ sub={
+ prCostFailed ? (
+ <LemonButton size="xsmall" onClick={loadPrCost} loading={prCostLoading}>
+ Retry
+ </LemonButton>
+ ) : visiblePrCost?.jobs_available ? undefined : (
+ 'Job-level source not synced'
+ )
+ }
+ loading={prCostLoading}
+ />
+ {visiblePrCost?.llm_spend && (
+ <MetricTile
+ label="LLM spend"
+ tooltip="Token spend from AI coding/review sessions on this PR's branch, including spend from the same session before the branch was created."
+ value={compactUsd(visiblePrCost.llm_spend.cost_usd)}
+ sub={`${compactCount(
+ visiblePrCost.llm_spend.input_tokens + visiblePrCost.llm_spend.output_tokens
+ )} tokens · ${pluralize(visiblePrCost.llm_spend.generations, 'generation')}`}
+ />
+ )}
+ </div>
+ </>
) : (
- <PullRequestFrictionCard friction={friction} loading={frictionLoading} />
+ <LemonSkeleton className="h-24 w-full" />
)}
- </Section>
- )}
- <Section id="pr-timeline" title="Lifecycle">
- {timelinesFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load the timeline for this pull request"
- onRetry={loadTimelines}
- loading={timelinesLoading}
- />
- ) : !timelines ? (
- <LemonSkeleton className="h-40 w-full" />
- ) : timeline ? (
- <div className="flex flex-col gap-2">
- <PullRequestDeliveryTimeline pr={timeline} />
- {/* Only a merged or ready pull request has a ready-to-merge time. A bot, or a deleted account
- with no handle, has no pace to compare. */}
- {!!timeline.author.handle &&
- !timeline.author.is_bot &&
- (timeline.merged_at || (timeline.state === 'open' && !timeline.is_draft)) && (
- <div className="max-w-3xl">
- <PullRequestComparisonCard pr={timeline} sourceId={sourceId} />
- </div>
+ {/* Friction exists only for merged pull requests. It reads a fixed window, like the author and team
+ pages, and comes first there too. */}
+ {pullRequest?.state === 'merged' && (
+ <Section id="pr-friction" title="Friction" note={`Last ${friction?.window_days ?? 30} days`}>
+ {frictionFailed ? (
+ <CIAnalyticsLoadError onRetry={loadFriction} loading={frictionLoading} />
+ ) : (
+ <PullRequestFrictionCard friction={friction} loading={frictionLoading} />
)}
- </div>
- ) : (
- <div className="text-sm text-secondary">
- No timeline for this pull request yet. If it stays empty, check the GitHub source's sync status.
- </div>
- )}
- </Section>
+ </Section>
+ )}
- <Section
- id="pr-runs"
- title="CI runs"
- right={
- runs.length > 0 ? (
- <span className="text-xs text-secondary">
- Cumulative · {pluralize(passed, 'run')} passed
- {failed > 0 && <> · {failed} failed</>}
- {running > 0 && <> · {running} still running</>}
- </span>
- ) : undefined
- }
- >
- {commitGroups.length > 0 && (
- <LemonInput
- type="search"
- placeholder="Filter workflows…"
- value={workflowFilter}
- onChange={setWorkflowFilter}
- className="mb-3 max-w-md"
- />
- )}
- {prRunsLoading && commitGroups.length === 0 ? (
- <LemonSkeleton className="h-24 w-full" />
- ) : prRunsFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load CI runs for this pull request"
- onRetry={loadPrRuns}
- loading={prRunsLoading}
- />
- ) : commitGroups.length === 0 ? (
- <div className="text-sm text-secondary">No CI runs attributed to this pull request yet.</div>
- ) : filteredPrWorkflowRows.length === 0 ? (
- <div className="text-sm text-secondary">No workflows match “{workflowFilter}”.</div>
- ) : (
- <PrWorkflowsTable
- rows={filteredPrWorkflowRows}
- filteredRuns={filteredRuns}
- failingJobLabelByWorkflow={failingJobLabelByWorkflow}
- runCostByKey={runCostByKey}
- showCost={visiblePrCost?.jobs_available ?? false}
- loading={prRunsLoading}
- repoOwner={repoOwner}
- repoName={repoName}
- sourceId={sourceId}
- runJobs={runJobs}
- runJobsLoading={runJobsLoading}
- expandedRunKeys={expandedRunKeys}
- setRunExpanded={setRunExpanded}
- />
- )}
- </Section>
+ <Section id="pr-timeline" title="Lifecycle">
+ {timelinesFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load the timeline for this pull request"
+ onRetry={loadTimelines}
+ loading={timelinesLoading}
+ />
+ ) : !timelines ? (
+ <LemonSkeleton className="h-40 w-full" />
+ ) : timeline ? (
+ <div className="flex flex-col gap-2">
+ <PullRequestDeliveryTimeline pr={timeline} />
+ {/* Only a merged or ready pull request has a ready-to-merge time. A bot, or a deleted account
+ with no handle, has no pace to compare. */}
+ {!!timeline.author.handle &&
+ !timeline.author.is_bot &&
+ (timeline.merged_at || (timeline.state === 'open' && !timeline.is_draft)) && (
+ <div className="max-w-3xl">
+ <PullRequestComparisonCard pr={timeline} sourceId={sourceId} />
+ </div>
+ )}
+ </div>
+ ) : (
+ <div className="text-sm text-secondary">
+ No timeline for this pull request yet. If it stays empty, check the GitHub source's sync
+ status.
+ </div>
+ )}
+ </Section>
- {failed > 0 && (
- <Section id="pr-failures" title="Failures">
- <FailureLogGroups
- logs={failureLogs}
- loading={failureLogsLoading}
- onRetry={loadFailureLogs}
- logsOnGitHub={failedRunsOnGitHub}
- errorDescription={
- failedRunsOnGitHub
- ? 'Retry, or open one of the failed runs on GitHub to read its logs.'
- : 'Retry, or read the failed run logs in your CI provider.'
+ <Section
+ id="pr-runs"
+ title="CI runs"
+ right={
+ runs.length > 0 ? (
+ <span className="text-xs text-secondary">
+ Cumulative · {pluralize(passed, 'run')} passed
+ {failed > 0 && <> · {failed} failed</>}
+ {running > 0 && <> · {running} still running</>}
+ </span>
+ ) : undefined
}
- emptyText={`Failure logs aren't available for these runs. They weren't collected, fork runs may not be linked to this pull request, or the logs have aged out of retention. ${
- failedRunsOnGitHub
- ? 'Open a failed run on GitHub to read its logs.'
- : 'Read the failed run logs in your CI provider.'
- }`}
- />
- </Section>
- )}
+ >
+ {commitGroups.length > 0 && (
+ <LemonInput
+ type="search"
+ placeholder="Filter workflows…"
+ value={workflowFilter}
+ onChange={setWorkflowFilter}
+ className="mb-3 max-w-md"
+ />
+ )}
+ {prRunsLoading && commitGroups.length === 0 ? (
+ <LemonSkeleton className="h-24 w-full" />
+ ) : prRunsFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load CI runs for this pull request"
+ onRetry={loadPrRuns}
+ loading={prRunsLoading}
+ />
+ ) : commitGroups.length === 0 ? (
+ <div className="text-sm text-secondary">
+ No CI runs attributed to this pull request yet.
+ </div>
+ ) : filteredPrWorkflowRows.length === 0 ? (
+ <div className="text-sm text-secondary">No workflows match “{workflowFilter}”.</div>
+ ) : (
+ <PrWorkflowsTable
+ rows={filteredPrWorkflowRows}
+ filteredRuns={filteredRuns}
+ failingJobLabelByWorkflow={failingJobLabelByWorkflow}
+ runCostByKey={runCostByKey}
+ showCost={visiblePrCost?.jobs_available ?? false}
+ loading={prRunsLoading}
+ repoOwner={repoOwner}
+ repoName={repoName}
+ sourceId={sourceId}
+ runJobs={runJobs}
+ runJobsLoading={runJobsLoading}
+ expandedRunKeys={expandedRunKeys}
+ setRunExpanded={setRunExpanded}
+ />
+ )}
+ </Section>
+
+ {failed > 0 && (
+ <Section id="pr-failures" title="Failures">
+ <FailureLogGroups
+ logs={failureLogs}
+ loading={failureLogsLoading}
+ onRetry={loadFailureLogs}
+ logsOnGitHub={failedRunsOnGitHub}
+ errorDescription={
+ failedRunsOnGitHub
+ ? 'Retry, or open one of the failed runs on GitHub to read its logs.'
+ : 'Retry, or read the failed run logs in your CI provider.'
+ }
+ emptyText={`Failure logs aren't available for these runs. They weren't collected, fork runs may not be linked to this pull request, or the logs have aged out of retention. ${
+ failedRunsOnGitHub
+ ? 'Open a failed run on GitHub to read its logs.'
+ : 'Read the failed run logs in your CI provider.'
+ }`}
+ />
+ </Section>
+ )}
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx
index a37c712b057a..112b13c014fb 100644
--- a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx
+++ b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx
@@ -302,3 +302,19 @@ export const RepoOverviewWithTrunkQueueData: Story = {
}),
],
}
+
+// Two connected repositories: the title gains the button that switches between them.
+export const RepoOverviewWithSeveralRepositories: Story = {
+ render: () => <App />,
+ parameters: { pageUrl: urls.engineeringAnalytics('PostHog/posthog') },
+ decorators: [
+ mswDecorator({
+ get: {
+ 'api/projects/:team_id/engineering_analytics/sources/': [
+ ...SOURCES,
+ { id: 'src-2', repo: 'PostHog/posthog-js', prefix: '' },
+ ],
+ },
+ }),
+ ],
+}
diff --git a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx
index 93e94e0af4b9..22bdb7191139 100644
--- a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx
@@ -12,7 +12,6 @@ import { urls } from 'scenes/urls'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
-import { RepoEntityHeader } from '../components/EntityHeader'
import { PullRequestTable } from '../components/PullRequestTable'
import { formatAxisMinutes, hasEnoughRunActivity } from '../components/RunActivityChart'
import { RunActivityMiniBars } from '../components/RunActivityMiniBars'
@@ -91,8 +90,6 @@ export function RepoOverviewScene(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <RepoEntityHeader repoFullName={activeSource?.repo || ''} />
-
{/* The PR backlog below the panel is current-state, not windowed. */}
<ScopePanel busy={hubReloading}>
{/* The windowed headline metrics: each card compares this window against the previous
diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
index ff7c2568c8e5..5c301281eaef 100644
--- a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx
@@ -12,15 +12,16 @@ import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { EntityHeader, VerdictPill } from '../components/EntityHeader'
import { FailureLogGroups } from '../components/FailureLogs'
import { GroupedJobsTable } from '../components/GroupedJobsTable'
import { MetricTile } from '../components/MetricTile'
+import { ProductNav } from '../components/ProductNav'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
import { formatCost, formatMinutes, runPrNumber } from '../components/runTables'
-import { RepoScopeChip, ScopeBar } from '../components/ScopeBar'
+import { ScopeBar } from '../components/ScopeBar'
import { Section } from '../components/Section'
import { githubCommitUrl, githubRunUrl } from '../lib/github'
import { isDecisiveFailure } from '../lib/lifecycle'
@@ -57,14 +58,17 @@ export function WorkflowRunDetailScene(): JSX.Element {
failureLogs,
failureLogsLoading,
} = useValues(workflowRunDetailLogic)
+ const { repoOwner, repoName } = useMountedLogic(workflowRunDetailLogic).props
const { loadRun, loadJobs, loadFailureLogs } = useActions(workflowRunDetailLogic)
const { searchParams } = useValues(router)
if (!isValidRunId) {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Workflow run" resourceType={{ type: 'health' }} />
- <span className="text-secondary">That run id isn't valid.</span>
+ <RepoSceneTitle repo={`${repoOwner}/${repoName}`} />
+ <ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <span className="text-secondary">That run id isn't valid.</span>
+ </ProductNav>
</SceneContent>
)
}
@@ -107,23 +111,23 @@ export function WorkflowRunDetailScene(): JSX.Element {
if (loadFailed) {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Workflow run" resourceType={{ type: 'health' }} />
- <CIAnalyticsLoadError
- title="Couldn't load this workflow run"
- description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
- onRetry={loadRun}
- loading={runLoading}
- />
+ <RepoSceneTitle repo={`${repoOwner}/${repoName}`} />
+ <ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <CIAnalyticsLoadError
+ title="Couldn't load this workflow run"
+ description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
+ onRetry={loadRun}
+ loading={runLoading}
+ />
+ </ProductNav>
</SceneContent>
)
}
return (
<SceneContent className="pb-16">
- {/* Scene chrome keeps the generic label; the EntityHeader below owns the title. */}
- <SceneTitleSection
- name="Workflow run"
- resourceType={{ type: 'health' }}
+ <RepoSceneTitle
+ repo={`${repoOwner}/${repoName}`}
actions={
githubUrl ? (
<LemonButton
@@ -139,161 +143,165 @@ export function WorkflowRunDetailScene(): JSX.Element {
}
/>
- {run ? (
- <>
- <ScopeBar
- repoSlot={
- <RepoScopeChip
- label={`${run.repo.owner}/${run.repo.name}`}
- to={withScope(
- urls.engineeringAnalytics(`${run.repo.owner}/${run.repo.name}`),
- searchParams,
- sourceId
- )}
+ <ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ {run ? (
+ <>
+ <ScopeBar
+ crumbs={[
+ {
+ label: 'Workflows',
+ to: withScope(
+ urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),
+ searchParams,
+ sourceId
+ ),
+ },
+ {
+ label: run.workflow_name,
+ // Carries the window scope back so stepping up doesn't reset it.
+ to: withScope(
+ urls.engineeringAnalyticsWorkflowRuns(
+ run.repo.owner,
+ run.repo.name,
+ run.workflow_name
+ ),
+ searchParams,
+ sourceId
+ ),
+ },
+ { label: `run #${run.id}` },
+ ]}
+ showDate={false}
/>
- }
- crumbs={[
- {
- label: run.workflow_name,
- // Carries the window scope back so stepping up doesn't reset it.
- to: withScope(
- urls.engineeringAnalyticsWorkflowRuns(
- run.repo.owner,
- run.repo.name,
- run.workflow_name
- ),
- searchParams,
- sourceId
- ),
- },
- { label: `run #${run.id}` },
- ]}
- showDate={false}
- />
- <EntityHeader
- icon={
- run.conclusion == null ? (
- <IconHourglass className="text-muted" />
- ) : isDecisiveFailure(run.conclusion) ? (
- <IconXCircle className="text-danger" />
- ) : run.conclusion === 'success' ? (
- <IconCheckCircle className="text-success" />
- ) : (
- <IconPause className="text-muted" />
- )
- }
- title={run.workflow_name}
- titleSuffix={`#${run.id}`}
- slug={
- <>
- {run.head_branch && <span>{run.head_branch}</span>}
- {run.head_sha && (
+ <EntityHeader
+ icon={
+ run.conclusion == null ? (
+ <IconHourglass className="text-muted" />
+ ) : isDecisiveFailure(run.conclusion) ? (
+ <IconXCircle className="text-danger" />
+ ) : run.conclusion === 'success' ? (
+ <IconCheckCircle className="text-success" />
+ ) : (
+ <IconPause className="text-muted" />
+ )
+ }
+ title={run.workflow_name}
+ titleSuffix={`#${run.id}`}
+ slug={
<>
- <span>· commit</span>
- <Link
- to={githubCommitUrl(run.repo.owner, run.repo.name, run.head_sha)}
- target="_blank"
- >
- {run.head_sha.slice(0, 7)}
- </Link>
+ {run.head_branch && <span>{run.head_branch}</span>}
+ {run.head_sha && (
+ <>
+ <span>· commit</span>
+ <Link
+ to={githubCommitUrl(run.repo.owner, run.repo.name, run.head_sha)}
+ target="_blank"
+ >
+ {run.head_sha.slice(0, 7)}
+ </Link>
+ </>
+ )}
+ {prUrl && (
+ <>
+ <span>· pull request</span>
+ <Link to={prUrl}>#{prNumber}</Link>
+ </>
+ )}
+ {run.run_attempt > 1 && <span>· attempt {run.run_attempt}</span>}
+ {run.run_started_at && (
+ <span>
+ · started <TZLabel time={run.run_started_at} />
+ </span>
+ )}
</>
- )}
- {prUrl && (
- <>
- <span>· pull request</span>
- <Link to={prUrl}>#{prNumber}</Link>
- </>
- )}
- {run.run_attempt > 1 && <span>· attempt {run.run_attempt}</span>}
- {run.run_started_at && (
- <span>
- · started <TZLabel time={run.run_started_at} />
- </span>
- )}
- </>
- }
- right={
- verdict ? (
- <VerdictPill
- kind={
- run.conclusion == null
- ? 'warning'
- : isDecisiveFailure(run.conclusion)
- ? 'danger'
- : run.conclusion === 'success'
- ? 'success'
- : 'muted'
- }
- >
- {verdict.label}
- </VerdictPill>
- ) : undefined
- }
- />
+ }
+ right={
+ verdict ? (
+ <VerdictPill
+ kind={
+ run.conclusion == null
+ ? 'warning'
+ : isDecisiveFailure(run.conclusion)
+ ? 'danger'
+ : run.conclusion === 'success'
+ ? 'success'
+ : 'muted'
+ }
+ >
+ {verdict.label}
+ </VerdictPill>
+ ) : undefined
+ }
+ />
- <div className="flex flex-wrap gap-2.5">
- <MetricTile
- label="Duration"
- tooltip="Wall-clock time of the run."
- value={run.duration_seconds == null ? '—' : humanFriendlyDuration(run.duration_seconds)}
- />
- <MetricTile
- label="Queue time"
- tooltip="From run started to the first job starting."
- value={queueSeconds != null ? humanFriendlyDuration(queueSeconds) : '—'}
- loading={jobsPending}
- />
- <MetricTile
- label="Jobs"
- tooltip={jobRollupLabel}
- value={jobs ? `${jobs.length}` : '—'}
- loading={jobsPending}
- />
- <MetricTile
- label="Estimated cost"
- tooltip={
- runCost
- ? `${formatMinutes(runCost.billableMinutes)} billable × runner-tier rate${
- runCost.unsettledJobs > 0
- ? ` · ${pluralize(runCost.unsettledJobs, 'unsettled job')} excluded`
- : ''
- }.`
- : jobsFailed
- ? "Couldn't load this run's jobs."
- : 'Available once the job-level source is synced.'
- }
- value={runCost ? formatCost(runCost.estimatedCostUsd) : '—'}
- loading={jobsPending}
- />
- </div>
+ <div className="flex flex-wrap gap-2.5">
+ <MetricTile
+ label="Duration"
+ tooltip="Wall-clock time of the run."
+ value={
+ run.duration_seconds == null ? '—' : humanFriendlyDuration(run.duration_seconds)
+ }
+ />
+ <MetricTile
+ label="Queue time"
+ tooltip="From run started to the first job starting."
+ value={queueSeconds != null ? humanFriendlyDuration(queueSeconds) : '—'}
+ loading={jobsPending}
+ />
+ <MetricTile
+ label="Jobs"
+ tooltip={jobRollupLabel}
+ value={jobs ? `${jobs.length}` : '—'}
+ loading={jobsPending}
+ />
+ <MetricTile
+ label="Estimated cost"
+ tooltip={
+ runCost
+ ? `${formatMinutes(runCost.billableMinutes)} billable × runner-tier rate${
+ runCost.unsettledJobs > 0
+ ? ` · ${pluralize(runCost.unsettledJobs, 'unsettled job')} excluded`
+ : ''
+ }.`
+ : jobsFailed
+ ? "Couldn't load this run's jobs."
+ : 'Available once the job-level source is synced.'
+ }
+ value={runCost ? formatCost(runCost.estimatedCostUsd) : '—'}
+ loading={jobsPending}
+ />
+ </div>
- <Section id="jobs" title="Jobs">
- {jobsFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load this run's jobs"
- onRetry={loadJobs}
- loading={jobsLoading}
- />
- ) : (
- <GroupedJobsTable jobs={jobs} loading={jobsLoading} />
- )}
- </Section>
+ <Section id="jobs" title="Jobs">
+ {jobsFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load this run's jobs"
+ onRetry={loadJobs}
+ loading={jobsLoading}
+ />
+ ) : (
+ <GroupedJobsTable jobs={jobs} loading={jobsLoading} />
+ )}
+ </Section>
- {isDecisiveFailure(run.conclusion) && (
- <Section id="failure-logs" title="Failure logs">
- <FailureLogGroups
- logs={failureLogs}
- loading={failureLogsLoading}
- onRetry={loadFailureLogs}
- jobNames={jobNamesById}
- logsOnGitHub={githubUrl !== null}
- />
- </Section>
+ {isDecisiveFailure(run.conclusion) && (
+ <Section id="failure-logs" title="Failure logs">
+ <FailureLogGroups
+ logs={failureLogs}
+ loading={failureLogsLoading}
+ onRetry={loadFailureLogs}
+ jobNames={jobNamesById}
+ logsOnGitHub={githubUrl !== null}
+ />
+ </Section>
+ )}
+ </>
+ ) : (
+ <LemonSkeleton className="h-64 w-full" />
)}
- </>
- ) : (
- <LemonSkeleton className="h-64 w-full" />
- )}
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
index 5153a47c595a..e53d8b0ca4e9 100644
--- a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx
@@ -23,16 +23,17 @@ import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { EntityHeader, VerdictPill } from '../components/EntityHeader'
import { GroupedJobsTable } from '../components/GroupedJobsTable'
import { JobAggregatesTable } from '../components/JobAggregatesTable'
import { MetricTile } from '../components/MetricTile'
+import { ProductNav } from '../components/ProductNav'
+import { RepoSceneTitle } from '../components/RepoSceneTitle'
import { RunActivityChart, hasEnoughRunActivity } from '../components/RunActivityChart'
import { RunConclusionTag } from '../components/runTables'
-import { RepoScopeChip, ScopeBar, WorkflowScopeChip, WorkflowScopeControls } from '../components/ScopeBar'
+import { ScopeBar, WorkflowScopeChip, WorkflowScopeControls } from '../components/ScopeBar'
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
import { ShareRow } from '../components/ShareRow'
@@ -292,228 +293,239 @@ export function WorkflowRunsScene(): JSX.Element {
if (loadFailed) {
return (
<SceneContent className="pb-16">
- <SceneTitleSection name="Workflow" resourceType={{ type: 'health' }} />
- <CIAnalyticsLoadError
- title="Couldn't load this workflow's runs"
- description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
- onRetry={loadRuns}
- loading={runsLoading}
- />
+ <RepoSceneTitle repo={`${repoOwner}/${repoName}`} />
+ <ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <CIAnalyticsLoadError
+ title="Couldn't load this workflow's runs"
+ description="It may not exist in the connected GitHub source. Retry, or check the source's sync status."
+ onRetry={loadRuns}
+ loading={runsLoading}
+ />
+ </ProductNav>
</SceneContent>
)
}
return (
<SceneContent className="pb-16">
- {/* Scene chrome keeps the generic label; the EntityHeader below owns the title. */}
- <SceneTitleSection
- name="Workflow"
- resourceType={{ type: 'health' }}
+ <RepoSceneTitle
+ repo={`${repoOwner}/${repoName}`}
actions={
<LemonButton type="secondary" size="small" to={githubUrl} targetBlank sideIcon={<IconExternal />}>
View on GitHub
</LemonButton>
}
/>
- <ScopeBar
- repoSlot={
- <RepoScopeChip
- label={`${repoOwner}/${repoName}`}
- to={withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId)}
- />
- }
- crumbs={[
- {
- label: workflowName,
- node: (
- <WorkflowScopeChip
- repoOwner={repoOwner}
- repoName={repoName}
- workflowName={workflowName}
- sourceId={sourceId}
- />
- ),
- },
- ]}
- showDate={false}
- />
- <EntityHeader
- icon={<IconGear />}
- title={workflowName}
- slug={`${repoOwner}/${repoName}`}
- right={verdictPill}
- />
- {workflowHealthFailed && (
- <LemonBanner type="warning">
- These figures could not load, so they cover only the runs in the table below rather than the whole
- window. Refresh to try again.
- </LemonBanner>
- )}
- <ScopePanel busy={panelBusy} controls={<WorkflowScopeControls />}>
- <div className="flex flex-wrap gap-2.5">
- <MetricTile
- label="Pass rate"
- tooltip={`${humanFriendlyNumber(healthSummary.passedRuns)} of ${humanFriendlyNumber(
- healthSummary.conclusiveRuns
- )} runs with a pass-or-fail result passed.`}
- value={percent(healthSummary.passRate)}
- loading={workflowHealthLoading}
- />
- <MetricTile
- label="Runs"
- tooltip={
- healthSummary.reruns > 0
- ? `Includes ${humanFriendlyNumber(healthSummary.reruns)} re-run cycles.`
- : undefined
- }
- value={compactCount(healthSummary.totalRuns)}
- sub={runsTruncated ? `table shows the most recent ${runRows.length}` : undefined}
- loading={workflowHealthLoading}
- />
- <MetricTile
- label="Duration p50"
- tooltip="Median duration over successful runs. Runs under 10 seconds with no work are excluded when longer samples exist. All-fast workflows use every successful run."
- value={
- healthSummary.medianSeconds != null
- ? humanFriendlyDuration(healthSummary.medianSeconds)
- : '—'
- }
- sub={
- healthSummary.p95Seconds != null
- ? `→ ${humanFriendlyDuration(healthSummary.p95Seconds)} p95`
- : undefined
- }
- loading={workflowHealthLoading}
- />
- <MetricTile
- label="Estimated median queue time"
- tooltip="Estimated median wait from job created to started: each job's median, weighted by how often the job ran."
- value={queueP50Seconds != null ? humanFriendlyDuration(queueP50Seconds) : '—'}
- sub={jobAggregatesFailed ? "Couldn't load" : undefined}
- loading={jobAggregatesLoading}
+ <ProductNav activeTab="workflows" repo={`${repoOwner}/${repoName}`} sourceId={sourceId}>
+ <div className="flex flex-col gap-4">
+ <ScopeBar
+ crumbs={[
+ {
+ label: 'Workflows',
+ to: withScope(
+ urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),
+ searchParams,
+ sourceId
+ ),
+ },
+ {
+ label: workflowName,
+ node: (
+ <WorkflowScopeChip
+ repoOwner={repoOwner}
+ repoName={repoName}
+ workflowName={workflowName}
+ sourceId={sourceId}
+ />
+ ),
+ },
+ ]}
+ showDate={false}
/>
- <MetricTile
- label="Cost"
- tooltip={
- costSummary?.estimatedCostUsd != null
- ? `${compactMinutes(costSummary.billableMinutes)} billable · ${compactUsd(
- !workflowHealthFailed && healthSummary.totalRuns > 0
- ? costSummary.estimatedCostUsd / healthSummary.totalRuns
- : null
- )} per run.`
- : runnerCostsFailed
- ? undefined
- : 'Available once the job-level source is synced.'
- }
- value={costSummary?.estimatedCostUsd != null ? compactUsd(costSummary.estimatedCostUsd) : '—'}
- sub={
- costSummary?.estimatedCostUsd != null
- ? undefined
- : runnerCostsFailed
- ? "Couldn't load"
- : 'Job-level source not synced'
- }
- loading={runnerCostsLoading || workflowHealthLoading}
+ <EntityHeader
+ icon={<IconGear />}
+ title={workflowName}
+ slug={`${repoOwner}/${repoName}`}
+ right={verdictPill}
/>
- </div>
- <Section id="health" title="Health" busy={healthBusy}>
- {runActivityFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load run activity"
- onRetry={loadRunActivity}
- loading={runActivityLoading}
- />
- ) : hasEnoughRunActivity(activityRuns) ? (
- <RunActivityChart runs={activityRuns} truncated={activityTruncated} />
- ) : runActivityLoading ? (
- <LemonSkeleton className="h-80 w-full" />
- ) : (
- <LemonCard hoverEffect={false} className="p-4 text-xs text-secondary">
- Not enough completed runs in the window to chart yet. Widen the date range or the run scope.
- </LemonCard>
- )}
- </Section>
- <Section id="jobs" title="Jobs">
- {jobAggregatesFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load jobs"
- onRetry={loadJobAggregates}
- loading={jobAggregatesLoading}
- />
- ) : (
- <JobAggregatesTable
- aggregates={jobAggregates}
- loading={jobAggregatesLoading}
- totalCostUsd={costSummary?.estimatedCostUsd ?? null}
- />
+ {workflowHealthFailed && (
+ <LemonBanner type="warning">
+ These figures could not load, so they cover only the runs in the table below rather than the
+ whole window. Refresh to try again.
+ </LemonBanner>
)}
- </Section>
- <Section id="cost" title="Cost" busy={costBusy}>
- {runnerCostsFailed ? (
- <CIAnalyticsLoadError
- title="Couldn't load cost"
- onRetry={loadRunnerCosts}
- loading={runnerCostsLoading}
- />
- ) : runnerCosts.length > 0 ? (
- <RunnerTierCard costs={runnerCosts} />
- ) : runnerCostsLoading ? (
- <LemonSkeleton className="h-40 w-full" />
- ) : (
- <LemonCard hoverEffect={false} className="p-4 text-xs text-secondary">
- No cost data. The job-level source isn't synced, or nothing ran in the window. Widen the
- date range, or check the source's sync status.
- </LemonCard>
- )}
- </Section>
- <Section id="runs" title="Runs">
- {/* Container queries drop the secondary columns when the scene is narrow, so Duration and
- Started stay in view. */}
- <LemonCard hoverEffect={false} className="overflow-hidden p-0 @container/runs">
- <LemonTable<WorkflowRunRow>
- dataSource={runRows}
- columns={runColumns}
- size="small"
- embedded
- loading={runsLoading}
- rowKey={runRowKey}
- useURLForSorting={false}
- defaultSorting={{ columnKey: 'started', order: -1 }}
- pagination={{ pageSize: 25 }}
- onRow={(run) => ({
- className: 'cursor-pointer',
- onClick: () =>
- setRunExpanded(
- runRowKey(run),
- !expandedRunKeys.includes(runRowKey(run)),
- run.runId,
- run.runAttempt,
- run.ciEngine
- ),
- })}
- expandable={{
- noIndent: true,
- isRowExpanded: (run) => expandedRunKeys.includes(runRowKey(run)),
- expandedRowRender: (run) => (
- <GroupedJobsTable
- jobs={runJobs[jobCacheKey(run.id, run.runAttempt, run.ciEngine)]}
- loading={runJobsLoading}
- embedded
- />
- ),
- }}
- emptyState="No runs for this workflow in the connected source."
- nouns={['run', 'runs']}
- data-attr="engineering-analytics-workflow-runs-table"
- />
- <div className="border-t border-primary px-4 py-2 text-[11px] text-tertiary">
- {runsTruncated
- ? `Showing the most recent ${runRows.length} runs in the window.`
- : `${runRows.length} runs in the window.`}
+ <ScopePanel busy={panelBusy} controls={<WorkflowScopeControls />}>
+ <div className="flex flex-wrap gap-2.5">
+ <MetricTile
+ label="Pass rate"
+ tooltip={`${humanFriendlyNumber(healthSummary.passedRuns)} of ${humanFriendlyNumber(
+ healthSummary.conclusiveRuns
+ )} runs with a pass-or-fail result passed.`}
+ value={percent(healthSummary.passRate)}
+ loading={workflowHealthLoading}
+ />
+ <MetricTile
+ label="Runs"
+ tooltip={
+ healthSummary.reruns > 0
+ ? `Includes ${humanFriendlyNumber(healthSummary.reruns)} re-run cycles.`
+ : undefined
+ }
+ value={compactCount(healthSummary.totalRuns)}
+ sub={runsTruncated ? `table shows the most recent ${runRows.length}` : undefined}
+ loading={workflowHealthLoading}
+ />
+ <MetricTile
+ label="Duration p50"
+ tooltip="Median duration over successful runs. Runs under 10 seconds with no work are excluded when longer samples exist. All-fast workflows use every successful run."
+ value={
+ healthSummary.medianSeconds != null
+ ? humanFriendlyDuration(healthSummary.medianSeconds)
+ : '—'
+ }
+ sub={
+ healthSummary.p95Seconds != null
+ ? `→ ${humanFriendlyDuration(healthSummary.p95Seconds)} p95`
+ : undefined
+ }
+ loading={workflowHealthLoading}
+ />
+ <MetricTile
+ label="Estimated median queue time"
+ tooltip="Estimated median wait from job created to started: each job's median, weighted by how often the job ran."
+ value={queueP50Seconds != null ? humanFriendlyDuration(queueP50Seconds) : '—'}
+ sub={jobAggregatesFailed ? "Couldn't load" : undefined}
+ loading={jobAggregatesLoading}
+ />
+ <MetricTile
+ label="Cost"
+ tooltip={
+ costSummary?.estimatedCostUsd != null
+ ? `${compactMinutes(costSummary.billableMinutes)} billable · ${compactUsd(
+ !workflowHealthFailed && healthSummary.totalRuns > 0
+ ? costSummary.estimatedCostUsd / healthSummary.totalRuns
+ : null
+ )} per run.`
+ : runnerCostsFailed
+ ? undefined
+ : 'Available once the job-level source is synced.'
+ }
+ value={
+ costSummary?.estimatedCostUsd != null
+ ? compactUsd(costSummary.estimatedCostUsd)
+ : '—'
+ }
+ sub={
+ costSummary?.estimatedCostUsd != null
+ ? undefined
+ : runnerCostsFailed
+ ? "Couldn't load"
+ : 'Job-level source not synced'
+ }
+ loading={runnerCostsLoading || workflowHealthLoading}
+ />
</div>
- </LemonCard>
- </Section>
- </ScopePanel>
+ <Section id="health" title="Health" busy={healthBusy}>
+ {runActivityFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load run activity"
+ onRetry={loadRunActivity}
+ loading={runActivityLoading}
+ />
+ ) : hasEnoughRunActivity(activityRuns) ? (
+ <RunActivityChart runs={activityRuns} truncated={activityTruncated} />
+ ) : runActivityLoading ? (
+ <LemonSkeleton className="h-80 w-full" />
+ ) : (
+ <LemonCard hoverEffect={false} className="p-4 text-xs text-secondary">
+ Not enough completed runs in the window to chart yet. Widen the date range or the
+ run scope.
+ </LemonCard>
+ )}
+ </Section>
+ <Section id="jobs" title="Jobs">
+ {jobAggregatesFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load jobs"
+ onRetry={loadJobAggregates}
+ loading={jobAggregatesLoading}
+ />
+ ) : (
+ <JobAggregatesTable
+ aggregates={jobAggregates}
+ loading={jobAggregatesLoading}
+ totalCostUsd={costSummary?.estimatedCostUsd ?? null}
+ />
+ )}
+ </Section>
+ <Section id="cost" title="Cost" busy={costBusy}>
+ {runnerCostsFailed ? (
+ <CIAnalyticsLoadError
+ title="Couldn't load cost"
+ onRetry={loadRunnerCosts}
+ loading={runnerCostsLoading}
+ />
+ ) : runnerCosts.length > 0 ? (
+ <RunnerTierCard costs={runnerCosts} />
+ ) : runnerCostsLoading ? (
+ <LemonSkeleton className="h-40 w-full" />
+ ) : (
+ <LemonCard hoverEffect={false} className="p-4 text-xs text-secondary">
+ No cost data. The job-level source isn't synced, or nothing ran in the window. Widen
+ the date range, or check the source's sync status.
+ </LemonCard>
+ )}
+ </Section>
+ <Section id="runs" title="Runs">
+ {/* Container queries drop the secondary columns when the scene is narrow, so Duration and
+ Started stay in view. */}
+ <LemonCard hoverEffect={false} className="overflow-hidden p-0 @container/runs">
+ <LemonTable<WorkflowRunRow>
+ dataSource={runRows}
+ columns={runColumns}
+ size="small"
+ embedded
+ loading={runsLoading}
+ rowKey={runRowKey}
+ useURLForSorting={false}
+ defaultSorting={{ columnKey: 'started', order: -1 }}
+ pagination={{ pageSize: 25 }}
+ onRow={(run) => ({
+ className: 'cursor-pointer',
+ onClick: () =>
+ setRunExpanded(
+ runRowKey(run),
+ !expandedRunKeys.includes(runRowKey(run)),
+ run.runId,
+ run.runAttempt,
+ run.ciEngine
+ ),
+ })}
+ expandable={{
+ noIndent: true,
+ isRowExpanded: (run) => expandedRunKeys.includes(runRowKey(run)),
+ expandedRowRender: (run) => (
+ <GroupedJobsTable
+ jobs={runJobs[jobCacheKey(run.id, run.runAttempt, run.ciEngine)]}
+ loading={runJobsLoading}
+ embedded
+ />
+ ),
+ }}
+ emptyState="No runs for this workflow in the connected source."
+ nouns={['run', 'runs']}
+ data-attr="engineering-analytics-workflow-runs-table"
+ />
+ <div className="border-t border-primary px-4 py-2 text-[11px] text-tertiary">
+ {runsTruncated
+ ? `Showing the most recent ${runRows.length} runs in the window.`
+ : `${runRows.length} runs in the window.`}
+ </div>
+ </LemonCard>
+ </Section>
+ </ScopePanel>
+ </div>
+ </ProductNav>
</SceneContent>
)
}
diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.test.ts b/products/engineering_analytics/frontend/scenes/authorLogic.test.ts
index dda9d699c491..96bcbc67d305 100644
--- a/products/engineering_analytics/frontend/scenes/authorLogic.test.ts
+++ b/products/engineering_analytics/frontend/scenes/authorLogic.test.ts
@@ -28,7 +28,7 @@ describe('authorLogic', () => {
afterEach(() => logic?.unmount())
- it('keeps the repository and scope on the breadcrumbs back to the pull requests list', () => {
+ it('names the repository in the breadcrumbs and keeps the scope on the way back to its overview', () => {
router.actions.push(urls.engineeringAnalyticsAuthor('jane-dev', 'PostHog/posthog-js'), {
source: 'source-2',
date_from: '-30d',
@@ -36,11 +36,10 @@ describe('authorLogic', () => {
logic = authorLogic({ handle: 'jane-dev', sourceId: 'source-2', repo: 'PostHog/posthog-js' })
logic.mount()
- const [hub, pullRequests] = logic.values.breadcrumbs.map(({ path }) => new URL(path!, 'https://example.com'))
- expect(hub.pathname).toBe('/engineering-analytics/repos/PostHog/posthog-js/overview')
- expect(pullRequests.pathname).toBe('/engineering-analytics/repos/PostHog/posthog-js/pull-requests')
- for (const destination of [hub, pullRequests]) {
- expect(Object.fromEntries(destination.searchParams)).toEqual({ date_from: '-30d', source: 'source-2' })
- }
+ const [product, repository] = logic.values.breadcrumbs
+ expect(repository.name).toBe('PostHog/posthog-js')
+ const overview = new URL(product.path!, 'https://example.com')
+ expect(overview.pathname).toBe('/engineering-analytics/repos/PostHog/posthog-js/overview')
+ expect(Object.fromEntries(overview.searchParams)).toEqual({ date_from: '-30d', source: 'source-2' })
})
})
diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.ts b/products/engineering_analytics/frontend/scenes/authorLogic.ts
index 3791665520c4..6e44b63c1460 100644
--- a/products/engineering_analytics/frontend/scenes/authorLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/authorLogic.ts
@@ -3,14 +3,13 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
-import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
import { engineeringAnalyticsAuthorFrictionDetail, engineeringAnalyticsAuthorWorkflowCosts } from '../generated/api'
import type { AuthorFrictionDetailApi, WorkflowCostApi } from '../generated/api.schemas'
import { DeliveryScope } from '../lib/deliveryScope'
-import { withScope } from '../lib/scope'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
export interface AuthorLogicProps {
@@ -41,17 +40,35 @@ export interface authorLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface authorLogicActions {
loadFrictionDetail: () => any
- loadFrictionDetailFailure: (error: string, errorObject?: any) => { error: string; errorObject?: any }
+ loadFrictionDetailFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
loadFrictionDetailSuccess: (
frictionDetail: AuthorFrictionDetailApi,
payload?: any
- ) => { frictionDetail: AuthorFrictionDetailApi; payload?: any }
+ ) => {
+ frictionDetail: AuthorFrictionDetailApi
+ payload?: any
+ }
loadWorkflowCosts: () => any
- loadWorkflowCostsFailure: (error: string, errorObject?: any) => { error: string; errorObject?: any }
+ loadWorkflowCostsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
loadWorkflowCostsSuccess: (
workflowCosts: WorkflowCostApi[],
payload?: any
- ) => { workflowCosts: WorkflowCostApi[]; payload?: any }
+ ) => {
+ workflowCosts: WorkflowCostApi[]
+ payload?: any
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -62,12 +79,7 @@ export interface authorLogicMeta {
repo: (arg: string | null) => string | null
handle: (arg: string) => string
deliveryScope: (handle: string) => DeliveryScope
- breadcrumbs: (
- handle: string,
- repo: string | null,
- sourceId: string | null,
- searchParams: Record<string, any>
- ) => Breadcrumb[]
+ breadcrumbs: (repo: string | null, sourceId: string | null, searchParams: Record<string, any>) => Breadcrumb[]
}
}
@@ -133,27 +145,12 @@ export const authorLogic = kea<authorLogicType>([
// Memoized, so the delivery logics keyed by this scope see one stable object per author.
deliveryScope: [(s) => [s.handle], (handle: string): DeliveryScope => ({ kind: 'author', author: handle })],
breadcrumbs: [
- (s) => [s.handle, s.repo, s.sourceId, router.selectors.searchParams],
+ (s) => [s.repo, s.sourceId, router.selectors.searchParams],
(
- handle: string,
repo: string | null,
sourceId: string | null,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(repo), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsPullRequests',
- name: 'Pull requests',
- path: withScope(urls.engineeringAnalyticsPullRequestList(repo), searchParams, sourceId),
- iconType: 'health',
- },
- { key: ['EngineeringAnalyticsAuthor', handle], name: handle, iconType: 'health' },
- ],
+ ): Breadcrumb[] => repoBreadcrumbs(repo, searchParams, sourceId),
],
}),
diff --git a/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts b/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts
index 9b09c1717bdb..0429d6bde56a 100644
--- a/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts
@@ -49,6 +49,7 @@ import {
import { jobCacheKey } from '../lib/jobs'
import { WorkflowRun, isDecisiveFailure } from '../lib/lifecycle'
import { pushRoundOf } from '../lib/pushRounds'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
import { withScope } from '../lib/scope'
import { PrCommitRuns, groupRunsByCommit } from './pullRequestDetailLogic'
@@ -406,9 +407,7 @@ export interface ciExplorerLogicMeta {
breadcrumbs: (
repoOwner: string,
repoName: string,
- number: number,
sourceId: string | null,
- pullRequestUrl: string,
searchParams: Record<string, any>
) => Breadcrumb[]
}
@@ -805,33 +804,13 @@ export const ciExplorerLogic = kea<ciExplorerLogicType>([
withScope(urls.engineeringAnalyticsPullRequest(repoOwner, repoName, number), searchParams, sourceId),
],
breadcrumbs: [
- (s, p) => [p.repoOwner, p.repoName, p.number, s.sourceId, s.pullRequestUrl, router.selectors.searchParams],
+ (s, p) => [p.repoOwner, p.repoName, s.sourceId, router.selectors.searchParams],
(
repoOwner: string,
repoName: string,
- number: number,
sourceId: string | null,
- pullRequestUrl: string,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: ['EngineeringAnalyticsPullRequest', `${repoOwner}/${repoName}#${number}`],
- name: `${repoOwner}/${repoName} #${number}`,
- path: pullRequestUrl,
- iconType: 'health',
- },
- {
- key: ['EngineeringAnalyticsCIExplorer', `${repoOwner}/${repoName}#${number}`],
- name: 'CI explorer',
- iconType: 'health',
- },
- ],
+ ): Breadcrumb[] => repoBreadcrumbs(`${repoOwner}/${repoName}`, searchParams, sourceId),
],
}),
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
index e857b0b58116..58a31c933679 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
@@ -41,6 +41,7 @@ import {
} from './engineeringAnalyticsLogic'
import { engineeringAnalyticsSceneLogic } from './engineeringAnalyticsSceneLogic'
import { groupRunsByCommit, sortRunsForTriage } from './pullRequestDetailLogic'
+import { repoScopeLogic } from './repoScopeLogic'
jest.mock('../generated/api', () => ({
engineeringAnalyticsCiCards: jest.fn(),
@@ -370,7 +371,7 @@ describe('engineeringAnalyticsLogic', () => {
expect(mockWorkflowHealth).toHaveBeenLastCalledWith('1', { date_from: '-90d' })
})
- it('lists one option per (source, repo) pair and scopes to the picked repo', async () => {
+ it('lists one option per (source, repo) pair and switches to the picked repo', async () => {
// The option value encodes (source, repo) so a multi-repo source's repos stay distinct;
// two distinct sources and one source syncing two repos produce the same option shape.
mockSources.mockResolvedValue([
@@ -380,28 +381,65 @@ describe('engineeringAnalyticsLogic', () => {
])
logic = engineeringAnalyticsLogic()
logic.mount()
- await expectLogic(logic).toDispatchActions(['loadGithubSourcesSuccess', 'loadCardsSuccess'])
+ const scope = repoScopeLogic()
+ await expectLogic(scope).toDispatchActions(['loadGithubSourcesSuccess'])
+ await expectLogic(logic).toDispatchActions(['loadCardsSuccess'])
- expect(logic.values.hasMultipleSources).toBe(true)
- expect(logic.values.sourceOptions).toEqual([
+ expect(scope.values.hasMultipleSources).toBe(true)
+ expect(scope.values.sourceOptions).toEqual([
{ value: 'src-multi::posthog/posthog', label: 'posthog/posthog' },
{ value: 'src-multi::posthog/posthog.com', label: 'posthog/posthog.com' },
{ value: 'src-other::posthog/posthog.js', label: 'posthog/posthog.js' },
])
- logic.actions.setScope('src-multi', 'posthog/posthog.com')
+ // One source syncs that repository, so the path alone names it and no `?source` rides along.
+ scope.actions.switchRepo('src-multi::posthog/posthog.com')
await expectLogic(logic).toDispatchActions(['setScope', 'loadCardsSuccess'])
- expect(logic.values.selectedScope).toBe('src-multi::posthog/posthog.com')
- expect(mockCiCards).toHaveBeenLastCalledWith('1', { source_id: 'src-multi', repo: 'posthog/posthog.com' })
+ expect(routedPath()).toBe(urls.engineeringAnalytics('posthog/posthog.com'))
+ expect(router.values.searchParams).toEqual({})
+ expect(scope.values.selectedScope).toBe('src-multi::posthog/posthog.com')
+ expect(mockCiCards).toHaveBeenLastCalledWith('1', { source_id: undefined, repo: 'posthog/posthog.com' })
+ })
+
+ it.each([
+ [
+ 'another source of the repository on screen keeps the page and sets ?source',
+ 'src-mirror::PostHog/PostHog',
+ urls.engineeringAnalyticsPullRequest('posthog', 'posthog', 42),
+ { source: 'src-mirror' },
+ ],
+ [
+ 'a legacy source with no repository opens the repo-less list tab with ?source',
+ 'src-legacy::',
+ urls.engineeringAnalyticsPullRequestList(),
+ { source: 'src-legacy' },
+ ],
+ ])('switching repository: %s', async (_label, pick, pathname, searchParams) => {
+ mockSources.mockResolvedValue([
+ { id: 'src-main', repo: 'posthog/posthog', prefix: 'main', synced: true },
+ { id: 'src-mirror', repo: 'PostHog/PostHog', prefix: 'mirror', synced: true },
+ { id: 'src-legacy', repo: '', prefix: 'legacy', synced: true },
+ ])
+ router.actions.push(urls.engineeringAnalyticsPullRequest('posthog', 'posthog', 42))
+ const scope = repoScopeLogic()
+ scope.mount()
+ extraUnmounts.push(() => scope.unmount())
+ await expectLogic(scope).toDispatchActions(['loadGithubSourcesSuccess'])
+
+ scope.actions.switchRepo(pick)
+
+ expect(routedPath()).toBe(pathname)
+ expect(router.values.searchParams).toEqual(searchParams)
+ expect(scope.values.selectedScope).toBe(pick)
})
it('hides the picker when the team has a single source', async () => {
mockSources.mockResolvedValue([SOURCES[0]])
- logic = engineeringAnalyticsLogic()
- logic.mount()
- await expectLogic(logic).toDispatchActions(['loadGithubSourcesSuccess'])
+ const scope = repoScopeLogic()
+ scope.mount()
+ await expectLogic(scope).toDispatchActions(['loadGithubSourcesSuccess'])
- expect(logic.values.hasMultipleSources).toBe(false)
+ expect(scope.values.hasMultipleSources).toBe(false)
})
it('defaults to no source, then scopes every endpoint to the picked one and reloads', async () => {
@@ -531,7 +569,7 @@ describe('engineeringAnalyticsLogic', () => {
router.actions.push(urls.engineeringAnalyticsPullRequestList(repo), rest)
logic = engineeringAnalyticsLogic()
logic.mount()
- await expectLogic(logic).toDispatchActions(['loadGithubSourcesSuccess'])
+ await expectLogic(repoScopeLogic).toDispatchActions(['loadGithubSourcesSuccess'])
return jest.spyOn(posthog, 'capture').mockImplementation(() => undefined)
}
const jumpEvents = (capture: jest.SpyInstance): unknown[] =>
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
index 9f1aa1783e31..060838b73de6 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
@@ -11,7 +11,7 @@ import {
selectors,
} from 'kea'
import { loaders } from 'kea-loaders'
-import { actionToUrl, router, urlToAction } from 'kea-router'
+import { router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
import { ApiConfig, ApiError } from 'lib/api'
@@ -25,16 +25,15 @@ import {
engineeringAnalyticsCiCards,
engineeringAnalyticsPullRequests,
engineeringAnalyticsQuarantine,
- engineeringAnalyticsSources,
engineeringAnalyticsTrunkQuarantine,
engineeringAnalyticsWorkflowHealth,
} from '../generated/api'
import type { GitHubSourceApi, PullRequestListItemApi, PushCISampleApi } from '../generated/api.schemas'
import { CIStatus, ciStatusOf } from '../lib/ci'
import { parsePullRequestReference, resolvePullRequestTarget } from '../lib/pullRequestReference'
-import { repoFromPath, switchRepoPath } from '../lib/repoScope'
+import { repoFromPath } from '../lib/repoScope'
import { type FleetSummary, computeFleetSummary } from '../lib/runHealth'
-import { scopeToValue, withCurrentScope, withScope } from '../lib/scope'
+import { withCurrentScope, withScope } from '../lib/scope'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
import type { RunScopeParams } from './engineeringAnalyticsFiltersLogic'
import { repoScopeLogic } from './repoScopeLogic'
@@ -418,6 +417,8 @@ export interface engineeringAnalyticsLogicValues {
dateFrom: string | null // engineeringAnalyticsFiltersLogic
dateTo: string | null // engineeringAnalyticsFiltersLogic
runScopeParams: RunScopeParams // engineeringAnalyticsFiltersLogic
+ githubSources: GitHubSourceApi[] | null // repoScopeLogic
+ githubSourcesLoading: boolean // repoScopeLogic
activeCard: CardFilter | null
activeSource: GitHubSourceApi | null
anyLoading: boolean
@@ -432,11 +433,8 @@ export interface engineeringAnalyticsLogicValues {
filters: PullRequestFilters
fleetSummary: FleetSummary
fleetTruncated: boolean
- githubSources: GitHubSourceApi[]
- githubSourcesLoading: boolean
hasActiveFilters: boolean
hasActiveWorkflowFilters: boolean
- hasMultipleSources: boolean
notConnected: boolean
pullRequestJumpFailure: PullRequestJumpFailure | null
pullRequestJumpText: string
@@ -451,12 +449,7 @@ export interface engineeringAnalyticsLogicValues {
repo: string | null
scopeRepo: string | null
search: string
- selectedScope: string | null
sourceId: string | null
- sourceOptions: {
- label: string
- value: string
- }[]
stateFilter: PRStateFilter
stuckOnly: boolean
tableTruncated: boolean
@@ -480,7 +473,7 @@ export interface engineeringAnalyticsLogicValues {
export interface engineeringAnalyticsLogicActions {
noRepoToForward: () => {
value: true
- }
+ } // repoScopeLogic
applyCardFilter: (card: CardFilter) => {
card: CardFilter
}
@@ -502,21 +495,6 @@ export interface engineeringAnalyticsLogicActions {
cards: CardsData
payload?: any
}
- loadGithubSources: () => any
- loadGithubSourcesFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- loadGithubSourcesSuccess: (
- githubSources: GitHubSourceApi[],
- payload?: any
- ) => {
- githubSources: GitHubSourceApi[]
- payload?: any
- }
loadPullRequests: () => any
loadPullRequestsFailure: (
error: string,
@@ -687,21 +665,11 @@ export interface engineeringAnalyticsLogicMeta {
trunkQuarantineTestsByTeam: (
trunkQuarantine: TrunkQuarantineData | null
) => Record<string, TrunkQuarantinedTestRow[]>
- hasMultipleSources: (githubSources: GitHubSourceApi[]) => boolean
activeSource: (
- githubSources: GitHubSourceApi[],
+ githubSources: GitHubSourceApi[] | null,
sourceId: string | null,
scopeRepo: string | null
) => GitHubSourceApi | null
- sourceOptions: (githubSources: GitHubSourceApi[]) => {
- label: string
- value: string
- }[]
- selectedScope: (
- githubSources: GitHubSourceApi[],
- sourceId: string | null,
- scopeRepo: string | null
- ) => string | null
}
}
@@ -717,7 +685,13 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
path(['products', 'engineering_analytics', 'frontend', 'scenes', 'engineeringAnalyticsLogic']),
connect(() => ({
- values: [engineeringAnalyticsFiltersLogic, ['dateFrom', 'dateTo', 'runScopeParams']],
+ values: [
+ engineeringAnalyticsFiltersLogic,
+ ['dateFrom', 'dateTo', 'runScopeParams'],
+ // One sources list for the product: repoScopeLogic loads it for the switcher and the forward.
+ repoScopeLogic,
+ ['githubSources', 'githubSourcesLoading'],
+ ],
actions: [repoScopeLogic, ['noRepoToForward']],
})),
@@ -735,7 +709,7 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
setThrashOnly: (thrash: boolean) => ({ thrash }),
applyCardFilter: (card: CardFilter) => ({ card }),
setSourceId: (sourceId: string | null) => ({ sourceId }),
- // The picker selects a (source, repo) pair in one action, so both land before a single refresh.
+ // The URL names a (source, repo) pair, so both land in one action before a single refresh.
setScope: (sourceId: string | null, scopeRepo: string | null) => ({ sourceId, scopeRepo }),
setPullRequestJumpText: (text: string) => ({ text }),
submitPullRequestJump: true,
@@ -891,13 +865,6 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
},
},
],
- githubSources: [
- [] as GitHubSourceApi[],
- {
- loadGithubSources: async (): Promise<GitHubSourceApi[]> =>
- await engineeringAnalyticsSources(projectId()),
- },
- ],
})),
reducers({
@@ -963,7 +930,7 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
{ setSourceId: (_, { sourceId }) => sourceId, setScope: (_, { sourceId }) => sourceId },
],
// Repo scope of a multi-repo source. Cleared when the source changes on its own (the old repo
- // belongs to the old source); the picker uses setScope to set both together.
+ // belongs to the old source); the URL sets both together through setScope.
scopeRepo: [null as string | null, { setScope: (_, { scopeRepo }) => scopeRepo, setSourceId: () => null }],
pullRequestJumpText: ['', { setPullRequestJumpText: (_, { text }) => text }],
// A scope change clears the message because picking a repository is one of the fixes it asks for.
@@ -1169,27 +1136,23 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
(trunkQuarantine: TrunkQuarantineData | null): Record<string, TrunkQuarantinedTestRow[]> =>
groupBy(trunkQuarantine?.tests ?? [], (test) => test.ownerTeam),
],
- hasMultipleSources: [
- (s) => [s.githubSources],
- (githubSources: GitHubSourceApi[]): boolean => githubSources.length > 1,
- ],
- // The source reads resolve to: the picked one, else the backend default (oldest connected = first).
- // Matched by (source, repo), not source alone: a multi-repo source's entries share one id,
- // so headers and commit links reading activeSource.repo must reflect the picked repo, not
- // the first entry with that id.
activeSource: [
(s) => [s.githubSources, s.sourceId, s.scopeRepo],
(
- githubSources: GitHubSourceApi[],
+ loadedSources: GitHubSourceApi[] | null,
sourceId: string | null,
scopeRepo: string | null
): GitHubSourceApi | null => {
+ const githubSources = loadedSources ?? []
+ // GitHub matches repository names case-insensitively, so the path may differ from the source's spelling.
+ const isScopeRepo = (source: GitHubSourceApi): boolean =>
+ source.repo.toLowerCase() === scopeRepo?.toLowerCase()
if (!sourceId) {
// A repo-only scope (?repo with no ?source) resolves across sources — label that
// repo. Otherwise prefer the first *synced* repo, matching the repo the backend
// resolves by default (it skips still-backfilling repos), else the first entry.
return (
- (scopeRepo && githubSources.find((source) => source.repo === scopeRepo)) ||
+ (scopeRepo && githubSources.find(isScopeRepo)) ||
githubSources.find((source) => source.synced) ||
githubSources[0] ||
null
@@ -1200,49 +1163,13 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
// first synced repo of this source, matching the repo the backend resolves by default —
// else the header names an unsynced repo the loaders never read.
return (
- (scopeRepo && ofSource.find((source) => source.repo === scopeRepo)) ||
+ (scopeRepo && ofSource.find(isScopeRepo)) ||
ofSource.find((source) => source.synced) ||
ofSource[0] ||
null
)
},
],
- // One option per selectable (source, repo). The value encodes both so a multi-repo source's
- // repos are distinct entries; the label is the repo (falling back to prefix).
- sourceOptions: [
- (s) => [s.githubSources],
- (githubSources: GitHubSourceApi[]): { value: string; label: string }[] =>
- githubSources.map((source) => ({
- value: scopeToValue(source.id, source.repo),
- label: source.repo || source.prefix || `source ${source.id.slice(0, 8)}`,
- })),
- ],
- // The picker's current value: the entry matching the picked (source, repo), else that source's
- // first entry, else null (unpicked → placeholder + backend default).
- selectedScope: [
- (s) => [s.githubSources, s.sourceId, s.scopeRepo],
- (
- githubSources: GitHubSourceApi[],
- sourceId: string | null,
- scopeRepo: string | null
- ): string | null => {
- if (!sourceId) {
- // A repo-only scope (?repo, no ?source) highlights that repo across sources; an
- // unscoped page highlights nothing (placeholder shows the default label).
- const byRepo = scopeRepo && githubSources.find((source) => source.repo === scopeRepo)
- return byRepo ? scopeToValue(byRepo.id, byRepo.repo) : null
- }
- // Mirror activeSource: with no explicit repo, prefer the synced entry so the picker
- // highlights the repo the loaders actually read — else it shows an unsynced repo whose
- // selection would flip the page to not-connected.
- const ofSource = githubSources.filter((source) => source.id === sourceId)
- const match =
- (scopeRepo && ofSource.find((source) => source.repo === scopeRepo)) ||
- ofSource.find((source) => source.synced) ||
- ofSource[0]
- return match ? scopeToValue(match.id, match.repo) : null
- },
- ],
}),
listeners(({ actions, values }) => ({
@@ -1313,23 +1240,6 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
},
})),
- actionToUrl(() => ({
- // The repository is a path segment, so picking one navigates to the same page in it. `?source`
- // stays a query param: it only tells apart two sources that sync the same repository.
- setScope: ({ sourceId, scopeRepo }) => {
- if (!scopeRepo) {
- return undefined
- }
- const pathname = removeProjectIdIfPresent(router.values.location.pathname)
- const { repo: _repo, source: _source, ...searchParams } = router.values.searchParams
- return [
- switchRepoPath(pathname, scopeRepo),
- sourceId ? { ...searchParams, source: sourceId } : searchParams,
- router.values.hashParams,
- ]
- },
- })),
-
urlToAction(({ actions, values }) => {
// `?run_scope=` is hydrated by engineeringAnalyticsFiltersLogic, not here. A repo-less path takes
// no scope: repoScopeLogic forwards it to a repository first.
@@ -1358,7 +1268,6 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
}),
afterMount(({ actions, values }) => {
- actions.loadGithubSources()
// A scoped URL already refreshed through urlToAction, which runs before this hook. A repo-less
// product URL loads once repoScopeLogic forwards it, or once it finds nothing to forward to.
if (!awaitsRepoForward() && !values.cardsLoading) {
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
index c121475c9f58..dae69231ee0f 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
@@ -1,19 +1,30 @@
import { MakeLogicType, connect, kea, path, selectors } from 'kea'
+import { router } from 'kea-router'
import { sceneLogic } from '~/scenes/sceneLogic'
+import { Breadcrumb } from '~/types'
+
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
+import { engineeringAnalyticsLogic } from './engineeringAnalyticsLogic'
/** The root scene's views: the repo hub and the pull request, workflow, test, deploy, team, and author list pages. */
export type EngineeringAnalyticsView = 'hub' | 'pull-requests' | 'workflows' | 'tests' | 'deploys' | 'teams' | 'authors'
-export const VIEW_DESCRIPTIONS: Record<EngineeringAnalyticsView, string> = {
- hub: 'CI health, pull requests, workflows, and cost for the connected repo.',
- 'pull-requests': 'Pull requests and their CI status across connected repos.',
- workflows: 'Run volume, success rate, and duration per workflow over the selected window.',
- tests: 'Quarantine debt by team: which quarantined tests each team owns, and how long they have stood.',
- deploys:
- 'DORA-style deploy metrics from GitHub deployments: frequency, merge to deploy lead time, and failure proxies.',
- teams: 'Tests each team owns and their CI signal, from the owners.yaml map.',
- authors: 'Friction each author meets in CI, review, and the merge queue, against the typical author.',
+/** The scene subtitle. Teams and authors are organization-wide on GitHub, so their tabs say which
+ * repository's figures they show. */
+export function viewDescription(view: EngineeringAnalyticsView, repo: string | null): string {
+ const inRepo = repo ? ` in ${repo}` : ''
+ const descriptions: Record<EngineeringAnalyticsView, string> = {
+ hub: 'CI health, pull requests, workflows, and cost for the connected repo.',
+ 'pull-requests': 'Pull requests and their CI status.',
+ workflows: 'Run volume, success rate, and duration per workflow over the selected window.',
+ tests: 'Quarantine debt by team: which quarantined tests each team owns, and how long they have stood.',
+ deploys:
+ 'DORA-style deploy metrics from GitHub deployments: frequency, merge to deploy lead time, and failure proxies.',
+ teams: `Tests each team owns${inRepo} and their CI signal, from the owners.yaml map.`,
+ authors: `Friction each author meets${inRepo}: CI, review, and the merge queue, against the typical author.`,
+ }
+ return descriptions[view]
}
const SCENE_KEY_TO_VIEW: Record<string, EngineeringAnalyticsView> = {
@@ -28,14 +39,22 @@ const SCENE_KEY_TO_VIEW: Record<string, EngineeringAnalyticsView> = {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface engineeringAnalyticsSceneLogicValues {
+ scopeRepo: string | null // engineeringAnalyticsLogic
+ sourceId: string | null // engineeringAnalyticsLogic
sceneKey: string | null // sceneLogic
activeView: EngineeringAnalyticsView
+ breadcrumbs: Breadcrumb[]
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface engineeringAnalyticsSceneLogicMeta {
__keaTypeGenInternalSelectorTypes: {
activeView: (sceneKey: string | null) => EngineeringAnalyticsView
+ breadcrumbs: (
+ scopeRepo: string | null,
+ sourceId: string | null,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
}
}
@@ -49,12 +68,20 @@ export type engineeringAnalyticsSceneLogicType = MakeLogicType<
export const engineeringAnalyticsSceneLogic = kea<engineeringAnalyticsSceneLogicType>([
path(['products', 'engineering_analytics', 'frontend', 'scenes', 'engineeringAnalyticsSceneLogic']),
connect(() => ({
- values: [sceneLogic, ['sceneKey']],
+ values: [sceneLogic, ['sceneKey'], engineeringAnalyticsLogic, ['scopeRepo', 'sourceId']],
})),
selectors({
activeView: [
(s) => [s.sceneKey],
(sceneKey: string): EngineeringAnalyticsView => SCENE_KEY_TO_VIEW[sceneKey] ?? 'hub',
],
+ breadcrumbs: [
+ (s) => [s.scopeRepo, s.sourceId, router.selectors.searchParams],
+ (
+ scopeRepo: string | null,
+ sourceId: string | null,
+ searchParams: Record<string, string | undefined>
+ ): Breadcrumb[] => repoBreadcrumbs(scopeRepo, searchParams, sourceId),
+ ],
}),
])
diff --git a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
index c77d681d8f4a..13eab6150cd1 100644
--- a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
@@ -3,7 +3,6 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
-import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
@@ -30,7 +29,7 @@ import type {
import { failedShardsLabel, groupJobs } from '../lib/jobGroups'
import { jobCacheKey } from '../lib/jobs'
import { WorkflowRun, isDecisiveFailure, isPassingConclusion } from '../lib/lifecycle'
-import { withScope } from '../lib/scope'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -392,7 +391,6 @@ export interface pullRequestDetailLogicMeta {
breadcrumbs: (
repoOwner: string,
repoName: string,
- number: number,
sourceId: string | null,
searchParams: Record<string, any>
) => Breadcrumb[]
@@ -743,36 +741,13 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([
timelines?.items.find((item) => item.segments.length > 0) ?? null,
],
breadcrumbs: [
- (s, p) => [p.repoOwner, p.repoName, p.number, s.sourceId, router.selectors.searchParams],
+ (s, p) => [p.repoOwner, p.repoName, s.sourceId, router.selectors.searchParams],
(
repoOwner: string,
repoName: string,
- number: number,
sourceId: string | null,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsPullRequests',
- name: 'Pull requests',
- path: withScope(
- urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),
- searchParams,
- sourceId
- ),
- iconType: 'health',
- },
- {
- key: ['EngineeringAnalyticsPullRequest', `${repoOwner}/${repoName}#${number}`],
- name: `${repoOwner}/${repoName} #${number}`,
- iconType: 'health',
- },
- ],
+ ): Breadcrumb[] => repoBreadcrumbs(`${repoOwner}/${repoName}`, searchParams, sourceId),
],
}),
diff --git a/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts b/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts
index 23b235dc548c..d4298f361d16 100644
--- a/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts
@@ -1,9 +1,11 @@
// Keeps the repository in the URL: forwards a repo-less product URL (old links, the product root) to a
-// repository, and remembers the last repository used per project so the root reopens it.
+// repository, remembers the last repository used per project so the root reopens it, and switches
+// repository from any page of the product.
-import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { ApiConfig } from 'lib/api'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
@@ -11,9 +13,11 @@ import { teamLogic } from 'scenes/teamLogic'
import { engineeringAnalyticsSources } from '../generated/api'
import type { GitHubSourceApi } from '../generated/api.schemas'
-import { pickForwardRepo, repoFromPath, repoPathFor } from '../lib/repoScope'
+import { pickForwardRepo, repoFromPath, repoPathFor, switchRepoPath } from '../lib/repoScope'
+import { scopeFromValue, scopeToValue } from '../lib/scope'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
+const EVENT_REPO_SWITCHED = 'engineering analytics repo switched'
// The repo-less paths that forward. A repo path never forwards.
const LEGACY_PATHS = [
@@ -48,9 +52,15 @@ export interface repoScopeLogicValues {
currentTeamId: number | null // teamLogic
githubSources: GitHubSourceApi[] | null
githubSourcesLoading: boolean
+ hasMultipleSources: boolean
lastRepo: string | null
lastRepoByTeam: Record<string, string>
pendingForward: boolean
+ selectedScope: string | null
+ sourceOptions: {
+ label: string
+ value: string
+ }[]
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -86,12 +96,29 @@ export interface repoScopeLogicActions {
repo: string
teamId: number
}
+ switchRepo: (scopeValue: string) => {
+ scopeValue: string
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface repoScopeLogicMeta {
__keaTypeGenInternalSelectorTypes: {
lastRepo: (lastRepoByTeam: Record<string, string>, currentTeamId: number | null) => string | null
+ hasMultipleSources: (githubSources: GitHubSourceApi[] | null) => boolean
+ sourceOptions: (githubSources: GitHubSourceApi[] | null) => {
+ label: string
+ value: string
+ }[]
+ selectedScope: (
+ githubSources: GitHubSourceApi[] | null,
+ location: {
+ hash: string
+ pathname: string
+ search: string
+ },
+ searchParams: Record<string, any>
+ ) => string | null
}
}
@@ -114,6 +141,7 @@ export const repoScopeLogic = kea<repoScopeLogicType>([
// Nothing to forward to: the repo-less page stays and loads its own connect or empty state.
noRepoToForward: true,
rememberRepo: (teamId: number, repo: string) => ({ teamId, repo }),
+ switchRepo: (scopeValue: string) => ({ scopeValue }),
}),
loaders({
@@ -142,6 +170,38 @@ export const repoScopeLogic = kea<repoScopeLogicType>([
(lastRepoByTeam: Record<string, string>, currentTeamId: number | null): string | null =>
currentTeamId ? (lastRepoByTeam[currentTeamId] ?? null) : null,
],
+ hasMultipleSources: [
+ (s) => [s.githubSources],
+ (githubSources: GitHubSourceApi[] | null): boolean => (githubSources ?? []).length > 1,
+ ],
+ // One option per selectable (source, repo). The value encodes both so a multi-repo source's repos are
+ // distinct entries; the label is the repo (falling back to prefix).
+ sourceOptions: [
+ (s) => [s.githubSources],
+ (githubSources: GitHubSourceApi[] | null): { value: string; label: string }[] =>
+ (githubSources ?? []).map((source) => ({
+ value: scopeToValue(source.id, source.repo),
+ label: source.repo || source.prefix || `source ${source.id.slice(0, 8)}`,
+ })),
+ ],
+ selectedScope: [
+ (s) => [s.githubSources, router.selectors.location, router.selectors.searchParams],
+ (
+ githubSources: GitHubSourceApi[] | null,
+ location: { pathname: string },
+ searchParams: Record<string, any>
+ ): string | null => {
+ const repo = repoFromPath(removeProjectIdIfPresent(location.pathname))
+ const sourceId: string | undefined = searchParams.source
+ // A repo-less page highlights the legacy source its ?source names, if any.
+ const match = (githubSources ?? []).find((source) =>
+ repo
+ ? source.repo.toLowerCase() === repo.toLowerCase() && (!sourceId || source.id === sourceId)
+ : !source.repo && source.id === sourceId
+ )
+ return match ? scopeToValue(match.id, match.repo) : null
+ },
+ ],
}),
listeners(({ actions, values }) => {
@@ -182,6 +242,23 @@ export const repoScopeLogic = kea<repoScopeLogicType>([
actions.clearPendingForward()
actions.noRepoToForward()
},
+ // The same page in the picked repository, or the list tab when the page is about one entity.
+ // The path names the repository; `?source` only rides along when two sources sync it, or when
+ // a legacy source names no repository and its pages stay repo-less.
+ switchRepo: ({ scopeValue }) => {
+ const { sourceId, repo } = scopeFromValue(scopeValue)
+ posthog.capture(EVENT_REPO_SWITCHED, { repository_count: values.sourceOptions.length })
+ const pathname = removeProjectIdIfPresent(router.values.location.pathname)
+ const { repo: _repo, source: _source, ...searchParams } = router.values.searchParams
+ const sameRepo = (other: string | null): boolean => other?.toLowerCase() === repo?.toLowerCase()
+ const sourcesOfRepo = (values.githubSources ?? []).filter((source) => sameRepo(source.repo))
+ router.actions.push(
+ // Another source of the repository on screen keeps the page, entity pages included.
+ repo && sameRepo(repoFromPath(pathname)) ? pathname : switchRepoPath(pathname, repo),
+ !repo || sourcesOfRepo.length > 1 ? { ...searchParams, source: sourceId } : searchParams,
+ router.values.hashParams
+ )
+ },
}
}),
@@ -199,4 +276,11 @@ export const repoScopeLogic = kea<repoScopeLogicType>([
])
),
})),
+
+ // The repository switcher in every page's title needs the list, whether or not a forward asked for it.
+ afterMount(({ actions, values }) => {
+ if (!values.githubSources && !values.githubSourcesLoading) {
+ actions.loadGithubSources()
+ }
+ }),
])
diff --git a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts b/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
index 76b4e2d9c3d3..2dd016047eac 100644
--- a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
@@ -4,7 +4,6 @@ import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
import { Dayjs, dayjs } from 'lib/dayjs'
-import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
@@ -15,7 +14,7 @@ import {
} from '../generated/api'
import type { TeamTestSignalApi } from '../generated/api.schemas'
import { DeliveryScope } from '../lib/deliveryScope'
-import { withScope } from '../lib/scope'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
import {
LoaderStatus,
@@ -23,14 +22,7 @@ import {
engineeringAnalyticsLogic,
loaderStatusFromError,
} from './engineeringAnalyticsLogic'
-import {
- DEFAULT_TEAMS_WINDOW,
- TeamCIHealthRow,
- UNOWNED_TEAM,
- isTeamsDateRange,
- teamLabel,
- toTeamCIHealthRow,
-} from './teamsLogic'
+import { DEFAULT_TEAMS_WINDOW, TeamCIHealthRow, UNOWNED_TEAM, isTeamsDateRange, toTeamCIHealthRow } from './teamsLogic'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -163,12 +155,7 @@ export interface teamDetailLogicMeta {
trunkQuarantineTestsByTeam: Record<string, TrunkQuarantinedTestRow[]>,
ownerTeam: string
) => TrunkQuarantinedTestRow[]
- breadcrumbs: (
- ownerTeam: string,
- repo: string | null,
- sourceId: string | null,
- searchParams: Record<string, any>
- ) => Breadcrumb[]
+ breadcrumbs: (repo: string | null, sourceId: string | null, searchParams: Record<string, any>) => Breadcrumb[]
mergeTrendSeries: (mergeTrend: TeamMergeTrendData | null) => {
average: number[]
labels: string[]
@@ -317,31 +304,12 @@ export const teamDetailLogic = kea<teamDetailLogicType>([
): TrunkQuarantinedTestRow[] => trunkQuarantineTestsByTeam[ownerTeam] ?? [],
],
breadcrumbs: [
- (s) => [s.ownerTeam, s.repo, s.sourceId, router.selectors.searchParams],
+ (s) => [s.repo, s.sourceId, router.selectors.searchParams],
(
- ownerTeam: string,
repo: string | null,
sourceId: string | null,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(repo), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsTeams',
- name: 'Teams',
- path: withScope(urls.engineeringAnalyticsTeams(repo), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: ['EngineeringAnalyticsTeam', ownerTeam],
- name: teamLabel(ownerTeam),
- iconType: 'health',
- },
- ],
+ ): Breadcrumb[] => repoBreadcrumbs(repo, searchParams, sourceId),
],
/** Quill-ready daily series on the backend's own day buckets. Gaps carry the last values
* forward: a day without merges means "nothing merged", not instant merges, so
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts
index d8c355350d80..e626f860d65b 100644
--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts
+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts
@@ -1,8 +1,6 @@
-import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import { ApiConfig } from 'lib/api'
-import { urls } from 'scenes/urls'
import { initKeaTests } from '~/test/init'
@@ -88,49 +86,4 @@ describe('workflowRunDetailLogic', () => {
expect(read).toHaveBeenCalledWith('1', expect.objectContaining({ run_id: 42, ci_engine: 'depot_ci' }))
}
})
-
- it('links the loaded workflow breadcrumb back with the current scope', async () => {
- router.actions.push(urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', 42), {
- source: 'source-1',
- date_from: '2026-06-01',
- date_to: '2026-06-30',
- run_scope: 'merge_queue',
- })
- logic = workflowRunDetailLogic({
- repoOwner: 'PostHog',
- repoName: 'posthog',
- runId: 42,
- sourceId: 'source-1',
- })
- logic.mount()
-
- await expectLogic(logic).toDispatchActionsInAnyOrder(['loadRunSuccess', 'loadJobsSuccess'])
-
- expect(logic.values.breadcrumbs.map(({ name }) => name)).toEqual([
- 'Engineering analytics',
- 'Workflows',
- 'PostHog/posthog · CI',
- 'run #42',
- ])
- const workflowDestination = new URL(logic.values.breadcrumbs[2].path!, 'https://example.com')
- expect(workflowDestination.pathname).toBe(
- new URL(urls.engineeringAnalyticsWorkflowRuns('PostHog', 'posthog', 'CI'), 'https://example.com').pathname
- )
- expect(Object.fromEntries(workflowDestination.searchParams)).toEqual({
- date_from: '2026-06-01',
- date_to: '2026-06-30',
- run_scope: 'merge_queue',
- source: 'source-1',
- })
-
- router.actions.replace(urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', 42), {
- source: 'source-1',
- date_from: '-30d',
- })
- const hubDestination = new URL(logic.values.breadcrumbs[0].path!, 'https://example.com')
- expect(Object.fromEntries(hubDestination.searchParams)).toEqual({
- date_from: '-30d',
- source: 'source-1',
- })
- })
})
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
index 163e9526dd05..d86fc78c4d49 100644
--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
@@ -3,7 +3,6 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
-import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
@@ -14,8 +13,8 @@ import {
} from '../generated/api'
import type { CIEngineEnumApi, RunFailureLogsApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'
import { isDecisiveFailure } from '../lib/lifecycle'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
import { RunCostSummary, summarizeRunCost } from '../lib/runHealth'
-import { withScope } from '../lib/scope'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -103,8 +102,6 @@ export interface workflowRunDetailLogicMeta {
breadcrumbs: (
repoOwner: string,
repoName: string,
- runId: number,
- run: WorkflowRunDetailApi | null,
sourceId: string | null,
searchParams: Record<string, any>
) => Breadcrumb[]
@@ -210,55 +207,13 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([
(runId: number): boolean => Number.isFinite(runId),
],
breadcrumbs: [
- (s, p) => [p.repoOwner, p.repoName, p.runId, s.run, s.sourceId, router.selectors.searchParams],
+ (s, p) => [p.repoOwner, p.repoName, s.sourceId, router.selectors.searchParams],
(
repoOwner: string,
repoName: string,
- runId: number,
- run: WorkflowRunDetailApi | null,
sourceId: string | null,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => {
- const breadcrumbs: Breadcrumb[] = [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsWorkflows',
- name: 'Workflows',
- path: withScope(
- urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),
- searchParams,
- sourceId
- ),
- iconType: 'health',
- },
- ]
-
- if (run) {
- const loadedRepo = `${run.repo.owner}/${run.repo.name}`
- breadcrumbs.push({
- key: ['EngineeringAnalyticsWorkflowRuns', `${loadedRepo}/${run.workflow_name}`],
- name: `${loadedRepo} · ${run.workflow_name}`,
- path: withScope(
- urls.engineeringAnalyticsWorkflowRuns(run.repo.owner, run.repo.name, run.workflow_name),
- searchParams,
- sourceId
- ),
- iconType: 'health',
- })
- }
-
- breadcrumbs.push({
- key: ['EngineeringAnalyticsWorkflowRun', `${repoOwner}/${repoName}/runs/${runId}`],
- name: run ? `run #${runId}` : `${repoOwner}/${repoName} · run #${runId}`,
- iconType: 'health',
- })
- return breadcrumbs
- },
+ ): Breadcrumb[] => repoBreadcrumbs(`${repoOwner}/${repoName}`, searchParams, sourceId),
],
}),
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
index ccf8d52052d9..50a9a01437c7 100644
--- a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
@@ -3,7 +3,6 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
-import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
@@ -27,8 +26,8 @@ import type {
} from '../generated/api.schemas'
import type { CIEngineEnumApi } from '../generated/api.schemas'
import { jobCacheKey } from '../lib/jobs'
+import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
import { type CostSummary, type HealthSummary, computeHealthSummary, workflowHealthSummary } from '../lib/runHealth'
-import { withScope } from '../lib/scope'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
import type { RunScopeParams } from './engineeringAnalyticsFiltersLogic'
@@ -246,7 +245,6 @@ export interface workflowRunsLogicMeta {
breadcrumbs: (
repoOwner: string,
repoName: string,
- workflowName: string,
sourceId: string | null,
searchParams: Record<string, any>
) => Breadcrumb[]
@@ -566,36 +564,13 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([
},
],
breadcrumbs: [
- (s, p) => [p.repoOwner, p.repoName, p.workflowName, s.sourceId, router.selectors.searchParams],
+ (s, p) => [p.repoOwner, p.repoName, s.sourceId, router.selectors.searchParams],
(
repoOwner: string,
repoName: string,
- workflowName: string,
sourceId: string | null,
searchParams: Record<string, string | undefined>
- ): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsWorkflows',
- name: 'Workflows',
- path: withScope(
- urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),
- searchParams,
- sourceId
- ),
- iconType: 'health',
- },
- {
- key: ['EngineeringAnalyticsWorkflowRuns', `${repoOwner}/${repoName}/${workflowName}`],
- name: `${repoOwner}/${repoName} · ${workflowName}`,
- iconType: 'health',
- },
- ],
+ ): Breadcrumb[] => repoBreadcrumbs(`${repoOwner}/${repoName}`, searchParams, sourceId),
],
}),