-
Notifications
You must be signed in to change notification settings - Fork 372
Overlay: additional feature flags #2967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The loadConfig() function is mostly the same as getDefaultConfig(), except that it calls loadUserConfig() and stores the results in originalUserInput. This refactoring commit replaces the loadConfig() call with getDefaultConfig() and loadUserConfig(), which allows deleting a large amount of duplicated code.
In an upcoming change, getOverlayDatabaseMode() will depend on the contents of Config. As a result, getOverlayDatabaseMode() needs to be called after the rest of Config has already been populated. This commit performs the refactoring to move the getOverlayDatabaseMode() into initConfig(), after the rest of Config has already been populated.
Before we introduce additional features for controlling overlay analysis enablement, change the unit tests to specify features directly instead of through a isFeatureEnabled boolean field.
This change eliminates the need for setup-codeql.test to import from feature-flags.test, which makes the former run all tests defined in the latter.
1ab4d58
to
bb8638d
Compare
bb8638d
to
f3fa160
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the overlay analysis feature to support more granular per-language enablement through additional feature flags. Instead of relying on a single overlay_analysis
flag, the action now checks individual language-specific flags and code-scanning-specific flags to determine whether overlay analysis should be enabled.
- Adds 22 new overlay analysis feature flags for language-specific and code-scanning-specific configurations
- Implements chunked API requests to handle the increased number of feature flags (25 features per request)
- Refactors configuration generation to better determine when overlay analysis is appropriate based on the selected languages and configuration
Reviewed Changes
Copilot reviewed 15 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/feature-flags.ts | Adds new overlay analysis feature flags and implements chunked API requests |
src/config-utils.ts | Adds language-specific overlay analysis logic and refactors config generation |
src/testing-utils.ts | Moves utility functions and adds new test helpers for feature flag testing |
src/setup-codeql.test.ts | Updates import to use testing-utils for initializeFeatures |
src/feature-flags.test.ts | Adds test for chunked API requests and moves initializeFeatures |
src/config-utils.test.ts | Adds comprehensive tests for new overlay analysis logic |
src/codeql.ts | Refactors code scanning config generation to use shared utility |
src/trap-caching.ts | Minor import style changes |
while (featuresToRequest.length > 0) { | ||
featureChunks.push(featuresToRequest.splice(0, FEATURES_PER_REQUEST)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The splice operation modifies the original array, which could lead to unexpected behavior if featuresToRequest is used elsewhere. Consider using a copy of the array or a different iteration approach.
while (featuresToRequest.length > 0) { | |
featureChunks.push(featuresToRequest.splice(0, FEATURES_PER_REQUEST)); | |
for (let i = 0; i < featuresToRequest.length; i += FEATURES_PER_REQUEST) { | |
featureChunks.push(featuresToRequest.slice(i, i + FEATURES_PER_REQUEST)); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
featuresToRequest
is used only for populating featureChunks
, so it is safe to modify.
@@ -195,7 +196,7 @@ export interface AugmentationProperties { | |||
/** | |||
* Extra query exclusions to append to the config. | |||
*/ | |||
extraQueryExclusions?: ExcludeQueryFilter[]; | |||
extraQueryExclusions: ExcludeQueryFilter[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing extraQueryExclusions from optional to required is a breaking change to the interface. This could cause compilation errors for existing code that doesn't provide this property.
extraQueryExclusions: ExcludeQueryFilter[]; | |
extraQueryExclusions?: ExcludeQueryFilter[]; |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All uses of extraQueryExclusions
are in this repository, and they have all been checked and updated. Furthermore, AugmentationProperties
is never deserialized from files, so there is no concern for compatibility with earlier versions.
const remoteFlags = response.data as GitHubFeatureFlagsApiResponse; | ||
.map(([f]) => f); | ||
|
||
const FEATURES_PER_REQUEST = 25; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 25 should be defined as a named constant at the module level to improve maintainability and make it easier to adjust if API limits change.
const FEATURES_PER_REQUEST = 25; | |
const FEATURES_PER_REQUEST = FEATURES_PER_REQUEST_LIMIT; |
Copilot uses AI. Check for mistakes.
This PR updates the action to check additional per-language features for enabling overlay analysis.
See back-linked issue for additional context.
Merge / deployment checklist