Back to Sentry

Feature Flags (FlagPole)

.agents/skills/feature-flags/SKILL.md

26.8.0915 B
Original Source

Feature Flags (FlagPole)

New features should be gated behind a feature flag.

  1. Register the flag in src/sentry/features/temporary.py:

    python
    manager.add("organizations:my-feature", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
    

    Use api_expose=True if the frontend needs to check the flag. Use ProjectFeature and a projects: prefix for project-scoped flags.

  2. Python check:

    python
    if features.has("organizations:my-feature", organization, actor=user):
    
  3. Frontend check (requires api_expose=True):

    typescript
    organization.features.includes('my-feature');
    
  4. Tests:

    python
    with self.feature("organizations:my-feature"):
        ...
    
  5. Rollout: FlagPole YAML config lives in the sentry-options-automator repo, not here.

See https://develop.sentry.dev/feature-flags/ for full docs.