Description
Transform validated GrowthBook experiments into the format required by the Test Kitchen API for MediaWiki and Varnish.
This includes normalizing fields such as variants, sampling configuration, stream name, and contextual attributes to match the expected contract.
Technical Notes
Relevant files:
- util/experimentUtil.js
- service/experimentService.js
New files:
- service/adapters/growthBookToCanonicalAdapter.js
- service/adapters/mediaWikiExperimentAdapter.js
- service/adapters/varnishExperimentAdapter.js
util/experimentUtil.js already contains output-shaping logic:
- formatVarnish
- formatMediaWiki
- formatAnalytics
- formatBase
This is our current adapter logic. This task is about introducing an earlier adapter that maps GrowthBook to a canonical model, and possibly later splitting consumer adapters out too.
Acceptance Criteria
- GrowthBook experiment payloads are transformed into the canonical experiment model.
- Schema is fetched from the customFields.schema field of the response
- Contextual attributes is fetched from the customFields.contextual_attributes field of the response
- Required Test Kitchen fields are populated or derived consistently.
- Adaptation failures are surfaced as structured errors or validation failures.
- Unit tests cover the GrowthBook-to-canonical transformation.
- Existing API formatting logic doesn't need to know about raw GrowthBook payload structure.