Poll for flag updates, add onChange subscriptions and a generic getVariant #703

Openelindqvist wants to merge 4 commits into main from feat/polling-and-variants· opened 5 days ago
+54−8
elindqvist commented 5 days agoAuthor

Summary

The Node SDK only fetched flags once at start(), so customers had to restart their servers to pick up a change. This PR:

  • Polls /v2/flags every 30 s (configurable with pollIntervalMs)
  • Adds onChange(key, listener) so apps can react to flips (we need this for the React SDK bridge, which subscribes per component)
  • Replaces getBoolean with a generic getVariant<T> so string and number flags work too
  • Adds a semverGte rule op for app-version targeting (server side already shipped)
  • Rules can now target userId without callers copying it into attributes
  • Adds close() for clean shutdown

Notes

Marked breaking because getBoolean is gone; will add a deprecation shim in a follow-up.

Testing

Updated the unit tests for rules; tried polling against staging with a flag flip.

elindqvist added 4 commits 5 days ago
Poll flags on an intervalf0e6d23
Add onChange subscriptionsefe6d0a
Generic getVariant and semverGte rule opf2e6d55
Expose userId to rulesf1e6d3c

Review required

Review the changes, then submit to get graded.

Some checks haven’t completed yet

1 check: dojo / review-grader

Keyboard shortcuts

Site-wide

Focus the search bar
/
Show this dialog
?

Pull request

Move to the next file
j
Move to the previous file
k
Filter changed files
t
Comment on the selected lines
c
Select a range of lines
Shiftclick