Refactor feature flags to use functional availability rules - #3166
Open
SamMorrowDrums wants to merge 2 commits into
Open
Refactor feature flags to use functional availability rules#3166SamMorrowDrums wants to merge 2 commits into
SamMorrowDrums wants to merge 2 commits into
Conversation
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
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors feature gating around typed functional rules and shared request-scoped resolution.
Changes:
- Introduces
FeatureFlag,FeatureRule, and cached resolution state. - Migrates inventory items and GitHub tools from legacy flag fields.
- Updates HTTP/stdio integration, tests, generators, and documentation.
Show a summary per file
| File | Description |
|---|---|
script/print-mcp-diff-configs/main.go |
Uses the header-compatible flag accessor. |
pkg/inventory/server_tool.go |
Replaces legacy tool gates with FeatureRule. |
pkg/inventory/resources.go |
Adds resource feature rules. |
pkg/inventory/registry.go |
Collects and pre-resolves required features. |
pkg/inventory/registry_test.go |
Migrates inventory feature tests. |
pkg/inventory/prompts.go |
Adds prompt feature rules. |
pkg/inventory/filters.go |
Evaluates functional rules during filtering. |
pkg/inventory/features.go |
Implements typed rules and resolution state. |
pkg/inventory/features_test.go |
Tests predicates and caching. |
pkg/inventory/builder.go |
Removes the legacy feature filter. |
pkg/http/server.go |
Adapts HTTP feature resolution to typed flags. |
pkg/http/server_test.go |
Updates HTTP checker tests. |
pkg/http/handler.go |
Seeds request-owned feature state. |
pkg/http/handler_test.go |
Migrates handler feature tests. |
pkg/github/ui_tools.go |
Migrates the UI tool gate. |
pkg/github/ui_tools_test.go |
Verifies the UI feature rule. |
pkg/github/ui_capability_test.go |
Uses typed UI flags. |
pkg/github/tools.go |
Types granular flags and converts header flags. |
pkg/github/tools_validation_test.go |
Updates gated-duplicate validation. |
pkg/github/server.go |
Updates feature configuration documentation. |
pkg/github/server_test.go |
Updates dependency stubs. |
pkg/github/repositories.go |
Migrates file-blame gating. |
pkg/github/repositories_test.go |
Verifies file-blame rules. |
pkg/github/pullrequests.go |
Migrates consolidated PR rules. |
pkg/github/pullrequests_granular.go |
Migrates granular PR rules. |
pkg/github/issues.go |
Migrates consolidated issue rules. |
pkg/github/issues_test.go |
Updates issue-rule assertions. |
pkg/github/issues_granular.go |
Migrates granular issue rules. |
pkg/github/issue_dependencies.go |
Migrates dependency-tool gates. |
pkg/github/issue_dependencies_test.go |
Updates dependency gate tests. |
pkg/github/granular_tools_test.go |
Tests granular functional rules. |
pkg/github/find_duplicate.go |
Migrates duplicate-detection gating. |
pkg/github/find_duplicate_test.go |
Updates duplicate gate tests. |
pkg/github/feature_flags.go |
Types flags and defines reusable rules. |
pkg/github/feature_flags_test.go |
Migrates feature-resolution tests. |
pkg/github/dependencies.go |
Shares resolution through dependencies. |
pkg/github/dependencies_test.go |
Updates dependency checker tests. |
pkg/github/csv_output_test.go |
Migrates CSV rule fixtures. |
pkg/github/context_tools_test.go |
Uses typed IFC flags. |
pkg/github/actions_test.go |
Updates functional-rule terminology. |
internal/ghmcp/server.go |
Adapts stdio feature checking. |
docs/insiders-features.md |
Documents shared functional resolution. |
docs/feature-flags.md |
Documents availability rules. |
cmd/github-mcp-server/generate_docs.go |
Updates default documentation checker. |
cmd/github-mcp-server/feature_flag_docs.go |
Types feature documentation generation. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 45/45 changed files
- Comments generated: 4
- Review effort level: Balanced
Keep legacy string APIs compatible, seed feature state from each inventory's checker, persist caching for stdio calls, and fail closed for empty undeclared flags. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e4a1ca6-53f7-4158-af22-35d2448d0b13
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.
Summary
FeatureFlagEnable,FeatureFlagEnableAll, andFeatureFlagDisablewith typed functionalFeatureRulepredicatesinventory.FeatureFlagandFeatureResolvertypes for local and remote server consumersToolDependencies.IsFeatureEnabledAllowedFeatureFlags/header allowlistBreaking change
Inventory items now expose
FeatureRuleinstead of the three legacy feature-gate fields, andFeatureFlagCheckeracceptsinventory.FeatureFlaginstead ofstring.Validation
script/lintscript/testscript/generate-docs