Skip to content

feat(flags): add dynamic rollout and Redis-backed route gating - #313

Open
vbtgongithub wants to merge 2 commits into
mainfrom
codex/issue-300-feature-flags
Open

vbtgongithub wants to merge 2 commits into
mainfrom
codex/issue-300-feature-flags

Conversation

@vbtgongithub

Copy link
Copy Markdown
Collaborator

Closes #300

Changes

I added a MongoDB feature flag catalog with deterministic percentage rollouts and explicit user allowlists. I added authenticated flag discovery, admin-only flag list and update endpoints, and requireFlag middleware that returns HTTP 404 with FEATURE_DISABLED for a disabled or unknown flag.

I cache the catalog and per-user decisions in Redis for 60 seconds. A successful admin update bumps the flag version and rotates the catalog generation so an older refill cannot make stale definitions current again.

Validation

I passed backend TypeScript typechecking and all 12 targeted flag and ops tests. I tested rollout stability, allowlist behavior, authentication and admin authorization, route gating, cache invalidation, concurrent admin patches, and cache failure responses. The tests used a local MongoDB fixture and mocked Redis.

Limitations

I did not run the tests against a live Redis server. If MongoDB saves a flag update but Redis invalidation cannot be confirmed, the API reports the partial failure and readers can still see cached values for up to 60 seconds.

Signed-off-by: VBTG <vuppubhanu18@gmail.com>
@vbtgongithub

Copy link
Copy Markdown
Collaborator Author

@VarshithReddy2006 I have implemented the changes for this issue. Please review my changes and merge this PR if everything looks good.

@VarshithReddy2006 VarshithReddy2006 added enhancement New feature or request help wanted Extra attention is needed nsoc26 level3 10 points - core logic, database changes, and complex features. labels Nov 15, 2026
@VarshithReddy2006

Copy link
Copy Markdown
Owner

Hi @vbtgongithub,

The CI/CD \Unit Tests\ workflow failed on this PR with the following error:
\
AssertionError: add an import for these model files at the top of this test: expected [ 'featureFlag.model.ts' ] to deeply equal []
❯ src/tests/db/modelIndexes.test.ts:93:84
\\

To resolve this, please import \ eatureFlag.model.js\ in \�ackend/src/tests/db/modelIndexes.test.ts\ alongside the other model imports, re-run tests, and push the update. Thank you!

Signed-off-by: VBTG <vuppubhanu18@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request help wanted Extra attention is needed level3 10 points - core logic, database changes, and complex features. nsoc26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(flags,m0): build dynamic feature flag service with Redis caching, percentage rollout, and requireFlag middleware

2 participants