|
Repo Added
|
Files
1180
|
Badge
README BADGES
|
push
github
feat: add flag-gated `cleanupCount` on /api/admin/projects (#12103) As part of the project cards redesign, we want to include a mention of the number of flags in clean up, so this: - Adds `cleanupCount` to the `/api/admin/projects` response if the `newProjectList` feature flag is enabled (`cleanupCount` represents the number of features currently in `completed` lifecycle stage for the project). - [src/lib/features/project/project-service.ts](https://github.com/Unleash/unleash/pull/12103/changes#diff-6ca938c853245e8796001e79972100743R265) fetches `featureLifecycleReadModel.getStageCountByProject()` alongside the existing onboarding-status call via `Promise.all`. Each fetch has its own `.catch` returning an empty `Map`, so a failure in one doesn't take down the other. ## Performance considerations This PR adds a new caller of `getStageCountByProject()` to a somewhat critical admin endpoint. If this causes performance issues once we enable the flag, we could consider either of the following follow up tasks to mitigate: - **Index migration on `feature_lifecycles`**: add `(feature, created_at DESC)`. The query relies on `DISTINCT ON (feature) ORDER BY feature, created_at DESC`, and no matching index exists today (only the PK on `(feature, stage)`), so Postgres falls back to a sort. The index would let it scan in order instead. - **Move lifecycle counts per stage to a separate endpoint and lazy-load on the frontend**. We could also consider only loading a project lifecycle count if the card is visible on viewport. For now, since we already fetch all feature flag lifecycles for all projects in `/insights` (Analytics page), I'd merge as-is and only remediate if it becomes an issue. Shoutout to @melindafekete and @gergokekesi for discussing this with me 💖
1852 of 2047 branches covered (90.47%)
10 of 12 new or added lines in 2 files covered. (83.33%)
1 existing line in 1 file now uncovered.15118 of 17352 relevant lines covered (87.13%)
927.11 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|