Backend: migrate ENABLE_DONATIONS to donations_enabled feature flag#8771
Conversation
…ture flag Replace the static ENABLE_DONATIONS env config with a per-request `donations_enabled` feature flag so donations can be toggled remotely without a deploy. The Stripe credentials stay in env and are now required in production unconditionally (since the flag can be flipped on at any time), failing loudly at boot if missing. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Release NotesThis PR does not need to be included in release notes. Reason: This change is primarily an internal backend/configuration migration from an environment variable to a feature flag. While it improves operational flexibility for turning donations on or off without a deploy, it does not add or noticeably change functionality for end users, and it is not a major enough technical infrastructure change to surface in user-facing release notes. 🤖 Bot Debug InformationModel: |
Migrates the
ENABLE_DONATIONSenv toggle to adonations_enabledfeature flag (GrowthBook), so donations can be turned on/off remotely without a deploy. This is the first of Project 1 — movingENABLE_*functionality toggles onto the feature flag system.Policy this establishes for
ENABLE_*→ flag migrations:context.get_boolean_value("donations_enabled", default=False)(fails closed when experimentation is off/unconfigured).STRIPE_*) stay in env. Since the flag can be flipped on remotely at any time, the boot-time guarantee can no longer be gated on an enable-bit, so prod now requires the Stripe creds unconditionally (moved into theif not DEV:block) and screams loudly at boot if any are missing.Ops: create
donations_enabledin GrowthBook (default = prod's current donations state) before/at deploy. Until configured, the in-code default (False) applies.Testing
make formatclean;make mypyreports only the 2 pre-existing unrelated errors.test_donations.py10/10 — dropped the now-unnecessaryENABLE_DONATIONS=Truepatches (the flag defaults on in tests viaEXPERIMENTATION_PASS_ALL_GATES), and addedtest_donations_disabled, which uses the sharedfeature_flagsfixture to force the gate off and asserts theUNAVAILABLE/ "Donations are currently disabled." abort.Backend checklist
developif necessary for linear migration history (n/a — no DB changes)For maintainers
This PR was created with the Couchers PR skill.