Skip to content

Implement 'open feature' feature flagging#1371

Merged
gpeng merged 6 commits intomainfrom
spike-open-feature
Apr 28, 2026
Merged

Implement 'open feature' feature flagging#1371
gpeng merged 6 commits intomainfrom
spike-open-feature

Conversation

@gpeng
Copy link
Copy Markdown
Contributor

@gpeng gpeng commented Apr 23, 2026

Description

We currently feature flag using environment variables. As we expand our private beta we will need to be able to enable and disable functionality in a more complex way. We will also need to assure enabling features as we build them which will require a degree of accountability for enabling features that is difficult to support with environment variable based flags.

OpenFeature gives us a consistent pluggable interface that allows a simple implementation (this one) to replace the existing level of functionality we have and will allow us to expand the backend flag management to use a custom backend or a service e.g https://www.getunleash.io or other open feature compliant SaaS. (there are discussions afoot to this end in the wider programme.

This PR:

  • Installs the python open feature lib
  • Adds an application level environment variable DEPLOYED_TO. We don't currently have a reliable variable for the deployment envirnment
  • Adds a very simple yml file based backend for openfeature with flag enabling stuff to use in tests
  • Replaces one flag... baby steps.
  • Add docs

Jira link

Review notes

I haven't replaced everything in this PR. Some of the other 'flags' might be simpler to leave as env vars as they're not really features e.g. BASIC_AUTH

The DEPLOYED_TO variable could be used for other things, replacing the DJANGO_ENV which has been a bit contentious. That hasn't been done here either.

Review checklist

  • Check database queries are correctly scoped to current_provider
  • If this changes the gateway API (/api/v1/), confirm whether it is a breaking change — if so, a new major version (/api/v2/) is required (see ADR-006)

@gpeng gpeng changed the title Spike open feature Implement 'open feature' feature flagging Apr 24, 2026
@gpeng gpeng force-pushed the spike-open-feature branch 2 times, most recently from c5046f1 to 8f5c55d Compare April 27, 2026 13:58
Copy link
Copy Markdown
Contributor

@steventux steventux left a comment

Choose a reason for hiding this comment

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

Looks a lot better than env vars.
Made a small suggestion for readability, not a blocker.

Comment thread manage_breast_screening/core/feature_flags.py
Comment thread manage_breast_screening/mammograms/views/__init__.py Outdated
@gpeng gpeng force-pushed the spike-open-feature branch from 3fc11ee to ceba293 Compare April 27, 2026 15:50
@gpeng gpeng mentioned this pull request Apr 28, 2026
2 tasks
@gpeng gpeng force-pushed the spike-open-feature branch from ceba293 to 000f3ad Compare April 28, 2026 10:58
Copy link
Copy Markdown
Contributor

@steventux steventux left a comment

Choose a reason for hiding this comment

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

🎏

gpeng added 6 commits April 28, 2026 13:10
We're going to use openfeature format feature flags.
* Add application level environment variable to indicate the deployed
  environment that the running instance is running on.

This can be used to predicate the environment banner, flags files etc
* Use InMemoryStore
* Read yaml files for each env flags.<DEPLOYED_TO>.yaml
* Replace the existing env var based flag with a shiny new openfeature
  one

This is a basic test implementation that will apply accross all
environments currently
* Documentation for the yml openfeature implementation
* Add a COPY line to the docker file to build the flags files into the
  image.
* Set to 444 to write protect the files (flagged by SonarQube)
@gpeng gpeng force-pushed the spike-open-feature branch from 000f3ad to 8531d32 Compare April 28, 2026 12:16
@sonarqubecloud
Copy link
Copy Markdown

@gpeng gpeng merged commit 0d3a5b9 into main Apr 28, 2026
12 checks passed
@gpeng gpeng deleted the spike-open-feature branch April 28, 2026 12:28
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