Skip to content

feat: use lifecycles API#7793

Open
kyle-ssg wants to merge 12 commits into
mainfrom
feat/lifecycle-stats-api
Open

feat: use lifecycles API#7793
kyle-ssg wants to merge 12 commits into
mainfrom
feat/lifecycle-stats-api

Conversation

@kyle-ssg

@kyle-ssg kyle-ssg commented Jun 16, 2026

Copy link
Copy Markdown
Member

Conform the project lifecycle page to the new backend API (#7789):

  • Add lifecycle-status-counts RTK query for sidebar counts in one call
  • Add lifecycle_stage + evaluation_period_days params to getProjectFlags and a lifecycle_stage field on ProjectFlag
  • Each section now fetches only its own stage, classified server-side
  • Remove client-side tag/code-reference/evaluation classification, the per-flag EvaluationChecker and useEvaluationCounts hook
  • Single environment (name-matched "prod" by default, switchable in the left nav, persisted per project in a new redux slice) and a single evaluation_period_days replace the multi-env + dual-period controls
  • Drop the non-functional "LIFECYCLE STAGES" sidebar header/Add button

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Hooks up API for feature lifecycle

image

How did you test this code?

Go to lifecycle page as in the Flagsmith project

…ification

Conform the project lifecycle page to the new backend API (#7789):

- Add lifecycle-status-counts RTK query for sidebar counts in one call
- Add lifecycle_stage + evaluation_period_days params to getProjectFlags
  and a lifecycle_stage field on ProjectFlag
- Each section now fetches only its own stage, classified server-side
- Remove client-side tag/code-reference/evaluation classification, the
  per-flag EvaluationChecker and useEvaluationCounts hook
- Single environment (name-matched "prod" by default, switchable in the
  left nav, persisted per project in a new redux slice) and a single
  evaluation_period_days replace the multi-env + dual-period controls
- Drop the non-functional "LIFECYCLE STAGES" sidebar header/Add button

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kyle-ssg kyle-ssg requested a review from a team as a code owner June 16, 2026 09:06
@kyle-ssg kyle-ssg requested review from talissoncosta and removed request for a team June 16, 2026 09:06
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jul 1, 2026 2:53pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 1, 2026 2:53pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 1, 2026 2:53pm

Request Review

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 16, 2026
@kyle-ssg kyle-ssg marked this pull request as draft June 16, 2026 09:07
@github-actions github-actions Bot added the feature New feature or request label Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7793 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7793 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7793 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7793 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7793 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7793 Finished ✅ Results

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.5 seconds
commit  a369ed5
info  🔄 Run: #17534 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.2 seconds
commit  a369ed5
info  🔄 Run: #17534 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 4 suites
duration  10.5 seconds
commit  a369ed5
info  🔄 Run: #17534 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  1 minute, 10 seconds
commit  a369ed5
info  🔄 Run: #17534 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  43.3 seconds
commit  c890063
info  🔄 Run: #17980 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 2 suites
duration  12 seconds
commit  c890063
info  🔄 Run: #17980 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  41.4 seconds
commit  8923106
info  🔄 Run: #17981 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  44.8 seconds
commit  8923106
info  🔄 Run: #17981 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  53.4 seconds
commit  c890063
info  🔄 Run: #17980 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  19.8 seconds
commit  8923106
info  🔄 Run: #17981 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 5 suites
duration  3.7 seconds
commit  8923106
info  🔄 Run: #17981 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  42.3 seconds
commit  bf57a38
info  🔄 Run: #17982 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  39.8 seconds
commit  bf57a38
info  🔄 Run: #17982 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

failed  1 failed
passed  1 passed

Details

stats  2 tests across 2 suites
duration  57.7 seconds
commit  c890063
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17980 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise

### Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 4 suites
duration  33.2 seconds
commit  bf57a38
info  🔄 Run: #17982 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 2 suites
duration  12.5 seconds
commit  bf57a38
info  🔄 Run: #17982 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  42 seconds
commit  06ac488
info  🔄 Run: #17983 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  45.4 seconds
commit  06ac488
info  🔄 Run: #17983 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  6 passed

Details

stats  6 tests across 5 suites
duration  34.4 seconds
commit  06ac488
info  🔄 Run: #17983 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  12.2 seconds
commit  06ac488
info  🔄 Run: #17983 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  41.3 seconds
commit  ac8d1a3
info  🔄 Run: #17997 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  11.9 seconds
commit  ac8d1a3
info  🔄 Run: #17997 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  42.1 seconds
commit  ac8d1a3
info  🔄 Run: #17997 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  10.8 seconds
commit  ac8d1a3
info  🔄 Run: #17997 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  41.6 seconds
commit  5cf7e38
info  🔄 Run: #17998 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  4.3 seconds
commit  5cf7e38
info  🔄 Run: #17998 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  41.3 seconds
commit  5cf7e38
info  🔄 Run: #17998 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  36.1 seconds
commit  5cf7e38
info  🔄 Run: #17998 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  45.5 seconds
commit  0fe0f62
info  🔄 Run: #18000 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  43.1 seconds
commit  0fe0f62
info  🔄 Run: #18000 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  18.8 seconds
commit  0fe0f62
info  🔄 Run: #18000 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  38.4 seconds
commit  0fe0f62
info  🔄 Run: #18000 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  50.8 seconds
commit  34e3478
info  🔄 Run: #18001 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  45.6 seconds
commit  34e3478
info  🔄 Run: #18001 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 4 suites
duration  32.2 seconds
commit  34e3478
info  🔄 Run: #18001 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  59.6 seconds
commit  34e3478
info  🔄 Run: #18001 (attempt 1)

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@manos-saratsis

This comment was marked as spam.

Match the feature-lifecycle endpoints introduced in PR #7789:
- lowercase LifecycleStage values + SECTION_TO_STAGE mapping
- env-scoped counts URL (environments/{env}/feature-lifecycle-counts/)
- read lowercase count keys; drop unsupported filter + evaluation_period
  params from the counts query
- remove the orphaned evaluation-period selector (backend derives the
  window from project.stale_flags_limit_days)

Extract prod-environment prediction into predictProdEnvironment().

Add frontend context doc for running an unmerged backend PR's Docker image.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kyle-ssg and others added 2 commits July 1, 2026 09:50
- Fix loading state: use isFetching in addition to isLoading for proper
  loading indicator when switching between lifecycle sections
- Change environment picker from tag chips to dropdown select
- Add tooltip explaining environment selection affects evaluations only
- Remove checkbox selection from Stale and Remove sections for visual
  consistency with other sections
- Fix MONITOR_TOOLTIP type error by converting JSX to HTML string
- Add spacing before "Why am I seeing this?" link
- Fix FeatureImport.tsx type error with proper ternary for existingFlags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread frontend/.claude/context/testing-against-pr-backend.md Outdated
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 1, 2026

@emyller emyller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description looks out of date, as it still mentions the evaluation_period_days added in a previous API PoC, replaced with what ended up in production. I made sure it's not in the patch.

I think the new tab plays a nice role in calling attention to it, but I'm not 100% convinced we need to add yet another item in that [already crowded] horizontal space. Do you have any plans to use the lifecycle stage info also added to feature list and retrieve endpoints?

@kyle-ssg

kyle-ssg commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

The PR description looks out of date, as it still mentions the evaluation_period_days added in a previous API PoC, replaced with what ended up in production. I made sure it's not in the patch.

I think the new tab plays a nice role in calling attention to it, but I'm not 100% convinced we need to add yet another item in that [already crowded] horizontal space. Do you have any plans to use the lifecycle stage info also added to feature list and retrieve endpoints?

Lifecycle stages are largely project-wide rather than environment-specific (only evaluations are per-environment). In practice, feature lifecycle is typically assessed from a single environment—usually production—where other environments might not be meaningful.

Typing this out makes me think adding lifecycle filters to the environment features page could actually create confusion, since you'd be viewing project-level data within an environment-scope thats not production and therefore misleading.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@emyller

emyller commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Lifecycle stages are largely project-wide rather than environment-specific (only evaluations are per-environment). In practice, feature lifecycle is typically assessed from a single environment—usually production—where other environments might not be meaningful.

Precisely. My initial draft (which included evaluation_period_days mentioned earlier) was mounted on /api/v1/projects but I couldn't guess — from the backend — which environment "production" would be. Hence I ultimately decided to mount the counts endpoint to /api/v1/environments.

Perhaps /api/v1/projects/{}/lifecycle-stage-counts/?environment_id={} would have made more sense semantically.

Typing this out makes me think adding lifecycle filters to the environment features page could actually create confusion, since you'd be viewing project-level data within an environment-scoped context.

Agree! Thanks, I'm 100% convinced about the new tab now.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kyle-ssg

kyle-ssg commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Lifecycle stages are largely project-wide rather than environment-specific (only evaluations are per-environment). In practice, feature lifecycle is typically assessed from a single environment—usually production—where other environments might not be meaningful.

Precisely. My initial draft (which included evaluation_period_days mentioned earlier) was mounted on /api/v1/projects but I couldn't guess — from the backend — which environment "production" would be. Hence I ultimately decided to mount the counts endpoint to /api/v1/environments.

Yep makes total sense, we could add a whats your production setting but the current frontend cleverly looks for an environment name that has a name like prod

@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 1, 2026

@talissoncosta talissoncosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @kyle-ssg !

Just one point I wanna raise. The env selection is not persisting on reload.

Can you add 'lifecycleEnvironment on the whitelist on common/store line 41. So this will match with the PR description.

        whitelist: ['user', 'lifecycleEnvironment'],

Clicking a feature row in the lifecycle page now opens a side modal
with Usage and Settings tabs, matching the main feature modal styling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants