You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(features)!: use functional availability rules
Resolve declared inventory features once per request and share the request-owned cache with in-handler feature checks.
BREAKING CHANGE: Inventory items now use FeatureRule instead of FeatureFlagEnable, FeatureFlagEnableAll, and FeatureFlagDisable; FeatureFlagChecker now accepts FeatureFlag.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1e4a1ca6-53f7-4158-af22-35d2448d0b13
Copy file name to clipboardExpand all lines: docs/insiders-features.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,6 +205,13 @@ Insiders is a **meta feature flag** — the same shape as `default` or `all` for
205
205
3.**Insiders expansion.** If insiders mode is on (`--insiders`, `/insiders` route, or `X-MCP-Insiders: true`), every flag in [`InsidersFeatureFlags`](../pkg/github/feature_flags.go) is unioned in. The insiders expansion is **not** re-validated against the allowlist — insiders is a server-controlled switch that can reach internal-only flags.
206
206
4.**Server-side fallback (remote server only).** Any flag not yet decided falls back to the remote server's feature manager, which can roll a feature out independently of user input or insiders membership.
207
207
208
+
For tool availability, each functional feature rule statically declares the
209
+
flags it reads. The service deduplicates those declarations, resolves every
210
+
relevant flag once into request-owned state, and then evaluates all rules as
211
+
in-memory boolean expressions. The same state backs
212
+
`deps.IsFeatureEnabled`, so checks made inside a tool call reuse resolved values
213
+
and lazily cache any handler-only flag using the live tool-call context.
214
+
208
215
`AllowedFeatureFlags` and `InsidersFeatureFlags` are deliberately independent sets:
209
216
210
217
- A flag in **`AllowedFeatureFlags` only** is a regular opt-in: users can turn it on, but insiders does not auto-enable it. Granular issues/PRs flags work this way.
@@ -216,5 +223,6 @@ Insiders is a **meta feature flag** — the same shape as `default` or `all` for
216
223
1. Add a constant in `pkg/github/feature_flags.go`.
217
224
2. Add it to `AllowedFeatureFlags` if end users should be able to opt in via `--features` / `X-MCP-Features`.
218
225
3. Add it to `InsidersFeatureFlags` if insiders mode should turn it on automatically.
219
-
4. Gate the behavior on the concrete flag (`deps.IsFeatureEnabled(ctx, FeatureFlagX)`), never on `cfg.InsidersMode`. There is a `TestGitHubPackageDoesNotReadInsidersMode` guard test that fails if `pkg/github` reads `InsidersMode` directly.
220
-
5. The MCP-diff CI workflow picks up new entries in `AllowedFeatureFlags` automatically — see `.github/workflows/mcp-diff.yml`.
226
+
4. For tool availability, attach an `inventory.NewFeatureRule` that declares every flag used by its predicate. For behavior inside a handler, use `deps.IsFeatureEnabled(ctx, FeatureFlagX)`.
227
+
5. Gate on concrete flags, never on `cfg.InsidersMode`. There is a `TestGitHubPackageDoesNotReadInsidersMode` guard test that fails if `pkg/github` reads `InsidersMode` directly.
228
+
6. The MCP-diff CI workflow picks up new entries in `AllowedFeatureFlags` automatically — see `.github/workflows/mcp-diff.yml`.
0 commit comments