fix(flags): apply grace period to flag definitions cache verification#60533
Merged
Conversation
Make _get_team_ids_with_recently_updated_flags public to enable reuse in HyperCache management config. Add assertions to verify the grace-period skip is correctly wired into both cache verification configs.
Contributor
|
Reviews (1): Last reviewed commit: "fix(flags): export grace period team ID ..." | Re-trigger Greptile |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces false-positive “drift” reports from the HyperCache verifier by applying the existing flag-update grace period logic to the flag definitions HyperCache configs (with and without cohorts), so recently-updated teams can be skipped while async rebuilds are still in flight.
Changes:
- Promotes the flags-cache grace-period helper to a shared, non-private function (
get_team_ids_with_recently_updated_flags). - Wires that helper into both flag-definitions HyperCache management configs via
get_team_ids_to_skip_fix_fn. - Extends existing local-evaluation config tests to assert the skip function is set for both configs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| products/feature_flags/backend/flags_cache.py | Renames the grace-period helper and keeps the flags HyperCache config using it. |
| products/feature_flags/backend/local_evaluation.py | Adds the grace-period skip function to both flag-definitions HyperCache configs. |
| products/feature_flags/backend/test/test_flags_cache.py | Updates tests to use the renamed public helper. |
| products/feature_flags/backend/test/test_local_evaluation.py | Adds assertions that both flag-definitions configs have the skip function wired in. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matheus-vb
approved these changes
Jun 1, 2026
MattPua
pushed a commit
that referenced
this pull request
Jun 1, 2026
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.
Problem
The HyperCache verifier compares cached flag definitions against the database and "fixes" any drift it detects. Both
FLAG_DEFINITIONS_HYPERCACHE_MANAGEMENT_CONFIGandFLAG_DEFINITIONS_NO_COHORTS_HYPERCACHE_MANAGEMENT_CONFIGwere missingget_team_ids_to_skip_fix_fn, so the verifier had no way to know a flag had just been updated and the async cache rebuild was still in flight. The result was a steady stream of phantom drift reports for teams whose caches were already on their way to being refreshed.The
flagscache already has this protection via_get_team_ids_with_recently_updated_flagsinflags_cache.py. The two flag-definitions configs just weren't wired to it.Changes
_get_team_ids_with_recently_updated_flagstoget_team_ids_with_recently_updated_flagsso it can be shared across modules.get_team_ids_to_skip_fix_fnon both flag-definitions HyperCache configs inlocal_evaluation.py.How did you test this code?
Test coverage.