Repository navigation
fix(flags): skip flag revalidation when evaluation is disabled or pending - #1095
Conversation
|
@mvanhorn is attempting to deploy a commit to the Databuddy OSS Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
[Medium impact] The PR appears safe to merge. SummaryStops background flag refreshes while evaluation is disabled or waiting for a session.
No new actionable issues found. Tests were not run. Reviews (2) · Last reviewed commit: "fix(sdk): guard stale flag revalidation ..." · Reviewed by Greptile |
…ding isEnabled() and getValue() now require evaluation to be active before revalidating a stale entry or fetching a cache miss. Cached results and overrides are still returned immediately, and a miss still returns the existing loading or fallback value. Active stale reads still revalidate. Server flags tests cover disabled and pending stale reads, inactive cache misses, overrides while disabled, and an active stale read, and a patch changeset records the skip. Fixes databuddy-analytics#1091
Run the disabled and pending stale-read cases as separate tests sharing a helper instead of awaiting inside a loop, and test isEnabled() and getValue() revalidation on separate managers so each asserts its own refresh request for the stale key.
…nly the tests that need the fix
23907c0 to
b75cff9
Compare
7032cfa
into
databuddy-analytics:staging
Description
isEnabled() and getValue() now require evaluation to be active before revalidating a stale entry or fetching a cache miss. Cached results and overrides are still returned immediately, and a miss still returns the existing loading or fallback value. Active stale reads still revalidate. Server flags tests cover disabled and pending stale reads, inactive cache misses, overrides while disabled, and an active stale read, and a patch changeset records the skip.
After a flag is cached, synchronous isEnabled() and getValue() reads still start a background evaluation once that entry is stale, including when the manager is disabled or the session is still pending. The caller keeps receiving the cached flag while an extra evaluation request goes out. On a stale cache hit, both methods call revalidate() when the entry is stale and shouldSkipFetch() is false. On a cache miss, they start a background getFlag() when canFetchOnRead() is true. Neither branch checks config.disabled or config.isPending.
Closes #1091
Slice
Checklist
stagingand does not include another unmerged PR unless it is named above.Not claimed:
npm testcould not run in this environment (dotenv is not installed).staging; after it closes, this branch will not be reused for another change.Not claimed:
stagingwas not run locally either.Not claimed: the same reason as the box above applies.
AI disclosure
AI was used for assistance.
Summary by cubic
isEnabled()andgetValue()skip background flag revalidation when evaluation is disabled or the session is pending, so stale cached flags no longer trigger unnecessary network requests.revalidate().isEnabled()andgetValue()on separate managers.Fixes #1091.
Written for commit b75cff9. Summary will update on new commits.