Introduce a type-level check that CodeQL is passed during feature flag lookup if it is needed#3386
Merged
henrymercer merged 4 commits intomainfrom Jan 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces compile-time type safety for feature flag lookups by ensuring that CodeQL is passed when required. The key changes include:
- Refactored
featureConfigto use thesatisfiesoperator for better type inference - Added
FeatureWithoutCLItype to identify features that don't depend on CodeQL version - Updated
FeatureEnablementinterface with method overloads to enforce CodeQL requirement - Updated test helper functions to properly handle the new type distinctions
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/feature-flags.ts | Refactored type definitions and interface to add compile-time safety for CodeQL requirements; added FeatureWithoutCLI type and method overloads |
| src/feature-flags.test.ts | Updated test helper function getFeatureIncludingCodeQlIfRequired to use new type system; added imports for new types |
| src/testing-utils.ts | Added type cast in mock getValue implementation to support both method overloads |
| lib/*.js | Auto-generated JavaScript files reflecting the TypeScript changes (not reviewed per guidelines) |
mbg
approved these changes
Jan 5, 2026
Member
mbg
left a comment
There was a problem hiding this comment.
LGTM, other than one minor point. Very similar to what I came up with :)
| }, | ||
| getValue: async (feature) => { | ||
| return enabledFeatures.includes(feature); | ||
| return enabledFeatures.includes(feature as Feature); |
Member
There was a problem hiding this comment.
Minor: could this be a type annotation on feature?
Contributor
Author
There was a problem hiding this comment.
I agree that's slightly better, but I don't think it's worth going through another round of approval :)
This was referenced Jan 12, 2026
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.
Introduce a type-level check that CodeQL is passed during feature flag lookup if it is needed.
satisfiesrather than a type annotation to maintain a more precise type forfeatureConfigFeatureWithoutCLItype to record features whose enablement don't depend on the version of CodeQLFeatureEnablementinterface to add a call forFeatureWithoutCLIthat doesn't require CodeQL, and make the call forFeaturerequire CodeQLfeatureConfigto do a safe cast to the formerFeatureConfigtype usingsatisfies FeatureConfig as FeatureConfigRisk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Dev change only.
How did/will you validate this change?
.test.tsfiles).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist