Add polling to fetch experiment configs from GrowthBook
What?
- Add
experimentstable todb/init.sqlto hold GrowthBook-originated (and TK-registered for an interim period) experiments - Update Experiment model to only include fields needed to build the TK API response
- Add
service/growthBookClient.js: authenticated HTTP client with configurable retry logic - Add
service/growthBookPoller.js: polls GrowthBook on startup and at a configurable interval, updates the experiment configuration cache on each successful fetch - Add
service/experimentStitcher.js: merges TK and GrowthBook experiment lists; GrowthBook wins on slug conflict; - Add
service/experimentConfigurationService.js: minimal stubs to validate/adapt the GrowthBook API response (to be expanded in T421803 and T421804), loads TK experiments from the DB, stitches both sources (to be elaborated in T421808), and inserts the result into theexperiments_cachetable - Map
GrowthBookcustom fieldsevent_stream,contextual_attributes) toExperimentmodel fields - Wire poller into
app.jsandservice/serviceRegistry.js - Add
growthbookconfig block toconfig.dev.yamlandconfig.prod.yaml; injectGROWTHBOOK_API_KEYfrom environment inconfig/configuration.js - Add feature flag
run_pollerin growthbook config block to gate polling on staging and production - Add unit tests for all new components
Why?
- Experiments defined in GrowthBook need to be visible alongside TK-registered experiments so that Enrollment Authorities receive a unified, authoritative list of experiments regardless of which platform an experiment owner used to configure their experiment
Testing Instructions:
- In
config.local.yaml, add your api key in thegrowthbookconfig block - Run
make run-devin local dev environment - Check the
experimentstable in your local docker database to see both TK-originated and GB-originated experiments