Repository navigation
feat(flags): add dynamic rollout and Redis-backed route gating - #313
Open
vbtgongithub wants to merge 2 commits into
Open
vbtgongithub wants to merge 2 commits into
vbtgongithub wants to merge 2 commits into
Conversation
Signed-off-by: VBTG <vuppubhanu18@gmail.com>
Collaborator
Author
|
@VarshithReddy2006 I have implemented the changes for this issue. Please review my changes and merge this PR if everything looks good. |
Owner
|
Hi @vbtgongithub, The CI/CD \Unit Tests\ workflow failed on this PR with the following error: 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.