From 2b9aa4b652a5c7b179d2ed613e36ca0724db5bb6 Mon Sep 17 00:00:00 2001 From: Fahad Heylaal Date: Sun, 2 Aug 2026 13:17:52 +0200 Subject: [PATCH 1/2] feat: add mobile features --- README.md | 5 +++ attributes/appVersion.yml | 3 ++ features/mobile_experience.yml | 62 ++++++++++++++++++++++++++ features/mobile_feed.yml | 74 ++++++++++++++++++++++++++++++++ features/mobile_theme.yml | 44 +++++++++++++++++++ featurevisor.config.js | 2 +- segments/supportedMobileApp.yml | 6 +++ targets/mobile.yml | 4 ++ tests/mobile_experience.spec.yml | 35 +++++++++++++++ tests/mobile_feed.spec.yml | 54 +++++++++++++++++++++++ tests/mobile_theme.spec.yml | 31 +++++++++++++ 11 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 attributes/appVersion.yml create mode 100644 features/mobile_experience.yml create mode 100644 features/mobile_feed.yml create mode 100644 features/mobile_theme.yml create mode 100644 segments/supportedMobileApp.yml create mode 100644 targets/mobile.yml create mode 100644 tests/mobile_experience.spec.yml create mode 100644 tests/mobile_feed.spec.yml create mode 100644 tests/mobile_theme.spec.yml diff --git a/README.md b/README.md index c67f7f4..a0a112c 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ The generated target datafiles from this repository are available at these URLs: - `production`: https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-tag-all.json - `staging`: https://featurevisor-example-cloudflare.pages.dev/staging/featurevisor-tag-all.json +The smaller mobile target is intended for the native iOS and Android examples: + +- `production`: https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-mobile.json +- `staging`: https://featurevisor-example-cloudflare.pages.dev/staging/featurevisor-mobile.json + ### Usage with Featurevisor SDK Install the SDK in your application: diff --git a/attributes/appVersion.yml b/attributes/appVersion.yml new file mode 100644 index 0000000..ceea4ac --- /dev/null +++ b/attributes/appVersion.yml @@ -0,0 +1,3 @@ +description: Semantic version of the application +type: string + diff --git a/features/mobile_experience.yml b/features/mobile_experience.yml new file mode 100644 index 0000000..56ebc3f --- /dev/null +++ b/features/mobile_experience.yml @@ -0,0 +1,62 @@ +description: Mobile welcome experience with localized variations +tags: + - all + - mobile + +bucketBy: userId + +variablesSchema: + welcome_message: + type: string + defaultValue: Welcome + show_new_navigation: + type: boolean + defaultValue: false + +variations: + - value: control + weight: 50 + variables: + welcome_message: Welcome + show_new_navigation: false + + - value: treatment + weight: 50 + variables: + welcome_message: Welkom + show_new_navigation: true + +force: + staging: + - segments: netherlands + enabled: true + variation: treatment + - conditions: + - attribute: country + operator: equals + value: de + enabled: true + variation: control + + production: + - segments: netherlands + enabled: true + variation: treatment + - conditions: + - attribute: country + operator: equals + value: de + enabled: true + variation: control + +rules: + staging: + - key: everyone + segments: "*" + percentage: 100 + + production: + - key: everyone + segments: "*" + percentage: 100 + diff --git a/features/mobile_feed.yml b/features/mobile_feed.yml new file mode 100644 index 0000000..0995cd0 --- /dev/null +++ b/features/mobile_feed.yml @@ -0,0 +1,74 @@ +description: Mobile feed rollout with primitive and structured variables +tags: + - all + - mobile + +bucketBy: userId + +variablesSchema: + page_size: + type: integer + defaultValue: 10 + layout: + type: string + defaultValue: compact + sections: + type: array + items: + type: string + defaultValue: + - news + card_style: + type: object + properties: + cornerRadius: + type: integer + showImage: + type: boolean + required: + - cornerRadius + - showImage + defaultValue: + cornerRadius: 8 + showImage: false + +variations: + - value: compact + weight: 50 + variables: + page_size: 10 + layout: compact + sections: + - news + card_style: + cornerRadius: 8 + showImage: false + + - value: rich + weight: 50 + variables: + page_size: 20 + layout: cards + sections: + - featured + - news + - recommended + card_style: + cornerRadius: 16 + showImage: true + +rules: + staging: + - key: everyone + segments: "*" + percentage: 100 + + production: + - key: supported-apps + segments: supportedMobileApp + percentage: 100 + + - key: older-apps + segments: "*" + percentage: 25 + variation: compact diff --git a/features/mobile_theme.yml b/features/mobile_theme.yml new file mode 100644 index 0000000..aa06053 --- /dev/null +++ b/features/mobile_theme.yml @@ -0,0 +1,44 @@ +description: Theme experiment with several typed configuration values +tags: + - all + - mobile + +bucketBy: userId + +variablesSchema: + background_color: + type: string + defaultValue: "#fffdf8" + font_scale: + type: double + defaultValue: 1.05 + use_system_theme: + type: boolean + defaultValue: true + +variations: + - value: light + weight: 50 + variables: + background_color: "#fffdf8" + font_scale: 1.05 + use_system_theme: true + + - value: contrast + weight: 50 + variables: + background_color: "#18212f" + font_scale: 1.15 + use_system_theme: false + +rules: + staging: + - key: everyone + segments: "*" + percentage: 100 + + production: + - key: everyone + segments: "*" + percentage: 100 + diff --git a/featurevisor.config.js b/featurevisor.config.js index e433784..949289b 100644 --- a/featurevisor.config.js +++ b/featurevisor.config.js @@ -1,5 +1,5 @@ module.exports = { environments: ["staging", "production"], - tags: ["all"], + tags: ["all", "mobile"], prettyState: true, }; diff --git a/segments/supportedMobileApp.yml b/segments/supportedMobileApp.yml new file mode 100644 index 0000000..7b757f9 --- /dev/null +++ b/segments/supportedMobileApp.yml @@ -0,0 +1,6 @@ +description: Mobile application versions receiving the complete feed experience +conditions: + - attribute: appVersion + operator: semverGreaterThanOrEquals + value: 2.0.0 + diff --git a/targets/mobile.yml b/targets/mobile.yml new file mode 100644 index 0000000..4e23159 --- /dev/null +++ b/targets/mobile.yml @@ -0,0 +1,4 @@ +description: Include features intended for the iOS and Android examples + +tag: mobile + diff --git a/tests/mobile_experience.spec.yml b/tests/mobile_experience.spec.yml new file mode 100644 index 0000000..57f16b9 --- /dev/null +++ b/tests/mobile_experience.spec.yml @@ -0,0 +1,35 @@ +feature: mobile_experience +assertions: + - matrix: + environment: + - staging + - production + description: Netherlands receives the localized treatment in ${{ environment }} + at: 50 + environment: ${{ environment }} + target: mobile + context: + userId: mobile-user + country: nl + expectedToBeEnabled: true + expectedVariation: treatment + expectedVariables: + welcome_message: Welkom + show_new_navigation: true + + - matrix: + environment: + - staging + - production + description: Germany receives the control experience in ${{ environment }} + at: 50 + environment: ${{ environment }} + target: mobile + context: + userId: mobile-user + country: de + expectedToBeEnabled: true + expectedVariation: control + expectedVariables: + welcome_message: Welcome + show_new_navigation: false diff --git a/tests/mobile_feed.spec.yml b/tests/mobile_feed.spec.yml new file mode 100644 index 0000000..b30098e --- /dev/null +++ b/tests/mobile_feed.spec.yml @@ -0,0 +1,54 @@ +feature: mobile_feed +assertions: + - at: 25 + description: Staging serves the compact feed to all application versions + environment: staging + target: mobile + context: + appVersion: 1.5.0 + expectedToBeEnabled: true + expectedVariation: compact + expectedVariables: + page_size: 10 + layout: compact + sections: + - news + card_style: + cornerRadius: 8 + showImage: false + + - at: 75 + description: Supported production applications receive the rich feed + environment: production + target: mobile + context: + appVersion: 2.0.0 + expectedToBeEnabled: true + expectedVariation: rich + expectedVariables: + page_size: 20 + layout: cards + sections: + - featured + - news + - recommended + card_style: + cornerRadius: 16 + showImage: true + + - at: 20 + description: Older production applications remain in the gradual rollout + environment: production + target: mobile + context: + appVersion: 1.5.0 + expectedToBeEnabled: true + expectedVariation: compact + + - at: 30 + description: Older production applications outside the rollout are disabled + environment: production + target: mobile + context: + appVersion: 1.5.0 + expectedToBeEnabled: false diff --git a/tests/mobile_theme.spec.yml b/tests/mobile_theme.spec.yml new file mode 100644 index 0000000..1d24a44 --- /dev/null +++ b/tests/mobile_theme.spec.yml @@ -0,0 +1,31 @@ +feature: mobile_theme +assertions: + - matrix: + environment: + - staging + - production + at: 25 + description: The first half receives the light theme in ${{ environment }} + environment: ${{ environment }} + target: mobile + expectedToBeEnabled: true + expectedVariation: light + expectedVariables: + background_color: "#fffdf8" + font_scale: 1.05 + use_system_theme: true + + - matrix: + environment: + - staging + - production + at: 75 + description: The second half receives the contrast theme in ${{ environment }} + environment: ${{ environment }} + target: mobile + expectedToBeEnabled: true + expectedVariation: contrast + expectedVariables: + background_color: "#18212f" + font_scale: 1.15 + use_system_theme: false From 826e0930218662352a632b972b19eefc4fb4dfd4 Mon Sep 17 00:00:00 2001 From: Fahad Heylaal Date: Sun, 2 Aug 2026 13:20:43 +0200 Subject: [PATCH 2/2] updates --- README.md | 6 ++++++ features/mobile_feed.yml | 38 +++++++++++-------------------------- features/mobile_theme.yml | 22 +-------------------- tests/mobile_feed.spec.yml | 11 ++++++++--- tests/mobile_theme.spec.yml | 8 -------- 5 files changed, 26 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index a0a112c..5ce7356 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,12 @@ The smaller mobile target is intended for the native iOS and Android examples: - `production`: https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-mobile.json - `staging`: https://featurevisor-example-cloudflare.pages.dev/staging/featurevisor-mobile.json +The mobile target contains three focused examples: + +- `mobile_theme` demonstrates variations only. +- `mobile_feed` demonstrates variables only. +- `mobile_experience` demonstrates variations and variables together. + ### Usage with Featurevisor SDK Install the SDK in your application: diff --git a/features/mobile_feed.yml b/features/mobile_feed.yml index 0995cd0..3b3f433 100644 --- a/features/mobile_feed.yml +++ b/features/mobile_feed.yml @@ -1,4 +1,4 @@ -description: Mobile feed rollout with primitive and structured variables +description: Mobile feed configuration demonstrating variables without variations tags: - all - mobile @@ -32,31 +32,6 @@ variablesSchema: cornerRadius: 8 showImage: false -variations: - - value: compact - weight: 50 - variables: - page_size: 10 - layout: compact - sections: - - news - card_style: - cornerRadius: 8 - showImage: false - - - value: rich - weight: 50 - variables: - page_size: 20 - layout: cards - sections: - - featured - - news - - recommended - card_style: - cornerRadius: 16 - showImage: true - rules: staging: - key: everyone @@ -67,8 +42,17 @@ rules: - key: supported-apps segments: supportedMobileApp percentage: 100 + variables: + page_size: 20 + layout: cards + sections: + - featured + - news + - recommended + card_style: + cornerRadius: 16 + showImage: true - key: older-apps segments: "*" percentage: 25 - variation: compact diff --git a/features/mobile_theme.yml b/features/mobile_theme.yml index aa06053..c05f0c1 100644 --- a/features/mobile_theme.yml +++ b/features/mobile_theme.yml @@ -1,35 +1,16 @@ -description: Theme experiment with several typed configuration values +description: Theme experiment demonstrating variations without variables tags: - all - mobile bucketBy: userId -variablesSchema: - background_color: - type: string - defaultValue: "#fffdf8" - font_scale: - type: double - defaultValue: 1.05 - use_system_theme: - type: boolean - defaultValue: true - variations: - value: light weight: 50 - variables: - background_color: "#fffdf8" - font_scale: 1.05 - use_system_theme: true - value: contrast weight: 50 - variables: - background_color: "#18212f" - font_scale: 1.15 - use_system_theme: false rules: staging: @@ -41,4 +22,3 @@ rules: - key: everyone segments: "*" percentage: 100 - diff --git a/tests/mobile_feed.spec.yml b/tests/mobile_feed.spec.yml index b30098e..624afae 100644 --- a/tests/mobile_feed.spec.yml +++ b/tests/mobile_feed.spec.yml @@ -7,7 +7,6 @@ assertions: context: appVersion: 1.5.0 expectedToBeEnabled: true - expectedVariation: compact expectedVariables: page_size: 10 layout: compact @@ -24,7 +23,6 @@ assertions: context: appVersion: 2.0.0 expectedToBeEnabled: true - expectedVariation: rich expectedVariables: page_size: 20 layout: cards @@ -43,7 +41,14 @@ assertions: context: appVersion: 1.5.0 expectedToBeEnabled: true - expectedVariation: compact + expectedVariables: + page_size: 10 + layout: compact + sections: + - news + card_style: + cornerRadius: 8 + showImage: false - at: 30 description: Older production applications outside the rollout are disabled diff --git a/tests/mobile_theme.spec.yml b/tests/mobile_theme.spec.yml index 1d24a44..acd9bd1 100644 --- a/tests/mobile_theme.spec.yml +++ b/tests/mobile_theme.spec.yml @@ -10,10 +10,6 @@ assertions: target: mobile expectedToBeEnabled: true expectedVariation: light - expectedVariables: - background_color: "#fffdf8" - font_scale: 1.05 - use_system_theme: true - matrix: environment: @@ -25,7 +21,3 @@ assertions: target: mobile expectedToBeEnabled: true expectedVariation: contrast - expectedVariables: - background_color: "#18212f" - font_scale: 1.15 - use_system_theme: false