Add Support for Region-Based Feature Flags#10621
Merged
Conversation
srietkerk
reviewed
Jun 4, 2025
|
|
||
| try { | ||
| const response = await Util.requestAsync(options); | ||
| if (response.statusCode !== 200) { |
Contributor
There was a problem hiding this comment.
Is it possible that the status code that we get from the backend could be something other than 200 on something that's successful?
Contributor
Author
There was a problem hiding this comment.
This is something we control, and right now, 200 is the only "success" response we'd expect.
jwunderl
approved these changes
Jun 11, 2025
thsparks
added a commit
to microsoft/pxt-microbit
that referenced
this pull request
Jun 11, 2025
This sets feature flags for the blocks error list (globally enabled) and the AI Error Help (currently set to US only, though we'll likely want to change that to a different region before shipping). Support for region-based feature flags is added in microsoft/pxt#10621
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for feature flags that can be enabled (or disabled) for specific regions, based on the backend changes here: https://github.com/microsoft/pxt-backend/pull/1117
I've created a more generic "enabledFeatures" section of the AppTheme in pxtarget in an attempt to manage the proliferation of top-level feature switches. If no
includeRegionsorexcludeRegionsare specified, then the feature is enabled globally. Otherwise, it will only be enabled if the user's region matches one of theincludeRegionsand does not match any of theexcludeRegions.For development purposes, I've added a
DEV_REGIONconstant that we can change similar to how we manageDEV_BACKEND, which allows us to fake being in a different region on local builds. (This also simplified things, since our localhost cdn logic is a little weird and didn't actually go to staging.) In my own testing, however, I did ensure it works with an actual staging CDN URL, too.Upload Target: https://microbit.staging.pxt.io/app/f213b4bfa13132146caf582b2110dae5f61052d3-b71ebd062f
Fixes microsoft/pxt-microbit#6238