Skip to content

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

cklin
Copy link
Contributor

@cklin cklin commented Jul 10, 2025

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

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

cklin added 11 commits July 9, 2025 14:32
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.
@cklin cklin force-pushed the cklin/overlay-feature-flags branch from 1ab4d58 to bb8638d Compare July 11, 2025 17:04
@cklin cklin force-pushed the cklin/overlay-feature-flags branch from bb8638d to f3fa160 Compare July 11, 2025 19:07
@cklin cklin marked this pull request as ready for review July 11, 2025 19:23
@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 19:23
@cklin cklin requested a review from a team as a code owner July 11, 2025 19:23
@cklin cklin requested review from nickrolfe and mbg July 11, 2025 19:23
Copy link
Contributor

@Copilot Copilot AI left a 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

Comment on lines +629 to +630
while (featuresToRequest.length > 0) {
featureChunks.push(featuresToRequest.splice(0, FEATURES_PER_REQUEST));
Copy link
Preview

Copilot AI Jul 11, 2025

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.

Suggested change
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.

Copy link
Contributor Author

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[];
Copy link
Preview

Copilot AI Jul 11, 2025

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.

Suggested change
extraQueryExclusions: ExcludeQueryFilter[];
extraQueryExclusions?: ExcludeQueryFilter[];

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

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;
Copy link
Preview

Copilot AI Jul 11, 2025

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.

Suggested change
const FEATURES_PER_REQUEST = 25;
const FEATURES_PER_REQUEST = FEATURES_PER_REQUEST_LIMIT;

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy