Backend: Hide moderator badge behind a feature flag#8757
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9210b5e to
0c5cecc
Compare
0c5cecc to
2375dd8
Compare
|
I might be misunderstanding, but it looks like you're using this in the badges update query but not the get query? |
…rd time Add an optional `flag` to badge definitions: a flagged badge is only awarded (and listed in the GetBadges catalog) while its feature flag is on. The flag defaults on, so the moderator badge stays visible until show_moderator_badge is turned off in GrowthBook. The update_badges job converges membership, so flipping the flag off removes the moderator badge from all superusers on the next run; the catalog filter and a profile-side guard hide it from the web UI immediately. This keeps the badge's existence the single source of truth - no per-read-site filtering or notification special-casing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tend Drop the per-read GetBadges catalog filter so the badge catalog always returns the full list (badge name/color/description always resolve). The show_moderator_badge flag now only controls membership via update_badges. Hide the moderator badge from the /badges explorer with a frontend guard that mirrors the backend default-on flag, using useFeatureValue(..., true) so the badge shows unless the flag is explicitly off. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The badge-explorer hide and profile guard now live in #8766; this branch keeps only the backend gating.
…dges Add module-level get_boolean_value / get_string_value / ... to experimentation for evaluating flags with no user/request context (anonymous, like a logged-out user). The enabled / pass-all-gates gating moves into shared helpers that both the new global functions and CouchersContext use - the context keeps its cached per-request evaluator by passing it in. update_badges now calls experimentation.get_boolean_value directly instead of constructing a throwaway logged-out CouchersContext just to read a flag. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Name the no-user functions get_global_boolean_value / get_global_string_value / ... so call sites read as explicitly global, and spell out in the comments that they're only for flags that genuinely can't be per-user (a toggle that behaves the same for everyone) - anything per-user must go through the context so rollouts and experiments can bucket by user. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
551071c to
185934e
Compare
📝 Release NotesThis PR does not need to be included in release notes. Reason: This change mainly adds backend feature-flag control to hide or show the moderator badge, with no user-visible effect until a separate flag is enabled. As submitted, production behavior is unchanged by default, and it is mostly internal rollout infrastructure rather than a clear end-user feature release. 🤖 Bot Debug InformationModel: |
Hides the moderator profile badge from the UI, gated behind a GrowthBook feature flag so it can be rolled out and rolled back without a deploy.
This adds a generic
hiddenflag to badge definitions. A hidden badge is still awarded to users and stored inuser_badges(no data churn), but is:GetBadgescatalog (so it disappears from the/badgespage),badgeslist onGetUser, public profiles, and admin user-details, andThe
moderatorbadge is markedhidden. Whether the flag is honored is controlled by a new global gatehide_moderator_badge(viacheck_global_gate, which evaluates against a stable synthetic identity so it works in anonymous/AUTH_LEVEL_OPENand background-job contexts where there is no user). The gate is off by default, so behavior is unchanged in production until the flag is turned on; turning it off again is an instant rollback.To roll out: create a boolean feature/gate named
hide_moderator_badgein GrowthBook (default off) and turn it on when ready.Testing
test_hidden_badge_is_awarded_but_not_shown(gate on, the default in tests): the badge row is created but absent fromGetUserand no notification fires.test_hidden_badge_is_shown_when_rollout_gate_off(disables experimentation viamonkeypatch): the badge is shown on the profile and the add is notified — verifying the pre-rollout/rollback path.test_GetBadgesto reflect the moderator badge being excluded from the catalog when the gate is on.test_api,test_resources,test_bg_jobs,test_donations,test_public,test_admin) — all pass.make formatclean;make mypyhas only 2 pre-existing errors in untouched files.Backend checklist
developif necessary for linear migration history (no DB changes)Web frontend checklist
For maintainers
This PR was created with the Couchers PR skill.