Repository navigation
fix(Feature Lifecycle): Add missing documentation #9098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||
| --- | ||||||
| title: Feature Lifecycle | ||||||
| sidebar_label: Feature Lifecycle | ||||||
| sidebar_position: 7 | ||||||
| --- | ||||||
|
|
||||||
| The busy age of today makes it easy to forget feature flags in the code, and keep them either enabled — or disabled — | ||||||
| forever. They even overlap and nest sometimes, and create a grey area in feature flag management in which _nobody will | ||||||
| ever touch those features because things just work as they are_. For most of us, software management is already too busy | ||||||
| to fit in feature flag hygiene. | ||||||
|
|
||||||
| :::tip | ||||||
|
|
||||||
| As a good practice, feature flags should not live forever. | ||||||
|
|
||||||
| Most of the time, the ultimate goal of a feature flag is to help serve new software to audiences in a controlled way, | ||||||
| for example with [percentage rollouts](/managing-flags/rollout/rollout-by-percentage). Once the feature is fully rolled | ||||||
| out, the feature flag can be safely removed. | ||||||
|
|
||||||
| ::: | ||||||
|
|
||||||
| Feature Lifecycle highlights features at each stage of the development and release process, making it easier to spot | ||||||
| feature flags that should be removed: first from the code, then from Flagsmith. Find it under **Lifecycle** in your | ||||||
| project's navigation. | ||||||
|
|
||||||
|  | ||||||
|
|
||||||
| ## The stages of a feature flag | ||||||
|
|
||||||
| Within its life, and in the Lifecycle tab, a feature flag goes through these stages: | ||||||
|
|
||||||
| - `New`: Created in Flagsmith, but not in the code yet. Becomes `Live` once a code scan finds it. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| - `Live`: In the code and still being rolled out. Nothing to do. | ||||||
| - `Permanent`: Meant to stay, e.g. a kill switch. Never flagged for clean-up. | ||||||
| - `Stale`: Still in the code, but [untouched for a while](/managing-flags/stale-flags). Time to remove it from the code. | ||||||
| - `To Monitor`: Gone from the code, but still being evaluated, e.g. by an older release of the application. Wait before | ||||||
| deleting. | ||||||
| - `To Remove`: Gone from the code and no longer evaluated. Safe to delete from Flagsmith. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Prompt for AI agents
Suggested change
|
||||||
|
|
||||||
| ```mermaid | ||||||
| flowchart LR | ||||||
| New -->|found in code| Live | ||||||
| Live -->|no changes for a while| Stale | ||||||
| Live -->|permanent tag| Permanent | ||||||
| Stale -->|removed from code| Monitor[To Monitor] | ||||||
| Monitor -->|evaluations stop| Remove[To Remove] | ||||||
| ``` | ||||||
|
|
||||||
| ## How to set up | ||||||
|
|
||||||
| Make sure you set up [Code References](/managing-flags/code-references). Flagsmith does not have access to your | ||||||
| codebase, and only keeps track of where feature flags are referenced (file names and line numbers). | ||||||
|
|
||||||
| SDKs evaluating feature flags must also enable [Flag Analytics](/managing-flags/flag-analytics), so that Flagsmith knows | ||||||
| about per-feature usage. | ||||||
|
|
||||||
| The `Stale`, `To Monitor` and `To Remove` stages rely on | ||||||
| [Stale Flag Detection](/managing-flags/stale-flags#requirements), available on the **Scale-up** and **Enterprise** | ||||||
| plans. | ||||||
|
|
||||||
| :::note Self-hosted | ||||||
|
|
||||||
| Self-hosted installations of Flagsmith also need to ensure Flag Analytics is available on the API side. See | ||||||
| [Environment Variables](/deployment-self-hosting/core-configuration/environment-variables). | ||||||
|
|
||||||
| ::: | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import React, { FC, MouseEvent } from 'react' | ||
| import { ProjectFlag, VCSProvider } from 'common/types/responses' | ||
| import Format from 'common/utils/format' | ||
| import Tooltip from 'components/Tooltip' | ||
| import VCSProviderTag from './VCSProviderTag' | ||
|
|
||
| type CodeReferencesTagProps = { | ||
| counts: ProjectFlag['code_references_counts'] | undefined | ||
| onClick?: (e: MouseEvent<HTMLDivElement>) => void | ||
| } | ||
|
|
||
| const CodeReferencesTag: FC<CodeReferencesTagProps> = ({ counts, onClick }) => { | ||
| if (!counts?.length) { | ||
| return null | ||
| } | ||
|
|
||
| const total = counts.reduce((sum, { count }) => sum + count, 0) | ||
| const scans = Format.pluralise(total, 'time', 'times') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents |
||
| const repositories = Format.pluralise( | ||
| counts.length, | ||
| 'repository', | ||
| 'repositories', | ||
| ) | ||
| const tag = ( | ||
| <VCSProviderTag | ||
| count={total} | ||
| isWarning={total === 0} | ||
| vcsProvider={VCSProvider.GITHUB} | ||
| /> | ||
| ) | ||
|
|
||
| return ( | ||
| <Tooltip | ||
| title={ | ||
| onClick ? ( | ||
| <div onClick={onClick} className='cursor-pointer'> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This click handler is attached to a non-focusable Prompt for AI agents |
||
| {tag} | ||
| </div> | ||
| ) : ( | ||
| tag | ||
| ) | ||
| } | ||
| place='top' | ||
| > | ||
| {`Scanned ${scans} in ${repositories}`} | ||
| </Tooltip> | ||
| ) | ||
| } | ||
|
|
||
| export default CodeReferencesTag | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This overstates what Feature Lifecycle tracks: it does not represent every action in the six-step list, such as toggling the flag or applying Segment overrides. Describe it as tracking flags through lifecycle stages and identifying cleanup candidates.
Prompt for AI agents