Conversation
|
Size Change: +518 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
oliverlloyd
left a comment
There was a problem hiding this comment.
Are we saying here that within switches there is actually a subset of switches used for ab tests and that sometimes in the code these are getting confused with the main switches used as feature flags? Does this perhaps surface a larger problem that we should really have two properties on the model?
If the above is true, then ideally this transformation would happen earlier in the stack, in which case this change could be made into an enhancer. We use enhancers for the types of model changes that we:
- want to happen now so that we can write the rendering code the way we think it should be be but
- also want to move up to a higher level in the stack
By using enhancers we make any transition up in future easier (because the mutation is contained) and we also make writing rendering code easier as the model fits the right pattern.
|
|
||
| export const filterABTestSwitches = (switches: Switches): ABTestSwitches => | ||
| Object.fromEntries( | ||
| Object.entries(switches).filter(([key]) => key.startsWith('ab')), |
There was a problem hiding this comment.
Is there a convention that switches used for ab tests are given the ab prefix and this function is built on top of that pattern?
There was a problem hiding this comment.
Yes, this is a convention followed in frontend and the ab-testing framework expects it.
Sadly I couldn’t find documentation outside of the actual LoC where this stuff is evaluated. I tried to bring a change to the ab-testing library to use a template string to indicate this fact with ab${string}, but couldn’t get the repo to behave.
Worth keeping in mind that we recently refactored If we wanted to use an enhance pattern for this solution, we'd need to re-introduce some kind of enhancement protocol which works for the wider CAPI object, while making sure it doesn't prevent support for our new endpoints like |
|
We already have enhanceStandfirst which I think follows the pattern we would need here. Right now we have So maybe we could or something like that? |
What does this change?
Add a method to filter out unused switches.
Why?
We should only pass required props to
Islandchildren.Before
After