Skip to content

Commit ae002a5

Browse files
docs(feature-flags): clarify allowed and insiders sets are independent
Also add tests covering: - a user-toggleable flag (FeatureFlagIssuesGranular) that insiders does not turn on automatically - insiders mode not turning on user-only allowed flags Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c25c02 commit ae002a5

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

pkg/github/feature_flags.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ type FeatureFlags struct {
4343
// flags from request input are silently dropped here.
4444
// 2. If insiders mode is on, unioning in every flag from InsidersFeatureFlags.
4545
// Insiders is a server-controlled meta switch, so its expansion is NOT
46-
// re-validated against AllowedFeatureFlags — InsidersFeatureFlags may
47-
// intentionally include flags that are not user-controllable.
46+
// re-validated against AllowedFeatureFlags.
47+
//
48+
// AllowedFeatureFlags and InsidersFeatureFlags are independent sets:
49+
// - A flag in AllowedFeatureFlags but not InsidersFeatureFlags is a regular
50+
// opt-in flag that insiders mode does not turn on automatically.
51+
// - A flag in InsidersFeatureFlags but not AllowedFeatureFlags is reachable
52+
// only through insiders mode and cannot be enabled by user input.
4853
//
4954
// Returns a set (map) for O(1) lookup by the feature checker.
5055
func ResolveFeatureFlags(enabledFeatures []string, insidersMode bool) map[string]bool {

pkg/github/feature_flags_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,18 @@ func TestResolveFeatureFlags(t *testing.T) {
184184
expectedFlags: []string{MCPAppsFeatureFlag},
185185
unexpectedFlags: []string{"unknown_flag"},
186186
},
187+
{
188+
name: "user-only flags can be enabled but are not turned on by insiders",
189+
enabledFeatures: []string{FeatureFlagIssuesGranular},
190+
insidersMode: false,
191+
expectedFlags: []string{FeatureFlagIssuesGranular},
192+
},
193+
{
194+
name: "insiders does not enable user-only allowed flags",
195+
enabledFeatures: nil,
196+
insidersMode: true,
197+
unexpectedFlags: []string{FeatureFlagIssuesGranular, FeatureFlagPullRequestsGranular},
198+
},
187199
{
188200
name: "explicit plus insiders deduplicates",
189201
enabledFeatures: []string{MCPAppsFeatureFlag},

0 commit comments

Comments
 (0)