Skip to content

Conversation

henrymercer
Copy link
Contributor

This PR enables resolving supported languages using codeql resolve languages --filter-to-languages-with-queries, behind a feature flag. This allows users to more easily start using new extractors with the CodeQL Action and simplifies adding new languages.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@henrymercer henrymercer requested a review from mbg September 5, 2025 15:59
@henrymercer
Copy link
Contributor Author

henrymercer commented Sep 5, 2025

Waiting on the next nightly to start integration testing this, but the code is ready for a first pass review.

Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an initial look over this and it looks good to me so far, thanks! There are just a couple of very minor points I thought of.

@@ -5,10 +5,11 @@ import type { VersionInfo } from "./codeql";
export enum ToolsFeature {
AnalysisSummaryV2IsDefault = "analysisSummaryV2Default",
DatabaseInterpretResultsSupportsSarifRunProperty = "databaseInterpretResultsSupportsSarifRunProperty",
ForceOverwrite = "forceOverwrite",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I assume you moved ForceOverwrite so that the elements are in alphabetical order, but the new BuiltinExtractorsSpecifyDefaultQueries entry is at the end. Should that come after AnalysisSummaryV2IsDefault for consistency or was there another reason you moved ForceOverwrite?

Comment on lines +317 to +321
if (resolveSupportedLanguagesUsingCli) {
logger.debug(
`The CodeQL CLI supports the following languages: ${Object.keys(resolveResult.extractors).join(", ")}`,
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Since this is a .debug call, we can probably skip the resolveSupportedLanguagesUsingCli check since it wouldn't hurt having this in the debug output either way. Alternatively, I also wouldn't be opposed to making this an info-level message if the resolveSupportedLanguagesUsingCli check is kept.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this info is only relevant if resolveSupportedLanguagesUsingCli is true — otherwise it contains the whole list of extractors including HTML etc

@henrymercer henrymercer marked this pull request as ready for review September 9, 2025 13:55
@henrymercer henrymercer requested a review from a team as a code owner September 9, 2025 13:55
@henrymercer henrymercer requested review from Copilot and mbg September 9, 2025 13:55
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 enables resolving supported languages using the CodeQL CLI's codeql resolve languages --filter-to-languages-with-queries command, behind a feature flag. This allows users to more easily start using new extractors with the CodeQL Action and simplifies adding new languages by dynamically determining which languages have default queries available.

Key changes:

  • Adds a new feature flag ResolveSupportedLanguagesUsingCli to enable the CLI-based language resolution
  • Updates language resolution logic to optionally filter to languages with queries when the feature is enabled
  • Modifies configuration utilities to pass feature enablement through the language detection pipeline

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tools-features.ts Adds BuiltinExtractorsSpecifyDefaultQueries tools feature and reorganizes enum ordering
src/feature-flags.ts Adds ResolveSupportedLanguagesUsingCli feature flag configuration with required tools feature
src/config-utils.ts Updates language resolution to support CLI-based filtering and passes features through the pipeline
src/config-utils.test.ts Adds comprehensive test coverage for both CLI and non-CLI language resolution modes
src/codeql.ts Adds optional parameter to betterResolveLanguages for filtering to languages with queries
pr-checks/checks/multi-language-autodetect.yml Enables the feature flag for testing
.github/workflows/__multi-language-autodetect.yml Generated workflow file with feature flag enabled
Comments suppressed due to low confidence (1)

src/config-utils.ts:1

  • [nitpick] The function name getDefaultConfig doesn't clearly indicate what type of configuration it returns or that it's creating a new configuration object. Consider renaming to createDefaultConfig or buildDefaultConfig to better reflect its purpose.
import * as fs from "fs";

Comment on lines +7 to +12
BuiltinExtractorsSpecifyDefaultQueries = "builtinExtractorsSpecifyDefaultQueries",
DatabaseInterpretResultsSupportsSarifRunProperty = "databaseInterpretResultsSupportsSarifRunProperty",
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
SarifMergeRunsFromEqualCategory = "sarifMergeRunsFromEqualCategory",
ForceOverwrite = "forceOverwrite",
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
PythonDefaultIsToNotExtractStdlib = "pythonDefaultIsToNotExtractStdlib",
SarifMergeRunsFromEqualCategory = "sarifMergeRunsFromEqualCategory",
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The enum items are not in alphabetical order. Consider maintaining alphabetical order for better readability and maintainability.

Copilot uses AI. Check for mistakes.

@henrymercer henrymercer merged commit df1fe23 into main Sep 12, 2025
574 checks passed
@henrymercer henrymercer deleted the henrymercer/resolve-languages-default-queries branch September 12, 2025 09:12
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.

2 participants