Skip to content
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

feat(flags): add GET feature_flags/:id/status for determining flag staleness #26340

Merged
merged 51 commits into from
Dec 6, 2024

Conversation

havenbarnes
Copy link
Contributor

@havenbarnes havenbarnes commented Nov 21, 2024

Problem

This serves as a starting point for #16497
By hitting this new endpoint in the Feature Flag > Usage tab, we can show users when their flag isn't being used anymore and is ripe for deletion from Posthog AND in their codebase. Eventually, we can use this status checking logic as a way to automate the archival of flags or give users helpful hints about flag-related tech debt in general

Changes

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

  • Hit API locally a ton
  • Added exhaustive API test cases

Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

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

few copy suggestions and one question about the query.

posthog/models/feature_flag/flag_status.py Outdated Show resolved Hide resolved
posthog/models/feature_flag/flag_status.py Outdated Show resolved Hide resolved
posthog/models/feature_flag/flag_status.py Show resolved Hide resolved
posthog/models/feature_flag/flag_status.py Outdated Show resolved Hide resolved
posthog/models/feature_flag/flag_status.py Outdated Show resolved Hide resolved
@havenbarnes havenbarnes requested a review from dmarticus December 2, 2024 18:03
Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

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

API design looks fine and idiomatic; love the tests; only have some feedback on what feels like an abstraction collision between a flag being "enabled" | "disabled" vs enabled with a status. I want to do a better job modeling the different between flags that are enabled vs disabled vs stale vs inactive (especially since I think it'd be cool for folks to just disable flags that are stale and have that "just work", if possible).

posthog/models/feature_flag/flag_status.py Outdated Show resolved Hide resolved
@havenbarnes havenbarnes requested a review from dmarticus December 5, 2024 00:58
@havenbarnes havenbarnes merged commit 1383d83 into master Dec 6, 2024
89 checks passed
@havenbarnes havenbarnes deleted the detect-stale-flags branch December 6, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants